/* ============================================================
   4. PAGES.CSS - Styles Spécifiques (Search, Maps, Tools)
   ============================================================ */

/* --- TABLEAUX DE DONNÉES --- */
.table-container { overflow-x: auto; border: 1px solid var(--c-border); border-radius: 4px; margin-top: 0; max-height: 70vh; background-color: var(--c-surface); border-top: none; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; text-align: center; background-color: var(--c-bg); }
th { position: sticky; top: 0; z-index: 10; padding: 10px 4px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 2px solid var(--c-primary); color: var(--c-text); background-color: var(--c-surface); white-space: nowrap; vertical-align: middle; cursor: pointer; }
.th-content { display: flex; justify-content: center; align-items: baseline; gap: 3px; width: 100%; }
.unit-block { font-size: 0.65rem; color: var(--c-text-muted); text-transform: none; font-weight: normal; opacity: 0.8; margin-left: 0; }
th:hover { background-color: var(--c-surface); }
td { padding: 8px 4px; border-bottom: 1px solid var(--c-border); color: var(--c-text); white-space: nowrap; vertical-align: middle; text-align: center; }
tr:last-child td { border-bottom: none; }
tbody tr:nth-child(odd) { background-color: var(--c-bg); }
tbody tr:nth-child(even) { background-color: var(--c-surface); }
tbody tr:hover { background-color: rgba(0, 0, 0, 0.05); }
.dir-cell { display: flex; align-items: center; justify-content: center; gap: 4px; }
.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: 700; font-size: 0.9rem; }
.hum-cell { border-radius: 4px; padding: 2px 6px; display: inline-block; min-width: 30px; font-weight: 500; text-shadow: 0 1px 2px rgba(0,0,0,0.1); }

/* Analyse */
#analysisTable { border-collapse: separate; border-spacing: 0; width: 100%; }
#analysisTable th, #analysisTable td { border-right: 1px solid var(--c-border); border-bottom: 1px solid var(--c-border); padding: 8px 4px; text-align: center; vertical-align: middle; }
.an-cell-alt { font-weight: bold; background-color: var(--c-surface); color: var(--c-text); font-size: 0.8rem; border-right: 2px solid var(--c-border) !important; }
.an-header-sub { font-size: 0.65rem; text-transform: uppercase; color: var(--c-text-muted); margin-bottom: 2px; }
.an-header-main { font-size: 0.9rem; font-weight: 700; color: var(--c-text); }
.an-cell-data { font-size: 0.85rem; line-height: 1.2; }

/* --- MAPS --- */
#finMapContainer, #deriveMapContainer, #flightPlannerMapContainer, #forecastMap, #editorMap, #locations-map-container, #importMap { height: 30vh; min-height: 400px; width: 100%; margin-top: 1.5rem; border: 1px solid var(--c-border); background-color: var(--c-map-bg); position: relative; transition: opacity 0.3s ease; }

/* TRANSPARENCE MAP (Correction: fond seulement) */
.map-transparent .leaflet-tile-pane {
    opacity: 0.4 !important;
    filter: grayscale(100%);
}
.map-transparent .leaflet-overlay-pane,
.map-transparent .leaflet-marker-pane,
.map-transparent .leaflet-tooltip-pane,
.map-transparent .leaflet-popup-pane {
    opacity: 1 !important;
}

#locations-map-container { border-radius: var(--border-radius); }
#pilotGraph { min-height: 650px; margin: 0; }
[data-theme="windview"] .leaflet-layer { filter: invert(100%) hue-rotate(180deg) brightness(90%) contrast(85%) !important; }
[data-theme="windview"] .leaflet-popup-content-wrapper, [data-theme="windview"] .leaflet-control, [data-theme="windview"] .custom-marker, [data-theme="windview"] .custom-poi-icon { filter: invert(100%) hue-rotate(180deg); }

