:root {
    --sl-color-primary-600: var(--highlight-green); /* Default thumb color */
    --sl-color-primary-500: var(--highlight-green); /* Hover/active thumb color */

    /* Primary Colors */
    --primary-blue: #0d6aff;
    --primary-grey: #403c3f;

    /* Secondary Colors */
    --blue: #306ef8;
    --dark-blue: #062390;
    --darker-blue: #071f78;
    --sky-blue: #68c2fb;
    --aqua-blue: #6fe6fd;

    /* Greens */
    --mint-green: #85fbeb;
    --lime-green: #7af9b4;
    --spring-green: #71e68b;
    --apple-green: #82f984;
    --grass-green: #6cd46f;
    --forest-green: #43894d;

    /* Neutral Colors */
    --bg-white: #ffffff;
    --bg-light: #f3f4f6;
    --bg-gray: #e5e7eb;
    --bg-dark: #1f2937;

    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;

    /* Border Colors */
    --border-light: #e5e7eb;
    --border-medium: #d1d5db;

    /* Highlight Colors */
    --highlight-green: #82f984;
    --highlight-yellow: #f9ea46;
    --error: #ef4444;
    --info: #3b82f6;

    /* Opacity variants */
    --overlay-dark: rgba(0, 0, 0, 0.5);
    --overlay-light: rgba(255, 255, 255, 0.9);
}

/* #endregion */

/* #region Fonts -------------------------------------------*/

h2 {
    color: var(--primary-blue);
    font-size: 45px;
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    margin-bottom: 80px;
}

h3 {
    color: var(--blue);
    font-size: 30px;
    font-family: 'Poppins', sans-serif;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 10px;
}

li {
    font-size: 13.5px;
    margin-bottom: 10px;
}
ol {
    padding-left: 25px;
}

h4 {
    color: var(--primary-grey);
    font-size: 16px;
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    margin-bottom: 10px;
}

h6 {
    color: rgb(219, 219, 219);
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    font-weight: 300;
}
/* Full-bleed reset for iframe embedding */
html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Map Wrapper — fixed to iframe viewport, same pattern as story_map */
#map-wrap {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Side Panel — team details only, shown on drain click */
#side-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 35%;
    padding: 20px;
    background: white;
    border-right: 1px solid rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow: hidden;
    transition: transform 0.3s ease;
}

#side-panel.closed {
    transform: translateX(-100%);
}

/* Close button inside panel */
#panel-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-light);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11;
    transition: background 0.2s;
}

#panel-close:hover {
    background: var(--bg-gray);
    color: var(--text-primary);
}

/* Reopen toggle — shown on left edge when panel is closed */
#panel-toggle {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 28px;
    height: 52px;
    border: none;
    border-radius: 0 8px 8px 0;
    background: white;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    cursor: pointer;
    font-size: 16px;
    color: var(--primary-blue);
    align-items: center;
    justify-content: center;
    z-index: 11;
    transition: background 0.2s;
}

#panel-toggle:hover {
    background: var(--bg-light);
}

/* Mobile hint — hidden on desktop */
#mobile-hint {
    display: none;
}

/* Legend — floating overlay on the map */
#legend {
    position: absolute;
    top: 36px;
    left: 37%;
    z-index: 10;
    background: rgba(255,255,255,0.97);
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    padding: 20px;
    min-width: 220px;
    transition: left 0.3s ease;
}

#legend.panel-closed {
    left: 48px;
}

.panel-divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 10px 0;
}

.legend-title {
    color: var(--primary-blue);
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.01em;
}

.legend-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-row {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary);
}

.legend-header {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 6px;
    margin-bottom: 2px;
}

.legend-line {
    display: block;
    height: 3px;
    border-radius: 2px;
    width: 100%;
}

/* Search */
#search-container {
    position: absolute;
    top: 10px;
    right: 50px;
    z-index: 10;
    width: 300px;

}

/* Map */
#map-container {
    position: absolute;
    top: 0;
    left: 35%;
    right: 0;
    bottom: 0;
    border-radius: 25px;
    transition: left 0.3s ease;
}

#map-container.panel-closed {
    left: 0;
    border-radius: 0;
}

