/**
 * OpenStreetMap Fiber Infrastructure Styles
 */

/* OSM Fiber Control Panel */
.osm-fiber-control {
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
  margin-top: 10px !important;
  padding: 8px;
  min-width: 140px;
   height: 50px
}

.osm-control-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Toggle Switch */
.osm-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
   height: 25px
}

.osm-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.osm-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 20px;
  background: #e5e7eb;
  color: #084acd;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.osm-toggle input:checked + .osm-toggle-label {
  background: linear-gradient(135deg, #00ff00, #00cc88);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 255, 0, 0.3);
}

.osm-toggle-label i {
  font-size: 14px;
}

/* Refresh Button */
.osm-refresh-btn {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s ease;
}

.osm-refresh-btn:hover i {
  background: #f3f4f6;
  color: #111827;
  transform: rotate(90deg);
}

.osm-refresh-btn i {
  font-size: 12px;
}

/* Loading Indicator */
.osm-loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  background: rgba(255, 255, 255, 0.95);
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: none;
  align-items: center;
  justify-content: center;
}

.osm-loading-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #4f46e5;
  font-weight: 600;
}

.osm-loading-content i {
  font-size: 20px;
}

/* Error Message */
.osm-error {
  position: absolute;
  top: 60px;
  right: 10px;
  z-index: 1000;
  background: #fee2e2;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  animation: slideIn 0.3s ease;
}

.osm-error i {
  font-size: 16px;
}

.osm-error button {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 20px;
  cursor: pointer;
  margin-left: auto;
  padding: 0 4px;
}

.osm-error button:hover {
  color: #991b1b;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Statistics Panel */
.osm-stats {
  position: absolute;
  bottom: 80px;
  right: 10px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 2px solid #00ff00;
  display: none;
}

.osm-stats-content h4 {
  margin: 0 0 8px 0;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
}

.osm-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0;
  font-size: 12px;
}

.osm-stats-label {
  color: #6b7280;
  font-weight: 500;
}

.osm-stats-value {
  color: #111827;
  font-weight: 700;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
}

.osm-stats-close {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
}

.osm-stats-close:hover {
  color: #dc2626;
}

/* Popup Styles */
.osm-popup {
  min-width: 200px;
  font-size: 12px;
}

.osm-popup h4 {
  margin: 0 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
  color: #4f46e5;
  font-size: 13px;
  font-weight: 700;
}

.osm-popup strong {
  color: #6b7280;
  font-weight: 600;
}

.osm-popup small {
  display: block;
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px solid #f3f4f6;
  color: #9ca3af;
  font-size: 10px;
}

/* Legend for OSM Fiber Types */
.osm-legend {
  position: absolute;
  bottom: 20px;
  left: 10px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  font-size: 11px;
  display: none;
}

.osm-legend.visible {
  display: block;
}

.osm-legend h5 {
  margin: 0 0 6px 0;
  font-size: 12px;
  font-weight: 700;
  color: #111827;
}

.osm-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}

.osm-legend-line {
  width: 20px;
  height: 3px;
  border-radius: 2px;
}

.osm-legend-point {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.osm-legend-label {
  color: #6b7280;
  font-size: 11px;
}

/* Fiber line styles */
.fiber-confirmed {
  background: #00ffff;
}

.fiber-cable {
  background: #00ff00;
}

.telecom-general {
  background: #ffff00;
}

/* Facility point styles */
.facility-exchange {
  background: #ff0000;
}

.facility-datacenter {
  background: #0000ff;
}

.facility-cabinet {
  background: #ff9900;
}

.facility-connection {
  background: #ffff00;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .osm-fiber-control {
    min-width: 120px;
  }
  
  .osm-toggle-label {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  .osm-stats {
    bottom: 60px;
    right: 5px;
    padding: 8px 10px;
  }
  
  .osm-loading-content {
    font-size: 14px;
  }
  
  .osm-error {
    top: 50px;
    right: 5px;
    left: 5px;
    font-size: 12px;
  }
}

/* Animation for data loading */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 255, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 255, 0, 0);
  }
}

.osm-toggle input:checked + .osm-toggle-label {
  animation: pulse 1.5s infinite;
}

