/* ========================================
   WEATHER VISUALIZATION STYLES
   ======================================== */

/* Weather visualization specific styles */
/* Ensure no white space at the top */
html, body {
    margin: 0;
    color: white;
    padding: 0;
    background-color: #000000;
}

/* Account for the navbar toggle button at the top */
.main-content {
    padding-top: 0;
    margin-top: 0;
}

/* When navbar is shown, adjust content positioning */
.container-split.navbar-shown {
    margin-top: 80px;
    height: calc(100vh - 80px);
}

.container-split {
    display: flex;
    height: 100vh; /* Use full viewport height */
    min-height: 600px; /* Ensure minimum usable height */
    margin-top: 0; /* Start from the very top */
    box-sizing: border-box; /* Include margin in height calculation */
}

#map {
    width: 90%;
    flex: 1; /* Take up remaining space after year slider */
    margin: 20px 0; /* Replace padding with margin for better spacing */
    padding: 10px; /* Smaller internal padding */
    box-sizing: border-box; /* Ensure padding does not overflow container */
    background: #000000; /* Optional: subtle background for clarity */
    border-radius: 12px; /* Optional: rounded corners for aesthetics */
    min-height: 400px; /* Minimum height to ensure map is usable */
    position: relative;
    z-index: 1; /* Ensure map stays below navbar */
}

/* Ensure Leaflet map displays properly */
#map .leaflet-container {
    border-radius: 8px; /* Match the parent border radius */
}

/* Custom styling for Leaflet controls to match site theme */
.leaflet-control-layers {
    background-color: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid #20c997 !important;
    border-radius: 8px !important;
    color: white !important;
    z-index: 999 !important; /* Keep below navbar but above other content */
}

.leaflet-control-layers-toggle {
    background-color: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid #20c997 !important;
    border-radius: 8px !important;
}

.leaflet-control-layers-expanded {
    padding: 10px !important;
}

.leaflet-control-layers label {
    color: white !important;
    font-weight: 500 !important;
    margin-bottom: 5px !important;
}

.leaflet-control-layers input[type="radio"] {
    margin-right: 8px !important;
}

/* Style zoom controls */
.leaflet-control-zoom {
    border: 1px solid #20c997 !important;
    border-radius: 8px !important;
    overflow: hidden;
    z-index: 999 !important; /* Keep below navbar but above other content */
}

.leaflet-control-zoom a {
    background-color: rgba(0, 0, 0, 0.8) !important;
    color: #20c997 !important;
    border: none !important;
    font-weight: bold !important;
    text-shadow: none !important;
    transition: all 0.3s ease !important;
}

.leaflet-control-zoom a:hover {
    background-color: #20c997 !important;
    color: black !important;
}

/* Style attribution */
.leaflet-control-attribution {
    background-color: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    border-radius: 4px !important;
    z-index: 999 !important; /* Keep below navbar but above other content */
}

.leaflet-control-attribution a {
    color: #20c997 !important;
}

/* Style effects control */
.leaflet-control-effects {
    background-color: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid #20c997 !important;
    border-radius: 8px !important;
    padding: 8px !important;
    margin-bottom: 10px !important;
    z-index: 999 !important; /* Keep below navbar but above other content */
}

.leaflet-control-effects select {
    font-size: 12px !important;
    width: 120px !important;
}

.leaflet-control-effects select:focus {
    outline: none !important;
    border-color: #20c997 !important;
    box-shadow: 0 0 5px rgba(32, 201, 151, 0.5) !important;
}

/* Style search control */
.leaflet-control-search {
    background-color: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid #20c997 !important;
    border-radius: 8px !important;
    padding: 8px !important;
    margin-bottom: 10px !important;
    z-index: 999 !important; /* Keep below navbar but above other content */
}

.leaflet-control-search input {
    font-size: 12px !important;
}

.leaflet-control-search input:focus {
    border-color: #17a085 !important;
    box-shadow: 0 0 5px rgba(32, 201, 151, 0.3) !important;
}

