/* =========================================
   GLOBAL STYLES
   ========================================= */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1e1e1e;
    display: flex;
    flex-direction: column;
}

/* Fix the scrolling and background color specifically for the downloads page */
html:has(.downloads-page), 
body.downloads-page {
    height: auto;
    min-height: 100vh;
    background-color: #f4f4f9;
    overflow: auto;
}

/* =========================================
   TOP NAVIGATION BAR
   ========================================= */
#top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1e2129;
    color: white;
    padding: 0 20px;
    height: 50px;
    border-bottom: 2px solid #333;
    flex-shrink: 0;
}

#top-nav .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    height: 36px;
    width: auto;
}

#top-nav .brand strong {
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

#top-nav .tabs a {
    color: #aaa;
    text-decoration: none;
    padding: 15px 20px;
    font-size: 0.9rem;
    display: inline-block;
    transition: color 0.2s, border-bottom 0.2s;
}

#top-nav .tabs a:hover {
    color: white;
}

#top-nav .tabs a.active {
    color: #60a5fa; 
    border-bottom: 3px solid #60a5fa;
}

/* =========================================
   MAIN APP: DUAL MAP & CONTROL PANEL
   ========================================= */
#comparison-container {
    position: relative;
    flex-grow: 1; 
    width: 100%;
    overflow: hidden;
}

.map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
}

#control-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 2; 
    background-color: rgba(30, 33, 41, 0.9);
    color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    width: 280px;
    border: 1px solid #444;
}

#control-panel h2 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #fff;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
}

#control-panel label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: #ccc;
}

#control-panel select {
    width: 100%;
    padding: 8px;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: #2a2d36;
    color: white;
    cursor: pointer;
}

/* Opacity Slider */
input[type=range] {
    background: transparent;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: #60a5fa;
    cursor: pointer;
    margin-top: -5px;
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #555;
    border-radius: 2px;
}
input[type=range]:focus {
    outline: none;
}

/* =========================================
   DOWNLOADS PAGE
   ========================================= */
#downloads-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

#downloads-container h1 {
    color: #003366;
    font-size: 1.8rem;
    margin-bottom: 5px;
}

#downloads-container p {
    color: #555;
    margin-bottom: 30px;
}

/* Bootstrap-style List Group */
.download-list-group {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.download-list-item {
    position: relative;
    display: flex;
    justify-content: space-between; 
    align-items: center;            
    padding: 12px 20px;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    color: #333;
    font-size: 15px;
}

.download-list-item:last-child {
    border-bottom: none;
}

/* Accordion Container Styling */
.year-accordion {
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #fff;
    overflow: hidden; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.year-accordion summary {
    padding: 15px 20px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #00467f;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.year-accordion summary:hover {
    background-color: #e9ecef;
}

.year-accordion .download-list-group {
    border: none; 
    border-top: 1px solid #e0e0e0; 
    border-radius: 0;
}

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 900px) { 
    #top-nav {
        flex-direction: column;
        height: auto !important; 
        padding: 15px 10px;
        gap: 10px;
        align-items: center; 
    }

    #top-nav .brand {
        justify-content: center;
        margin-bottom: 5px;
        text-align: center;
    }

    #top-nav .tabs {
        display: flex;
        flex-wrap: wrap; 
        justify-content: center;
        gap: 5px; 
        width: 100%;
    }

    #top-nav .tabs a {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .page-wrapper {
        flex-direction: column;
    }
}

/* =========================================
   LEGACY SPLIT-SCREEN LAYOUT
   ========================================= */
.split-layout-wrapper {
    display: flex;
    flex-grow: 1; 
    width: 100%;
    overflow: hidden;
    position: relative;
    background-color: #1e1e1e;
}

/* Left Map Panel */
#map-panel {
    flex-grow: 1; 
    position: relative;
    height: 100%; 
    min-height: 100vh; 
    transition: width 0.3s ease; 
}

#legacy-map {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
}

/* Right Image Panel */
#image-panel {
    width: 40%; 
    min-width: 350px;
    background-color: #f4f4f9;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease-in-out, width 0.3s ease-in-out;
    transform: translateX(0); 
}

#image-panel.collapsed {
    width: 0;
    min-width: 0;
    transform: translateX(100%);
    border-left: none;
}

