:root {
    --bg-color: #0a0e14;
    --bg-secondary: #0d1117;
    --bg-elevated: #151b23;
    --card-bg: #111723;
    --bg-glass: rgba(22, 27, 34, 0.7);
    --text-color: #e0e6ed;
    --text-muted: #7a828e;
    --accent-color: #58a6ff;
    --accent-secondary: #388bfd;
    --accent-green: #3fb950;
    --accent-orange: #d29922;
    --accent-violet: #44d4b0;
    --accent-red: #f85149;
    --accent-cyan: #39d2c0;
    --border-color: #1c2128;
    --border-subtle: rgba(255,255,255,0.06);
    --font-primary: 'Outfit', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(88, 166, 255, 0.06);
    --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

:root.light-mode {
    --bg-color: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-elevated: #ffffff;
    --card-bg: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --text-color: #24292f;
    --text-muted: #57606a;
    --accent-color: #0969da;
    --accent-secondary: #0366d6;
    --border-color: #d0d7de;
    --border-subtle: rgba(27, 31, 36, 0.15);
    --shadow: 0 4px 24px rgba(140, 149, 159, 0.2);
    --shadow-glow: 0 0 30px rgba(9, 105, 218, 0.1);
}

/* UTILITIES */
.hidden {
    display: none !important;
}

/* LANDING PAGE */
.landing-container {
    /* Full screen setup */
    min-height: 100vh;
    width: 100%;
    /* max-width: 100vw; Removed */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    /* Prevent scrollbars during animations */
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 1200px;
    /* Desktop width */
    width: 100%;
    padding: 0 40px;
    box-sizing: border-box;
    animation: heroFadeIn 1.5s ease-out;
}

.hero-content span.highlight {
    color: var(--accent-color);
}

.hero-title {
    font-size: 3.5rem;
    /* Fixed desktop size */
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -3px;
    line-height: 1;
    text-transform: uppercase;
    color: white;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-labels {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    padding: 4px 10px;
    border: 1px solid #333;
    color: #666;
    letter-spacing: 1px;
}



.hero-content h1 span {
    color: var(--accent-color);
}

.hero-subtitle {
    font-family: var(--font-primary);
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 50px;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.hero-stats-row {
    display: flex;
    justify-content: center;
    gap: 80px;
    margin-bottom: 70px;
}

.h-stat {
    display: flex;
    flex-direction: column;
}

.h-val {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.h-lab {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 8px;
}

.enter-btn {
    background: transparent;
    color: #fff;
    border: 1px solid #444;
    padding: 20px 50px;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 15px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.enter-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: #fff;
    transform: translate(-50%, -50%);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: -1;
}

.enter-btn:hover {
    color: #000;
    border-color: #fff;
    transform: scale(1.05);
}

.enter-btn:hover::before {
    width: 110%;
    height: 110%;
}

.dot-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(#222 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 1;
    opacity: 0.6;
}

/* LOGO STYLING */
.hero-logo {
    margin-bottom: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hero-logo img {
    width: 220px;
    /* Desktop logo size */
    height: auto;
    filter: none;
    mix-blend-mode: normal;
    display: block;
    /* If the logo has a WHITE BG, this will look like a white block.
       If it is transparent, it will be perfect.
       If user says "Gemini_...png" and it has NO BG, we are good.
       If it HAS BG, we need mix-blend-mode: multiply IF background is white
       BUT multiply on DARK background -> INVISIBLE.
       
       So assumes logo IS ALREADY TRANSPARENT or use `mix-blend-mode: lighten` + `invert`?
       Let's stick to simple first.
    */
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.header-logo {
    margin-right: 14px;
    /* No background on container */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    flex-shrink: 0;
}

.header-logo img {
    height: 100%;
    width: auto;
    object-fit: contain;
    /* Removed filter to show colorful logo */
    /* filter: brightness(0) invert(1); */
    mix-blend-mode: normal;
    border-radius: 6px;
    opacity: 1;
    /* Full opacity for colorful logo */
}


.logo-area {
    display: flex;
    align-items: center;
}

.header-text h1 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0;
    line-height: 1.2;
}

.header-text h1 span {
    color: var(--accent-color);
}

.header-text p {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background:
        radial-gradient(1200px 500px at 10% -15%, rgba(56, 139, 253, 0.18), transparent 70%),
        radial-gradient(900px 420px at 90% -20%, rgba(63, 185, 80, 0.14), transparent 72%),
        var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, rgba(13, 17, 23, 0.75) 0%, rgba(10, 14, 20, 0.95) 45%, rgba(10, 14, 20, 1) 100%);
    display: flex;
    flex-direction: column;
}

/* HEADER */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    min-height: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
}

.logo-area h1 {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.4px;
    line-height: 1.2;
    margin: 0;
}

.logo-area h1 span {
    color: var(--accent-color);
}

.logo-area p {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1px;
    line-height: 1.3;
}

.header-stats {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 4px 10px 5px;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.theme-toggle-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.4rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.theme-toggle-btn:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

/* MAIN LAYOUT */
main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: 330px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
}

.sidebar h3 {
    padding: 16px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}
.filter-group {
    padding: 12px 20px 8px;
    /* Removed bottom border for cleaner look */
}

.filter-group label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 12px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    padding: 6px 12px;
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    color: var(--text-color);
}

.filter-btn.active {
    background: rgba(88, 166, 255, 0.15);
    border-color: rgba(88, 166, 255, 0.4);
    color: var(--accent-color);
    font-weight: 600;
}

.flight-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flight-list-toolbar {
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.toggle-flight-list-btn {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-family: var(--font-primary);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.toggle-flight-list-btn:hover {
    color: #fff;
    text-decoration: underline;
}

/* Upload Section */
.upload-section {
    padding: 8px 16px;
}

.upload-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.15), rgba(56, 139, 253, 0.1));
    border: 1px solid rgba(88, 166, 255, 0.3);
    color: var(--accent-color);
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.25), rgba(56, 139, 253, 0.2));
    border-color: rgba(88, 166, 255, 0.5);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.15);
}