/* Flight Planner & OACI */
#flightPlannerResult, #finStartPointResult, #deriveResult { margin-top: 1.5rem; padding: 1.5rem; background-color: var(--c-surface); border: 1px solid var(--c-border); }
.flight-summary-row { display: flex; flex-direction: row; justify-content: space-between; gap: 10px; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #eee; flex-wrap: wrap; }
.flight-summary-item { flex: 1; text-align: center; padding: 8px; border-radius: 6px; background: #f9f9f9; border: 1px solid #eee; min-width: 100px; }
.fs-low { color: #007bff; font-weight: 600; }
.fs-mix { color: #28a745; font-weight: 700; font-size: 1.05em; border:1px solid #28a745; background:#e8f5e9; }
.fs-high { color: #dc3545; font-weight: 600; }
.planner-toggle-group { display: flex; border: 2px solid #000; border-radius: 6px; overflow: hidden; }
.planner-toggle-btn { border: none; padding: 8px 16px; font-weight: 700; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; text-transform: uppercase; }
.planner-toggle-btn.active { background-color: #000; color: #fff; }
.planner-toggle-btn.inactive { background-color: #fff; color: #000; }
.planner-toggle-btn.btn-xs { padding: 4px 10px; font-size: 0.75rem; }
.airspace-filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; padding: 10px; background: #fcfcfc; border: 1px solid #eee; border-radius: 4px; }
.filter-cb-label { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; cursor: pointer; user-select: none; background: #fff; padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px; }
.filter-cb-label:hover { background: #f0f0f0; }
.filter-cb-label input { width: auto; 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); }

/* --- SEARCH PAGE --- */
#forecastSearchContainer { display: flex; flex-direction: row; justify-content: center; align-items: center; max-width: 600px; width: 100%; margin: 2rem auto 1.5rem; padding: 0 10px; gap: 10px; position: relative; z-index: 1001; }
#forecastSearchContainer .control-group.search-input-group { flex-grow: 1; width: auto; margin-bottom: 0; }
.search-wrapper { width: 100%; display: flex; align-items: center; position: relative; }
.search-wrapper input { width: 100% !important; height: 50px; border-radius: 25px !important; padding-left: 50px !important; padding-right: 20px !important; box-sizing: border-box; font-size: 1rem; border: 1px solid var(--c-border); background-color: var(--c-surface); }
.search-wrapper input:focus { border-color: var(--c-primary); box-shadow: 0 4px 15px rgba(0,0,0,0.1); outline: none; }
.search-icon { position: absolute; left: 15px; width: 22px !important; height: 22px !important; color: var(--c-text-muted); pointer-events: none; z-index: 10; }
#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; }
.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; 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; }
.item-left-col { flex-shrink: 0; width: 24px; margin-right: 15px; display: flex; align-items: center; justify-content: center; }
.item-content { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
#forecastSearchContainer .btn-round { width: 50px; height: 50px; min-width: 50px; padding: 0; border-radius: 50%; border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text); box-shadow: 0 4px 12px rgba(0,0,0,0.05); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 1002; transition: transform 0.2s; }
#forecastSearchContainer .btn-round:hover { transform: scale(1.05); border-color: var(--c-primary); }
#forecastSearchContainer .btn-action { display: none; }
#btnSearchAction { color: var(--c-primary); }
#btnSearchCancel { color: var(--c-danger); }

#forecastFilterBar { display: none; flex-direction: column; gap: 15px; margin-bottom: 2rem; width: 100%; max-width: 600px; margin-left: auto; margin-right: auto; padding: 0 10px; }
#forecastFilterBar .control-group { width: 100%; display: flex; flex-direction: column; margin-bottom: 0; }
.hp-hours-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 250px; overflow-y: auto; }
.hp-days-row { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 5px; border-bottom: 1px solid var(--c-border); }
.hp-day-item { padding: 5px 10px; background: var(--c-surface); border: 1px solid var(--c-border); cursor: pointer; font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; border-radius: 4px; }
.hp-day-item.active { background: var(--c-primary); color: var(--c-text-on-primary); border-color: var(--c-primary); }
.hp-hour-item { padding: 10px; text-align: center; background: var(--c-bg); border: 1px solid var(--c-border); cursor: pointer; font-size: 0.9rem; border-radius: 8px; font-weight: 500; transition: all 0.2s; }
.hp-hour-item:hover { border-color: var(--c-primary); background-color: rgba(0,0,0,0.02); }
.hp-hour-item.selected { background: var(--c-primary); color: var(--c-text-on-primary); }
#forecastFilterBar #okBtn { width: 100%; height: 50px; border-radius: 25px; font-size: 1.1rem; text-transform: uppercase; letter-spacing: 1px; }

/* DARK MODE FIXES SEARCH */
html:not(.dark) .search-wrapper input, html:not(.dark) .input-pill-style, html:not(.dark) .picker-trigger { background-color: #ffffff !important; border-color: var(--c-border); color: #000000 !important; }
html:not(.dark) #forecastSearchContainer .btn-round { background-color: #ffffff; color: #000000; }
html.dark .search-wrapper input, html.dark .input-pill-style, html.dark .picker-trigger { background-color: #2a2a2a !important; border-color: #444; color: #ffffff !important; }
html.dark #forecastSearchContainer .btn-round { background-color: #2a2a2a; border-color: #444; color: #ffffff; }
html.dark .search-icon { color: #aaa; }

/* PAGE SEARCH : SÉLECTEUR 2 ÉTAPES */
#dayPickerContainer {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 10px;
    justify-content: center; /* Centré par défaut */
    border-bottom: 1px dashed var(--c-border);
    /* Gestion > 7 jours sur 2 lignes */
    flex-wrap: wrap; 
}

#hourPickerContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    min-height: 40px;
}

.hour-hidden-group {
    display: none; /* Masqué par défaut */
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    padding-top: 10px;
}
.hour-hidden-group.show { display: flex; }

/* Bouton [+] pour les heures */
.btn-expand-hours {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--c-text-muted);
}
.btn-expand-hours:hover { color: var(--c-primary); border-color: var(--c-primary); }

/* GESTIONNAIRE DE MODÈLES (DRAG & DROP) */
.manager-list-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface);
}

.model-manager-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-border);
    transition: background 0.2s;
}

.model-manager-item:last-child { border-bottom: none; }

.model-manager-item.dragging {
    opacity: 0.5;
    background: #e3f2fd;
    border: 1px dashed var(--c-primary);
}

.mm-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

.mm-handle {
    cursor: grab;
    color: var(--c-text-muted);
    font-size: 1.2rem;
    padding: 5px;
}
.mm-handle:active { cursor: grabbing; }

.mm-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.mm-name { font-weight: 700; font-size: 0.9rem; }
.mm-desc { font-size: 0.75rem; color: var(--c-text-muted); }

/* Model Selector specific */
.model-selector-container { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; justify-content: center; }
.model-group-title { width: 100%; font-size: 0.7rem; color: var(--c-text-muted); margin: 5px 0 2px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; text-align: left; padding-left: 5px; }

/* VIEWER FILTERS */
.viewer-filters-container { display: flex; flex-direction: row; flex-wrap: nowrap; gap: 15px; align-items: flex-end; background-color: var(--c-surface); padding: 10px 15px; border: 1px solid var(--c-border); border-radius: 4px; margin-bottom: 1rem; }
.filter-group { flex: 1; display: flex; flex-direction: column; }
.filter-select { width: 100%; padding: 8px; border: 1px solid var(--c-border); background-color: var(--c-bg); color: var(--c-text); font-size: 0.9rem; height: 38px; }
#btnMobileFilter { display: none; }
@media (max-width: 768px) {
    .viewer-filters-container { display: none; }
    #btnMobileFilter { display: flex; align-items: center; justify-content: center; background: var(--c-surface); border: 1px solid var(--c-border); padding: 8px 12px; border-radius: 4px; font-size: 0.9rem; cursor: pointer; margin-bottom: 1rem; width: 100%; }
    #mobileFiltersBody { display: flex; flex-direction: column; gap: 15px; }
}
#mobile-filter-modal { display: none; position: fixed; z-index: 3000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); backdrop-filter: blur(2px); align-items: flex-end; justify-content: center; }
#mobile-filter-modal .modal-content { width: 100%; max-width: 100%; margin: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-top-left-radius: 16px; border-top-right-radius: 16px; padding: 20px; animation: slideUp 0.3s ease-out; }

/* Display Settings */
#display-settings-modal .modal-content { max-width: 400px; padding: 1.5rem; width: 95%; }
#config-modal-grid { display: flex; flex-direction: column; gap: 1.5rem; }
@media (min-width: 768px) { #config-modal-grid { display: grid !important; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; } #display-settings-modal .modal-content { max-width: 900px !important; width: 90%; } }
#display-settings-modal h3 { font-size: 0.9rem; border-bottom: 1px solid var(--c-border); margin-bottom: 15px; padding-bottom: 5px; margin-top: 0; font-weight: 600; text-transform: uppercase; }
#settings-drag-list { list-style: none; padding: 0; margin: 0; max-height: 400px; overflow-y: auto; }
.settings-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--c-border); background-color: var(--c-bg); transition: transform 0.2s, box-shadow 0.2s; font-size: 0.85rem; }
.settings-left { display: flex; align-items: center; flex-grow: 1; }
.settings-right { display: flex; align-items: center; gap: 10px; }
.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; }
.settings-item.dragging { opacity: 0.5; background: var(--c-surface); border: 1px dashed var(--c-primary); }

/* Weather Detail */
.weather-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 15px; }
.wd-item { background: var(--c-surface); padding: 10px; border-radius: 6px; border: 1px solid var(--c-border); text-align: center; }
.wd-label { font-size: 0.7rem; text-transform: uppercase; color: var(--c-text-muted); display: block; margin-bottom: 4px; }
.wd-value { font-size: 1rem; font-weight: 600; color: var(--c-text); }
#weather-modal-header { text-align: center; border-bottom: 1px solid var(--c-border); padding-bottom: 15px; margin-bottom: 20px; }
#weather-modal-header h3 { margin: 0; font-size: 1.5rem; color: var(--c-text); }

/* SÉLECTEUR D'HEURES (4 COLONNES) - Sun Info */
.sun-info-bar { display: flex; justify-content: space-between; width: 100%; margin-bottom: 10px; font-size: 0.85rem; color: var(--c-text-muted); background: var(--c-bg); padding: 8px 12px; border-radius: 6px; border: 1px solid var(--c-border); }
.sun-time-item { display: flex; align-items: center; gap: 6px; }
.periods-container { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; width: 100%; }
.period-block { display: flex; flex-direction: column; gap: 8px; background: var(--c-surface); padding: 10px; border-radius: 8px; border: 1px solid var(--c-border); }
.period-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; color: var(--c-text-muted); text-align: center; border-bottom: 1px solid var(--c-border); padding-bottom: 5px; margin-bottom: 5px; }
.hours-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 600px) { .periods-container { grid-template-columns: 1fr; } }

