/* css/styles.css */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Roboto:wght@300;400;500&display=swap');

:root {
    /* --- TYPOGRAPHIE --- */
    --font-family-sans: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-family-serif: 'Playfair Display', 'Times New Roman', serif;
    
    --font-size-base: 0.9rem;
    --font-size-sm: 0.8rem;
    
    /* --- GEOMETRIE --- */
    --border-radius: 0px; /* Design Zara : Angles droits stricts */
    
    /* --- TRANSITIONS --- */
    --transition-base: all 0.2s ease;
}

/* --- PALETTE MONOCHROME (Style Zara Home) --- */
html:not(.dark) {
    --c-primary: #000000;        /* Noir profond */
    --c-primary-light: #333333;
    --c-bg: #ffffff;             /* Blanc pur */
    --c-surface: #fcfcfc;        /* Blanc très légèrement cassé */
    --c-border: #e0e0e0;         /* Gris clair fin */
    --c-text: #1a1a1a;           /* Noir texte */
    --c-text-muted: #757575;     /* Gris moyen */
    --c-text-on-primary: #ffffff;
    --c-danger: #9e1b1b;         /* Rouge bordeaux */
    --c-success: #2e7d32;        /* Vert forêt */
    --c-logo-stroke: #000000;
}

html.dark {
    --c-primary: #ffffff;
    --c-primary-light: #cccccc;
    --c-bg: #121212;
    --c-surface: #1c1c1c;
    --c-border: #333333;
    --c-text: #e0e0e0;
    --c-text-muted: #a0a0a0;
    --c-text-on-primary: #000000;
    --c-danger: #cf6679;
    --c-success: #81c784;
    --c-logo-stroke: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-weight: 300;
    line-height: 1.6;
    color: var(--c-text);
    background-color: var(--c-bg);
    margin: 0;
    /* CORRECTION HEADER : On assure assez d'espace pour le header fixe */
    padding-top: 80px; 
}

.container { max-width: 1400px; margin: 0 auto; padding: 2rem; }

/* --- TITRES & TEXTES --- */
h1, h2, h3, h4, .section-title, .logo-text {
    font-family: var(--font-family-serif);
    font-weight: 400;
    color: var(--c-text);
    letter-spacing: 0.02em;
}

.section-title {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    border-bottom: 1px solid var(--c-primary);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.section-subtitle {
    font-family: var(--font-family-sans);
    font-size: 0.85rem;
    color: var(--c-text-muted);
    margin-top: -1rem;
    margin-bottom: 2rem;
    font-style: italic;
}

/* --- HEADER (Correction Positionnement) --- */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 70px;
    background-color: var(--c-bg);
    border-bottom: 1px solid var(--c-border);
    
    /* FORCE FIXED : Évite les conflits avec sticky */
    position: fixed !important;
    top: 0; 
    left: 0; 
    right: 0;
    z-index: 9999 !important; /* Priorité absolue sur les cartes */
    
    transition: background-color 0.3s;
}

.logo-link { text-decoration: none; display: flex; align-items: center; }
.logo-svg { height: 28px; width: auto; }
.logo-svg path { stroke: var(--c-text) !important; }
.logo-text tspan { fill: var(--c-text) !important; font-family: var(--font-family-serif); }

/* Navigation */
.tabs { display: flex; gap: 2rem; height: 100%; }
.tab {
    padding: 0;
    cursor: pointer;
    color: var(--c-text-muted);
    font-family: var(--font-family-sans);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
    display: flex;
    align-items: center;
    height: 100%;
    border-bottom: 2px solid transparent;
    transition: color 0.2s;
    position: relative;
}
.tab:hover { color: var(--c-text); }
.tab.active {
    color: var(--c-text);
    border-bottom: 2px solid var(--c-primary);
}
.tab.disabled { opacity: 0.3; pointer-events: none; cursor: not-allowed; }


/* --- AUTHENTIFICATION --- */
#auth-container { padding-right: 1rem; border-right: 1px solid var(--c-border); margin-right: 1rem;}
#user-info { display: flex; align-items: center; gap: 0.8rem; cursor: pointer; padding: 0.25rem 0.5rem; border-radius: var(--border-radius); }
#user-info:hover { background-color: var(--c-surface); }
.avatar { 
    width: 32px; height: 32px; 
    border-radius: 50%; 
    object-fit: cover; 
    filter: grayscale(100%); 
    border: 1px solid var(--c-border);
}
.avatar:hover { filter: grayscale(0%); }
#user-details { display: flex; flex-direction: column; line-height: 1.1; text-align: right; }
#user-name { font-size: 0.8rem; font-weight: 600; color: var(--c-text); }
#user-profile { font-size: 0.65rem; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

#theme-toggle { background: none; border: none; color: var(--c-text); cursor: pointer; padding: 0; display: flex; align-items: center; }
#theme-toggle svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.5; }