.leaflet-control-search button:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* Style temporary search marker */
.temp-search-marker {
    font-size: 20px !important;
    text-align: center !important;
    line-height: 20px !important;
}

/* Weather station control styles */
.leaflet-control-stations {
    background-color: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid #20c997 !important;
    border-radius: 8px !important;
    padding: 8px !important;
    margin-bottom: 10px !important;
    z-index: 999 !important; /* Keep below navbar but above other content */
}

.leaflet-control-stations button {
    background-color: rgba(0, 0, 0, 0.8) !important;
    color: #20c997 !important;
    border: 1px solid #20c997 !important;
    border-radius: 4px !important;
    padding: 5px 10px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    transition: all 0.3s ease !important;
}

.leaflet-control-stations button:hover {
    background-color: #20c997 !important;
    color: black !important;
}

/* Weather station legend styles */
.leaflet-control-legend {
    background-color: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid #20c997 !important;
    border-radius: 8px !important;
    padding: 12px !important;
    margin: 10px !important;
    min-width: 200px !important;
    color: white !important;
    font-family: Arial, sans-serif !important;
    font-size: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    z-index: 999 !important; /* Keep below navbar but above other content */
}

.leaflet-control-legend h4 {
    margin: 0 0 8px 0 !important;
    color: #20c997 !important;
    font-size: 14px !important;
    font-weight: bold !important;
}

.leaflet-control-legend div {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 6px !important;
}

.leaflet-control-legend .coverage-icon {
    width: 16px !important;
    height: 16px !important;
    border: 1px solid #20c997 !important;
    border-radius: 50% !important;
    background: rgba(32, 201, 151, 0.1) !important;
    margin-right: 8px !important;
}

.leaflet-control-legend .marker-icon {
    width: 6px !important;
    height: 6px !important;
    border: 1px solid #20c997 !important;
    border-radius: 50% !important;
    background: #20c997 !important;
    margin-right: 8px !important;
}

/* Modal/Popup styles for enlarged plot views */
.plot-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #1a1a1a;
    margin: 2% auto;
    padding: 0;
    border: 2px solid #20c997;
    border-radius: 12px;
    width: 90%;
    height: 90%;
    max-width: 1200px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background-color: #20c997;
    color: black;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

.close-button {
    background: none;
    border: none;
    font-size: 30px;
    font-weight: bold;
    color: black;
    cursor: pointer;
    padding: 0;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-button:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.modal-body {
    flex: 1;
    padding: 20px;
    overflow: auto;
    color: white;
}

.plot-reset-info {
    color: #ccc;
    text-align: center;
    font-size: 18px;
    margin-bottom: 15px;
}

.polar-plot-title {
    color: #20c997;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 5px;
    margin-top: 15px;
}

.modal-plot-container {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

/* Thumbnail styles */
.enlargeable-plot {
    width: 100%;
    height: 400px;
    background: #000000;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
}

.enlargeable-plot:hover {
    border-color: #20c997;
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(32, 201, 151, 0.3);
}

.enlargeable-plot::before {
    content: attr(data-title);
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(32, 201, 151, 0.9);
    color: black;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    z-index: 10;
}

.enlargeable-plot::after {
    content: '🔍 Click to enlarge';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #20c997;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.enlargeable-plot:hover::after {
    opacity: 1;
}

/* Plot loading states */
.plot-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 18px;
    color: #666;
}

.plot-loading-large {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 28px;
    color: #666;
}

.dashboard-container {
    width: 50%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #000000;
    justify-content: flex-start; /* Align to top */
    align-items: center;    /* Center horizontally */
}

.year-slider-container {
    flex-shrink: 0; /* Don't shrink when space is limited */
    padding: 10px;
    background-color: black;
    min-height: 90px; /* Ensure it has enough space for controls */
    max-height: 100px; /* Ensure it has enough space for controls */
}

.year-slider {
    width: 100%;
    margin: 10px 0;
}

.year-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-weight: bold;
    color: white;
}