.drive-sync-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(63, 185, 176, 0.12), rgba(46, 160, 140, 0.08));
    border: 1px solid rgba(63, 185, 176, 0.35);
    color: var(--teal-accent, #3fb5b0);
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drive-sync-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(63, 185, 176, 0.22), rgba(46, 160, 140, 0.15));
    border-color: rgba(63, 185, 176, 0.55);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(63, 185, 176, 0.12);
}

.drive-sync-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sidebar.flights-collapsed .flight-list {
    display: none;
}

.sidebar.flights-collapsed .sidebar-footer {
    margin-top: 0;
}

/* FLIGHT CARD */
.flight-card {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.flight-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.flight-card.active {
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.08), rgba(0,0,0,0.2));
    border-color: rgba(88, 166, 255, 0.4);
    box-shadow: 0 4px 16px rgba(88, 166, 255, 0.1);
}

.flight-card h4 {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: #e6edf3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 28px;
}

.flight-meta {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.4);
    display: flex;
    justify-content: space-between;
}

/* Flight card mini stats */
.flight-mini-stats {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.mini-stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.62rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 4px;
}

.mini-icon {
    font-size: 0.58rem;
    color: var(--accent-color);
}

.flight-card.active .mini-stat {
    background: rgba(88, 166, 255, 0.1);
    border-color: rgba(88, 166, 255, 0.2);
    color: #c9d1d9;
}

.delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 5;
    opacity: 0.4;
}

.delete-btn:hover {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-red);
    opacity: 1;
}

.delete-btn svg {
    width: 14px;
    height: 14px;
}

.admin-mode .flight-card:hover .delete-btn {
    display: flex;
}

.admin-mode .delete-btn {
    display: flex;
}

/* SCROLLBARS */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(88, 166, 255, 0.4);
}

/* DETAILS PANEL */
.details-panel {
    flex: 1;
    padding: 16px 20px 18px 20px;
    margin-left: 0;
    overflow-y: auto;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
}

.details-panel.analysis-active {
    padding-top: 10px;
}

.empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    gap: 12px;
}

.empty-state svg {
    opacity: 0.15;
    margin-bottom: 8px;
}

.empty-state h2 {
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-color);
    font-size: 1.1rem;
}

.empty-state p {
    font-size: 0.82rem;
    max-width: 340px;
    text-align: center;
    line-height: 1.6;
}

.detail-header {
    margin-bottom: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-elevated));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-glow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.detail-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0;
    letter-spacing: -0.3px;
}

.badge {
    background: rgba(88, 166, 255, 0.12);
    color: var(--accent-color);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    margin-left: 10px;
    border: 1px solid rgba(88, 166, 255, 0.2);
    letter-spacing: 0.3px;
}

/* GRID STATS */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.35s var(--transition-smooth);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-color);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.stat-card:nth-child(1)::before { background: var(--accent-cyan); }
.stat-card:nth-child(2)::before { background: var(--accent-green); }
.stat-card:nth-child(3)::before { background: var(--accent-violet); }
.stat-card:nth-child(4)::before { background: var(--accent-orange); }
.stat-card:nth-child(5)::before { background: var(--accent-red); }