/* --- BOUTONS & INPUTS --- */
button {
    padding: 0.7rem 1.2rem;
    border: 1px solid var(--c-primary);
    border-radius: 0;
    cursor: pointer;
    font-family: var(--font-family-sans);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background-color: var(--c-primary);
    color: var(--c-text-on-primary);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
button:hover {
    background-color: transparent;
    color: var(--c-primary);
}
button:disabled {
    background-color: var(--c-border);
    border-color: var(--c-border);
    color: #999;
    cursor: not-allowed;
}

.btn-outline {
    background-color: transparent;
    color: var(--c-text);
    border: 1px solid var(--c-border);
}
.btn-outline:hover {
    border-color: var(--c-primary);
    background-color: var(--c-surface);
}

.btn-danger-small {
    border: 1px solid var(--c-border);
    color: var(--c-text-muted);
    background: transparent;
    padding: 0.3rem 0.6rem;
    font-size: 0.65rem;
}
.btn-danger-small:hover {
    color: var(--c-danger);
    border-color: var(--c-danger);
}

/* BOUTON SAVE RAPIDE EN NOIR */
.save-mini-btn {
    padding: 2px 6px;
    font-size: 0.65rem;
    margin-left: 10px;
    background-color: var(--c-surface);
    border: 1px solid var(--c-border);
    color: #000000 !important;
    cursor: pointer;
    font-weight: bold;
}
.save-mini-btn:hover {
    background-color: var(--c-primary);
    color: var(--c-text-on-primary) !important;
}

/* Icones SVG dans les boutons */
.btn-icon-svg {
    width: 14px; height: 14px;
    fill: currentColor;
    margin-right: 0.5rem;
}

/* Champs de formulaire */
input, select, textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid var(--c-border);
    border-radius: 0;
    background-color: transparent;
    color: var(--c-text);
    font-family: var(--font-family-sans);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--c-primary);
}

/* Style Selecteur Custom (Flèche noire simple) */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem top 50%;
    background-size: 0.65rem auto;
    padding-right: 2rem;
}

label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--c-text-muted);
    margin-bottom: 0.4rem;
    display: block;
}

.controls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; align-items: flex-end; margin-bottom: 1.5rem;}
.control-group { display: flex; flex-direction: column; }
.input-with-unit { display: flex; align-items: center; }
.input-with-unit input { border-right: none; }
.input-unit {
    padding: 0.8rem;
    background-color: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: none;
    color: var(--c-text-muted);
    font-size: 0.8rem;
}

/* Classes utilitaires */
.w-full { width: 100%; grid-column: 1 / -1; }
.text-white { color: white !important; }


/* --- CONTENEURS & VUES --- */
main { background-color: transparent; box-shadow: none; }
.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* SOUS-ONGLETS (Viewer, Tools, Paramètres) */
.sub-tabs {
    display: flex;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: 2rem;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbar Firefox */
}
.sub-tabs::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome */

.sub-tab {
    background: none;
    border: none;
    color: var(--c-text-muted);
    padding: 0.8rem 1.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.sub-tab:hover { color: var(--c-text); }
.sub-tab.active {
    color: var(--c-text);
    border-bottom: 2px solid var(--c-primary);
}
.view-content { display: none; }
.view-content.active { display: block; }


/* --- VIEWER / DATA --- */
.top-controls-container {
    display: flex; align-items: flex-end; justify-content: space-between;
    padding-bottom: 1rem; margin-bottom: 1rem;
    gap: 1rem;
}

/* Tableaux */
.table-container {
    overflow-x: auto;
    border-top: 1px solid var(--c-primary);
    border-bottom: 1px solid var(--c-border);
    margin-top: 1rem;
}
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; text-align: left; }
th {
    padding: 0.8rem 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text-muted);
    background-color: var(--c-surface);
    white-space: nowrap;
}
td {
    padding: 0.8rem 0.6rem;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text);
    white-space: nowrap;
}
tr:last-child td { border-bottom: none; }

/* Cellules Spéciales */
.dir-cell { display: flex; align-items: center; gap: 0.5rem; }
.arrow-container {
    display: inline-flex; justify-content: center; align-items: center;
    width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid var(--c-border);
    background: transparent !important; 
}
.arrow-svg { fill: var(--c-text); width: 10px; height: 10px; }

#dataTable .speed-cell { 
    font-weight: 600; 
}
#dataTable .dir-toggle-icon { width: 10px; height: 10px; margin-left: 4px; opacity: 0.5; }

/* --- CARTES --- */
/* CORRECTION HAUTEUR CARTE pour mobile/laptop */
#finMapContainer, #deriveMapContainer, #flightPlannerMapContainer {
    height: 60vh; 
    min-height: 400px;
    width: 100%;
    margin-top: 1.5rem;
    border: 1px solid var(--c-border);
    background-color: #f0f0f0;
    filter: grayscale(0.1); 
    position: relative; /* Pour le z-index des contrôles */
}
#pilotGraph { min-height: 650px; }

/* Transparence Carte */
.map-transparent .leaflet-tile-pane {
    opacity: 0.4 !important;
    filter: grayscale(1) contrast(1.2);
}

/* --- RESULTATS & LISTES --- */
#flightPlannerResult, #finStartPointResult, #deriveResult {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: var(--c-surface);
    border: 1px solid var(--c-border);
}
#flightPlannerResult h4 { margin-top: 0; border-bottom: 1px solid var(--c-border); padding-bottom: 0.5rem; font-size: 1rem;}

#takeoff-bases-list-container ul, #forecast-history-list-container ul, #flight-plan-history-list ul {
    list-style-type: none; padding: 0; margin: 0;
}
.takeoff-base-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--c-border);
}
.takeoff-base-item:first-child { border-top: 1px solid var(--c-border); }
.takeoff-base-item div { display: flex; flex-direction: column; gap: 0.2rem; }
.takeoff-base-item strong { font-weight: 500; font-size: 0.95rem; }
.takeoff-base-item small { color: var(--c-text-muted); font-size: 0.75rem; }


/* --- MODALS --- */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(255,255,255,0.9); backdrop-filter: blur(3px); }
.modal-content {
    background-color: var(--c-bg);
    margin: 5vh auto;
    padding: 2.5rem;
    border: 1px solid var(--c-primary);
    width: 90%; max-width: 550px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.05);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; border-bottom: 1px solid var(--c-border); padding-bottom: 0.5rem; }
.close-btn { font-size: 2rem; font-weight: 300; cursor: pointer; line-height: 1; }
.close-btn:hover { color: var(--c-primary); }

