* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(100vw - 350px);
    height: 100vh;
    z-index: 1;
}

#settings-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    background-color: white;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    z-index: 1000;
}

#settings-panel h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

#settings-panel h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #555;
    font-weight: 600;
}

.settings-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.settings-section:last-of-type {
    border-bottom: none;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.checkbox-group label:hover {
    background-color: #f5f5f5;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.setting-item input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
    cursor: pointer;
}

.setting-item span {
    display: inline-block;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.setting-item select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.setting-item select:hover {
    border-color: #999;
}

.setting-item select:focus {
    outline: none;
    border-color: #4CAF50;
}

.setting-item select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Time Interval Dual Slider Styling - Green Theme */
.dual-slider-container {
    position: relative;
    height: 40px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.slider-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.slider-track::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
}

.slider-track::-moz-range-track {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
}

.slider-track::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #4CAF50;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-top: -6px;
    pointer-events: auto;
    position: relative;
    z-index: 3;
}

.slider-track::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #4CAF50;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    position: relative;
    z-index: 3;
}

.slider-range {
    position: absolute;
    height: 6px;
    background: #4CAF50;
    border-radius: 3px;
    pointer-events: none;
    z-index: 1;
    top: 0;
}

#time-range-display {
    font-weight: 600;
    color: #4CAF50;
    float: right;
}

/* Button Group Styling - Green Theme */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.month-group {
    gap: 5px;
}

.toggle-btn {
    padding: 0;
    border: 2px solid #ddd;
    background-color: white;
    color: #666;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn:hover {
    border-color: #81c784;
    background-color: #f1f8f4;
}

.toggle-btn.active {
    background-color: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.toggle-btn:active {
    transform: scale(0.95);
}

/* Days of week - single row, distributed evenly */
.setting-item:has([data-day]) .button-group {
    flex-wrap: nowrap;
    gap: 3px;
    justify-content: space-between;
}

.setting-item:has([data-day]) .toggle-btn {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
}

/* Month buttons - same size as day buttons, 3 rows layout */
.month-group {
    justify-content: flex-start;
}

.month-group .toggle-btn {
    width: 36px;
    height: 36px;
    font-size: 12px;
    flex: 0 0 36px;
}

/* Select All / Deselect All Controls */
.select-all-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    margin-top: 8px;
}

.select-all-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background-color: white;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    flex: 1;
}

.select-all-btn:hover {
    border-color: #4CAF50;
    background-color: #f1f8f4;
    color: #4CAF50;
}

.select-all-btn:active {
    transform: scale(0.95);
}

/* Toggle Switch */
.toggle-switch-label {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100%;
    margin-bottom: 0 !important;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #4CAF50;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px #4CAF50;
}

/* Apply Button */
.apply-btn {
    width: 100%;
    height: 44px;
    padding: 0 20px;
    border: none;
    background-color: #4CAF50;
    color: white !important;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.apply-btn-text {
    color: white !important;
}

.apply-btn:hover:not(:disabled) {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.apply-btn:active:not(:disabled) {
    transform: translateY(0);
}

.apply-btn:disabled {
    background-color: #81c784;
    cursor: not-allowed;
    opacity: 0.8;
}

/* Loading Spinner */
.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.spinner .path {
    stroke: white;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Polygon hover effects */
.leaflet-zoom-hide path {
    cursor: pointer;
    pointer-events: fill;
    transition: transform 0.25s ease-out,
    filter 0.25s ease-out;
    transform-origin: center center;
    transform-box: fill-box;
}

/* Hovered polygon - smooth lift on hover */
.leaflet-zoom-hide path.hovered {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4)) brightness(1.1);
    stroke: white !important;
    stroke-width: 3.5px !important;
    transition: transform 0.2s cubic-bezier(0.34, 1.2, 0.64, 1),
    filter 0.2s ease-out,
    stroke 0.2s ease-out,
    stroke-width 0.2s ease-out;
    pointer-events: fill;
}

/* When leaving, apply slow drop/fall effect */
.leaflet-zoom-hide path.leaving {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    filter 0.5s ease-in-out;
    pointer-events: fill;
}

/* Radio Group Styling - Circular buttons like toggle buttons */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.radio-label {
    position: relative;
    cursor: pointer;
    user-select: none;
    flex: 0 0 auto;
}

.radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-label span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    background-color: white;
    color: #666;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.radio-label:hover span {
    border-color: #81c784;
    background-color: #f1f8f4;
}

.radio-label input[type="radio"]:checked + span {
    background-color: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.radio-label:active span {
    transform: scale(0.95);
}

/* Day radio group - single row layout like original toggle buttons */
.day-radio-group {
    flex-wrap: wrap;
    gap: 4px;
    justify-content: space-between;
}

.day-radio-group .radio-label {
    flex: 0 0 36px;
}

.day-radio-group .radio-label span {
    width: 36px;
    height: 36px;
}

/* First radio button (All) - keep same size for consistency */
.day-radio-group .radio-label:first-child span {
    width: 36px;
    font-size: 11px;
}

/* Visualization type radio group - larger rectangular buttons with rounded corners */
.viz-type-radio-group {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: 8px;
}

.viz-type-radio-group .radio-label {
    flex: 1;
}

.viz-type-radio-group .radio-label span {
    width: 100%;
    height: 50px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.viz-type-radio-group .radio-label input[type="radio"] {
    display: none;
}

.viz-type-radio-group .radio-label:hover span {
    border-color: #66bb6a;
    background-color: #e8f5e9;
}

.viz-type-radio-group .radio-label input[type="radio"]:checked + span {
    background-color: #4CAF50;
    border-color: #4CAF50;
    color: white;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

/* Selected polygon/arc highlighting */
.leaflet-zoom-hide path.selected {
    stroke: #ff6b00 !important;
    stroke-width: 4px !important;
    filter: drop-shadow(0 4px 16px rgba(255, 107, 0, 0.6)) brightness(1.15);
    pointer-events: fill;
    z-index: 1000;
}