.stat-card:hover {
    border-color: rgba(255,255,255,0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .label {
    font-size: 0.62rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.stat-card .value {
    font-size: 1.6rem;
    font-weight: 600;
    color: #fff;
    font-family: var(--font-primary);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.stat-card:nth-child(1) .value { color: var(--accent-cyan); }
.stat-card:nth-child(2) .value { color: var(--accent-green); }
.stat-card:nth-child(3) .value { color: var(--accent-violet); }
.stat-card:nth-child(4) .value { color: var(--accent-orange); }
.stat-card:nth-child(5) .value { color: var(--accent-red); }

.stat-card .value .unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 3px;
}

.details-panel.analysis-active .detail-header {
    margin-bottom: 6px;
    padding: 6px 14px;
}

.details-panel.analysis-active .detail-header h2 {
    font-size: 1.05rem;
}

.details-panel.analysis-active .grid-stats {
    display: none;
}

.details-panel.analysis-active .stat-card {
    min-height: 0;
    padding: 10px 13px;
}

.details-panel.analysis-active .stat-card .label {
    margin-bottom: 4px;
    font-size: 0.56rem;
}

.details-panel.analysis-active .stat-card .value {
    font-size: 1.08rem;
}

/* MEDIA */
.media-section {
    margin-bottom: 16px;
}

.media-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.media-section h3::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.media-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.35s var(--transition-smooth);
}

.media-item:hover {
    border-color: rgba(88, 166, 255, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.media-item img,
.media-item video {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: all 0.3s ease;
}

.media-item p {
    padding: 12px 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.zoomable {
    cursor: zoom-in;
}

.zoomable:hover {
    opacity: 0.9;
}

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex !important;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius);
    box-shadow: 0 0 40px rgba(187, 134, 252, 0.2);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 2.5rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.close-btn:hover {
    opacity: 1;
    color: var(--accent-color);
}

/* Manage Data Button - Sidebar Footer Style */
.sidebar-footer {
    padding: 10px 14px 12px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.manage-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    min-height: 36px;
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s var(--transition-smooth);
}

.manage-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-color);
    border-color: rgba(255,255,255,0.12);
}

.manage-btn .icon {
    font-size: 0.58rem;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 2px 6px;
    letter-spacing: 0.1em;
    opacity: 0.85;
}

/* Admin Modal Styles - Nothing OS Style */
.admin-modal {
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.admin-modal.show {
    display: flex !important;
}

.modal-card {
    background: linear-gradient(180deg, #0b1018 0%, #0a0d13 100%);
    border: 1px solid var(--border-color);
    padding: 25px 30px;
    max-width: 550px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    border-radius: 12px;
}

.modal-header {
    border-bottom: 1px dashed var(--border-color);
    margin-bottom: 20px;
    padding-bottom: 15px;
}

.modal-header h2 {
    margin: 0 0 5px 0;
    font-size: 1.5em;
    font-family: var(--font-mono);
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: -1px;
}

.modal-header p {
    color: #666;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.7em;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.action-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
}

.action-card:hover {
    border-color: rgba(88, 166, 255, 0.45);
    background: rgba(88, 166, 255, 0.05);
}

.action-icon {
    font-size: 0.6rem;
    font-family: var(--font-mono);
    letter-spacing: 0.12em;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 4px 8px;
    margin-bottom: 15px;
    opacity: 0.8;
}

.action-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.action-card p {
    margin: 0;
    color: #666;
    font-size: 0.8em;
    line-height: 1.4;
    flex-grow: 1;
}

.action-btn {
    background: transparent;
    color: #fff;
    border: 1px solid #fff;
    padding: 10px 24px;
    border-radius: 30px;
    font-family: var(--font-mono);
    font-size: 0.8em;
    text-transform: uppercase;
    font-weight: bold;
    cursor: pointer;
    margin-top: auto;
    transition: all 0.2s;
    align-self: flex-start;
}

.action-card:hover .action-btn {
    background: #fff;
    color: #000;
}

.highlight {
    background: #000;
    border: 1px dashed #444;
    cursor: default;
}

.highlight:hover {
    border-color: #666;
    background: #000;
}

.code-block {
    background: #111;
    padding: 12px 16px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: #0f0;
    border: 1px solid #333;
    margin: 15px 0;
    font-size: 0.9em;
    user-select: all;
    width: 100%;
    box-sizing: border-box;
}

.small-text {
    font-size: 0.7em !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555 !important;
}

/* Hidden Flights List */
.hidden-list {
    margin-top: 20px;
    border: 1px solid #222;
    max-height: 200px;
    overflow-y: auto;
}

.hidden-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #222;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.hidden-item:last-child {
    border-bottom: none;
}

.restore-btn {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    padding: 4px 10px;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 6px;
    font-family: var(--font-mono);
}

.restore-btn:hover {
    background: #fff;
    color: #000;
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
    body {
        height: auto;
        overflow-y: auto;
        /* Enable body scroll */
        overflow-x: hidden;
    }

    .app-container {
        height: auto;
        min-height: 100vh;
        overflow: visible;
        /* Let body handle scrolling */
    }

    /* Stack Header */
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }

    .header-stats {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    /* Stack Main Layout */
    main {
        flex-direction: column;
        overflow: visible;
        /* Let page scroll */
    }

    /* Sidebar adjustments */
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 400px;
        /* Limit height so it doesn't dominate */
    }

    .flight-list {
        max-height: 250px;
        /* Scrollable list inside stacked sidebar */
    }

    .sidebar-footer {
        padding: 10px;
    }

    /* Detail View adjustments */
    .details-panel {
        padding: 15px;
        margin-left: 0;
        overflow: visible;
    }

    .detail-header {
        padding: 15px;
    }

    .detail-header h2 {
        font-size: 1.2rem;
    }

    /* Stats Grid to 2 columns on mobile */
    .grid-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* Media Grid */
    .media-grid {
        grid-template-columns: 1fr;
        /* 1 column for media */
    }

    .media-item img,
    .media-item video {
        height: 200px;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .manage-btn {
        margin-right: 0;
    }

    .manage-btn span {
        display: inline;
        /* Show icon again since we have space in footer */
    }
}

/* Login Overlay */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-card {
    background-color: var(--card-bg);
    padding: 3rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    max-width: 400px;
    width: 90%;
}

.login-card h1 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

.login-card h1 span {
    font-weight: 300;
    color: var(--accent-color);
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: white;
    color: #333;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 2rem;
    width: 100%;
    transition: background-color 0.2s;
}

.login-btn:hover {
    background-color: #f1f1f1;
}

.login-btn img {
    width: 20px;
    height: 20px;
}

.error-text {
    color: #ff6b6b;
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.2em;
}

/* Visibility classes */
.app-container {
    transition: opacity 0.3s ease;
}

.app-container.hidden {
    display: none;
}

.login-container.hidden {
    display: none;
}

/* Logout Button */
.logout-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    margin-bottom: 0;
    width: 100%;
    text-align: left;
    transition: all 0.25s ease;
}

.logout-btn:hover {
    border-color: rgba(248, 81, 73, 0.4);
    color: var(--accent-red);
    background: rgba(248, 81, 73, 0.05);
}

/* --- Plotting & Analysis UI --- */
.tab-viewport {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}

.tab-pane {
    display: none;
    padding: 1.2rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    flex-direction: column;
}

.tab-pane.active {
    display: flex;
}

.details-panel.analysis-active .tab-pane {
    padding: 0;
}

/* More room for the plot: tighter padding on Analysis only (Media/Map unchanged) */
#analysis-content.tab-pane {
    padding: 0.55rem 0.7rem 0.7rem;
}

.details-panel.analysis-active #analysis-content.tab-pane {
    padding: 0.55rem 0.7rem 0.7rem;
}