.year-range-display {
    text-align: center;
    font-size: 30px;
    font-weight: bold;
    color: #20c997;
    margin-bottom: 10px;
    white-space: normal;
    line-height: 1.2;
    padding: 0px 50px;
    display: block;
}

.year-range-values {
    display: block;
    margin-top: 0.5em;
    font-size: 0.9em;
}

/* Custom range slider styles */
.range-slider {
    position: relative;
    width: 100%;
    height: 40px;
    margin: 20px 0;
}

.range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    pointer-events: none;
    -webkit-appearance: none;
}

.range-slider input[type="range"]:nth-child(1) {
    z-index: 2;
}

.range-slider input[type="range"]:nth-child(2) {
    z-index: 1;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #20c997;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid white;
}

.range-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #20c997;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid white;
}

.range-slider input[type="range"]:nth-child(1) {
    background: #333;
}

.range-slider input[type="range"]:nth-child(2) {
    background: #333;
}

#temperature-plots {
    width: 50%;
    padding: 20px;
    overflow: auto;
    background-color: black;
    height: 100%; /* Ensure the temperature plots container takes full height */
}

/* Loading spinner styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #20c997;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: white;
    margin-top: 20px;
    font-size: 18px;
    text-align: center;
}

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

/* Four-container layout for Temperature tab */
.temp-tab-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    height: 100%;
    justify-content: flex-end;
}

.temp-tab-top {
    flex: 1 1 30%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    border-radius: 8px;
    margin-bottom: 0px;
    overflow: hidden;
}

.temp-tab-bottom-row {
    flex: 1 1 100%;
    display: flex;
    gap: 10px;
    height: 100%;
}

.temp-tab-bottom-cell {
    flex: 1 1 0;
    background: #000000;
    border-radius: 8px;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

/* Two-vertical-section layout for Max Temperature tab */
.temp-tab-vertical {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 16px;
}

.temp-tab-vertical-top {
    flex: 1 1 50%;
    background: #000000;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    overflow: hidden;
    position: relative;
}

/* Average temperature plot on top - full width */
.temp-tab-avg-top {
    flex: 1 1 40%;
    display: flex;
    margin-bottom: 16px;
}

.temp-tab-top-cell {
    width: 100%;
    background: #000000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.temp-tab-top-cell:hover {
    border-color: #20c997;
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(32, 201, 151, 0.3);
}

.temp-tab-top-cell::before {
    content: attr(data-title);
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(32, 201, 151, 0.9);
    color: black;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    z-index: 10;
}

.temp-tab-top-cell::after {
    content: '🔍 Click to enlarge';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #20c997;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.temp-tab-top-cell:hover::after {
    opacity: 1;
}

/* Min and Max temperature plots below - side by side */
.temp-tab-vertical-bottom {
    flex: 1 1 30%;
    display: flex;
    gap: 10px;
    height: 0;
    min-height: 0;
}

.temp-tab-bottom-cell {
    flex: 1 1 0;
    background: #000000;
    border-radius: 8px;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

/* Individual plot containers */
.individual-plot-container {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
}

.individual-plot-container:hover {
    border-color: #20c997;
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(32, 201, 151, 0.3);
}

.individual-plot-container::before {
    content: attr(data-title);
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(32, 201, 151, 0.9);
    color: black;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    z-index: 10;
}

.individual-plot-container::after {
    content: '🔍 Click to enlarge';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #20c997;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.individual-plot-container:hover::after {
    opacity: 1;
}

/* Ensure plots fit within containers */
.enlargeable-plot > div,
.temp-tab-bottom-cell > div,
.temp-tab-top-cell > div,
.temp-tab-vertical-top > div {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
}

h1 {
    color: #20c997;
    font-size: 16;
}

.section-heading {
    color: green;
    font-weight: bold;
}

/* Plotly container fixes */
.plotly-graph-div {
    width: 100% !important;
    height: 100% !important;
}

.plotly-graph-div .plot-container {
    width: 100% !important;
    height: 100% !important;
}


