:root {
  --popup-width: 800px;
  --popup-height: 600px;
  --circle-small-radius: 40px;
  --circle-large-radius: 100px;
  --switch-angle: 0deg; /* Configurable switch angle - you can change this value */
}

/* Switch line styles */
.popup-switch-line {
  position: absolute;
  height: 2px;
  transform-origin: 0 50%;
  z-index: 2001;
  /* Removed background-color - it will be set dynamically */
}

.popup-switch-connection-point {
  position: absolute;
  width: 10px;  /* Increased from 8px to match connected lines */
  height: 10px; /* Increased from 8px to match connected lines */
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2003;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
  /* Removed background-color - it will be set dynamically */
}

.popup-switch-control {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid #333;
  border-radius: 2px;
  cursor: pointer;
  z-index: 2004;
  transform: translate(-50%, -50%);
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.popup-switch-control:hover {
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* ON/OFF Slider Control */
.switch-slider-container {
  position: absolute;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #333;
  border-radius: 20px;
  padding: 10px 15px;
  z-index: 2005;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-family: 'Inter', sans-serif;
  min-width: 120px;
}

.switch-slider-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
  color: #333;
}

.switch-slider {
  position: relative;
  width: 60px;
  height: 30px;
  background-color: #ccc;
  border-radius: 15px;
  margin: 0 auto;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #999;
}

.switch-slider.on {
  background-color: #4CAF50;
  border-color: #45a049;
}

.switch-slider.off {
  background-color: #999;
  border-color: #999;
}

.switch-slider-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background-color: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch-slider.on .switch-slider-knob {
  transform: translateX(28px);
}

.switch-slider-text {
  font-size: 10px;
  font-weight: 500;
  margin-top: 5px;
  text-align: center;
  color: #666;
}

.switch-slider-close {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.switch-slider-close:hover {
  background: #da190b;
}




#map {
  height: 100vh;
  width: 100%;
}

.substation-label {
  pointer-events: none;
  /* Optional: style for better look */
}

.slider-container {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(1px);
  padding: 4px 4px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  border: 1px solid rgba(255,255,255,0.3);
}

.slider-container label {
  font-weight: 500;
  min-width: 70px;
  font-size: 14px;
  color: #333;
}

#snapshot-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  outline: none;
  opacity: 0.8;
  transition: opacity 0.2s;
  cursor: pointer;
}

#snapshot-slider:hover {
  opacity: 1;
}

#snapshot-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.1s;
}

#snapshot-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

#snapshot-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#snapshot-label {
  min-width: 140px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  font-family: 'Inter', monospace;
}

#play-pause-btn {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  min-width: 40px;
  font-family: 'Inter', sans-serif;
}

#play-pause-btn:hover {
  background: #2563eb;
}

#play-pause-btn:active {
  transform: scale(0.95);
}

#map {
  /* Remove margin-top - slider now overlays the map */
  height: 100vh;
  width: 100%;
}

/* Ensure body and html take full space */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

.custom-substation-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--popup-width);
  height: var(--popup-height);
  background-color: rgba(255, 255, 255, 0.85);
  z-index: 2000;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  pointer-events: auto;
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 20px;
  color: #333;
  background: none;
  border: none;
  z-index: 2001;
}

.popup-substation-name {
  position: absolute;
  top: 10px;
  right: 40px;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  font-family: 'Inter', sans-serif;
}

.popup-circle-small {
  width: calc(var(--circle-small-radius) * 2);
  height: calc(var(--circle-small-radius) * 2);
  border-radius: 50%;
  border: 2px solid currentColor;
  background-color: transparent;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.popup-circle-large {
  width: calc(var(--circle-large-radius) * 2);
  height: calc(var(--circle-large-radius) * 2);
  border-radius: 50%;
  border: 2px solid currentColor;
  background-color: transparent;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1999;
}

.popup-params-window {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 200px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px;
  overflow: auto;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
}

.popup-params-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 2px;
}

.popup-param-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popup-line {
  position: absolute;
  height: 2px;
  background-color: currentColor;
  transform-origin: 0 50%;
  pointer-events: none;
  z-index: 2001;
}

/* Style for popup line labels */
.popup-line-label {
  position: absolute;
  z-index: 2003;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, 
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-size: 12px;
  letter-spacing: 0.3px;
  transition: transform 0.1s ease;
}

.popup-line-label:hover {
  transform: scale(1.05);
}


.popup-line-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.popup-connection-point {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: currentColor;
  transform: translate(-50%, -50%);
  z-index: 2003;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.line-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 5px solid currentColor;
  transform-origin: center bottom;
  z-index: 2002;
}

/* Small dot for bi-directional flows */
.line-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  transform: translate(-50%, -50%);
  z-index: 2002;
}

/* Style for power and capacity labels */
.popup-power-label {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 4px;
  padding: 3px 6px;
  color: #333;
  z-index: 2003;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, 
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-size: 12px;
  letter-spacing: 0.3px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.popup-line-label, .popup-power-label {
  /* Shared styles to ensure consistency */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, 
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-size: 15px;
  font-weight: normal;
  letter-spacing: 0.3px;
}

.substation-tooltip {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, 
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  padding: 4px 8px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 3000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  border: none;
}

/* Tooltip arrow styling */
.leaflet-tooltip-top.substation-tooltip:before {
  border-top-color: rgba(0, 0, 0, 0.7);
}

/* Make substation markers slightly larger on hover */
.leaflet-interactive:hover {
  stroke-width: 2px !important;
  stroke-opacity: 1 !important;
}

.clickable-bus {
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.clickable-bus:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.popup-switch {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 8px;
  border-radius: 4px;
  border: 2px solid #333;
  z-index: 2002;
  cursor: help;
  transition: all 0.2s ease;
}

.popup-switch:hover {
  transform: translate(-50%, -50%) scale(1.2);
}

.popup-bus-tooltip {
  position: fixed;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  white-space: nowrap;
  z-index: 3000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-bus-tooltip strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.popup-circle-small:hover,
.popup-circle-large:hover {
  transform: translate(-50%, -50%) scale(1.05);
  transition: all 0.1s ease;
}

/* Move zoom controls below the snapshot slider */
.leaflet-control-zoom {
  margin-top: 80px !important;
  margin-left: 10px !important;
}