.analysis-controls {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-group label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

#msg-type-select {
    background: var(--bg-elevated);
    color: var(--text-color);
    border: 1px solid var(--border-subtle);
    padding: 0.6rem 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    outline: none;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s;
}

#msg-type-select:focus {
    border-color: var(--accent-color);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    font-family: var(--font-mono);
    transition: all 0.3s var(--transition-smooth);
}

.checkbox-item:hover {
    background: rgba(88, 166, 255, 0.06);
    border-color: rgba(88, 166, 255, 0.25);
}

.checkbox-item input {
    accent-color: var(--accent-color);
}

/* Multi-Select Dropdown */
.multi-select-dropdown {
    position: relative;
    min-width: 140px;
}

.dropdown-trigger {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.28rem 0.6rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    transition: all 0.2s;
}

.dropdown-trigger:hover {
    border-color: rgba(255,255,255,0.4);
}

.dropdown-trigger::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    margin-left: 0.6rem;
    transition: transform 0.2s ease;
}

.multi-select-dropdown.open .dropdown-trigger::after {
    transform: rotate(180deg);
}

.dropdown-trigger.has-selection {
    background-color: rgba(88, 166, 255, 0.08);
    border-color: rgba(88, 166, 255, 0.4);
    color: #88c0d0;
}

.dropdown-popover {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 260px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    z-index: 1000;
    display: none;
    flex-direction: column;
    padding: 0.5rem;
}

.multi-select-dropdown.open .dropdown-popover {
    display: flex;
}

.single-select-popover {
    width: auto;
    min-width: 100%;
    padding: 0.25rem 0;
}

.single-select-popover .select-option {
    padding: 0.4rem 0.8rem;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.15s;
    white-space: nowrap;
}

.single-select-popover .select-option:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.single-select-popover .select-option.selected {
    background-color: rgba(88, 166, 255, 0.15);
    color: #88c0d0;
}

.graph-panel-header .graph-fields-list {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.25rem;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    margin-bottom: 0.5rem;
    padding-right: 0.25rem;
}

.graph-panel-header .graph-fields-list::-webkit-scrollbar {
    width: 6px;
}

.graph-panel-header .graph-fields-list::-webkit-scrollbar-track {
    background: transparent;
}

.graph-panel-header .graph-fields-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.graph-panel-header .graph-fields-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.graph-panel-header .graph-fields-list .checkbox-item {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 0.25rem 0.56rem;
    font-size: 0.66rem;
}

.graph-panel-header .graph-fields-list .checkbox-item input {
    width: 13px;
    height: 13px;
}

/* Multi-Graph Panel System */
.analysis-global-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.add-graph-btn {
    background: transparent;
    border: 1px dashed var(--accent-color);
    color: var(--accent-color);
    padding: 8px 18px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.add-graph-btn:hover:not(:disabled) {
    background: rgba(88, 166, 255, 0.1);
    border-style: solid;
}

.add-graph-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--text-muted);
    color: var(--text-muted);
}

#graph-panels-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.graph-plot-stack {
    position: relative;
    width: 100%;
    min-width: 0;
}

