:root {
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent: #38bdf8;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top right, #1e293b, var(--bg-dark));
    color: var(--text-main);
    min-height: 100vh;
}

.dashboard {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1rem;
    gap: 1rem;
    overflow: hidden;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

h1 { font-weight: 800; font-size: 1.5rem; letter-spacing: -0.5px; }
.accent { color: var(--accent); }

.stats-container {
    display: flex;
    gap: 2rem;
}

.stat-box {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.stat-box .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-box .value { font-size: 1.25rem; font-weight: 600; }

.controls {
    display: flex;
    gap: 2rem;
    padding: 0.75rem 2rem;
    justify-content: flex-end;
}

.toggle {
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    transition: color 0.2s;
}
.toggle:hover { color: var(--text-main); }
.toggle input { cursor: pointer; accent-color: var(--accent); }

.main-content {
    display: flex;
    flex: 1;
    gap: 1rem;
    overflow: hidden;
}

.sidebar {
    width: 380px;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.sidebar h2 { font-size: 1rem; color: var(--text-muted); margin-bottom: 1rem; }

.aircraft-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.aircraft-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.6rem;
    font-size: 0.8rem;
    transition: transform 0.2s, background 0.2s, border-color 0.2s;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0; /* CRITICAL FIX: prevents cards from being squished vertically */
}
.aircraft-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}
.aircraft-card.expanded {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.05);
}

.card-header { 
    display: grid; 
    grid-template-columns: 1fr auto auto; 
    gap: 0.5rem;
    align-items: center;
}
.card-callsign { font-weight: 600; color: var(--accent); font-size: 0.9rem; }
.card-hex { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; }
.card-chevron { font-size: 0.75rem; color: var(--text-muted); transition: transform 0.2s; justify-self: end; }

.card-collapsible {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin-top 0.3s ease-out;
}
.aircraft-card.expanded .card-collapsible {
    max-height: 500px;
    opacity: 1;
    margin-top: 0.75rem;
}

.card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    font-size: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.5rem;
}

.card-photo-container {
    margin-top: 0.5rem;
    text-align: center;
}

.map-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    background: var(--bg-dark);
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--glass-bg);
    color: var(--text-main);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}
.leaflet-popup-content-wrapper { border-radius: 12px; }

.plane-icon {
    transition: transform 0.3s ease;
    filter: drop-shadow(0 0 4px var(--accent));
}

.pulse-icon-container {
    pointer-events: none;
    z-index: 1000 !important;
}

.pulse-marker {
    width: 40px;
    height: 40px;
    border: 3px solid #38bdf8;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.2);
    box-shadow: 0 0 8px #38bdf8, inset 0 0 8px #38bdf8;
    animation: pulse-animation 1.5s infinite ease-out;
}

@keyframes pulse-animation {
    0% {
        transform: scale(0.4);
        opacity: 1;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* Styles responsifs pour mobiles et tablettes */
@media (max-width: 768px) {
    .dashboard {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }
    
    .stats-container {
        grid-template-columns: repeat(3, 1fr);
        display: grid;
        gap: 0.5rem;
    }
    
    .stat-box {
        text-align: left;
        background: rgba(255, 255, 255, 0.02);
        padding: 0.5rem;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .controls {
        padding: 0.75rem 1rem;
        justify-content: space-around;
        gap: 1rem;
    }
    
    .main-content {
        flex-direction: column;
        height: auto;
        overflow: visible;
        gap: 0.5rem;
    }
    
    .sidebar {
        width: 100%;
        height: 450px;
        order: 2;
    }
    
    .map-container {
        width: 100%;
        height: 400px;
        min-height: 400px;
        order: 1;
    }
    
    /* Adaptabilité de la modale de réglages */
    .glass-panel[style*="width: 500px"] {
        width: 95% !important;
        max-width: 500px !important;
        margin: 5% auto !important;
    }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
