/* --- DESIGN SYSTEM --- */
:root {
    --geo-blue: #004D9D;
    --geo-bronze: #D3641F;
    --glass-bg: rgba(15, 23, 42, 0.95);
    --glass-border: rgba(255, 255, 255, 0.15);
    --active-card: rgba(0, 77, 157, 0.6);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    background: #000;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 1;
}

.ui-layer {
    position: relative;
    z-index: 10;
    height: 100vh;
    pointer-events: none;
}

/* --- SIDEBAR --- */
.sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 340px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-right: 1px solid var(--glass-border);
    padding: 1.5rem;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    z-index: 20;
}

.brand h1 {
    color: white;
    font-size: 1.5rem;
    margin: 0;
    font-weight: 800;
}

.brand span {
    color: var(--geo-blue);
}

.brand p {
    color: #94a3b8;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* NAVIGATION */
.nav-links {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 15px;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
}

.nav-links li a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: 0.2s;
}

.nav-links li a:hover {
    color: var(--geo-bronze);
}

/* SEARCH FILTERS */
.filter-group {
    display: flex;
    gap: 10px;
}

.filter-select {
    width: 100%;
    padding: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: white;
    outline: none;
    font-size: 0.8rem;
    cursor: pointer;
}

.filter-select option {
    background: #0f172a;
}

/* SEARCH BAR */
.search-container {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    padding: 12px 40px 12px 12px;
    border-radius: 6px;
    color: white;
    outline: none;
    transition: 0.3s;
    font-size: 0.9rem;
}

.search-input:focus {
    border-color: var(--geo-blue);
    box-shadow: 0 0 10px rgba(0, 77, 157, 0.3);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--geo-blue);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* TOOLS */
.gps-btn {
    width: 100%;
    padding: 10px;
    background: #10b981;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gps-btn:hover {
    background: #059669;
}

.tool-btn {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: #cbd5e1;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
    font-size: 0.9rem;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.cta-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--geo-bronze), #d97706);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(211, 100, 31, 0.4);
    margin-top: 10px;
}

/* PROJECT CARDS (FILTERS) */
.cards-container {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 1rem;
    pointer-events: none;
    z-index: 15;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    padding: 1.2rem;
    width: 180px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    border-left: 4px solid transparent;
    pointer-events: auto;
    cursor: pointer;
    transition: 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card.active {
    background: var(--active-card);
    border-left-color: var(--geo-bronze);
    box-shadow: 0 0 20px rgba(0, 77, 157, 0.5);
}

.card h3 {
    color: white;
    font-size: 0.9rem;
    margin: 0 0 5px 0;
}

.card p {
    color: #94a3b8;
    font-size: 0.7rem;
    margin: 0;
}

.card i {
    color: var(--geo-blue);
    font-size: 1.2rem;
    margin-bottom: 8px;
    display: block;
}

.card.active i {
    color: white;
}

/* MARKER STYLES */
.survey-marker {
    width: 30px;
    height: 30px;
    background-color: var(--geo-bronze);
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    animation: pulse 2s infinite;
}

/* PROJECT MARKERS */
.marker-hydro {
    color: #3b82f6;
    font-size: 24px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.marker-geo {
    color: #eab308;
    font-size: 24px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.marker-all {
    color: #ef4444;
    font-size: 24px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(211, 100, 31, 0.7);
    }

    70% {
        box-shadow: 0 0 0 25px rgba(211, 100, 31, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(211, 100, 31, 0);
    }
}

.maplibregl-popup-content {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid var(--geo-bronze);
    color: white;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
}

.maplibregl-popup-close-button {
    color: white;
    font-size: 16px;
    padding: 5px;
}

/* MOBILE RESPONSIVENESS */
.sidebar-toggle {
    display: flex;
    /* Always visible on both mobile and desktop */
    position: fixed;
    /* Fixed position relative to viewport */
    top: 20px;
    /* Align with sidebar header */
    left: 295px;
    /* Position just outside the 340px sidebar + 10px gap */
    z-index: 25;
    /* Below sidebar but above map */
    width: 40px;
    height: 40px;
    background: var(--geo-blue);
    border: none;
    border-radius: 4px;
    /* Square with rounded corners looks better at top */
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 4px 0 15px rgba(0, 77, 157, 0.4);
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: left 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    /* Smooth transition when sidebar moves */
    /* CRITICAL: Enables clicking inside pointer-events: none layer */
}

/* DESKTOP TOGGLE BEHAVIOR */
.sidebar.open {
    transform: translateX(-110%);
    /* Desktop: .open class HIDES the sidebar */
}

.sidebar.open+.sidebar-toggle {
    left: 20px;
    /* Toggle button moves to left edge */
    border-radius: 8px;
}

/* Sidebar transition - ensure global */
.sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
        left: 10px;
        /* Mobile: Start at left */
    }

    .sidebar {
        transform: translateX(-105%);
        /* Mobile: Default Hidden */
        width: 85%;
        max-width: 320px;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    /* Mobile: .open class SHOWS the sidebar */
    .sidebar.open {
        transform: translateX(0);
    }

    /* Move toggle button when sidebar opens */
    .sidebar.open+.sidebar-toggle {
        left: calc(80vw + 10px);
        /* Move with sidebar: 85% viewport width + 10px gap */
        max-width: 330px;
        /* But cap at max sidebar width + gap */
    }

    /* Adjust Cards for Mobile */
    .cards-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 10px;
        /* Space for scrollbar */
    }

    .card {
        min-width: 140px;
        padding: 1rem;
        flex-shrink: 0;
    }

    .maplibregl-ctrl-top-right {
        top: 70px;
        /* Push controls down so toggle button doesn't overlap */
    }

}