.graph-panel {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.graph-panel-header {
    padding: 0.38rem 0.55rem 0.44rem;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
}

.graph-panel-header .analysis-controls {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    gap: 0.42rem 0.7rem;
    align-items: center;
}

.graph-panel-header select {
    background: var(--bg-elevated);
    color: var(--text-color);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.3rem 0.52rem;
    min-height: 30px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    outline: none;
}

.graph-panel-header select:focus {
    border-color: var(--accent-color);
}

.graph-panel-header .graph-scale-mode-select {
    width: auto;
    max-width: 6.25rem;
    min-width: 4.25rem;
    flex: 0 0 auto;
}

.graph-panel-header .event-overlay-select {
    width: auto;
    max-width: 9.4rem;
    min-width: 6.8rem;
    flex: 0 0 auto;
}

.graph-panel-header .data-fields-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
    min-width: 0;
}

.graph-panel-header .graph-field-dropdown {
    position: relative;
    flex: 1;
    min-width: 0;
    max-width: 340px;
}

.graph-panel-header .graph-field-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: var(--bg-elevated);
    color: var(--text-color);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.38rem 0.62rem;
    min-height: 34px;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    outline: none;
    cursor: pointer;
    text-align: left;
}

.graph-panel-header .graph-field-dropdown-trigger::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-muted);
    flex-shrink: 0;
}

.graph-panel-header .graph-field-dropdown-trigger:focus {
    border-color: var(--accent-color);
}

.graph-panel-header .graph-field-dropdown-summary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.graph-panel-header .graph-field-dropdown-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: min(280px, 50vh);
    overflow-y: auto;
    z-index: 100;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    padding: 0.35rem 0;
}

.field-dropdown-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.field-dropdown-checkbox-list .field-dd-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.65rem;
    margin: 0 0.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--text-color);
    transition: background 0.15s ease;
}

.field-dropdown-checkbox-list .field-dd-row:hover {
    background: rgba(88, 166, 255, 0.08);
}

.field-dropdown-checkbox-list .field-dd-row input {
    accent-color: var(--accent-color);
    flex-shrink: 0;
}

.graph-panel-header .data-fields-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.graph-panel-header .data-fields-row .selection-actions {
    flex: 0 0 auto;
    margin-left: 0;
    margin-top: 0;
}

.selection-actions {
    margin-top: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-left: 0.35rem;
}

.selection-clear-btn {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    padding: 0.3rem 0.62rem;
    min-height: 30px;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    cursor: pointer;
}

.selection-clear-btn:hover:not(:disabled) {
    border-color: rgba(248, 81, 73, 0.6);
    color: #ff8d8d;
}

.selection-clear-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Compact header row: labels beside controls on wide screens (all controls stay visible) */
@media (min-width: 720px) {
    .graph-panel-header .analysis-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 0.65rem 1.6rem;
        align-items: center;
    }
    .graph-panel-header .control-group--preset {
        min-width: 0;
    }
    .graph-panel-header .control-group--preset select {
        min-width: 0;
        width: 100%;
    }
    .graph-panel-header .control-group {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.35rem 0.4rem;
        min-width: 0;
        flex: 0 0 auto;
    }
    .graph-panel-header .control-group label {
        flex: 0 0 auto;
        margin: 0;
    }
    .graph-panel-header .control-group--preset label {
        min-width: auto;
    }
    .graph-panel-header .control-group--scale label {
        min-width: auto;
    }
    .graph-panel-header .control-group--events label {
        min-width: auto;
    }
    .graph-panel-header .control-group--fields > label {
        align-self: center;
        padding-top: 0;
    }
    .graph-panel-header .control-group:has(.graph-fields-list) {
        display: flex;
        flex: 1 1 300px;
        align-items: center;
        gap: 0.45rem;
    }
    .graph-panel-header .control-group:has(.graph-fields-list) > label {
        min-width: auto;
    }
    .graph-panel-header .data-fields-row .graph-field-dropdown {
        max-width: none;
    }
    .graph-panel-header .control-group--actions {
        margin-left: auto;
        padding-top: 0;
    }
}

.graph-panel-header .control-group--actions {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
}