/* Cacher le bouton GO */
#okBtn { display: none !important; }

/* --- PATCH PAGES --- */
.view-content.active {
    display: block !important;
    animation: fadeIn 0.3s ease;
}

#flightPlannerMapContainer { 
    height: 45vh; 
    min-height: 300px; 
    width: 100%; 
    margin-top: 10px; 
    border: 1px solid var(--c-border); 
    background-color: var(--c-map-bg); 
    position: relative; 
}

/* Style du Toggle VOL/FIN sur la carte */
.map-toggle-control {
    background: white;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    background-clip: padding-box;
    display: flex;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    cursor: pointer;
}

.map-toggle-btn {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    background: #fff;
    border: none;
    border-right: 1px solid #ccc;
    cursor: pointer;
}
.map-toggle-btn:last-child { border-right: none; }
.map-toggle-btn:hover { background-color: #f4f4f4; }

.map-toggle-btn.active {
    background-color: #000;
    color: #fff;
}

/* --- LEAFLET CUSTOM CONTROLS --- */
.custom-map-control {
    background: white;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    background-clip: padding-box;
    box-shadow: none; /* On enlève l'ombre par défaut de leaflet pour utiliser la nôtre */
}

/* Ajustement du groupe de boutons quand il est dans la carte */
.leaflet-control .planner-toggle-group {
    border: 2px solid #000;
    border-radius: 4px;
    background: white;
    overflow: hidden;
    display: flex;
}

.leaflet-control .planner-toggle-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    border: none;
    border-right: 1px solid #000;
    border-radius: 0;
}
.leaflet-control .planner-toggle-btn:last-child {
    border-right: none;
}