.profile-avatar-section { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.avatar-large { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; filter: grayscale(100%); border: 1px solid var(--c-border); }


/* --- MOBILE --- */
.mobile-menu, .hamburger-menu-container { display: none; }
@media (max-width: 1024px) {
    .top-bar .tabs { display: none; }
    .hamburger-menu-container { display: flex; }
    .hamburger-menu span { height: 1px; width: 25px; background-color: var(--c-text); margin: 5px 0; display: block; }
    
    .mobile-menu { 
        position: fixed; /* Fixé aussi pour suivre le scroll */
        top: 70px; /* Juste sous le header */
        left: 0; 
        width: 100%; 
        background-color: var(--c-bg); 
        border-bottom: 1px solid var(--c-border); 
        z-index: 3000; 
    }
    .mobile-menu .tab { width: 100%; padding: 1rem 2rem; height: auto; border-bottom: none; justify-content: flex-start; }
    
    .controls-grid { grid-template-columns: 1fr; gap: 1rem; }
    #user-details { display: none; } /* Cache le nom sur mobile */
    .sub-tabs { gap: 1rem; padding-bottom: 5px; justify-content: flex-start; }
}

/* Fix Mobile Menu Display */
.mobile-menu.open { display: block !important; }

/* SECURITÉ : On masque toujours le menu mobile sur les grands écrans */
@media (min-width: 1025px) {
    .mobile-menu { display: none !important; }
}

/* DROPDOWN MENU */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--c-surface);
    border: 1px solid var(--c-border);
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 5000;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a {
    color: var(--c-text);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
}

.dropdown-menu a:hover {
    background-color: var(--c-bg);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--c-border);
    margin: 0;
}

.poi-label-text {
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff;
    white-space: nowrap;
}

/* --- IMPRESSION PDF (ONE PAGE) --- */
@media print {
    @page { size: A4; margin: 1cm; }
    body { padding: 0; background: white; color: black; font-family: 'Times New Roman', serif; }
    
    /* Masquer les éléments inutiles */
    .top-bar, .mobile-menu, #fpExportControls, .task-tool-content:not(#toolFlightPlanner) { display: none !important; }
    #toolFlightPlanner .controls-grid, #derive > .control-group, #taskHelperArchiveTabsContainer, .sub-tabs { display: none !important; }
    
    /* Conteneur principal */
    main { box-shadow: none; border: none; }
    .container { padding: 0; margin: 0; max-width: 100%; }
    .tab-content.active, .task-tool-content { display: block !important; padding: 0; }
    .printable-content { display: block !important; background-color: #ffffff; border: none; margin: 0; padding: 0; }
    
    /* Carte : Taille réduite pour tenir sur la page */
    #flightPlannerMapContainer {
        display: block !important; 
        height: 350px !important; 
        width: 100% !important;
        border: 1px solid #000 !important;
        margin-bottom: 15px;
        page-break-inside: avoid;
    }
    .leaflet-control-container { display: none !important; }

    /* Header PDF */
    #print-header { display: block !important; border-bottom: 2px solid #000; margin-bottom: 15px; padding-bottom: 10px; }
    #print-header h1 { font-size: 20pt; margin: 0; text-transform: uppercase; letter-spacing: 2px; }
    #print-header h2 { font-size: 12pt; margin: 5px 0; font-weight: normal; font-style: italic; }
    #print-header p { font-size: 9pt; margin: 5px 0 0 0; color: #333; }

    /* Tableau de synthèse */
    #print-data-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 8pt; font-family: sans-serif; }
    #print-data-table th, #print-data-table td { border: 1px solid #ccc; padding: 4px; text-align: center; }
    #print-data-table th { background-color: #f0f0f0 !important; -webkit-print-color-adjust: exact; font-weight: bold; }

    /* Résultats */
    #flightPlannerResult { 
        border: 1px solid #000; padding: 10px; margin-top: 15px; font-family: sans-serif; font-size: 9pt; 
        page-break-inside: avoid; 
    }
    #flightPlannerResult h4 { margin-top: 0; text-transform: uppercase; border-bottom: 1px solid #ccc; padding-bottom: 5px; margin-bottom: 5px; }
    #flightPlannerResult p { margin: 2px 0; }
    
    .btn-outline { display: none; }

    /* Thème WindView (Inspiré de windy/aviation) */
[data-theme="windview"] {
    --c-bg: #1e1e1e;
    --c-surface: #2a2a2a;
    --c-text: #e0e0e0;
    --c-text-muted: #aaaaaa;
    --c-primary: #ffcc00; /* Jaune aviation */
    --c-primary-hover: #e6b800;
    --c-text-on-primary: #000000;
    --c-border: #444;
    --shadow-md: 0 4px 6px rgba(0,0,0,0.5);
}
/* Force la carte à être sombre si nécessaire via des filtres ou changement de tuiles */
[data-theme="windview"] .leaflet-layer {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

/* --- AUTOCOMPLETE LIST STYLE AMÉLIORÉ --- */

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-top: none;
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 2000;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* Item de la liste : Aligné à gauche, Flexbox */
.autocomplete-item {
    display: flex !important; /* Force l'alignement horizontal */
    align-items: center !important;
    justify-content: flex-start !important;
    flex-direction: row !important; /* Important : pas de colonne */
    
    padding: 12px 16px;
    cursor: pointer;
    background: white;
    border-bottom: 1px solid #f0f0f0; /* Fine ligne grise */
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #f9f9f9;
}

/* Flèche grise (remplace la terre) */
.item-arrow-icon {
    width: 14px !important;
    height: 14px !important;
    min-width: 14px !important; /* Empêche l'écrasement */
    fill: #cccccc; /* Gris clair */
    display: block;
}
.item-content {
    display: flex;
    flex-direction: column; /* Nom au-dessus, détail en dessous */
    justify-content: center;
    flex-grow: 1;
    overflow: hidden;
    text-align: left;
}

.item-left-col {
    flex-shrink: 0;
    width: 50px; /* Largeur fixe pour aligner verticalement */
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Calé à gauche */
}

/* Ligne titre */
.item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--c-text);
    width: 100%;
    text-align: left;
}