.remove-graph-btn {
    background: transparent;
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-graph-btn:hover {
    background: rgba(248, 81, 73, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.graph-plot-wrap {
    position: relative;
    width: 100%;
}

.graph-plot-area {
    position: relative;
    width: 100%;
    /* Grow with viewport; leave room for app chrome + graph controls + range slider */
    height: clamp(520px, calc(100vh - 205px), 980px);
    min-height: 420px;
    background: rgba(0, 0, 0, 0.2);
}

.plot-timeline-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 12;
    overflow: hidden;
}

.plot-mode-region {
    position: absolute;
    top: 0;
    bottom: 0;
    opacity: 0.08;
}

.plot-mode-line,
.plot-event-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
}

.plot-mode-line {
    border-left: 1px dotted currentColor;
    opacity: 0.7;
}

.plot-event-line {
    border-left: 1px dashed rgba(248, 250, 252, 0.75);
    opacity: 0.85;
}

.plot-mode-label,
.plot-event-label {
    position: absolute;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    color: #dbeafe;
    background: rgba(2, 6, 23, 0.68);
    border: 1px solid rgba(88, 166, 255, 0.28);
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.plot-mode-label {
    top: 8px;
    transform: translateX(-50%);
}

.plot-event-label {
    bottom: 8px;
    transform: translateX(-50%) rotate(-90deg);
    transform-origin: center;
}

.analysis-empty-hint {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-align: center;
    padding: 0 1rem;
}

.analysis-placeholder {
    text-align: center;
    padding: 5rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* Tabs Refinement */
.tab-controls {
    display: flex;
    gap: 0;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.55rem 1.1rem;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border-bottom: 2px solid transparent;
    transition: all 0.3s var(--transition-smooth);
    margin-bottom: -1px;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-color);
    background: rgba(255,255,255,0.02);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
    background: rgba(88, 166, 255, 0.04);
}

/* SUMMARY INFO */
.summary-info {
    display: flex;
    gap: 2rem;
    margin-bottom: 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.muted {
    color: var(--text-muted);
}

.unit {
    font-size: 0.7em;
    color: var(--text-muted);
    margin-left: 2px;
}

/* MAP VIEW */
#map-content, #map-3d-content {
    /* Display is handled by .tab-pane.active */
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#map-content.active, #map-3d-content.active {
    display: flex;
}

#map-view, #map-3d-view {
    flex: 1;
    width: 100%;
    background: #111;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.map-replay-panel {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 700;
    padding: 12px 14px;
    border: 1px solid rgba(88, 166, 255, 0.24);
    border-radius: 14px;
    background: rgba(5, 10, 18, 0.78);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
    color: var(--text-color);
    font-family: var(--font-mono);
}

.map-replay-panel__top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.map-replay-btn {
    border: 1px solid rgba(88, 166, 255, 0.55);
    border-radius: 10px;
    background: rgba(88, 166, 255, 0.18);
    color: #dbeafe;
    min-width: 76px;
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-weight: 700;
    cursor: pointer;
}

.map-replay-btn:hover {
    background: rgba(88, 166, 255, 0.28);
}

.map-replay-follow,
.map-replay-speed {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 0.74rem;
}

.map-replay-follow input {
    accent-color: var(--accent-color);
}

.map-replay-speed select {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-elevated);
    color: var(--text-color);
    padding: 5px 8px;
    font-family: var(--font-mono);
}

.map-replay-range {
    width: 100%;
    accent-color: #ffb000;
}

.map-replay-readout {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
    color: #cbd5e1;
    font-size: 0.72rem;
}

.map-drone-icon {
    background: transparent;
    border: none;
}

.map-drone {
    position: relative;
    width: 42px;
    height: 42px;
    transform: rotate(var(--yaw));
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.52));
}

.map-drone::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 18px;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #0b1120;
    border: 2px solid #e5e7eb;
    z-index: 4;
}

.map-drone__arm {
    position: absolute;
    left: 6px;
    top: 19px;
    width: 30px;
    height: 4px;
    border-radius: 999px;
    background: #0b1120;
    z-index: 2;
}

.map-drone__arm--y {
    transform: rotate(90deg);
}

.map-drone__rotor {
    position: absolute;
    width: 13px;
    height: 13px;
    border-radius: 999px;
    border: 2px solid rgba(219, 234, 254, 0.92);
    background: rgba(88, 166, 255, 0.5);
    z-index: 3;
}

.map-drone__rotor--front {
    left: 14px;
    top: 0;
    border-color: rgba(34, 197, 94, 0.95);
    background: rgba(34, 197, 94, 0.45);
}

.map-drone__rotor--right {
    right: 0;
    top: 14px;
}

.map-drone__rotor--back {
    left: 14px;
    bottom: 0;
}

.map-drone__rotor--left {
    left: 0;
    top: 14px;
}

.map-drone__nose {
    position: absolute;
    left: 19px;
    top: -9px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 10px solid #22c55e;
    z-index: 5;
}

@media (max-width: 720px) {
    .map-replay-panel {
        left: 8px;
        right: 8px;
        bottom: 8px;
    }
    .map-replay-readout {
        gap: 8px;
        font-size: 0.65rem;
    }
}

/* Dark mode overrides for Leaflet controls */
.leaflet-bar a {
    background-color: #1a1a1a !important;
    border-bottom: 1px solid #333 !important;
    color: #eee !important;
}

.leaflet-bar a:hover {
    background-color: #333 !important;
}

.leaflet-container {
    font-family: var(--font-mono) !important;
    background: #000 !important;
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 1024px) {
    .landing-page {
        overflow-x: hidden;
        width: 100vw;
    }

    .hero-content {
        padding: 20px;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .hero-logo img {
        width: 180px !important;
        max-width: 80vw;
    }

    .hero-title {
        /* Clamp: Min 1.8rem, Preferred 10vw, Max 3rem */
        font-size: clamp(1.8rem, 10vw, 3rem) !important;
        line-height: 1.1;
        letter-spacing: -2px;
        word-wrap: break-word;
        word-break: break-word;
    }

    .hero-subtitle {
        font-size: 0.85rem;
        padding: 0 10px;
        line-height: 1.5;
    }

    .logo-area {
        flex-direction: column;
        gap: 15px;
    }

    .status-labels {
        display: flex;
        flex-direction: column !important;
        gap: 10px;
        align-items: center;
        width: 100%;
    }

    .status-label {
        font-size: 0.8rem;
        padding: 8px 16px;
        width: auto;
        min-width: 150px;
        justify-content: center;
    }

    .stats-container {
        flex-direction: row;
        gap: 15px;
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
    }

    .stat-item {
        min-width: 120px;
    }

    .stat-number {
        font-size: 2rem;
    }

    .enter-btn {
        width: 90%;
        max-width: 320px;
        padding: 15px 20px;
        font-size: 1rem;
        justify-content: space-between;
        margin-top: 20px;
    }
}

/* IMAGE MODAL */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: 0.3s;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--accent-color);
    text-decoration: none;
    cursor: pointer;
}