/* Style pour transformer l'input en titre élégant */
input#cityName.viewer-city-title {
    font-family: 'Playfair Display', serif; /* Ou votre police de titre */
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--c-text);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

input#cityName.viewer-city-title::placeholder {
    color: var(--c-text-muted);
    opacity: 0.5;
}

input#cityName.viewer-city-title:focus {
    border-bottom: 1px solid var(--c-border);
}

/* --- HISTORY TABLES (DESIGN GROUPÉ) --- */

.history-group-row {
    transition: background-color 0.2s;
    cursor: pointer;
}

.history-group-row:hover {
    background-color: rgba(0,0,0,0.03);
}

/* Colonne Date */
.col-date {
    white-space: nowrap;
    width: 100px;
    text-align: right;
    border-right: 1px solid var(--c-border);
    padding-right: 15px !important;
}
.row-date-main {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--c-primary);
    text-transform: capitalize;
}
.row-date-year {
    display: block;
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

/* Colonne Ville */
.col-city {
    width: 140px;
    text-align: left;
    padding-left: 15px !important;
}
.row-city-name {
    display: block;
    font-weight: 600;
    font-size: 1rem;
}
.row-count-badge {
    display: inline-block;
    font-size: 0.7rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--c-text-muted);
    margin-top: 2px;
}

