/* FlyCase Live — Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0f;
    color: #e0e0e0;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ── Cesium Container ── */

#cesiumContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

/* Masquer les controles Cesium par defaut */
.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-fullscreenContainer,
.cesium-viewer-infoBoxContainer,
.cesium-viewer-selectionIndicatorContainer,
.cesium-viewer-geocoderContainer,
.cesium-viewer-bottom,
.cesium-credit-logoContainer,
.cesium-credit-textContainer {
    display: none !important;
}

/* ── Glass Panel (glassmorphism) ── */

.glass-panel {
    position: fixed;
    background: rgba(10, 10, 20, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(100, 200, 255, 0.15);
    border-radius: 16px;
    padding: 20px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ── Flight Info Panel (haut gauche) ── */

#flightInfoPanel {
    top: 20px;
    left: 20px;
    min-width: 240px;
    max-width: 280px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(100, 200, 255, 0.1);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #00e676;
    box-shadow: 0 0 8px #00e676;
    animation: pulse-glow 2s infinite;
    flex-shrink: 0;
}

.status-dot.ground {
    background: #ff9800;
    box-shadow: 0 0 8px #ff9800;
}

.status-dot.ended {
    background: #9e9e9e;
    box-shadow: none;
    animation: none;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#flightStatus {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #00e676;
}

#flightStatus.ground { color: #ff9800; }
#flightStatus.ended { color: #9e9e9e; }

/* ── Info Identity (Pilote, Avion, Immat) ── */

.info-identity {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

/* ── Flight Data Grid ── */

.info-data {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.data-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
    background: rgba(0, 224, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(100, 200, 255, 0.08);
}

.data-value {
    font-size: 18px;
    font-weight: 700;
    color: #00e0ff;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.data-unit {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 15px;
    font-weight: 600;
    color: #00e0ff;
    font-variant-numeric: tabular-nums;
}

.info-separator {
    height: 1px;
    background: rgba(100, 200, 255, 0.1);
    margin: 4px 0;
}

.info-time {
    text-align: center;
    padding: 6px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.info-time span {
    font-size: 16px;
    font-weight: 700;
    color: #00e0ff;
    font-variant-numeric: tabular-nums;
}

/* ── Flight Phases ── */

.info-phases {
    padding: 6px 0 0;
    border-top: 1px solid rgba(100, 200, 255, 0.1);
    margin-top: 4px;
}

.phase-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 4px;
    font-size: 11px;
}

.phase-label {
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.5px;
}

.phase-time {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.phase-time.active {
    color: #00e676;
}

/* ── GPX Button ── */

.gpx-button {
    display: block;
    margin-top: 12px;
    padding: 10px;
    text-align: center;
    background: rgba(0, 224, 255, 0.15);
    border: 1px solid rgba(0, 224, 255, 0.3);
    border-radius: 10px;
    color: #00e0ff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.gpx-button:hover {
    background: rgba(0, 224, 255, 0.25);
    transform: translateY(-1px);
}

/* ── Instruments Panel (bas droite) ── */

#instrumentsPanel {
    bottom: 20px;
    right: 20px;
    padding: 12px;
}

.instruments-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.instrument {
    width: 120px;
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.instrument svg {
    width: 120px;
    height: 120px;
}

.instrument-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

/* ── Instruments Toggle (mobile) ── */

.instruments-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(100, 200, 255, 0.2);
    background: rgba(10, 10, 20, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    color: #00e0ff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.instruments-toggle:active {
    background: rgba(0, 224, 255, 0.2);
}

/* ── Camera Controls (bas gauche) ── */

.camera-controls {
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 6px;
    padding: 8px;
}

.cam-btn {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(100, 200, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    padding: 0;
}

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

.cam-btn:hover {
    background: rgba(0, 224, 255, 0.15);
    border-color: rgba(0, 224, 255, 0.4);
}

.cam-btn.active {
    background: rgba(0, 224, 255, 0.2);
    border-color: rgba(0, 224, 255, 0.6);
    box-shadow: 0 0 10px rgba(0, 224, 255, 0.2);
    color: #00e0ff;
}

/* ── Loading Screen ── */

#loadingScreen, #notFoundScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0f;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.loading-logo-img {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
    box-shadow: 0 4px 24px rgba(0, 120, 255, 0.4);
}

.panel-logo {
    width: 24px;
    height: 24px;
    border-radius: 6px;
}

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

.loading-content h1 {
    font-size: 28px;
    font-weight: 700;
    color: #00e0ff;
    margin-bottom: 12px;
}

.loading-content p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 24px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 224, 255, 0.1);
    border-top-color: #00e0ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════
   ── RESPONSIVE : TABLETTE (< 768px) ──
   ══════════════════════════════════════════════ */

@media (max-width: 768px) {
    #flightInfoPanel {
        top: env(safe-area-inset-top, 10px);
        left: 10px;
        right: 10px;
        max-width: none;
        min-width: 0;
        padding: 12px 14px;
        border-radius: 14px;
    }

    .panel-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
        gap: 8px;
    }

    .panel-logo {
        width: 20px;
        height: 20px;
    }

    #flightStatus {
        font-size: 12px;
    }

    .info-identity {
        flex-direction: row;
        gap: 12px;
        margin-bottom: 8px;
    }

    .info-identity .info-item {
        flex-direction: column;
        gap: 2px;
    }

    .info-identity .info-label {
        font-size: 9px;
    }

    .info-identity .info-value {
        font-size: 12px;
    }

    .info-data {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .data-cell {
        padding: 4px 2px;
    }

    .data-value {
        font-size: 16px;
    }

    .info-time span {
        font-size: 14px;
    }

    /* Instruments : masques par defaut sur tablette/mobile */
    #instrumentsPanel {
        display: none !important;
        bottom: 70px;
        right: 10px;
        padding: 8px;
    }

    #instrumentsPanel.visible {
        display: block !important;
    }

    .instruments-toggle {
        display: flex;
    }

    .instrument {
        width: 80px;
        height: 100px;
    }

    .instrument svg {
        width: 80px;
        height: 80px;
    }

    /* Camera controls : colonne verticale a droite */
    .camera-controls {
        bottom: auto;
        top: 50%;
        transform: translateY(-50%);
        left: auto;
        right: 10px;
        flex-direction: column;
        padding: 6px;
        border-radius: 12px;
    }

    .cam-btn {
        width: 40px;
        height: 40px;
        font-size: 17px;
        border-radius: 8px;
    }
}

/* ══════════════════════════════════════════════
   ── RESPONSIVE : TELEPHONE (< 480px) ──
   ══════════════════════════════════════════════ */

@media (max-width: 480px) {
    #flightInfoPanel {
        padding: 10px 12px;
        border-radius: 12px;
    }

    .panel-header {
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .info-identity {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    .info-data {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .data-value {
        font-size: 14px;
    }

    .data-unit {
        font-size: 8px;
    }

    .info-time {
        padding: 4px 0 0;
    }

    .info-time span {
        font-size: 13px;
    }

    .camera-controls {
        right: 8px;
    }

    .cam-btn {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    .instruments-toggle {
        bottom: 16px;
        right: 56px;
        width: 36px;
        height: 36px;
        font-size: 17px;
    }

    /* Instruments sur phone : plus petit */
    #instrumentsPanel {
        bottom: 60px;
        right: 8px;
    }

    .instrument {
        width: 65px;
        height: 85px;
    }

    .instrument svg {
        width: 65px;
        height: 65px;
    }
}