.maplibregl-ctrl-group {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Basemap Control */
.maplibregl-ctrl-basemap {
    background: white;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(0,0,0,.1);
}

.basemap-switcher-btn {
    width: 29px;
    height: 29px;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.basemap-switcher-btn:hover { background-color: #f5f5f5; }

.basemap-switcher-btn svg { width: 20px; height: 20px; }

.basemap-panel {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 10px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 12px;
    min-width: 180px;
}

.basemap-panel.active { display: block; }

.basemap-panel h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #333;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.basemap-options { display: flex; flex-direction: column; gap: 6px; }

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

.basemap-option:hover { background-color: #f5f5f5; }

.basemap-option input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
    accent-color: #007cbf;
}

.basemap-option label {
    cursor: pointer;
    font-size: 13px;
    color: #666;
    user-select: none;
    flex: 1;
}

.basemap-option input[type="radio"]:checked + label {
    color: #007cbf;
    font-weight: 500;
}

/* Drain Popups */
.drain-popup .maplibregl-popup-content {
    padding: 6px 10px;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    background: rgba(255,255,255,0.95);
}

.drain-popup .maplibregl-popup-close-button { display: none; }

.drain-popup-inner {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.drain-val {
    color: #222;
    font-weight: 500;
    white-space: nowrap;
}

.drain-val-bold {
    font-weight: 700;
}

/* Audit Drain Popups */
.audit-drain-popup .maplibregl-popup-content {
    padding: 0;
    border-radius: 6px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    min-width: 160px;
    background: #fff;
}

.audit-drain-popup .maplibregl-popup-close-button { display: none; }

.adp-inner {
    display: flex;
    flex-direction: column;
}

.adp-header {
    background: #e0f0ff;
    color: #1a3d80;
    font-weight: 700;
    font-size: 13px;
    padding: 7px 12px;
    letter-spacing: 0.02em;
}

.adp-header--in-progress {
    background: #ffe0f0;
    color: #8b2252;
}

.adp-header--done {
    background: #dcfce7;
    color: #166534;
}

.adp-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 12px;
    border-top: 1px solid #f5e0ec;
    gap: 16px;
}

.adp-attr {
    color: #888;
    font-weight: 500;
    white-space: nowrap;
}

.adp-val {
    color: #222;
    font-weight: 400;
    text-align: right;
}

/* Team role rows (default state) */
.team-role-desc {
    color: var(--text-secondary);
    margin: 2px 0 0;
    line-height: 1.4;
}

.team-role-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 50px;
}

/* Team Panel */
#team-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#team-captain {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

#team-crew {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#crew-name {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#team-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.team-label {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--blue);
}

.team-capt-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-grey);
    letter-spacing: 0.01em;
}

.team-institute-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.team-crew-name {
    font-size: 12px;
    font-weight: 400;
    color: var(--primary-grey);
    letter-spacing: 0.01em;
}

.team-icon {
width: 30%;
}

/* ============================================================
   RESPONSIVE — Tablet (768px–1024px)
   ============================================================ */
@media (max-width: 1024px) and (min-width: 768px) {
    #side-panel {
        width: 42%;
        padding: 14px;
    }

    #map-container {
        left: 42%;
    }

    #legend {
        left: 44%;
        padding: 14px;
        min-width: 190px;
    }

    #search-container {
        width: 220px;
        right: 40px;
    }

    .team-role-row {
        margin-bottom: 24px;
    }

    h3 {
        font-size: 22px;
    }

    h4 {
        font-size: 14px;
    }

    .team-icon {
        width: 25%;
    }
}

/* ============================================================
   RESPONSIVE — Mobile (< 768px)
   ============================================================ */
@media (max-width: 767px) {
    /* Side panel hidden on mobile */
    #side-panel {
        display: none !important;
    }

    /* Map fills full screen */
    #map-container {
        top: 0;
        left: 0 !important;
        right: 0;
        bottom: 0;
        border-radius: 0 !important;
        transition: none;
    }

    /* Hide panel toggle button on mobile */
    #panel-toggle {
        display: none !important;
    }

    /* Mobile hint pill */
    #mobile-hint {
        display: block;
        position: absolute;
        bottom: 60px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(255,255,255,0.92);
        color: var(--text-secondary);
        font-size: 12px;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        padding: 7px 14px;
        border-radius: 20px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        white-space: nowrap;
        z-index: 10;
        pointer-events: none;
    }

    /* Legend repositioned to top-left */
    #legend {
        top: 8px;
        left: 8px !important;
        padding: 10px 12px;
        min-width: 160px;
        font-size: 12px;
        transition: none;
    }

    .legend-title {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .legend-row {
        font-size: 11px;
        gap: 6px;
    }

    /* Search bar narrower */
    #search-container {
        top: 8px;
        right: 8px;
        width: calc(50% - 16px);
        max-width: 200px;
    }
}
