body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: #f4f7f6;
    color: #333;
}

#map {
    flex: 1;
    height: 100vh;
    order: 1;
    position: relative;
}

#sidebar {
    width: 310px;
    padding: 20px;
    background-color: #ffffff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    z-index: 10;
    display: flex;
    flex-direction: column;
    order: 2;
    flex-shrink: 0;
}

#sidebar h1 {
    margin-top: 0px;
    font-size: 1.8em;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

#sidebar h2 {
    font-size: 1.2em;
    color: #34495e;
    margin-bottom: 10px;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 5px;
}

#indicators {
    margin-bottom: 10px;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
}

.indicator-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.95em;
}

/* Class for label text (e.g., "Policy Movers:") */
.indicator-label-text {
    margin-right: auto; /* Pushes counts container to the right */
    padding-right: 10px;
    /* Removed margin-left that was used to align with color dots */
}

/* Keep #total-buyouts-label bold as it was previously */
#total-buyouts-label {
    font-weight: bold;
    /* Removed margin-left as color dots are gone */
}

/* Container for the main count */
.indicator-counts-container {
    display: flex;
    align-items: baseline;
    width: 55px; /* Reduced from 100px since we no longer have year values */
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Style for the main count part (the numbers) */
.indicator-main-count {
    width: 55px; /* Fixed width for the main count box */
    padding: 3px 6px; /* Adjusted padding */
    border-radius: 4px; /* Full border radius now (not just left side) */
    font-size: 0.9em;
    font-weight: bold;
    text-align: right;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    border: 1px solid transparent; /* Base border */
        background-color: #e0e0e0;
    color: #333;
    border-color: #d0d0d0;
    text-align: center;
}

/* Specific background/text color for Policy Mover counts */
#policy-mover-yes-count,
#policy-mover-no-count {
    background-color: #e0e0e0;
    color: #333;
    border-color: #d0d0d0;
    text-align: center;
}
#policy-mover-yes-year-value,
#policy-mover-no-year-value {
    background-color: #d0d0d0;
    color: #333;
    border-color: #d0d0d0;
    border-left-color: #b0b0b0; /* Slightly darker separator */
}

/* Specific background/text color for Total Buyouts count */
#total-buyouts-count {
    background-color: #3498db;
    color: white;
    border-color: #2980b9; /* Match border to year value bg for seamless look */
    text-align: center;
}
#total-buyouts-year-value {
    background-color: #2980b9;
    color: white;
    border-color: #2980b9;
    border-left-color: #1f6da8; /* Slightly darker separator */
}

#info-panel {
    margin-top: 20px;
    padding: 15px;
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    min-height: 100px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-size: 0.9em;
}

#info-panel h3 {
    margin-top: 0;
    color: #2c3e50;
}

#info-panel p {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* For Mapbox popups */
.mapboxgl-popup {
    max-width: 250px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.mapboxgl-popup-content {
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.mapboxgl-popup-content h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.mapboxgl-popup-content p {
    margin: 0;
    font-size: 0.85em;
    color: #555;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  vertical-align: middle;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #27ae60;
}
input:checked + .slider:before {
  transform: translateX(22px);
}

#toggle-container {
    display: flex;
    justify-content: space-between; /* Distribute space for 3 buttons */
    align-items: center;
    gap: 5px; /* Reduced gap */
    margin-bottom: 18px;
}

.toggle-btn {
    background: #e0e0e0;
    border: none;
    color: #333;
    padding: 8px 12px; /* Slightly reduced padding */
    border-radius: 6px;
    font-size: 0.9em; /* Slightly reduced font size */
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    margin: 0;
    flex-grow: 1; /* Allow buttons to grow */
    text-align: center; /* Center text in button */
    min-width: auto; /* Remove min-width or set to a smaller value */
}
.toggle-btn.active {
    background: #3498db;
    color: #fff;
    font-weight: bold;
}
.toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px #27ae6055;
}

#floating-modal {
    display: none;
}

#floating-modal {
    position: fixed;
    top: 24px;
    right: 32px;
    width: 340px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.13);
    z-index: 1001;
    padding: 20px 22px 18px 22px;
    font-size: 1em;
    max-height: 90vh;
    overflow-y: auto;
}