/* Hover effects for fiber lines on map */
.leaflet-interactive.osm-fiber-line:hover {
  stroke-width: 5;
  stroke-opacity: 1;
}

/* Custom cursor for OSM elements */
.osm-fiber-element {
  cursor: help;
}

/* Print styles */
@media print {
  .osm-fiber-control,
  .osm-stats,
  .osm-loading,
  .osm-error {
    display: none !important;
  }
}


/* Rate Limit Notice */
.osm-rate-limit-notice {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: linear-gradient(135deg, #fef3c7, #fbbf24);
  color: #92400e;
  padding: 12px 20px;
  border-radius: 8px;
  border: 2px solid #f59e0b;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: slideDown 0.3s ease;
  font-weight: 600;
}

.osm-rate-limit-notice i {
  font-size: 18px;
  margin-right: 8px;
}

.rate-limit-hint {
  font-size: 11px;
  opacity: 0.8;
  font-weight: normal;
}

/* Success Notice */
.osm-success-notice {
  position: absolute;
  top: 60px;
  right: 10px;
  z-index: 1000;
  background: linear-gradient(135deg, #d1fae5, #10b981);
  color: #064e3b;
  padding: 10px 16px;
  border-radius: 8px;
  border: 2px solid #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease;
  font-weight: 600;
}

.osm-success-notice i {
  font-size: 18px;
  color: #059669;
}

/* Usage Display 
.osm-usage-display {
  margin-top: 8px;
  padding: 6px;
  background: #063698;
  border-radius: 6px;
  font-size: 11px;
} */

.usage-bar {
  width: 100%;
  height: 6px;
  background: #0742b8;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.usage-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s ease;
  border-radius: 3px;
}

.usage-text {
  text-align: center;
  color: #0139a9;
  font-weight: 600;
}

/* Animations */
@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* Color usage fill based on percentage */
.usage-fill[style*="width: 0%"],
.usage-fill[style*="width: 1%"],
.usage-fill[style*="width: 2%"],
.usage-fill[style*="width: 3%"],
.usage-fill[style*="width: 4%"] {
  background: linear-gradient(90deg, #10b981, #059669);
}

.usage-fill[style*="width: 5%"],
.usage-fill[style*="width: 6%"],
.usage-fill[style*="width: 7%"] {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.usage-fill[style*="width: 8%"],
.usage-fill[style*="width: 9%"],
.usage-fill[style*="width: 100%"] {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Style the OSM button to match zoom controls */
.osm-fiber-toggle {
  display: block !important;
  text-align: center;
  text-decoration: none;
  color: black;
  font-size: 12px;
  line-height: 30px;
  height: 30px;
  width: auto;
  padding: 0 5px;
  white-space: nowrap;
  border-top: 1px solid #ccc;
}

.osm-fiber-toggle:hover {
  background-color: #f4f4f4;
}

.osm-fiber-toggle i {
  font-size: 14px;
  margin-right: 2px;
}

.osm-legend-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.osm-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  font-size: 10px;
}

.osm-legend-line {
  width: 20px;
  height: 3px;
  border-radius: 1px;
}

.osm-legend-point {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid white;
}

.osm-legend-text {
  color: #6b7280;
  font-size: 10px;
}

/* Hide default tooltip */
.osm-toggle {
  position: relative;
}

/* Custom tooltip */
.osm-toggle::after {
  content: attr(data-tooltip);
  position: absolute;
 top: 30%;
  left: calc(100% + 200px);
  transform: translateX(-50%);
  margin-left: 10px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 10000;
}

/* Tooltip arrow */
.osm-toggle::before {
  content: '';
  position: absolute;
  bottom: 118%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #e0e0e0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 10000;
}

/* Show on hover */
.osm-toggle:hover::after,
.osm-toggle:hover::before {
  opacity: 1;
}


* Refresh button tooltip */
.osm-refresh-btn {
  position: relative;
}

.osm-refresh-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);  /* Position to the right */
  transform: translateY(-50%);
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border: 1px solid #e0e0e0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 10000;
}

/* Arrow for refresh button */
.osm-refresh-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: calc(100% + 4px);
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #e0e0e0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 10000;
}

/* Show on hover */
.osm-refresh-btn:hover::after,
.osm-refresh-btn:hover::before {
  opacity: 1;
}