/* --- VARIABLES ET BASES --- */
:root {
    --primary-blue: #2563eb;
    --dark-blue: #475569;   /* Ton nouveau Slate 600 */
    --accent-blue: #64748b; /* Une nuance légèrement plus claire pour les dégradés */
    --primary-blue: #3b82f6; /* Un bleu un peu plus doux pour les boutons */
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --text-main: #1e293b;
    --text-muted: #64748b;
}

/* Force le tableau à prendre toute la largeur */
.table-compact {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto !important; /* MODIFIÉ : Permet à la colonne remarque de s'étirer */
}

/* On définit des largeurs fixes pour les petites colonnes */
.table-compact th:nth-child(1) { width: 70px; }  /* Date */
.table-compact th:nth-child(2) { width: 75px; }  /* Avion */
.table-compact th:nth-child(3) { width: 120px; } /* Pilote */
.table-compact th:nth-child(4) { width: 60px; }  /* Temps */
.table-compact th:nth-child(5) { width: 90px; }  /* Trajet */
.table-compact th:nth-child(6) { width: 40px; }  /* Lnd */
.table-compact th:nth-child(7) { width: 50px; }  /* Carb. */
.table-compact th:nth-child(8) { width: 70px; }  /* Nature */
.table-compact th:nth-child(10) { width: 80px; } /* Actions */

/* La 9ème colonne (Remarques) boit tout l'espace restant */
.table-compact td:nth-child(9) {
    text-align: left !important;
    white-space: nowrap !important; /* MODIFIÉ : Force strictement une seule ligne */
    overflow: hidden;
    text-overflow: ellipsis;        /* Ajoute "..." si vraiment trop long */
    font-size: 0.75rem;
}

/* Style pour le passager dans la cellule remarques */
.passenger-tag {
    color: #2563eb;
    font-style: italic;
    font-weight: bold;
    margin-left: 6px;
    font-size: 0.7rem;
}

