/* UI Controls (Theme Toggle, Zoom, etc.) */

/* Map Controls Container */
#map-controls {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1001; /* Slightly higher than panel to ensure visibility */
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-right: 10px; /* Space from the panel edge */
  transition: right 0.3s ease; /* Smooth movement when panel resizes */
}

/* Map Control Button */
.map-control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: rgba(139, 90, 60, 0.95);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(212, 175, 55, 0.3);
  transition: all 0.3s ease;
  user-select: none;
  min-width: 60px;
  min-height: 60px;
  position: relative;
}

/* Active state - light pastel green background */
.map-control-btn.active {
  background: rgba(66, 133, 68, 0.95); /* Light pastel green */
  border-color: rgba(83, 153, 86, 0.5);
}

/* Cluster Marker Button Layout */
.cluster-marker-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Cluster Marker Visual */
.cluster-marker-visual {
  width: 40px;
  height: 40px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cluster Dot - Main marker circle */
.cluster-dot {
  width: 32px;
  height: 32px;
  background: #4CAF50; /* Green when active/on */
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Add inner highlight like real cluster markers */
  background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
}

/* Cluster Count Text inside the circle */
.cluster-count {
  font-size: 12px;
  font-weight: bold;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  line-height: 1;
}

/* Location Indicator - Small orange dot */
.location-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: #ff6b24 !important;
  border: 1px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

/* Location Count Text inside the orange dot */
.location-count {
  font-size: 10px;
  font-weight: bold;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  line-height: 1;
}

/* Status Text */
.cluster-status-text {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Button States */
.map-control-btn.active .cluster-dot {
  background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
}

.map-control-btn:not(.active) .cluster-dot {
  background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
}

/* Opacity reduction for "off" state */
.map-control-btn:not(.active) {
  opacity: 0.7; /* 30% opacity reduction */
}

.map-control-btn:not(.active):hover {
  opacity: 1; /* Recovery on hover */
}

/* Visual connection line to panel */
.map-control-btn::before {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 2px;
  background: #495057;
  border-radius: 1px;
  transition: background 0.3s ease;
}

.map-control-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.map-control-btn:hover .cluster-dot {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.map-control-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.map-control-btn:active .cluster-dot {
  transform: scale(0.95);
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  #map-controls {
    margin-right: 5px; /* Less margin on mobile */
  }
  
  .map-control-btn {
    padding: 12px;
    min-width: 70px;
    min-height: 70px;
  }
  
  .cluster-marker-visual {
    width: 28px;
    height: 28px;
  }
  
  .cluster-dot {
    width: 24px;
    height: 24px;
    border: 2px solid white;
  }
  
  .cluster-count {
    font-size: 9px;
  }
  
  .location-indicator {
    width: 14px;
    height: 14px;
    border: 1px solid white;
    bottom: -1px;
    right: -1px;
  }
  
  .location-count {
    font-size: 7px;
  }
  
  .cluster-status-text {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  #map-controls {
    margin-right: 2px; /* Minimal margin on very small screens */
  }
  
  .map-control-btn {
    padding: 10px;
    min-width: 60px;
    min-height: 60px;
  }
  
  .cluster-marker-visual {
    width: 24px;
    height: 24px;
  }
  
  .cluster-dot {
    width: 20px;
    height: 20px;
    border: 2px solid white;
  }
  
  .cluster-count {
    font-size: 8px;
  }
  
  .location-indicator {
    width: 12px;
    height: 12px;
    border: 1px solid white;
    bottom: -1px;
    right: -1px;
  }
  
  .location-count {
    font-size: 6px;
  }
  
  .cluster-status-text {
    font-size: 10px;
  }
}

/* Toggle Button */
#themeToggle {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  background: var(--popup-bg);
  color: var(--text-color);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Custom Zoom Control 
.custom-zoom-control {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  z-index: 1000;
  min-width: 200px;
}*/

[data-theme="dark"] .custom-zoom-control {
  background: rgba(40, 44, 52, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.zoom-display {
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: #333;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

[data-theme="dark"] .zoom-display {
  color: #ffffff;
}

.zoom-slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zoom-label {
  font-size: 16px;
  font-weight: bold;
  color: #666;
  user-select: none;
  cursor: default;
  width: 20px;
  text-align: center;
}

[data-theme="dark"] .zoom-label {
  color: #cccccc;
}

.zoom-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

[data-theme="dark"] .zoom-slider {
  background: #555;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4CAF50;
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.zoom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.zoom-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4CAF50;
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.zoom-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.zoom-slider::-webkit-slider-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #e0e0e0 0%, #4CAF50 100%);
}

[data-theme="dark"] .zoom-slider::-webkit-slider-track {
  background: linear-gradient(to right, #555 0%, #66BB6A 100%);
}

.zoom-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #e0e0e0 0%, #4CAF50 100%);
  border: none;
}

[data-theme="dark"] .zoom-slider::-moz-range-track {
  background: linear-gradient(to right, #555 0%, #66BB6A 100%);
}
