/* ===========================================
   CARNET DE VOL - Styles communs & Responsive
   =========================================== */

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

body { 
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; 
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    min-height: 100vh; 
    color: #fff;
}

/* ===========================================
   NAVIGATION
   =========================================== */
.navbar {
    background: rgba(0,0,0,0.3);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.navbar .logo {
    font-size: 1.3rem;
    font-weight: bold;
    color: #00d9ff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar nav {
    display: flex;
    gap: 5px;
}

.navbar nav a {
    color: #ccc;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.navbar nav a:hover,
.navbar nav a.active {
    background: rgba(0,217,255,0.2);
    color: #00d9ff;
}

.navbar nav a.btn-add {
    background: #00ff88;
    color: #1a1a2e;
    font-weight: 600;
}

/* Menu hamburger mobile */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #00d9ff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

/* ===========================================
   CONTAINER & CARDS
   =========================================== */
.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 20px; 
}

.card {
    background: rgba(255,255,255,0.05);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.card h2 { 
    color: #00ff88; 
    margin-bottom: 15px; 
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===========================================
   STATS BOXES
   =========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.global-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.stat-box {
    background: rgba(0,0,0,0.2);
    padding: 15px 10px;
    border-radius: 12px;
    text-align: center;
}

.stat-box .value { 
    font-size: 1.5rem; 
    color: #00d9ff; 
    font-weight: bold; 
}

.stat-box .label { 
    color: #888; 
    font-size: 0.7rem; 
    margin-top: 5px;
    text-transform: uppercase;
}

/* ===========================================
   TABLEAUX
   =========================================== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -10px;
    padding: 0 10px;
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    min-width: 600px;
}

th, td { 
    padding: 10px 8px; 
    text-align: left; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
    white-space: nowrap;
}

th { 
    color: #00d9ff; 
    font-weight: 600; 
    font-size: 0.7rem;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    background: rgba(26,26,46,0.95);
}

td { 
    color: #ccc; 
    font-size: 0.85rem; 
}

tr:hover { 
    background: rgba(255,255,255,0.03); 
}

.date-cell { font-weight: 600; color: #fff; }
.site-cell { color: #00ff88; }
.distance-cell { color: #ffcc00; font-weight: 600; }
.annee-cell { font-weight: bold; color: #00ff88; }
.highlight { color: #ffcc00; font-weight: bold; }

/* ===========================================
   FORMULAIRES
   =========================================== */
.form-group { margin-bottom: 15px; }

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #888;
    font-size: 0.85rem;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 16px; /* Évite le zoom sur iOS */
}

.form-group input:focus, 
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #00d9ff;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* ===========================================
   BOUTONS
   =========================================== */
.btn, button.btn, label.btn {
    display: inline-block;
    background: linear-gradient(135deg, #00d9ff, #00ff88);
    color: #1a1a2e;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    border: none;
    font-size: 0.95rem;
    text-decoration: none;
    text-align: center;
    min-height: 44px; /* Touch target */
}

.btn:active {
    transform: scale(0.98);
}

/* ===========================================
   UPLOAD ZONE
   =========================================== */
.upload-zone {
    border: 2px dashed rgba(0,217,255,0.4);
    border-radius: 10px;
    padding: 25px 15px;
    text-align: center;
}

/* ===========================================
   MESSAGES
   =========================================== */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}
.message.success { background: rgba(0,255,136,0.2); border-left: 4px solid #00ff88; }
.message.error { background: rgba(255,100,100,0.2); border-left: 4px solid #ff6464; }
.message.info { background: rgba(0,217,255,0.2); border-left: 4px solid #00d9ff; }

/* ===========================================
   GRAPHIQUES
   =========================================== */
.chart-container {
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 15px;
    height: 250px;
    position: relative;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* ===========================================
   HEATMAP
   =========================================== */
.heatmap-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 0.8rem; 
    min-width: auto;
}

.heatmap-table th { 
    padding: 8px 4px; 
    font-weight: bold; 
    font-size: 0.75rem;
    min-width: 40px;
}

.heatmap-table td { 
    padding: 8px 4px; 
    text-align: center; 
    border: 1px solid rgba(255,255,255,0.05);
    min-width: 40px;
}

.heatmap-cell {
    border-radius: 4px;
}

.mois-label {
    text-align: left !important;
    font-weight: 600;
    color: #ccc;
    white-space: nowrap;
}

.total-cell {
    font-weight: bold;
    color: #00ff88;
    background: rgba(0,255,136,0.1) !important;
}

/* ===========================================
   SITES TOP
   =========================================== */
.site-row {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.site-rank {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #00d9ff, #00ff88);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a2e;
    font-weight: bold;
    font-size: 0.8rem;
    margin-right: 12px;
    flex-shrink: 0;
}

.site-info { flex: 1; min-width: 0; }
.site-name { font-weight: 600; font-size: 0.9rem; }
.site-stats { color: #888; font-size: 0.8rem; }

/* ===========================================
   FILTRES
   =========================================== */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.filter-group { 
    display: flex; 
    flex-direction: column; 
    gap: 5px;
    flex: 1;
    min-width: 120px;
}

.filter-group label { 
    color: #888; 
    font-size: 0.75rem; 
}

.filter-group select, 
.filter-group input {
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 14px;
}

.btn-filter {
    padding: 10px 20px;
    background: #00d9ff;
    color: #1a1a2e;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

.btn-reset {
    padding: 10px 15px;
    background: transparent;
    color: #888;
    border: 1px solid #888;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ===========================================
   LIENS
   =========================================== */
a.xc-link { 
    color: #00d9ff; 
    text-decoration: none; 
    font-size: 0.8rem;
    padding: 4px 8px;
    background: rgba(0,217,255,0.2);
    border-radius: 4px;
    white-space: nowrap;
}

.view-all {
    display: inline-block;
    margin-top: 15px;
    color: #00d9ff;
    text-decoration: none;
    font-size: 0.9rem;
}

/* ===========================================
   RESPONSIVE - TABLETTE
   =========================================== */
@media (max-width: 900px) {
    .grid-2 { 
        grid-template-columns: 1fr; 
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-box .value { font-size: 1.3rem; }
}

/* ===========================================
   RESPONSIVE - SMARTPHONE
   =========================================== */
@media (max-width: 600px) {
    /* Navigation mobile */
    .navbar {
        padding: 12px 15px;
    }
    
    .navbar .logo {
        font-size: 1.1rem;
    }
    
    .navbar nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: linear-gradient(180deg, #1a1a2e, #16213e);
        flex-direction: column;
        padding: 80px 20px 20px;
        gap: 10px;
        transition: left 0.3s ease;
        box-shadow: 5px 0 20px rgba(0,0,0,0.5);
        z-index: 99;
    }
    
    .navbar nav.open {
        left: 0;
    }
    
    .navbar nav a {
        padding: 15px;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 98;
    }
    
    .menu-overlay.open {
        display: block;
    }
    
    /* Container */
    .container {
        padding: 15px;
    }
    
    /* Cards */
    .card {
        padding: 15px;
        border-radius: 12px;
    }
    
    .card h2 {
        font-size: 1rem;
    }
    
    /* Stats */
    .stats-grid,
    .global-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .stat-box {
        padding: 12px 8px;
    }
    
    .stat-box .value { 
        font-size: 1.2rem; 
    }
    
    .stat-box .label { 
        font-size: 0.6rem; 
    }
    
    /* Formulaires */
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    /* Filtres */
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .btn-filter, .btn-reset {
        width: 100%;
        text-align: center;
    }
    
    /* Boutons */
    .btn, button.btn, label.btn {
        width: 100%;
        padding: 14px;
    }
    
    /* Upload */
    .upload-zone {
        padding: 20px 10px;
    }
    
    .upload-zone p {
        font-size: 0.9rem;
    }
    
    /* Graphiques */
    .chart-container {
        height: 200px;
        padding: 10px;
    }
    
    /* Tableaux */
    table {
        min-width: 500px;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 0.75rem;
    }
    
    /* Heatmap */
    .heatmap-table th,
    .heatmap-table td {
        padding: 6px 3px;
        font-size: 0.7rem;
        min-width: 32px;
    }
    
    /* Sites */
    .site-row {
        padding: 10px 0;
    }
    
    .site-name { font-size: 0.85rem; }
    .site-stats { font-size: 0.75rem; }
    
    /* Header page */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    /* Year highlight */
    .year-highlight h2 {
        font-size: 1rem;
    }
}

/* ===========================================
   PETIT SMARTPHONE
   =========================================== */
@media (max-width: 380px) {
    .stats-grid,
    .global-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-box .value { 
        font-size: 1rem; 
    }
    
    .heatmap-table th,
    .heatmap-table td {
        padding: 4px 2px;
        font-size: 0.65rem;
        min-width: 28px;
    }
}
