/* =========================================================
   Aurora Development Dashboard — Dual Theme Edition
   ========================================================= */

/* ── Light theme (default) ──────────────────────────── */
:root {
    --aurora-yellow: #FFD500;
    --aurora-red: #E30613;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);

    --bg-main: #F2F4F7;
    --glass: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.06);
    --text-primary: #1A1D23;
    --text-muted: rgba(0, 0, 0, 0.35);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --timeline-track-bg: rgba(0, 0, 0, 0.08);
    --timeline-fade: linear-gradient(to top, rgba(242, 244, 247, 0.92), transparent);
    --logo-filter: none;
    --logo-chip-bg: transparent;
    --logo-chip-border: transparent;
    --logo-chip-border-width: 0px;
    --logo-chip-radius: 0px;
    --logo-chip-padding-y: 0px;
    --logo-chip-padding-x: 0px;
    --logo-chip-shadow: none;
}

/* ── Dark theme ─────────────────────────────────────── */
:root[data-theme="dark"] {
    --bg-main: #0D1117;
    --glass: rgba(13, 17, 23, 0.72);
    --glass-border: rgba(255, 213, 0, 0.12);
    --text-primary: #FFFFFF;
    --text-muted: rgba(255, 255, 255, 0.4);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --timeline-track-bg: rgba(255, 255, 255, 0.08);
    --timeline-fade: linear-gradient(to top, rgba(13, 17, 23, 0.92), transparent);
    /* Keep logo readable on dark by adding a subtle light chip behind it */
    --logo-filter: brightness(1.05) contrast(1.05);
    --logo-chip-bg: rgba(255, 255, 255, 0.98);
    --logo-chip-border: rgba(255, 255, 255, 0.28);
    --logo-chip-border-width: 1px;
    --logo-chip-radius: 9px;
    --logo-chip-padding-y: 3px;
    --logo-chip-padding-x: 8px;
    --logo-chip-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    min-height: 100vh;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    cursor: none;
    transition: background 0.5s ease, color 0.5s ease;
}

/* ── Layout ─────────────────────────────────────────── */
#dashboard-container {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    height: 100vh;
    height: 100dvh;
}
#map { position: absolute; inset: 0; z-index: 1; }

.leaflet-container { background: var(--bg-main) !important; transition: background 0.5s ease; }
.leaflet-control-zoom, .leaflet-control-attribution { display: none !important; }

/* ── Logo badge ─────────────────────────────────────── */
.overlay-logo {
    position: absolute;
    top: calc(36px + var(--safe-top));
    left: calc(36px + var(--safe-left));
    z-index: 1000;
    background: var(--glass);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 12px 24px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow);
    transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}

.dashboard-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-img {
    height: 42px; width: auto;
    filter: var(--logo-filter);
    background: var(--logo-chip-bg);
    border: var(--logo-chip-border-width) solid var(--logo-chip-border);
    border-radius: var(--logo-chip-radius);
    padding: var(--logo-chip-padding-y) var(--logo-chip-padding-x);
    box-shadow: var(--logo-chip-shadow);
    transition: filter 0.4s ease, background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.dashboard-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--text-muted);
    transition: color 0.4s;
}

.dashboard-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--aurora-red);
    transition: color 0.4s;
}

.rnd-credit {
    position: absolute;
    bottom: calc(122px + var(--safe-bottom)); /* sits just above the timeline panel */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100; /* Above timeline (1000) */
    font-family: 'Montserrat', sans-serif;
    font-size: 0.60rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-muted);
    opacity: 0.78;
    white-space: nowrap;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 5px 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: color 0.4s;
}

/* ── Hero stats ─────────────────────────────────────── */
.overlay-stats {
    position: absolute;
    top: calc(36px + var(--safe-top));
    right: calc(36px + var(--safe-right));
    z-index: 1000;
    background: var(--glass);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    padding: 22px 44px;
    display: flex; align-items: center; gap: 32px;
    box-shadow: var(--shadow);
    transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}

.hero-stat {
    display: flex; flex-direction: column; align-items: center;
    min-width: 110px;
}

.hero-number {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -3px;
    background: linear-gradient(135deg, var(--aurora-red) 0%, var(--aurora-yellow) 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.3s ease;
}

.hero-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-top: 6px;
    transition: color 0.4s;
}

.hero-divider {
    width: 1px; height: 54px;
    background: linear-gradient(to bottom, transparent, var(--aurora-red), transparent);
    opacity: 0.15;
}

/* ── Timeline ───────────────────────────────────────── */
.timeline-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 110px; /* Increased height */
    z-index: 1000;
    background: var(--timeline-fade);
    display: flex; flex-direction: column;
    justify-content: flex-end;
    padding: 0 48px calc(24px + var(--safe-bottom)); /* Increased bottom padding */
    transition: background 0.4s;
}

/* Visual track */
.timeline-track {
    position: relative;
    width: 100%; height: 6px;
    background: var(--timeline-track-bg);
    border-radius: 3px;
    margin-bottom: 12px;
    overflow: visible;
    transition: background 0.4s;
}

.timeline-progress {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    background: linear-gradient(90deg, var(--aurora-red), var(--aurora-yellow));
    border-radius: 3px;
    transition: width 0.1s linear;
    box-shadow: 0 0 12px rgba(227, 6, 19, 0.35);
}

.timeline-thumb {
    position: absolute;
    top: 50%; transform: translate(-50%, -50%);
    width: 18px; height: 18px;
    background: #FFF;
    border: 4px solid var(--aurora-red);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(227, 6, 19, 0.3);
    transition: left 0.1s linear;
    z-index: 2;
}