.item-title {
    font-size: 0.95rem;
    font-weight: 600;
    padding-left: 10px;
    color: #1a1a1a;
    line-height: 1.2;
}

.item-subtitle {
    font-size: 0.8rem;
    color: #8e8e93; /* Gris iOS */
    margin-top: 2px;
    font-weight: 400;
    line-height: 1.2;
}

/* Sous-titre (Pays) */
.item-subtext {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
    text-align: left;
}

/* --- BADGES COULEURS --- */
.badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    color: white !important;
    text-align: center;
    display: inline-block;
    min-width: 45px;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.badge-perso { background-color: #333333 !important; }
.badge-group { background-color: #007AFF !important; } /* Bleu iOS */
.badge-public { background-color: #34C759 !important; } /* Vert iOS */

.item-subtext {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

.ios-arrow-icon {
    width: 18px !important;
    height: 18px !important;
    fill: #c7c7cc; /* Gris clair */
    display: block;
}

#forecastSearchResults {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15); /* Ombre portée douce */
    border: 1px solid rgba(0,0,0,0.05);
    
    /* FORCE la suppression des puces */
    list-style: none !important;
    list-style-type: none !important;
    padding: 0 !important;
    margin: 0 !important;
    
    max-height: 350px;
    overflow-y: auto;
    z-index: 10000;
}

/* Groupe texte pour alignement vertical */
.search-text-group {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.search-main-text {
    font-weight: 600;
    color: var(--c-text);
    font-size: 0.95rem;
}

.search-subtext {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    margin-top: 2px;
}

/* Badges pour l'origine du lieu */
.badge-perso { background-color: #e0e0e0; color: #333; padding: 2px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: bold; text-transform: uppercase; }
.badge-public { background-color: #d1fae5; color: #065f46; padding: 2px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: bold; text-transform: uppercase; }
.badge-team { background-color: #dbeafe; color: #1e40af; padding: 2px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: bold; text-transform: uppercase; }

/* Mode sombre */
[data-theme="windview"] .autocomplete-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.search-wrapper input {
    padding-left: 34px; /* Était 38px. Réduisez légèrement si l'icône est plus petite */
}

/* 1. On force la taille et le centrage du conteneur SVG */
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%); /* Centrage vertical parfait */
    
    width: 12px !important;  /* Taille forcée petite */
    height: 12px !important;
    
    color: var(--c-text-muted);
    pointer-events: none;
    z-index: 10;
}

/* 2. CRUCIAL : On affine le trait pour que l'icône reste nette en petit */
.search-icon path {
    stroke-width: 1.5 !important; /* Était à 2 ou 3, on le force à 1.5 */
}

.search-wrapper input {
    padding-left: 38px; /* Espace pour la loupe */
}

/* --- AUTOCOMPLETE LIST (Alignement & Badges) --- */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-top: none;
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 2000;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.autocomplete-item {
    display: flex !important;       /* Force l'alignement côte à côte */
    align-items: center !important; /* Centre verticalement */
    justify-content: flex-start;    /* Colle tout à gauche */
    gap: 12px;                      /* Espace entre badge/flèche et texte */
    padding: 10px 15px;
    border-bottom: 1px solid var(--c-border);
    cursor: pointer;
    background: white;
}

.autocomplete-item:hover {
    background-color: #f5f5f5;
}


/* Badges restaurés */
.badge-type {
    font-size: 0.6rem;
    font-weight: bold;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 2px;
    margin-right: 10px;
    min-width: 50px;
    text-align: center;
}
.badge-perso { background-color: #e0e0e0; color: #333; }
.badge-public { background-color: #d1fae5; color: #065f46; }
.badge-team { background-color: #dbeafe; color: #1e40af; }
.badge-geo { background-color: transparent; font-size: 1.2em; border: none; }

/* --- PAGE PLAN : TOGGLE BUTTONS UNIFIÉS --- */
.planner-toggle-group {
    display: flex;
    border: 1px solid var(--c-primary);
    border-radius: 4px; /* Légèrement arrondi */
    overflow: hidden;
    margin-right: 0; /* On gère l'espacement via le grid/flex du parent */
}

.planner-toggle-btn {
    border: none;
    padding: 0.5rem 1.5rem; /* Plus large */
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 0;
    font-weight: 600;
    flex: 1; /* Largeur égale */
}

/* État Actif : Noir */
.planner-toggle-btn.active {
    background-color: #ffffff;
    color: #000000;
}

/* État Inactif : Blanc */
.planner-toggle-btn.inactive {
    background-color: #ffffff;
    color: #000000;
}
.planner-toggle-btn.inactive:hover {
    background-color: #f0f0f0;
}

/* Break pour la ligne suivante des options */
.break-row {
    width: 100%;
    height: 10px;
}

/* --- PAGE LIEUX : ONGLETS FILTRES --- */
.filter-btn {
    padding: 5px 12px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    color: var(--c-text); /* Noir par défaut */
    cursor: pointer;
    font-size: 0.8rem;
    border-radius: 15px;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--c-primary);
}

.filter-btn.active {
    background: var(--c-primary);
    color: var(--c-text-on-primary); /* Blanc quand actif */
    border-color: var(--c-primary);
}

/* --- OACI TABLE (Résultat Plan) --- */
.oaci-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.8rem;
}
.oaci-table th, .oaci-table td {
    border: 1px solid var(--c-border);
    padding: 6px;
    text-align: left;
}
.oaci-table th { background-color: var(--c-surface); }

/* Toast Notification */
#toast-container {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 10000; /* Au-dessus de tout */
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}

#toast-container.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px; /* Petit effet de montée */
}

/* Variante Succès/Erreur */
#toast-container.success { border-left: 5px solid #4CAF50; }
#toast-container.error { border-left: 5px solid #F44336; }

}


/* =========================================
   AUTOCOMPLETE DESIGN (OPTION A - COMPACT & IOS)
   ========================================= */

/* 1. Le Conteneur Flottant */
#forecastSearchResults {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.05);
    /* FORCE la suppression des puces */
    list-style: none !important;
    list-style-type: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: 350px;
    overflow-y: auto;
    z-index: 10000;
}

/* 2. L'élément de liste (Compact) */
.autocomplete-item {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-direction: row !important;
    padding: 10px 14px;
    cursor: pointer;
    background: white;
    /* Ligne fine grise */
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
    color: var(--c-text);
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background-color: #f7f7f7; }

/* 3. Colonne Gauche (Badge ou Flèche) */
.item-left-col {
    flex-shrink: 0;
    width: 24px; /* Juste assez pour l'icône ou début du badge */
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 4. Contenu Texte (Option A : Ligne unique ou compact) */
.item-content {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.item-main-text {
    font-weight: 200;
    padding-left: 10px;
    color: #1a1a1a;
}

.item-sub-text {
    font-size: 0.85rem;
    color: #8e8e93; /* Gris iOS */
    font-weight: 400;
}

/* 5. Badges (Gauche) */
.badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    color: white !important;
    letter-spacing: 0.5px;
    line-height: 1;
    display: inline-block;
}

.badge-perso { background-color: #333333 !important; }
.badge-group { background-color: #007AFF !important; } /* Bleu iOS */
.badge-public { background-color: #34C759 !important; } /* Vert iOS */

/* 6. Icône Flèche IOS (Chevron) */
.ios-arrow-icon {
    width: 16px !important;
    height: 16px !important;
    fill: #c7c7cc; /* Gris clair */
    display: block;
}

/* --- CONFIG BUTTON (ENGRENAGE) --- */
.config-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    color: var(--c-text-muted);
}
.config-btn:hover {
    background-color: var(--c-surface);
    color: var(--c-text);
}
.config-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* --- IOS SWITCH TOGGLE --- */
.control-group-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--c-border);
}
.control-group-row:last-child { border-bottom: none; }
.control-group-row label { margin: 0; font-size: 0.9rem; color: var(--c-text); font-weight: 500; text-transform: none; letter-spacing: 0; }

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Activé (Vert iOS) */
input:checked + .slider { background-color: #34C759; }
input:focus + .slider { box-shadow: 0 0 1px #34C759; }
input:checked + .slider:before { transform: translateX(16px); }

/* Forme ronde */
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* --- MODAL PARAMÈTRES COMPACT & DRAGGABLE --- */

/* Réduire la taille du modal */
#display-settings-modal .modal-content {
    max-width: 320px; /* Plus étroit */
    padding: 1.5rem;
}

#display-settings-modal h2 {
    font-size: 1rem; /* Titre plus petit */
    margin: 0;
}

/* Liste des paramètres */
#settings-drag-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0; /* Moins de hauteur */
    border-bottom: 1px solid var(--c-border);
    background-color: var(--c-bg);
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 0.8rem; /* Texte plus petit */
}

/* Poignée de déplacement (Hamburger) */
.drag-handle {
    cursor: grab;
    color: var(--c-text-muted);
    margin-right: 10px;
    font-size: 1.2rem;
    line-height: 1;
    user-select: none;
}
.drag-handle:active { cursor: grabbing; }

/* Élément en cours de déplacement */
.settings-item.dragging {
    opacity: 0.5;
    background: var(--c-surface);
    border: 1px dashed var(--c-primary);
}

/* Switch iOS reduit */
.switch {
    width: 34px;
    height: 20px;
}
.slider:before {
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
}
input:checked + .slider:before {
    transform: translateX(14px);
}

/* ==================================================================
   ⚡ MISE À JOUR WINXPLORER (Mobile, iOS Search, Cockpit) 
   Ajoutez ce bloc à la FIN de votre fichier CSS existant.
   ================================================================== */

/* --- 1. CORRECTIFS STRUCTURELS --- */
body { padding-top: 80px; } /* Sécurité pour le header fixe */
header.top-bar { position: fixed !important; top: 0; width: 100%; z-index: 10000; }

/* --- 2. BARRE DE RECHERCHE (Style iOS & Fix Triangle) --- */
.search-wrapper { position: relative; }
.search-wrapper input { padding-left: 38px !important; border-radius: 8px !important; }

/* Loupe centrée */
.search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 14px !important; height: 14px !important;
    color: #757575; pointer-events: none; z-index: 10;
}
.search-icon path { stroke-width: 1.5 !important; }

/* Liste Résultats Flottante */
#forecastSearchResults {
    position: absolute; top: calc(100% + 5px); left: 0; right: 0;
    background: #ffffff; border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); border: 1px solid rgba(0,0,0,0.05);
    list-style: none !important; padding: 0 !important; margin: 0 !important;
    max-height: 350px; overflow-y: auto; z-index: 10000;
}

/* Élément de liste */
.autocomplete-item {
    display: flex !important; align-items: center !important;
    flex-direction: row !important; justify-content: flex-start !important;
    padding: 10px 14px; cursor: pointer; background: white;
    border-bottom: 1px solid #f0f0f0;
}
.autocomplete-item:hover { background-color: #f7f7f7; }

.item-left-col { flex-shrink: 0; width: 24px; margin-right: 10px; display: flex; align-items: center; justify-content: center; }
.item-content { flex-grow: 1; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.item-main-text { font-weight: 600; color: #1a1a1a; font-size: 0.9rem; }
.item-sub-text { font-size: 0.85rem; color: #8e8e93; font-weight: 400; }

/* Badges */
.badge { font-size: 0.6rem; font-weight: 700; padding: 3px 6px; border-radius: 6px; text-transform: uppercase; color: white !important; display: inline-block; min-width: 45px; text-align: center; line-height: 1; }
.badge-perso { background-color: #333 !important; }
.badge-public { background-color: #34C759 !important; }
.badge-group { background-color: #007AFF !important; }
.ios-arrow-icon { width: 16px !important; height: 16px !important; fill: #c7c7cc; display: block; }


/* --- 3. PLANIFICATEUR (Style Cockpit & Toggle) --- */
#toolFlightPlanner .controls-grid {
    background: #fcfcfc; padding: 10px; border: 1px solid #e0e0e0;
    margin-top: 10px; display: flex; flex-direction: column; gap: 10px;
}

.planner-toggle-group { display: flex; border: 1px solid #000; border-radius: 4px; overflow: hidden; }
.planner-toggle-btn { border: none; padding: 6px 12px; font-size: 0.8rem; font-weight: 600; cursor: pointer; flex: 1; }
.planner-toggle-btn.active { background-color: #fcfcfc; color: #000; } /* Blanc */
.planner-toggle-btn.inactive { background-color: #000; color: #fff; } /* Noir */

/* Boutons Carte */
#btnMapType, #btnToggleOACI, #btnToggleTransp, #btnShowProfile, #btnTogglePOI {
    padding: 6px 12px; font-size: 0.75rem; border: 1px solid #e0e0e0; background: transparent;
}
.active-state { background-color: #000 !important; color: #fff !important; border-color: #000 !important; }


/* --- 4. MODAL PARAMÈTRES (Drag & Drop) --- */
#display-settings-modal .modal-content { max-width: 320px; padding: 1.5rem; }
.settings-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee; font-size: 0.8rem; background: #fff; }
.drag-handle { cursor: grab; color: #999; margin-right: 10px; font-size: 1.2rem; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #34C759; }
input:checked + .slider:before { transform: translateX(14px); }


/* --- 5. VERSION MOBILE (Responsive) --- */
.mobile-menu, .hamburger-menu-container { display: none; }

@media (max-width: 1024px) {
    /* Header Mobile : Masquer éléments PC */
    .top-bar .tabs, #user-info, #auth-container button, #theme-toggle { display: none !important; }
    
    /* Afficher le Burger */
    .hamburger-menu-container { display: flex !important; align-items: center; }
    .hamburger-menu { cursor: pointer; padding: 10px; }
    .hamburger-menu span { height: 2px; width: 25px; background-color: #333; margin: 5px 0; display: block; }
    
    /* Conteneur Menu Mobile Déroulant */
    .mobile-menu { 
        position: fixed; top: 70px; left: 0; width: 100%; height: calc(100vh - 70px);
        background-color: #fff; border-bottom: 1px solid #e0e0e0; 
        z-index: 3000; display: none; padding: 1rem; overflow-y: auto; flex-direction: column;
    }
    .mobile-menu.open { display: flex !important; }
    
    /* Style des liens principaux */
    .mobile-menu .tab { 
        width: 100%; padding: 1rem 0; height: auto; 
        border-bottom: 1px solid #eee; font-size: 1.1rem; display: block; 
        color: #000; text-align: left;
    }
    
    /* --- CORRECTIF : Section Profil dans le menu --- */
    .mobile-profile-section {
        display: block !important; /* Force l'affichage */
        border-top: 1px solid #e0e0e0;
        margin-top: 10px;
        padding-top: 10px;
        width: 100%;
    }
    
    /* Style des liens profil (plus petits/gris) */
    .mobile-profile-section .tab {
        font-size: 0.9rem !important;
        color: #757575 !important;
        padding: 0.8rem 0 !important;
        border-bottom: none;
    }
    
    /* Stack Search & Filtres (Vertical) */
    #forecastSearchContainer, #forecastFilterBar { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
    #forecastFilterBar .control-group { width: 100%; min-width: 0 !important; }
    #forecastFilterBar .control-group div[style*="display:flex"] { display: grid !important; grid-template-columns: 1fr auto auto auto; gap: 5px; }

    /* Viewer & Graph */
    .top-controls-container { flex-direction: column !important; align-items: stretch !important; }
    #pilotGraph { min-height: 400px; }
    
    /* Planificateur Mobile (Vertical) */
    #toolFlightPlanner .controls-grid { display: flex !important; flex-direction: column !important; }
    #toolFlightPlanner .controls-grid > div { width: 100%; }
    
    /* Toggle VOL/FIN pleine largeur */
    .planner-toggle-group { width: 100%; }
    .planner-toggle-btn { flex: 1; text-align: center; }
    
    /* Carte réduite sur mobile */
    #flightPlannerMapContainer { height: 45vh; min-height: 300px; }
}
/* --- RESPONSIVE MES LIEUX --- */
@media (max-width: 768px) {
    .responsive-controls {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    .responsive-controls > button {
        width: 100%;
    }
    
    /* Tableaux scrollables sur mobile */
    #locations-list-container table {
        min-width: 600px; /* Force le scroll horizontal si le tableau est large */
    }
    
    /* Ajustement hauteur carte mes lieux */
    #locations-map-container {
        height: 50vh !important;
    }
    
    /* Ajustement grille import */
    .import-params-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* CORRECTIF RECHERCHE */
#forecastSearchResults {
    z-index: 20000 !important; /* Au-dessus de tout */
    background-color: white !important;
    color: black !important;
    border: 1px solid #ccc;
    max-height: 300px;
    overflow-y: auto;
}

/* S'assurer que le texte est visible */
.item-main-text { color: #000 !important; font-weight: 600; }
.item-sub-text { color: #666 !important; }

/* ==================================================================
   🛠️ PATCH OPTIMISATION (Z-Index & Mobile UX)
   ================================================================== */

/* 1. CORRECTION Z-INDEX (Couches)
   L'ordre doit être : Base < Header < Menu Mobile < Modal < Toast
*/
header.top-bar { z-index: 1000 !important; }        /* Niveau 1 : Barre de nav */
.mobile-menu { z-index: 1100 !important; }          /* Niveau 2 : Menu déroulant */
.autocomplete-list { z-index: 1200 !important; }    /* Niveau 3 : Recherche */

/* Les Modals doivent être AU-DESSUS de tout le reste */
.modal { z-index: 9999 !important; }                /* Niveau Max */
#toast-container { z-index: 10000 !important; }     /* Notification Ultime */


/* 2. OPTIMISATION MOBILE (Planificateur)
   Au lieu d'une longue liste verticale, on met les inputs côte à côte
*/
@media (max-width: 768px) {
    /* Grille compacte pour les outils */
    #toolFlightPlanner .controls-grid, 
    #derive .controls-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important; /* 2 colonnes forcées */
        gap: 10px !important;
    }

    /* Exceptions : Les éléments qui doivent rester larges */
    .control-group-full, 
    #toolFlightPlanner button[onclick="planFlight()"] { 
        grid-column: 1 / -1; /* Prend toute la largeur */
        width: 100%;
    }
    
    /* Boutons plus gros pour le tactile */
    .btn-outline, .planner-toggle-btn {
        padding: 12px 10px; /* Zone de touche agrandie */
    }
}

/* 3. CONFORT VISUEL */
/* Croix de fermeture plus accessible */
.close-btn {
    font-size: 2.5rem;
    line-height: 2.5rem;
    padding: 0 10px;
    color: var(--c-text-muted);
}

/* Ombres plus douces pour les cartes */
.admin-card, .modal-content {
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

/* --- MODAL ÉDITION LIEU COMPACT --- */

/* Conteneur principal plus large sur PC */
.modal-compact {
    max-width: 800px !important;
    padding: 1.5rem !important;
    width: 95% !important;
}

/* Layout Split (PC) */
.modal-body-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

/* CARTE */
#editorMapWrapper {
    height: 250px;
    width: 100%;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    overflow: hidden;
}
#editorMap { height: 100%; width: 100%; }

/* Bouton Map Switcher (Overlay) */
.map-overlay-btn {
    position: absolute;
    top: 10px; right: 10px;
    z-index: 1000;
    background: white;
    border: 1px solid #ccc;
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.search-bar-compact { display: flex; gap: 5px; margin-bottom: 5px; }
.coords-row { display: flex; gap: 5px; margin-top: 5px; }
.coords-row input { flex: 1; font-size: 0.8rem; padding: 4px; }

/* FORMULAIRE (Grille dense) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 10px; /* Row Gap / Column Gap */
}

.control-group label { margin-bottom: 2px; font-size: 0.7rem; }
.compact-input { padding: 6px !important; font-size: 0.85rem !important; height: 32px; }
textarea.compact-input { height: auto; }

.full-width { grid-column: 1 / -1; }

.btn-save-compact {
    width: 100%; margin-top: 15px; padding: 10px;
    background-color: var(--c-primary); color: white; border: none;
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    .modal-compact { padding: 1rem !important; margin: 10px auto; max-height: 95vh; overflow-y: auto; }
    
    .modal-body-split {
        grid-template-columns: 1fr; /* Empilement */
        gap: 15px;
    }
    
    /* Carte plus petite sur mobile pour gagner de la place */
    #editorMapWrapper { height: 180px; }
    
    /* Inputs plus gros pour le doigt */
    .compact-input { height: 40px; font-size: 16px !important; /* Evite zoom iOS */ }
}

/* --- CORRECTION BOUTON CARTE (Visibilité) --- */
.map-overlay-btn {
    position: absolute;
    top: 10px; 
    right: 10px;
    z-index: 1000;
    
    background: #ffffff;
    color: #333333 !important; /* Force le texte en noir/gris */
    border: 1px solid #cccccc;
    border-radius: 4px; /* Un peu plus joli */
    
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background 0.2s;
}

.map-overlay-btn:hover {
    background: #f0f0f0;
    color: #000000 !important;
}

/* --- MODERNISATION HEADER & TABS --- */
.tab {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--c-text-muted);
    transition: all 0.3s ease;
    padding: 0 5px;
    position: relative;
    opacity: 0.7;
}

.tab:hover {
    color: var(--c-text);
    opacity: 1;
}

.tab.active {
    color: var(--c-primary);
    border-bottom: none; /* On enlève la ligne basique */
    opacity: 1;
}

/* Petit point moderne sous l'onglet actif */
.tab.active::after {
    content: '';
    position: absolute;
    bottom: 18px; /* Ajustez selon la hauteur du header */
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background-color: var(--c-primary);
    border-radius: 50%;
}

/* Badge BETA */
.beta-badge {
    font-family: var(--font-family-sans);
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--c-danger);
    background: rgba(220, 53, 69, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.05em;
}

/* --- MODERNISATION SEARCH (Plus petit, plus haut) --- */
#forecastSearchContainer .control-group {
    max-width: 500px; /* Largeur réduite */
    width: 100%;
}

.search-wrapper input {
    height: 48px; /* Plus haut */
    border-radius: 8px !important; /* Coins arrondis modernes */
    padding-left: 42px !important;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    border: 1px solid #ddd;
    transition: all 0.2s ease;
}

.search-wrapper input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.search-icon {
    width: 18px !important;
    height: 18px !important;
    left: 14px;
    color: #999;
}

/* --- MINI FOOTER --- */
.app-mini-footer {
    text-align: center;
    font-size: 0.7rem;
    color: var(--c-text-muted);
    padding: 2rem 0 1rem;
    margin-top: auto;
    width: 100%;
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* --- FIX TOAST (Notification qui reste) --- */
#toast-container {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, bottom 0.5s ease;
}
#toast-container.show {
    opacity: 1;
    visibility: visible;
}

/* --- MODERNISATION MOTEUR RECHERCHE (Search) --- */

/* 1. Conteneur principal centré */
#forecastSearchContainer {
    display: flex;
    justify-content: center; /* Centre horizontalement */
    align-items: center;     /* Centre verticalement */
    gap: 10px;               /* Espace entre Input et Bouton */
    max-width: 600px;        /* Largeur max pour ne pas être trop étiré */
    margin: 2rem auto;       /* Centré dans la page avec marge haut/bas */
    width: 100%;
    padding: 0 20px;         /* Marge de sécurité mobile */
}

/* 2. Le champ de recherche (Input) */
#forecastSearchContainer .control-group {
    flex-grow: 1;            /* Prend toute la place dispo */
    margin-bottom: 0;        /* Reset marges */
    position: relative;
    z-index: 2000;           /* Pour que la liste passe au-dessus */
}

/* On cache le label "Lieu ou Base" qui n'est plus nécessaire visuellement */
#forecastSearchContainer label {
    display: none;
}

/* Style de l'input */
.search-wrapper input {
    height: 50px;
    border-radius: 25px !important; /* Forme pilule moderne */
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* Ombre douce */
    padding-left: 45px !important;
    font-size: 1rem;
    width: 100%;
}
.search-wrapper input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Loupe */
.search-icon {
    left: 18px;
    width: 18px !important;
    height: 18px !important;
    color: #999;
}

/* 3. Le bouton GPS (Minimaliste) */
#forecastSearchContainer .btn-outline {
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;      /* Rond parfait */
    border: 1px solid #e0e0e0; /* Bordure très fine (ou 'none' si vous préférez sans) */
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 0; /* Reset marge */
}

/* Effet au survol */
#forecastSearchContainer .btn-outline:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    border-color: var(--c-primary);
    color: var(--c-primary);
    background: white;
}

/* Retirer le label vide au-dessus du bouton GPS */
#forecastSearchContainer .control-group:last-child label {
    display: none;
}

/* LISTE RÉSULTATS (Ajustement largeur) */
#forecastSearchResults {
    border-radius: 16px;
    margin-top: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    border: none;
    overflow: hidden; /* Coins arrondis */
}

/* --- TABLEAU PREVISION MODERNISÉ --- */

/* 1. En-têtes sobres */
#dataTable th {
    background-color: #ffffff; /* Fond blanc */
    color: #000000;            /* Texte Noir */
    font-weight: 400;          /* Pas de gras (Regular) */
    border-bottom: 2px solid #000; /* Ligne noire marquée */
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: bottom;
}

/* 2. Zébrure (Lignes alternées) */
#dataTable tbody tr:nth-child(odd) {
    background-color: #ffffff;
}
#dataTable tbody tr:nth-child(even) {
    background-color: #f9f9f9; /* Gris très clair */
}
#dataTable tbody tr:hover {
    background-color: #f0f0f0; /* Highlight au survol */
}