/* THEME TOGGLE BUTTON */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font-primary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle-btn:hover {
    color: var(--text-color);
    border-color: var(--text-muted);
    background: var(--bg-elevated);
}

/* MOBILE FIXES (Tablets & Phones) */
@media (max-width: 768px) {

    /* Header Fixes */
    .main-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
        /* Tighter gap */
        padding: 10px 15px;
    }

    .logo-area {
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        /* Reduced gap */
    }

    .header-logo {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 0;
        padding: 0;
    }

    .header-logo img {
        width: 135px;
        /* Exact size requested */
        max-width: 90%;
        height: auto;
        display: block;
    }

    .header-text {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .header-text h1 {
        font-size: 1.6rem;
        letter-spacing: -1px;
        margin-bottom: 0;
        line-height: 1.2;
        text-align: center;
    }

    .header-text p {
        font-size: 0.75rem;
        color: var(--text-muted);
        margin-top: 4px;
        text-align: center;
    }

    .header-stats {
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 15px;
        /* Tighter stats alignment */
        padding-top: 10px;
        border-top: 1px solid var(--border-color);
        margin-top: 8px;
    }

    .stat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        min-width: 80px;
    }

    .stat-value {
        font-size: 1.2rem;
        color: var(--accent-color);
        font-weight: 700;
        line-height: 1.1;
    }

    .stat-label {
        font-size: 0.6rem;
        letter-spacing: 0.5px;
        color: var(--text-muted);
        margin-top: 2px;
    }

    /* Sidebar/Flight List Fixes */
    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px;
        max-height: none;
        overflow-y: visible;
    }

    .flight-card {
        padding: 10px 14px;
        margin-bottom: 8px;
        border: 1px solid var(--border-color);
        background: rgba(255, 255, 255, 0.02);
    }

    .flight-card h4 {
        font-size: 0.95rem !important;
        margin-bottom: 4px;
        white-space: nowrap;
        /* No wrapping */
        overflow: hidden;
        /* Hide overflow */
        text-overflow: ellipsis;
        /* Add ... */
        max-width: 100%;
        display: block;
        padding-right: 25px;
        /* Space for delete btn */
    }

    .flight-meta {
        font-size: 0.75rem;
        opacity: 0.9;
        display: flex;
        justify-content: space-between;
    }

    .filter-options {
        display: flex;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 5px;
        gap: 8px;
        justify-content: flex-start;
    }

    .filter-options::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        padding: 8px 14px;
        font-size: 0.75rem;
        flex: 0 0 auto;
        white-space: nowrap;
    }

    /* Analysis Controls Fix */
    .analysis-controls {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .upload-section {
        padding: 8px 10px;
    }

    .upload-btn {
        padding: 8px 10px;
        font-size: 0.7rem;
    }
}

.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: var(--bg-color);
    background: var(--bg-color);
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.fullscreen-mode .graph-plot-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.fullscreen-mode #plot-area,
.fullscreen-mode .graph-plot-area {
    height: 100% !important;
    flex: 1;
    min-height: 0;
}

.fullscreen-mode #graph-panels-container,
.fullscreen-mode #analysis-ui {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
}

.fullscreen-mode .graph-panel {
    flex: 1 0 auto;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 20px;
}

#plot-area {
    width: 100%;
    height: 550px;
    background: rgba(0, 0, 0, 0.2);
}

/* ===== BIN Upload Section ===== */
.upload-section {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.upload-btn {
    width: 100%;
    background: rgba(88, 166, 255, 0.04);
    border: 1px dashed rgba(88, 166, 255, 0.25);
    color: var(--accent-color);
    padding: 12px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.35s var(--transition-smooth);
}

.upload-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent-color);
    border-style: solid;
    color: #fff;
    box-shadow: 0 0 16px rgba(88, 166, 255, 0.1);
}

.upload-btn svg {
    flex-shrink: 0;
    stroke: currentColor;
}

/* ===== Parse Progress Overlay ===== */
.parse-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.parse-overlay.hidden {
    display: none;
}

.parse-card {
    background: #111;
    border: 1px solid #333;
    padding: 40px 50px;
    text-align: center;
    max-width: 420px;
    width: 90%;
}

.parse-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 20px;
    border: 3px solid #333;
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.parse-card h3 {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 8px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.parse-card p {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 20px;
    font-family: var(--font-mono);
}

.parse-bar-track {
    width: 100%;
    height: 4px;
    background: #222;
    border-radius: 2px;
    overflow: hidden;
}

.parse-bar-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 2px;
    transition: width 0.15s ease;
}