/* Year labels */
.timeline-years {
    display: flex;
    justify-content: space-between;
    padding: 0;
    position: relative; z-index: 1002;
}

.year-tick {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    padding: 4px 10px;
    border-radius: 16px;
    background: transparent;
    cursor: default;
}

.year-tick.active {
    color: #fff;
    background: var(--aurora-red);
    transform: translateY(-8px) scale(1.15);
    font-weight: 900;
    box-shadow: 0 4px 14px rgba(227, 6, 19, 0.6);
    z-index: 10;
}

/* Hidden range input */
input[type="range"] {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 50px;
    opacity: 0; cursor: pointer;
    z-index: 1003;
}

/* ── Mini controls ──────────────────────────────────── */
.mini-controls {
    position: absolute;
    bottom: calc(100px + var(--safe-bottom));
    right: calc(36px + var(--safe-right));
    z-index: 1000;
    display: flex; gap: 10px;
}

.mini-btn {
    width: 36px; height: 36px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    transition: all 0.3s ease;
    opacity: 0.5;
    box-shadow: var(--shadow);
}

.mini-btn:hover {
    opacity: 1;
    background: var(--aurora-yellow);
    color: #000;
    transform: translateY(-2px);
}

/* ── Map markers ────────────────────────────────────── */
.marker-container {
    display: flex; justify-content: center; align-items: center;
}

.marker-pulse {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--aurora-red);
    border: 2px solid var(--aurora-yellow);
    box-shadow: 0 0 8px rgba(227, 6, 19, 0.3);
    animation: pulse-subtle 3s infinite ease-in-out;
}

@keyframes pulse-subtle {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.12); opacity: 1; box-shadow: 0 0 10px rgba(227, 6, 19, 0.45); }
}

/* ── Counter pop ────────────────────────────────────── */
.hero-number.pop {
    animation: number-pop 0.4s ease;
}

@keyframes number-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Tablet & Mobile
   ═══════════════════════════════════════════════════════ */

/* ── Tablet (≤ 900px) ──────────────────────────────── */
@media (max-width: 900px) {
    body { cursor: auto; } /* Restore cursor on touch */

    .overlay-logo {
        top: calc(16px + var(--safe-top));
        left: calc(16px + var(--safe-left));
        padding: 10px 16px;
        border-radius: 14px;
        gap: 10px;
    }

    .logo-img { height: 32px; }

    .dashboard-title,
    .dashboard-subtitle { font-size: 0.62rem; letter-spacing: 3px; }

    .overlay-stats {
        top: calc(16px + var(--safe-top));
        right: calc(16px + var(--safe-right));
        padding: 14px 20px;
        gap: 16px;
        border-radius: 16px;
    }

    .hero-stat { min-width: 70px; }

    .hero-number {
        font-size: 2.6rem;
        letter-spacing: -2px;
    }

    .hero-label { font-size: 0.65rem; letter-spacing: 2px; margin-top: 4px; }

    .hero-divider { height: 36px; }

    .timeline-bar {
        height: 90px;
        padding: 0 24px calc(18px + var(--safe-bottom));
    }

    .year-tick { font-size: 10px; padding: 3px 6px; }

    .mini-controls {
        bottom: calc(84px + var(--safe-bottom));
        right: calc(16px + var(--safe-right));
        gap: 8px;
    }

    .mini-btn { width: 32px; height: 32px; font-size: 13px; }

    .rnd-credit { bottom: calc(96px + var(--safe-bottom)); font-size: 0.55rem; letter-spacing: 2px; }
}

/* ── Mobile (≤ 600px) ──────────────────────────────── */
@media (max-width: 600px) {
    /* Stack logo + stats vertically, both top */
    .overlay-logo {
        top: calc(12px + var(--safe-top));
        left: calc(12px + var(--safe-left));
        padding: 8px 14px;
        gap: 8px;
        border-radius: 12px;
    }

    .logo-img { height: 26px; }

    .dashboard-title,
    .dashboard-subtitle { font-size: 0.55rem; letter-spacing: 2px; }

    /* Stats: centre top */
    .overlay-stats {
        top: auto;
        bottom: calc(166px + var(--safe-bottom));
        right: 50%;
        transform: translateX(50%);
        padding: 10px 18px;
        gap: 12px;
        border-radius: 14px;
    }

    .hero-stat { min-width: 56px; }

    .hero-number {
        font-size: 2rem;
        letter-spacing: -1px;
    }

    .hero-label { font-size: 0.58rem; letter-spacing: 1.5px; }

    .hero-divider { height: 30px; }

    /* Timeline */
    .timeline-bar {
        bottom: calc(56px + var(--safe-bottom));
        height: 80px;
        padding: 0 12px calc(14px + var(--safe-bottom));
    }

    /* Hide some year ticks to avoid crowding */
    .year-tick:nth-child(even) { display: none; }

    .year-tick { font-size: 9px; padding: 2px 4px; }

    .year-tick.active { display: block !important; }

    /* Mini controls: bottom-left (away from stats) */
    .mini-controls {
        top: calc(12px + var(--safe-top));
        right: calc(12px + var(--safe-right));
        bottom: auto; left: auto;
        gap: 6px;
    }

    .mini-btn { width: 30px; height: 30px; font-size: 12px; border-radius: 8px; }

    .rnd-credit {
        display: block;
        bottom: calc(146px + var(--safe-bottom));
        font-size: 0.5rem;
        letter-spacing: 1.7px;
        padding: 4px 8px;
        opacity: 0.88;
    }
}