body {
    background-color: var(--light-bg);
    color: var(--text-main);
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* --- NAVIGATION (HEADER) --- */
header, .nav-main {
    background-color: var(--dark-blue);
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-main {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-main a {
    color: #f8fafc !important;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 15px;
    transition: all 0.2s;
}

.nav-main a:hover {
    color: #3b82f6 !important;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
}

.version-badge {
    background: #3b82f6;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 10px;
}

/* --- DASHBOARD STRUCTURE --- */
.dash-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
}

.dash-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.logo-box img {
    height: 65px;
    width: auto;
}

.welcome-text {
    text-align: right;
}

.welcome-text h2 {
    margin: 0;
    color: var(--dark-blue);
    font-size: 1.6rem;
    font-weight: 800;
}

.welcome-text p {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 1rem;
}

/* --- STATS GRID --- */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-val {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary-blue);
    margin-top: 10px;
}

/* --- BALANCE BANNER --- */
.balance-banner {
    background: linear-gradient(135deg, var(--dark-blue) 0%, var(--accent-blue) 100%);
    color: #ffffff;
    padding: 35px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    box-shadow: 0 10px 25px rgba(71, 85, 105, 0.2); 
    position: relative;
    overflow: hidden;
}

.balance-info h3 { margin: 0; font-size: 1.4rem; font-weight: 700; }
.balance-info span { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; opacity: 0.8; letter-spacing: 1px; }

.balance-val { font-size: 3.5rem; font-weight: 900; line-height: 1; }
.solde-alerte { color: #fecaca; }

/* --- TABLE CARD (Correction finale alignement) --- */
.vols-header {
    background: #1e3a8a !important; /* Bleu foncé */
    color: white !important;         /* Texte blanc */
    padding: 15px !important;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 1.1rem;
    border-radius: 8px 8px 0 0;   /* Arrondi en haut uniquement */
    text-align: center;           /* Optionnel : pour centrer le titre */
}

.vols-header h2, 
.vols-header h3 {
    margin: 0 !important;
    color: var(--dark-blue) !important;
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em;
}
.vols-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.vols-table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important; 
}

.vols-table th {
    background: #f8fafc;
    padding: 12px 5px !important;
    text-align: center !important; 
    font-size: 0.70rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.vols-table td {
    padding: 12px 5px !important;
    border-top: 1px solid #f1f5f9;
    font-size: 0.85rem;
    text-align: center !important; 
    vertical-align: middle !important;
}

/* --- CONFIGURATION DES COLONNES --- */
.vols-table .col-date     { width: 85px !important; }
.vols-table .col-immat    { width: 85px !important; }
.vols-table .col-trajet   { width: 130px !important; }
.vols-table .col-nature   { width: 75px !important; }
.vols-table .col-fonction { width: 65px !important; }
.vols-table .col-temps    { width: 75px !important; font-weight: 800 !important; color: #1e293b !important; }

.vols-table th.col-remarks,
.vols-table td.col-remarks-content {
    width: auto !important;
    text-align: left !important;
    padding-left: 20px !important;
}

.vols-table td.col-remarks-content {
    font-size: 0.85rem !important;
    color: var(--text-muted);
    white-space: nowrap !important; /* MODIFIÉ : Strictement une ligne */
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-free { background: #dcfce7; color: #166534; }
.badge-paid { background: #f1f5f9; color: #475569; }

/* --- STYLES GÉNÉRIQUES --- */
main {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 20px;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-main);
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    margin-bottom: 15px;
    font-family: inherit;
}

.btn {
    display: inline-block;
    background: var(--primary-blue);
    color: white !important;
    padding: 10px 20px;
    border-radius: 8px;
    border: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
}

.btn.secondary { background: #6b7280; }
.btn.danger { background: var(--danger); }

.flash {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}
.flash.ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash.error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.reg-badge { 
    display: inline-block;
    color: white; 
    padding: 3px 7px; 
    border-radius: 4px; 
    font-family: monospace; 
    font-weight: bold; 
    font-size: 0.75rem;
    text-align: center;
    min-width: 65px;
}

.vols-table tbody tr:hover {
    background-color: #f8fafc !important;
}

.vols-table .col-fonction strong {
    display: inline-block;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    min-width: 40px; 
}

/* --- PAGE FLIGHTS : STRUCTURE --- */
.dash-container-grid { 
    display: grid; 
    grid-template-columns: 360px 1fr; 
    gap: 20px; 
    padding: 10px;
    max-width: 98% !important; /* MODIFIÉ : On élargit la zone de travail */
}

.badge-nature {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
}
/* --- AJUSTEMENT CHIRURGICAL FINAL --- */

/* 1. On libère le conteneur principal */
.dash-container, .dash-container-grid {
    max-width: 98% !important;
    width: 98% !important;
}

/* 2. On force le tableau à s'étaler dans cet espace */
.table-compact {
    table-layout: auto !important;
    width: 100% !important;
}

/* 3. On verrouille la ligne unique pour les remarques */
.table-compact td:nth-child(9), 
.vols-table td.col-remarks-content {
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* --- CORRECTION GLOBALE POUR BOUTONS RADIO ET CHECKBOX --- */

/* 1. On force les boutons radio et cases à cocher à ne pas prendre 100% de largeur */
input[type="radio"], 
input[type="checkbox"] {
    width: auto !important;      /* Annule le "width: 100%" qui étire le bouton */
    display: inline-block !important; /* Force le bouton à rester sur la même ligne */
    margin-right: 8px !important;     /* Petit espace avec le texte */
    margin-bottom: 0 !important;      /* Annule les marges du bas excessives */
    vertical-align: middle !important; /* Centre le bouton par rapport au texte */
    height: auto !important;      /* Évite les déformations de hauteur */
    transform: scale(1.2);        /* Optionnel : les grossit un peu pour le tactile */
}

/* 2. On s'assure que le label (le texte) s'affiche correctement à côté */
label {
    display: inline-flex;    /* Utilise Flexbox pour aligner bouton et texte */
    align-items: center;     /* Centre verticalement */
    gap: 5px;               /* Espace de sécurité */
}

/* 3. Exception pour les formulaires classiques (Login, Saisie vol) */
/* On remet le comportement normal pour les champs TEXTE seulement */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;             /* Eux, on veut qu'ils prennent toute la place */
    display: block;
    margin-bottom: 15px;
}