/* Colonne Modèles (Grille de badges) */
.col-models {
    text-align: left !important;
}
.models-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.model-badge-item {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.model-badge-item:hover {
    border-color: var(--c-accent, #007acc);
    background-color: #f0f7ff;
    transform: translateY(-1px);
}

.mb-time {
    font-weight: 700;
    margin-right: 6px;
    color: var(--c-primary);
}
.mb-name {
    color: var(--c-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Dark Mode Adjustments */
html.dark .model-badge-item {
    background: #2a2a2a;
    border-color: #444;
}
html.dark .model-badge-item:hover {
    background: #333;
    border-color: #666;
}
html.dark .history-group-row:hover {
    background-color: rgba(255,255,255,0.05);
}

/* Colonne Actions */
.col-actions {
    width: 50px;
    text-align: center;
}
.btn-icon {
    border: none;
    font-size: 1.1rem;
    opacity: 0.6;
    cursor: pointer;
}
.btn-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* --- HISTORY FILTERS (Alignement Horizontal) --- */
.history-header-controls {
    margin-bottom: 20px;
    background: var(--c-surface);
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--c-border);
}

.filters-container {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    align-items: center;
    /* Force l'alignement sur une ligne */
    flex-wrap: nowrap; 
}

.filter-group {
    flex: 1; /* Chaque input prend 50% de l'espace */
    display: flex;
    gap: 5px;
    position: relative;
}

.filter-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 0.9rem;
}

/* --- HISTORY TABLE (NOUVEAU DESIGN) --- */

/* Badge Date (Carré arrondi sur 2 lignes) */
.date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 6px 10px;
    width: fit-content;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.date-badge-day {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--c-primary);
}

.date-badge-month {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--c-text-muted);
    margin-top: 2px;
    font-weight: 600;
}

/* Badge Heure (Simple) */
.time-tag {
    display: inline-block;
    background: #eef6fc;
    color: #1d72b8;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 2px;
    border: 1px solid rgba(29, 114, 184, 0.2);
}

/* Badge Modèle (Coloré) */
.model-tag {
    display: inline-block;
    background: #f0f0f0;
    color: #444;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin: 2px;
    border: 1px solid #ddd;
    font-weight: 500;
}

/* Ajustement des colonnes */
.history-table td { vertical-align: middle; }
.col-date { width: 90px; }
.col-city { font-weight: 600; font-size: 1rem; }
.col-hours { width: 20%; }
.col-models { width: 20%; }
.col-actions { width: 50px; text-align: center; }

/* Responsive Mobile : On empile si l'écran est trop petit */
@media (max-width: 600px) {
    .filters-container { flex-wrap: wrap; }
    .filter-group { min-width: 100%; }
}

/* --- HISTORY TABLE --- */

/* Badge Date (Carré arrondi sur 3 lignes) */
.date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 6px 8px; /* Un peu moins de padding latéral */
    width: fit-content;
    min-width: 65px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.date-badge-day {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--c-primary);
}

.date-badge-month {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--c-text-muted);
    margin-top: 2px;
    font-weight: 600;
    line-height: 1;
}

/* NOUVEAU : Année */
.date-badge-year {
    font-size: 0.65rem;
    color: #999;
    margin-top: 2px;
    font-weight: 400;
}

/* --- VUE TENDANCE --- */
.trend-section { margin-bottom: 20px; }
.trend-title { font-size: 0.8rem; text-transform: uppercase; color: var(--c-text-muted); margin-bottom: 5px; }

