/* Core App Layout Window */
html, body {
    margin: 0;
    padding: 0;
    height: 100% !important;
    width: 100% !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#map {
    width: 100% !important;
    height: 100vh !important;
    display: block;
    background-color: #2c3e50;
    z-index: 1;
}

/* Sidebar Floating Overlay Layout Container (Desktop Default) */
#sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 260px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    z-index: 1000;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#sidebar h2 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 8px;
}

/* Interactive Drawer Toggle Pull-Tab (Hidden on Desktop) */
.drawer-toggle {
    display: none;
}

#location-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Individual Interactive List Items */
.list-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #34495e;
    border-left: 5px solid #ccc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

/* Inline Circular Indicator Dot (Hidden on Desktop viewports) */
.item-color-dot {
    display: none;
}

.list-item:hover {
    transform: translateX(4px);
    background: #f8f9fa;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Modal Popup & Action Button Styling */
.popup-content {
    max-width: 220px;
    text-align: center;
    padding: 4px;
}

.popup-content h3 {
    margin: 4px 0 6px 0;
    color: #2c3e50;
    font-size: 16px;
}

.popup-content p {
    font-size: 12px;
    color: #555;
    line-height: 1.4;
    margin: 0 0 12px 0;
}

/* "Learn More" Style inside the popup bubble */
.popup-content .learn-more-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #34495e;
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease;
}

.popup-content .learn-more-btn:hover {
    background-color: #2c3e50;
}

/* Hide Leaflet bottom attribution layer dynamically */
.leaflet-bottom {
    display: none;
}

/* =================================================================
   FULL PAGE MODAL OVERLAY LAYOUT AND FADE ANIMATIONS
   ================================================================= */
#detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(44, 62, 80, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999; /* Fully blocks map structures */
    display: none; /* Fixed fallback rendering layout flash bug */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Class triggered by JS to execute smooth fade-in */
#detail-overlay.active {
    display: flex;
    opacity: 1;
}

/* Floating top right close action cross button layout */
#overlay-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 48px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#overlay-close-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Centered master information sheet display bounds */
.overlay-card {
    display: flex;
    width: 84%;
    /*max-width: 960px;*/
    height: 75vh;
    max-height: 600px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* Left structural frame for imagery handling */
.overlay-left {
    flex: 1;
    width: 50%;
    background-color: #ecf0f1;
}

#overlay-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Right structural frame for textual layouts */
.overlay-right {
    flex: 1;
    width: 50%;
    padding: 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#overlay-title {
    margin: 0 0 16px 0;
    font-size: 32px;
    color: #2c3e50;
    font-weight: 700;
}

#overlay-description {
    margin: 0 0 30px 0;
    font-size: 16px;
    color: #555555;
    line-height: 1.6;
}

/* External secondary redirection button style */
#overlay-external-link {
    align-self: flex-start;
    display: none;
    padding: 12px 28px;
    background-color: #34495e;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#overlay-external-link:hover {
    background-color: #2c3e50;
    transform: translateY(-2px);
}

/* =================================================================
   MOBILE RESPONSIVE ENGINE RULES (Screens under 768px)
   ================================================================= */
@media (max-width: 768px) {
    html, body {
        position: fixed;
        overflow: hidden;
    }

    /* Transform sidebar into a sliding bottom sheet drawer */
    #sidebar {
        top: auto;
        left: 0;
        bottom: 0;
        width: 100%;
        max-height: 40vh;
        box-sizing: border-box;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
        padding: 0 20px 20px 20px;
        backdrop-filter: blur(12px);
        background: rgba(255, 255, 255, 0.92);
        overflow-y: visible;
    }

    /* Style the collapsible UI action handle container */
    .drawer-toggle {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        height: 28px;
        cursor: pointer;
    }

    /* The visual pill-shaped pull-tab indicator */
    .drawer-toggle::before {
        content: '';
        width: 44px;
        height: 5px;
        background-color: #bdc3c7;
        border-radius: 3px;
        transition: background-color 0.2s ease;
    }

    .drawer-toggle:active::before {
        background-color: #7f8c8d;
    }

    #sidebar h2 {
        font-size: 16px;
        margin: 0 0 12px 0;
    }

    /* Arrange location list into a swipeable horizontal strip */
    #location-list {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch; 
        scrollbar-width: none; 
    }

    #location-list::-webkit-scrollbar {
        display: none;
    }

    /* Transform list nodes into thumb-friendly carousel cards */
    .list-item {
        flex: 0 0 190px;
        margin-bottom: 0;
        padding: 14px;
        border-left: none;
        border-bottom: 5px solid #ccc;
        box-sizing: border-box;
        font-size: 13px;
    }

    /* Make the circular icon dot visible on mobile layout viewports */
    .item-color-dot {
        display: block;
        width: 10px;
        height: 10px;
        min-width: 10px;
        border-radius: 50%;
        margin-right: 8px;
    }

    .list-item:hover {
        transform: none;
    }

    /* CSS Class triggered by JavaScript to collapse the sheet */
    #sidebar.collapsed {
        transform: translateY(calc(100% - 28px));
    }

    /* Relocate zoom control layout node so it never overlaps the sheet */
    .leaflet-top {
        top: 16px !important;
    }

    /* Overlay mobile dimensions */
    #overlay-close-btn {
        top: 10px;
        right: 10px;
        font-size: 36px;
    }

    .overlay-card {
        flex-direction: column;
        width: 90%;
        height: 80vh;
        max-height: 540px;
    }

    .overlay-left {
        width: 100%;
        height: 35%;
        min-height: 160px;
        flex: none;
    }

    .overlay-right {
        width: 100%;
        height: 65%;
        padding: 14px;
        justify-content: flex-start;
        overflow-y: auto;
    }

    #overlay-title {
        font-size: 22px;
        margin-bottom: 10px;
    }

    #overlay-description {
        font-size: 14px;
        margin-bottom: 20px;
    }
}

.outro p {
    font-size: 2rem;
    max-width: 600px;
    text-align: center;
    line-height: 1.5;
    opacity: 0; /* Add this: Keeps it hidden until scroll activates */
}

/* Overlay styles Mobile + Tablet */
@media screen and (max-width: 1024px) {
    #overlay-title {
        margin: 0 0 12px 0;
        font-size: 20px;
    }

    #overlay-description {
        margin: 0 0 16px 0;
        font-size: 14px;
        line-height: 1.3;
    }
}