/* ========================================
   Live Flight Tracker - Aviation Dark Theme
   ======================================== */

:root {
    /* Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-panel: rgba(22, 27, 34, 0.85);
    --accent-primary: #00d4ff;
    --accent-secondary: #0ea5e9;
    --accent-glow: rgba(0, 212, 255, 0.3);
    --warning: #f59e0b;
    --success: #22c55e;
    --danger: #ef4444;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --border-color: rgba(255, 255, 255, 0.1);

    /* Typography */
    --font-display: 'Roboto Mono', monospace;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --panel-padding: 16px;
    --panel-radius: 12px;
    --header-height: 56px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ========================================
   Header
   ======================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-primary);
    text-shadow: 0 0 20px var(--accent-glow);
}

.event-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.utc-time {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-dot.disconnected {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

.status-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   Map
   ======================================== */

#map {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* Remove Leaflet default styling */
.leaflet-container {
    background: var(--bg-primary);
    font-family: var(--font-body);
}

/* ========================================
   Panels (Glassmorphism)
   ======================================== */

.panel {
    position: fixed;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--panel-radius);
    padding: var(--panel-padding);
    z-index: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.panel-header {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

/* Route Panel */
.route-panel {
    top: calc(var(--header-height) + 20px);
    left: 20px;
    min-width: 200px;
}

.route-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.airport-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.airport-icao {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.route-progress {
    padding: 12px 0;
}

.progress-track {
    position: relative;
    width: 100%;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
    transition: width 0.5s ease;
}

.progress-plane {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: var(--accent-primary);
    transition: left 0.5s ease;
    text-shadow: 0 0 8px var(--accent-glow);
}

/* Altitude Panel */
.altitude-panel {
    top: calc(var(--header-height) + 20px);
    right: 20px;
    min-width: 160px;
    text-align: center;
}

.altitude-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.altitude-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.altitude-unit {
    font-size: 14px;
    color: var(--text-secondary);
}

.vertical-speed {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

.vs-arrow {
    font-size: 16px;
    font-weight: 700;
}

.vs-arrow.climbing {
    color: var(--success);
}

.vs-arrow.descending {
    color: var(--warning);
}

.vs-arrow.level {
    color: var(--text-secondary);
}

.vs-value {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 500;
}

.vs-unit {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Telemetry Bar */
.telemetry-bar {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 32px;
}

.telemetry-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.telemetry-label {
    font-size: 10px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.telemetry-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.telemetry-value-row {
    display: flex;
    align-items: baseline;
    gap: 0;
}

.telemetry-unit {
    font-size: 18px;
    color: var(--text-secondary);
}

.telemetry-degree {
    position: relative;
    top: -8px;
}

.telemetry-divider {
    width: 1px;
    height: 40px;
    background: var(--border-color);
}

/* Controls Panel */
.controls-panel {
    bottom: 20px;
    right: 20px;
    padding: 12px 16px;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-control input {
    appearance: none;
    width: 40px;
    height: 22px;
    background: var(--text-muted);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-control input::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-control input:checked {
    background: var(--accent-primary);
}

.toggle-control input:checked::before {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========================================
   No Data Overlay
   ======================================== */

.no-data-overlay {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 17, 23, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
    transition: opacity 0.5s ease;
}

.no-data-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.no-data-content {
    text-align: center;
}

.no-data-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    color: var(--accent-primary);
    animation: float 3s ease-in-out infinite;
}

.no-data-icon svg {
    width: 100%;
    height: 100%;
}

.no-data-text {
    font-size: 18px;
    color: var(--text-secondary);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ========================================
   Aircraft Marker
   ======================================== */

.aircraft-marker {
    width: 48px;
    height: 48px;
    transition: transform 0.3s ease;
}

.aircraft-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    :root {
        --panel-padding: 12px;
        --header-height: 48px;
    }

    .header {
        padding: 0 12px;
    }

    .logo {
        font-size: 20px;
    }

    .event-name {
        display: none;
    }

    .utc-time {
        font-size: 14px;
    }

    .route-panel {
        left: 10px;
        min-width: 140px;
    }

    .airport-icao {
        font-size: 22px;
    }

    .altitude-panel {
        right: 10px;
        min-width: 120px;
    }

    .altitude-value {
        font-size: 28px;
    }

    .telemetry-bar {
        left: 10px;
        right: 10px;
        transform: none;
        gap: 12px;
        padding: 12px 16px;
        justify-content: space-between;
    }

    .telemetry-item {
        min-width: auto;
    }

    .telemetry-value {
        font-size: 18px;
    }

    .telemetry-divider {
        display: none;
    }

    .controls-panel {
        bottom: 90px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .route-panel,
    .altitude-panel {
        display: none;
    }

    .telemetry-bar {
        bottom: 10px;
    }
}

/* ========================================
   Debug Panel (Test Environment Only)
   ======================================== */

.debug-panel {
    position: fixed;
    top: calc(var(--header-height) + 20px);
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: calc(100% - 40px);
    max-height: 400px;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--panel-radius);
    z-index: 600;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

.debug-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    color: var(--warning);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.debug-panel-header button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.debug-panel-header button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.debug-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    max-height: 340px;
}

.debug-message {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
    font-size: 11px;
}

.debug-message:last-child {
    margin-bottom: 0;
}

.debug-header {
    display: flex;
    gap: 12px;
    margin-bottom: 6px;
}

.debug-time {
    font-family: var(--font-display);
    color: var(--text-muted);
}

.debug-topic {
    font-family: var(--font-display);
    color: var(--accent-primary);
}

.debug-payload {
    font-family: var(--font-display);
    font-size: 10px;
    color: var(--text-secondary);
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 8px;
    border-radius: 4px;
}

/* Scrollbar styling for debug content */
.debug-content::-webkit-scrollbar {
    width: 6px;
}

.debug-content::-webkit-scrollbar-track {
    background: transparent;
}

.debug-content::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.debug-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