/* Grille Nuages */
.cloud-grid {
    display: grid;
    grid-template-columns: 80px repeat(24, 1fr);
    /* On ajuste la grille pour qu'elle s'adapte au contenu */
    grid-auto-rows: 30px; 
    gap: 0;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    margin-bottom: 5px;
    position: relative; /* Important pour le canvas absolu */
    background: #fff; /* Fond blanc par défaut */
    overflow: hidden;
}

.cloud-background-canvas {
    position: absolute;
    left: 80px;  /* Largeur de la colonne Label */
    top: 30px;   /* Hauteur de la ligne En-tête */
    right: 0;
    bottom: 0;
    width: calc(100% - 80px);
    height: calc(100% - 30px);
    pointer-events: none; /* Laisse passer les clics */
    z-index: 1;
    image-rendering: auto; /* Force le lissage du navigateur */
}

.cloud-cell {
    position: relative;
    z-index: 2; /* Au-dessus du canvas */
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important; /* On force la transparence */
}

.cloud-data-cell.hover-sync {
    box-shadow: inset 0 0 0 2px #ff9800; /* Cadre Orange */
    z-index: 10;
}
.cloud-data-cell.hover-sync::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 50%;
    width: 1px;
    background: rgba(255, 152, 0, 0.5); /* Ligne verticale subtile */
}