/* 3. Style des petites unités */
.unit-label {
    font-size: 0.65em;
    color: #999;
    margin-left: 2px;
    font-weight: normal;
}

/* 4. Cellule Humidité (Colorée) */
.hum-cell {
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-block;
    min-width: 35px;
    text-align: center;
}






/* ==================================================================
   🛠️ PATCH DESIGN GLOBAL & LAYOUT (Background, Footer, Search)
   ================================================================== */



main {
    flex: 1; /* Pousse le footer vers le bas */
    /* Fond blanc semi-transparent pour lire le texte sur les nuages si besoin */
    /* background: rgba(255, 255, 255, 0.5); optionnel */
}

/* Footer collé en bas */
.app-mini-footer {
    background: rgba(255, 255, 255, 0.9); /* Fond pour lisibilité */
    margin-top: auto;
}

/* 2. SEARCH (Résultats plus fins) */
.autocomplete-item {
    padding: 6px 14px !important; /* Hauteur réduite de moitié */
    font-size: 0.9rem;
}

.item-main-text {
    font-weight: 400 !important; /* Pas de gras */
}

/* Espace Badge - Nom */
.item-left-col {
    margin-right: 15px !important; /* Espace augmenté */
}

/* 3. SEARCH DESKTOP (Retour à la ligne) */
@media (min-width: 769px) {
    #forecastFilterBar {
        flex-wrap: wrap; /* Autorise le retour à la ligne */
    }
    
    /* Le bloc "Lieu sélectionné" prend toute la largeur (100%) */
    #forecastFilterBar .control-group:first-child {
        flex-basis: 100%;
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Les sélecteurs se mettent en dessous */
    #forecastFilterBar .control-group:not(:first-child) {
        flex-grow: 1;
    }
}

/* 4. MODAL CONFIG (Paysage 2 colonnes sur Desktop) */
@media (min-width: 769px) {
    /* Agrandir le modal pour le mode paysage */
    #display-settings-modal .modal-content {
        max-width: 700px !important; 
    }

    /* Le corps du modal devient une grille */
    #config-modal-grid {
        display: grid;
        grid-template-columns: 1fr 1px 1fr; /* Gauche | Ligne | Droite */
        gap: 20px;
        align-items: start;
    }

    /* La ligne de séparation verticale */
    .modal-separator {
        width: 1px;
        height: 100%;
        background-color: #eee;
    }
    
    /* Ajustement hauteur liste drag & drop */
    #settings-drag-list {
        max-height: 400px !important; /* Plus de place */
    }
}