#floating-modal h1 {
    font-size: 1.4em;
    color: #2c3e50;
    margin-bottom: 16px;
    margin-top: 0;
    text-align: center;
}

#indicators h2 {
    margin-top: 0;
}

#hover-popup {
    position: fixed;
    pointer-events: none;
    z-index: 2000;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13);
    padding: 14px 18px;
    min-width: 220px;
    max-width: 320px;
    font-size: 0.98em;
    color: #222;
    display: none;
    transition: opacity 0.12s;
}

#hover-popup h3 {
    margin: 0 0 8px 0;
    font-size: 1.08em;
    color: #2c3e50;
}

#hover-popup p {
    margin: 0 0 6px 0;
    line-height: 1.5;
    font-size: 0.97em;
}

#year-slider-container {
    margin: 10px 0 10px 0;
    padding: 0 2px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
}

#year-mode-container {
    display: flex;
    gap: 15px;
    margin-top: 12px;
    justify-content: center;
}

.year-mode-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
    color: #34495e;
}

.year-mode-option input[type="radio"] {
    margin: 0;
    margin-right: 6px;
    width: 16px;
    height: 16px;
    accent-color: #3498db;
    cursor: pointer;
}

.year-mode-label {
    cursor: pointer;
    user-select: none;
}

#multi-flow-container {
    margin: 10px 0 10px 0;
    padding: 12px 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
    display: flex;
    justify-content: center;
}

.multi-flow-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
    color: #34495e;
}

.multi-flow-option input[type="checkbox"] {
    margin: 0;
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: #3498db;
    cursor: pointer;
}

.multi-flow-label {
    cursor: pointer;
    user-select: none;
    font-weight: 500;
}

/* Harris County extra info styles */
.harris-extra-info {
    /* margin-left: 28px; */ /* Removed margin-left */
    margin-bottom: 2px;
    font-size: 0.85em;
    color: #888;
    display: block;
    line-height: 1.3;
}
.harris-extra-label {
    color: #888;
}
.harris-extra-sep {
    color: #bbb;
    margin: 0 4px;
}
.harris-extra-pm {
    color: #555;
}
.harris-extra-pm b {
    color: #222;
    font-weight: 600;
}
.harris-extra-nonpm {
    font-size: 0.85em;
    color: #888;
    font-style: italic;
    letter-spacing: 0.1px;
    margin-top: -4px;
    margin-bottom: 2px;
}

/* Origin County extra info styles */
.origin-extra-info {
    margin-bottom: 2px;
    font-size: 0.85em;
    color: #888;
    display: block;
    line-height: 1.3;
}
.origin-extra-label {
    color: #888;
}
.origin-extra-sep {
    color: #bbb;
    margin: 0 4px;
}
.origin-extra-pm {
    color: #555;
}
.origin-extra-pm b {
    color: #222;
    font-weight: 600;
}
.origin-extra-nonpm {
    font-size: 0.85em;
    color: #888;
    font-style: italic;
    letter-spacing: 0.1px;
    margin-top: -4px;
    margin-bottom: 2px;
}

/* Utility class to hide elements */
.hidden {
    display: none !important;
}

/* Container for the clear flow button */
#clear-flow-btn-container {
    margin-top: 10px; /* Spacing from the indicators block */
}

/* Styling for the clear flow button */
.panel-action-button {
    width: 100%;
    padding: 10px 12px;
    background-color: #6c757d; /* A neutral, secondary button color */
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease-in-out;
}

.panel-action-button:hover {
    background-color: #5a6268; /* Darker shade on hover */
}

.panel-action-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.4); /* Focus ring */
}

/* Map Legend */
#map-legend {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.95em;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 20px;
}

.legend-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
    margin-right: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    line-height: 1.3;
    white-space: nowrap;
}

.legend-symbol {
    width: 12px;
    height: 12px;
    margin-right: 6px;
    flex-shrink: 0;
}

.legend-circle {
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.legend-line {
    height: 3px;
    border-radius: 1.5px;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(244, 247, 246, 0.95);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#loading-content {
    text-align: center;
    background: white;
    padding: 40px 50px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    max-width: 400px;
}

#loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-text {
    font-size: 1.2em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

#loading-subtext {
    font-size: 0.9em;
    color: #7f8c8d;
    line-height: 1.4;
}

#year-slider {
    accent-color: #3498db;
}