.upload-name-card {
    text-align: left;
}

.upload-name-card h3 {
    white-space: normal;
    text-align: center;
    margin-bottom: 12px;
}

.upload-name-hint {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 12px;
    word-break: break-all;
    text-align: center;
}

.upload-name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    margin-bottom: 20px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #fff;
    background: #0d0d0d;
    border: 1px solid #444;
    border-radius: 6px;
}

.upload-name-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.upload-name-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.upload-name-btn {
    padding: 8px 16px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #444;
    background: #1a1a1a;
    color: #ccc;
}

.upload-name-btn.primary {
    background: var(--accent-color);
    color: #0a0a0a;
    border-color: transparent;
    font-weight: 600;
}

.upload-name-btn.secondary:hover {
    border-color: #666;
    color: #fff;
}

.upload-name-btn.primary:hover {
    filter: brightness(1.08);
}

/* ===== Drag-and-Drop Overlay ===== */
.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(13, 17, 23, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.drop-overlay.hidden {
    display: none;
}

.drop-content {
    text-align: center;
    color: var(--accent-color);
    animation: dropPulse 1.5s ease-in-out infinite;
}

.drop-content svg {
    margin-bottom: 20px;
    opacity: 0.8;
}

.drop-content h2 {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 8px;
    color: #fff;
}

.drop-content p {
    font-size: 0.8rem;
    color: #666;
    font-family: var(--font-mono);
}

@keyframes dropPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.03); }
}

/* Uploaded flight badge */
.uploaded-badge {
    display: inline-block;
    font-size: 0.6rem;
    padding: 2px 6px;
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-color);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
}

/* Saved flight badge */
.saved-badge {
    display: inline-block;
    font-size: 0.6rem;
    padding: 2px 6px;
    background: rgba(118, 255, 3, 0.12);
    color: #76ff03;
    border: 1px solid rgba(118, 255, 3, 0.3);
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
}

/* Save to Dashboard button (detail header) */
.save-flight-btn {
    background: transparent;
    border: 1px solid rgba(118, 255, 3, 0.4);
    color: #76ff03;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    margin-left: auto;
}

.save-flight-btn:hover {
    background: rgba(118, 255, 3, 0.1);
    border-color: #76ff03;
    color: #fff;
}

.save-flight-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.save-flight-btn svg {
    flex-shrink: 0;
    stroke: currentColor;
}

.saved-indicator {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #76ff03;
    margin-left: auto;
    letter-spacing: 0.5px;
}

/* Floating Min / Max / Mean stats (Mission Planner–style) */
.stats-floating-legend {
    position: absolute;
    top: 10px;
    right: 52px;
    left: auto;
    bottom: auto;
    z-index: 30;
    max-width: min(96%, 560px);
    padding: 8px 10px;
    border-radius: var(--radius, 6px);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.35;
    cursor: grab;
    pointer-events: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    user-select: none;
}

.stats-floating-legend:active {
    cursor: grabbing;
}

.stats-floating-legend--light {
    background: #fff;
    border: 1px solid #2d2d2d;
    color: #1a1a1a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.stats-floating-legend--dark {
    background: rgba(22, 22, 26, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #c9d1d9;
}

.stats-floating-legend__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin-bottom: 6px;
}

.stats-floating-legend__row:last-child {
    margin-bottom: 0;
}

.stats-floating-legend__swatch {
    width: 18px;
    height: 3px;
    border-radius: 1px;
    flex-shrink: 0;
}

.stats-floating-legend__label {
    font-weight: 500;
    margin-right: 2px;
}

.stats-floating-legend__sep {
    opacity: 0.55;
    margin: 0 2px;
}

.stats-floating-legend__stats {
    opacity: 0.95;
    letter-spacing: 0.01em;
}

/* Custom Draggable Legend */
.custom-draggable-legend {
    position: absolute;
    top: auto;
    left: auto;
    right: 14px;
    bottom: 56px;
    background: rgba(20, 20, 20, 0.85);
    border: 1px solid var(--border-subtle);
    padding: 8px 12px;
    border-radius: var(--radius);
    z-index: 100;
    cursor: grab;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-color);
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    min-width: 250px;
}

.custom-draggable-legend:active {
    cursor: grabbing;
}

.custom-draggable-legend .legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.custom-draggable-legend .legend-item:last-child {
    margin-bottom: 0;
}

.custom-draggable-legend .legend-color {
    width: 14px;
    height: 2px;
    display: inline-block;
    margin-right: 8px;
    flex-shrink: 0;
}

.custom-draggable-legend .legend-text {
    white-space: nowrap;
}

/* Light Theme overrides for legend */
[data-theme="light"] .custom-draggable-legend {
    background: rgba(255, 255, 255, 0.85);
    color: #333;
}

/* ===== Light Mode Specific Overrides ===== */
.light-mode .graph-panel,
.light-mode .flight-card {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.light-mode .graph-plot-area,
.light-mode #plot-area {
    background: #f6f8fa;
}

.light-mode .cesium-viewer-bottom {
    display: none !important;
}

.light-mode select[data-role="speed"] option {
    background: #fff;
    color: #000;
}