.image-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #00467f;
    color: white;
}

.image-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

#close-panel-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

#close-panel-btn:hover {
    color: #ff6b6b;
}

.image-panel-content {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    white-space: nowrap; 
}

#oblique-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; 
    border: 1px solid #ccc;
    background: #fff;
}

/* The clickable vertical divider */
#panel-divider {
    width: 6px;
    background-color: rgb(85 85 85 / 70%); 
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10; 
    color: white;
    font-size: 10px;
    transition: background-color 0.2s ease;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

#panel-divider:hover {
    background-color: #8a8a8a; 
}

/* =========================================
   OBLIQUE VIEWER TOOLTIP
   ========================================= */
#tooltip {
    display: none;
    position: fixed; 
    z-index: 9999;
    background-color: rgba(30, 33, 41, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
    pointer-events: none; 
    border: 1px solid #555;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    line-height: 1.5;
}

/* =========================================
   MAP POPUP STYLING
   ========================================= */
.maplibregl-popup-content {
    max-width: 450px !important; 
    width: max-content; 
    padding: 15px;
    border-radius: 8px;
}

.popupwrap {
    max-height: 250px; 
    overflow-y: auto; 
    overflow-x: hidden; 
    margin-top: 10px;
    padding-right: 5px; 
}

.popup-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #ddd;
    padding: 12px 10px; 
    border-left: 4px solid transparent; 
    box-sizing: border-box;
    margin-right: 8px; 
    gap: 10px; 
    transition: all 0.2s ease-in-out;
}

.popup-item:last-child {
    border-bottom: none;
}

.active-popup-item {
    background-color: rgba(4, 62, 154, 0.1); 
    border-left: 4px solid #030303; 
    border-radius: 0 4px 4px 0;
}

.floatleftpop {
    flex: 0 0 auto; 
    white-space: nowrap; 
    font-size: 0.85rem;
    line-height: 1.3; 
    padding-right: 15px; 
    margin-top: 2px;
    text-align: center; 
}

.floatrightpop {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1; 
    align-items: stretch; 
}

/* =========================================
   BUTTON STYLES
   ========================================= */
.floatrightpop button, 
.btn-download {
    cursor: pointer;
    font-weight: 600;
    line-height: 1.5;
    border: none;
    border-radius: 4px;
    text-align: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Download specific button tweaks */
.btn-download {
    background-color: #337ab7; 
    color: #fff;
    border: 1px solid #2e6da4;
    padding: 6px 12px;        
    font-size: 13px;          
}
.btn-download:hover { background-color: #286090; border-color: #204d74; }
.btn-download:focus { outline: none; box-shadow: 0 0 0 2px rgba(51, 122, 183, 0.5); }

/* Popup specific buttons */
.floatrightpop button {
    padding: 5px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
    width: 100%;
}
.btn-sync { background: #007bff; color: white; }
.btn-show { background: #17a2b8; color: white; }
.btn-black { background: #000000; color: #ffffff; }
.btn-yellow { background: #ffc107; color: #000000; }

.btn-sync:hover { background: #0056b3; }
.btn-show:hover { background: #117a8b; }
.btn-black:hover { background: #333333; }
.btn-yellow:hover { background: #e0a800; }

/* =========================================
   STARTUP INSTRUCTIONS OVERLAY
   ========================================= */
#oblique-instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    text-align: left;
    width: 380px; 
    pointer-events: none; 
}

#oblique-instructions p {
    color: #333;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 10px 0;
    white-space: normal !important; 
    overflow-wrap: break-word; 
}

#oblique-instructions h3 {
    margin-top: 0;
    color: #043e9a; 
    font-size: 1.2rem;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
    text-align: center;
}

/* =========================================
   MAPLIBRE DEFAULT ATTRIBUTION FIX (LEGACY MAP)
   ========================================= */
#legacy-map .maplibregl-ctrl-bottom-right {
    bottom: 50px !important; 
    right: 0px !important;  
    z-index: 1000 !important; 
}

#legacy-map .maplibregl-ctrl-attrib {
    display: block !important;
    visibility: visible !important;
    background-color: rgba(255, 255, 255, 0.75) !important; 
}