.cloud-label {
    background: var(--c-surface) !important; /* Les labels restent opaques */
    z-index: 3;
    font-weight: 600;
    padding-left: 8px;
    justify-content: flex-start;
    border-right: 1px solid var(--c-border);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    color: var(--c-text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
}

.cloud-data-value {
    opacity: 0;
    font-size: 0.6rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    pointer-events: none;
    transition: opacity 0.2s;
}
.cloud-data-cell:hover .cloud-data-value,
.cloud-data-cell.hover-sync .cloud-data-value { opacity: 1; }


.cloud-fill {
    width: 100%; height: 100%;
    background-color: #555; /* Gris nuage */
    transition: opacity 0.2s;
}

.cloud-data-cell { cursor: crosshair; }
.cloud-data-cell.hover-sync { box-shadow: inset 0 0 0 2px #ff9800; }
.cloud-data-cell.hover-sync::after {
    content: ''; position: absolute; top:0; bottom:0; left:50%; width:1px; background:rgba(255,152,0,0.5);
}

/* Barre Jour/Nuit */
.daynight-container {
    display: flex;
    height: 30px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
    border: 1px solid var(--c-border);
}
.dn-hour {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    border-right: 1px solid rgba(255,255,255,0.1);
}
.dn-night { background-color: #2c3e50; color: #aaa; }
.dn-day { background-color: #f1c40f; color: #333; } /* Jaune jour */
.dn-twilight { background-color: #e67e22; color: white; } /* Orange crépuscule */

.sun-times-labels {
    text-align: center;
    font-size: 0.8rem;
    color: var(--c-text-muted);
    margin-top: 5px;
    font-weight: 600;
}

/* --- TENDANCE V6 (Switch & Advanced) --- */

/* 1. Le Switch Tableau / Graphique */
.trend-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    background: var(--c-bg);
    padding: 5px;
    border-radius: 8px;
    border: 1px solid var(--c-border);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.trend-switch-btn {
    padding: 6px 15px;
    border: none;
    background: transparent;
    color: var(--c-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}
.trend-switch-btn.active {
    background: var(--c-primary); /* Bleu */
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 2. Tableau Complet (Grid) */
.trend-full-table {
    display: grid;
    grid-template-columns: 80px repeat(24, 1fr); /* Label réduit à 80px pour laisser place aux data */
    border: 1px solid var(--c-border);
    border-radius: 8px;
    overflow-x: auto;
    background: #fff;
    margin-bottom: 20px;
    font-family: var(--font-family-sans);
    /* Ombre subtile pour le relief */
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.tf-cell.col-hover {
    background-color: rgba(0, 0, 0, 0.05) !important; /* Gris léger au survol */
    /* On garde la couleur de fond si c'est le header jour/nuit, on assombrit juste un peu */
    filter: brightness(0.95); 
}

/* --- Menu Contextuel Tendance --- */
#trend-context-menu {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ccc; /* Bordure légère */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); /* Ombre portée */
    border-radius: 6px;
    z-index: 9999;
    min-width: 150px;
    overflow: hidden; /* Pour que les coins arrondis coupent le contenu */
}

.ctx-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #333;
    transition: background 0.1s;
    background: white;
    border-bottom: 1px solid #f5f5f5; /* Petit séparateur */
}

.ctx-item:hover {
    background-color: #e3f2fd; /* Bleu très clair au survol */
    color: #1976d2; /* Bleu plus foncé */
}

.ctx-item:last-child {
    border-bottom: none;
}

.tf-row { display: contents; } /* Permet aux enfants d'être dans la grille parente */

.tf-cell {
    padding: 8px 2px; /* Plus d'espace vertical */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border-right: 1px solid rgba(0,0,0,0.03); /* Séparateur très léger */
    position: relative;
    min-width: 32px; /* Cellules un peu plus larges */
    transition: background-color 0.1s;
}

/* Colonne de gauche (Labels) */
.tf-label {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 20; /* Au-dessus du reste */
    align-items: flex-start;
    padding-left: 10px;
    font-weight: 700;
    color: var(--c-text);
    border-right: 2px solid rgba(0,0,0,0.05); /* Séparation plus nette */
    font-size: 0.7rem;
}
.tf-sublabel {
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--c-text-muted);
    margin-top: 3px;
}   
/* Ligne Nuage (Spéciale avec Canvas) */
.tf-cloud-container {
    grid-column: 2 / -1; /* Prend toute la largeur sauf label */
    height: 90px; /* 3 lignes de 30px */
    position: relative;
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    grid-template-rows: repeat(3, 1fr);
}
.tf-cloud-bg-canvas {
    position: absolute; top:0; left:0; width:100%; height:100%; z-index: 1; pointer-events: none;
}
.tf-cloud-cell-overlay {
    z-index: 2;
    display: flex; align-items: center; justify-content: center;
    color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    font-size: 0.6rem; font-weight: bold;
}

/* Flèche Vent */
.wind-arrow-icon {
    width: 14px; height: 14px;
    transition: transform 0.3s;
    fill: var(--c-text);
}
.wind-text-cell {
    flex-direction: column;
    gap: 2px;
    font-size: 0.6rem;
}

/* 3. Popup Graphique Personnalisé (En haut) */
#custom-trend-tooltip {
    position: absolute;
    top: 55px; /* Juste sous les tabs */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 15px;
    border-radius: 20px; /* Arrondi */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid var(--c-border);
    display: flex;
    gap: 15px;
    z-index: 50;
    pointer-events: none; /* Ne gêne pas la souris */
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
}
.tt-time { font-weight: 700; color: var(--c-primary); border-right:1px solid #ddd; padding-right:10px; }
.tt-item { display: flex; align-items: center; gap: 5px; }


.tf-header-cell {
    height: 45px; /* Plus haut pour contenir l'heure du soleil */
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-weight: 700;
    color: #444;
}

/* Couleurs Header (Idem Graphique) */
.dn-day-bg { background-color: #fcf4c5; color: #555; }   /* Jaune pâle */
.dn-night-bg { background-color: #2c3e50; color: #fff; } /* Bleu nuit */
.dn-twilight-bg { background-color: #e67e22; color: #fff; } /* Orange */

.sun-time-mini {
    font-size: 0.55rem;
    margin-top: 2px;
    opacity: 0.8;
    white-space: nowrap;
}

/* PLUIE : Pastille Ronde */
.rain-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.65rem;
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* TOOLTIP Graphique (Style Popup) */
#custom-trend-tooltip {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.1);
    display: flex;
    gap: 15px;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    font-family: var(--font-family-sans);
    align-items: center;
}
.tt-time-box {
    background: var(--c-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
}
.tt-val { font-weight: bold; margin-left: 3px; }

/* 1. Header Tableau : Lisibilité au survol */
.tf-header-cell.col-hover {
    /* Quand surligné, on force une couleur de texte sombre pour le contraste */
    color: #000 !important; 
    background-color: #e0e0e0 !important; /* Gris un peu plus soutenu */
    font-weight: 800;
}
/* On garde l'orange visible même survolé */
.tf-header-cell.col-hover .sun-time-mini {
    color: #d35400; 
    font-weight: bold;
}

/* 2. Nuages : Cercles proportionnels */
.cloud-badge {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: bold;
    color: white;
    /* L'opacité sera gérée en JS, ici couleur de base */
    background-color: #1976d2; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 3. Tooltip Graphique (Fixe en haut) */
#custom-trend-tooltip {
    position: absolute;
    top: 10px; /* Collé en haut du conteneur relative */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 12px;
    border-radius: 6px; /* Boxing carré arrondi comme tableau */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid var(--c-border);
    display: flex;
    gap: 12px;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    font-size: 0.75rem;
    white-space: nowrap;
}
/* Entête Tooltip identique tableau */
.tt-header {
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    color: #333;
    margin-right: 5px;
}

/* Petit ajustement pour les unités dans les cases */
.tf-cell small {
    font-weight: normal;
    opacity: 0.7;
}

/* Header info au dessus du tableau */
.trend-header-info {
    display: flex;
    gap: 15px;
    padding: 8px 12px;
    background: #f1f3f4;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: #444;
}

/* Style de la colonne sélectionnée */
.tf-cell.col-selected {
    background-color: rgba(33, 150, 243, 0.1) !important; /* Bleu très pâle */
    border-left: 1px solid #90caf9;
    border-right: 1px solid #90caf9;
}

/* Boutons CTA dans le tableau */
.trend-cta-btn {
    display: block;
    width: 90%;
    margin: 2px auto;
    padding: 2px 0;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.cta-simu { color: #2e7d32; border-color: #a5d6a7; } /* Vert */
.cta-simu:hover { background: #e8f5e9; }

.cta-data { color: #0277bd; border-color: #81d4fa; } /* Bleu */
.cta-data:hover { background: #e1f5fe; }

.cta-graph { color: #c62828; border-color: #ef9a9a; } /* Rouge */
.cta-graph:hover { background: #ffebee; }

 .btn-add-sounding-hover { display: none; padding: 2px 8px; font-size: 0.9rem; font-weight: bold; color: white; background-color: var(--c-danger); border-radius: 4px; border: none; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.tf-cell:hover .btn-add-sounding-hover { display: inline-block; }

/* Boutons ronds Header */
.btn-round-icon {
    width: 36px; height: 36px; border-radius: 50%; border: 1px solid #eee;
    background: #fff; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #555; transition: all 0.2s;
}
.btn-round-icon:hover { background: #f5f5f5; color: #222; border-color: #ccc; }

/* Groupe Toggle Sub-nav (Simu/Data/Graph) */
.sub-view-toggle-group {
    display: flex; background: #f1f3f5; padding: 3px; border-radius: 20px;
}
.sv-toggle-btn {
    border: none; background: transparent; padding: 6px 16px;
    font-size: 0.8rem; font-weight: 600; color: #666;
    cursor: pointer; border-radius: 15px; transition: all 0.2s;
}
.sv-toggle-btn.active {
    background: #fff; color: #222; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.sv-toggle-btn:hover:not(.active) { color: #333; }



/* Chips Lieux Récents */
.history-chip {
    background: #fff; border: 1px solid #ddd; padding: 6px 12px;
    border-radius: 20px; font-size: 0.85rem; color: #444; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; gap: 5px;
    transition: all 0.2s;
}
.history-chip:hover { border-color: #aaa; background: #f5f5f5; }
.history-chip svg { color: #999; }

/* Boutons de navigation ronds (Header) */
/* CORRECTIF VISIBILITÉ BOUTONS RONDS */
.btn-nav-round {
    width: 40px; height: 40px; 
    border-radius: 50%; 
    border: 1px solid #ddd;
    background: #fff; 
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; 
    color: #555; /* <--- IMPORTANT : Donne la couleur gris foncé aux icônes */
    transition: all 0.2s;
}

/* Force la couleur du SVG */
.btn-nav-round svg {
    stroke: #555; 
    width: 20px; 
    height: 20px;
}

.btn-nav-round:hover {
    background: #f5f5f5;
    color: #333;
}

/* État Actif (Rouge) */
.btn-nav-round.active {
    background: #e74c3c; 
    border-color: #c0392b;
    color: white;
}
.btn-nav-round.active svg {
    stroke: white; /* L'icône devient blanche quand actif */
}

.vh-pill-display-sm {
    transition: background-color 0.2s ease, transform 0.1s;
}