/* =========================================
   1. RESET & VARIABLES (L'ADN du Design)
   ========================================= */
   :root {
    --bg-deep: #020617;       /* Fond profond (Slate 950) */
    --bg-card: rgba(30, 41, 59, 0.4); /* Fond des cartes semi-transparent */
    --primary: #22d3ee;       /* Cyan */
    --accent: #d946ef;        /* Magenta */
    --text-main: #f1f5f9;     /* Blanc cassé (plus doux) */
    --text-muted: #94a3b8;    /* Gris bleuté pour les sous-titres */
    --border-color: rgba(255, 255, 255, 0.08); /* Bordures très fines */
    --glass-blur: blur(12px); /* Effet de flou arrière-plan */
    --radius: 12px;           /* Arrondis modernes */
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3); /* Ombre portée douce */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    overflow: hidden; /* Empêche le scroll global, chaque section scrollera si besoin */
    height: 100vh;
    /* Un fond subtil avec un gradient radial pour donner de la profondeur */
    background: radial-gradient(circle at 15% 50%, rgba(34, 211, 238, 0.08), transparent 25%),
                radial-gradient(circle at 85% 30%, rgba(217, 70, 239, 0.08), transparent 25%),
                var(--bg-deep);
}

/* Scrollbar Custom (Très fine et discrète) */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

/* =========================================
   2. HEADER & NAVIGATION (Style "Dock")
   ========================================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px !important; /* Un peu plus haut pour l'élégance */
    padding: 0 30px;
    background: rgba(2, 6, 23, 0.8) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 1000;
}

.logo {
    font-weight: 300;
    font-size: 1.2rem;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.logo span {
    font-weight: 800;
    color: var(--text-main);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.main-nav {
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,0.03);
    padding: 6px;
    border-radius: 50px; /* Forme de pilule */
    border: 1px solid var(--border-color);
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 40px;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

/* =========================================
   3. LAYOUT & GRILLES (Dashboard Structure)
   ========================================= */
main {
    height: calc(100vh - 70px);
    width: 100%;
    position: relative;
    padding: 20px;
}

.view-section {
    display: none;
    height: 100%;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Grilles Responsive */
.dashboard-grid {
    display: grid;
    gap: 20px;
    height: 100%;
    width: 100%;
}

/* --- LAYOUT BIAIS & IA : GAUCHE (LARGE) / DROITE (COLONNE) --- */

/* 1. La Grille Principale */
.ia-grid-split {
    display: grid;
    /* LE SECRET EST ICI : 2.5fr pour la gauche (Large), 1fr pour la droite (Etroit) */
    /* Cela garantit que le nuage de points a ~70% de l'écran pour ne pas être écrasé */
    grid-template-columns: 2.5fr 1fr; 
    grid-template-rows: 100%; /* Toute la hauteur */
    gap: 20px;
    height: 100%;
    min-height: 0; /* Important pour Firefox */
}

/* 2. Le Panneau de Gauche (Nuage de points) */
.ia-grid-split > .dashboard-panel:first-child {
    height: 100%;
    display: flex;
    flex-direction: column;
    /* On s'assure qu'il ne déborde pas */
    min-width: 0; 
}

/* 3. La Colonne de Droite (Les 3 graphiques empilés) */
.split-bottom-row-3 {
    display: grid;
    /* Une seule colonne */
    grid-template-columns: 1fr; 
    /* 3 lignes égales les unes sous les autres */
    grid-template-rows: repeat(3, 1fr); 
    gap: 20px;
    height: 100%;
    min-height: 0;
}

/* Ajustement pour que les graphiques de droite restent lisibles */
.split-bottom-row-3 .dashboard-panel {
    padding: 15px; /* Un peu moins de padding pour gagner de la place */
}

.split-bottom-row-3 h2 {
    font-size: 0.8rem; /* Titres un peu plus petits à droite */
}
/* Grid Spécifique : Sémantique (50% / 50%) */
.semantic-grid {
    grid-template-columns: 1fr 1fr;
}

.right-column {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 20px;
}

/* Grid Spécifique : Culture */
.culture-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    height: calc(100% - 90px); /* Moins la barre de KPI */
}

/* =========================================
   4. PANNEAUX & CARTES (Glassmorphism)
   ========================================= */
.dashboard-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    /* Effet Glacé */
    backdrop-filter: var(--glass-blur); 
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
    position: relative;
}

.dashboard-panel:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.full-panel {
    width: 100%;
    height: 100%;
}

/* Entêtes des panneaux */
.panel-header {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.panel-header h2 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-main);
    font-weight: 600;
    display: flex;
    align-items: center;
}

/* Petit indicateur coloré avant le titre */
.panel-header h2::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 0 8px var(--primary);
}

.panel-subtitle {
    font-family: 'Inter', sans-serif;
    margin-top: 4px;
    font-size: 0.75rem !important;
    opacity: 0.7;
}

/* =========================================
   5. GRAPHIQUES & CONTENEURS
   ========================================= */
.strict-wrapper {
    flex-grow: 1;
    position: relative;
    width: 100%;
    min-height: 0; /* Crucial pour le resize */
}

.chart-container, .chart-container-2d {
    width: 100% !important;
    height: 100% !important;
}

/* Donut IA Center Text */
.relative-container { position: relative; }
.donut-center-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}
.donut-center-text span {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
}
.donut-center-text small {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =========================================
   6. ÉLÉMENTS D'INTERFACE (Boutons, Filtres)
   ========================================= */
.filter-bar, .year-selector {
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.filter-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0 8px;
    font-weight: 600;
}

.filter-chip, .year-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.filter-chip:hover, .year-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}

.filter-chip.active, .year-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* KPI BAR (Section Culture) */
.kpi-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    height: 80px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.kpi-card.highlight {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.1), rgba(2, 6, 23, 0.4));
    border-color: rgba(34, 211, 238, 0.3);
}

.kpi-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
}

/* =========================================
   7. PANEL LATÉRAL (Side Panel)
   ========================================= */
.details-panel {
    position: fixed;
    top: 70px; /* Sous le header */
    right: -360px; /* Caché */
    width: 350px;
    height: calc(100vh - 70px);
    background: rgba(15, 23, 42, 0.95); /* Plus opaque pour la lisibilité */
    border-left: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2000;
    padding: 25px;
    overflow-y: auto;
    box-shadow: -10px 0 40px rgba(0,0,0,0.5);
}

.details-panel.open { right: 0; }

.close-btn {
    position: absolute;
    top: 15px; right: 15px;
    background: none; border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}
.close-btn:hover { color: var(--text-main); }

.panel-header-content h2 {
    font-size: 1.4rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
}

.badges-row { display: flex; gap: 10px; margin-bottom: 25px; }
.badge-code { background: #334155; padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-family: monospace; }
.badge-trend { padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: bold; background: #334155; color: #fff; }
.trend-up { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.trend-down { background: rgba(244, 63, 94, 0.2); color: #fb7185; }

/* AI Analysis Card */
.ai-analysis-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
}

.ai-card-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
    font-size: 0.85rem; font-weight: 600; color: #e2e8f0;
}

.ai-progress-bar {
    height: 6px; background: rgba(255,255,255,0.1); border-radius: 10px; overflow: hidden; margin-bottom: 10px;
}
.ai-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); width: 0%; transition: width 1s ease; }
.ai-verdict { font-size: 0.8rem; line-height: 1.4; color: var(--text-muted); }

/* KPI Grid in Panel */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 30px; }
.kpi-item { background: rgba(0,0,0,0.2); padding: 12px; border-radius: 6px; display: flex; flex-direction: column; }
.kpi-item.full-width { grid-column: span 2; }
.kpi-item .label { font-size: 0.7rem; color: #64748b; text-transform: uppercase; }
.kpi-item .value { font-size: 1.2rem; font-weight: 700; margin-top: 4px; }
.text-cyan { color: var(--primary); }
.text-pink { color: var(--accent); }
.sub-label { font-size: 0.7rem; color: #64748b; margin-top: 2px; }

/* Charts in Panel */
.panel-chart-container { margin-bottom: 30px; }
.panel-chart-container h3 { font-size: 0.9rem; color: #e2e8f0; margin-bottom: 10px; font-weight: 600; }
.chart-wrapper { height: 150px; position: relative; }

/* =========================================
   8. MODE ARTISTIQUE (IMAGE & SWITCH)
   ========================================= */
.art-mode-wrapper {
    display: flex; align-items: center; gap: 10px;
    padding-left: 20px; border-left: 1px solid var(--border-color);
}
.art-label { font-size: 0.8rem; font-weight: 600; color: #fff; }

/* Switch Toggle Design */
.switch { position: relative; display: inline-block; width: 44px; 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: #334155;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute; content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider { background: linear-gradient(90deg, var(--accent), #f43f5e); }
input:checked + .slider:before { transform: translateX(20px); }

/* VUE ARTISTIQUE (L'image par-dessus tout) */
#view-artistique {
    display: none;
}

#view-artistique.active {
    display: flex !important;
    justify-content: center;
    align-items: center;
    position: fixed !important;
    top: 70px; /* Sous le header */
    left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: calc(100vh - 70px);
    background-color: var(--bg-deep);
    z-index: 500;
}

.art-container {
    width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
}

#art-image {
    max-width: 90%; max-height: 90%;
    object-fit: contain;
    filter: drop-shadow(0 0 30px rgba(34, 211, 238, 0.15));
    animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 30px rgba(34, 211, 238, 0.15)); }
    50% { transform: scale(1.02); filter: drop-shadow(0 0 50px rgba(217, 70, 239, 0.25)); }
}

/* =========================================
   9. INTRO ANIMATION (Loader)
   ========================================= */
.intro-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 20000;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 1s ease, visibility 1s;
}
.intro-overlay.finished { opacity: 0; visibility: hidden; pointer-events: none; }

.intro-content { text-align: center; position: relative; z-index: 2; width: 60%; max-width: 600px; }
.intro-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0.3; transition: background 1s ease;
}
.bg-step-1 { background: radial-gradient(circle, #22d3ee 0%, transparent 60%); }
.bg-step-2 { background: radial-gradient(circle, #10b981 0%, transparent 60%); }
.bg-step-3 { background: radial-gradient(circle, #d946ef 0%, transparent 60%); }
.bg-step-4 { background: radial-gradient(circle, #fbbf24 0%, transparent 60%); }

#intro-text {
    font-size: 2rem; color: white; font-weight: 300; margin-bottom: 30px;
    height: 80px; transition: opacity 0.5s ease, transform 0.5s ease;
}
.text-hidden { opacity: 0; transform: translateY(20px); }

.intro-progress-bar {
    width: 100%; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden;
}
#intro-progress-fill { height: 100%; width: 0%; background: #fff; transition: width 0.1s linear; }

/* =========================================
   10. TOOLS / TOOLTIPS
   ========================================= */
#tooltip, #flow-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 6px;
    pointer-events: none;
    font-size: 0.8rem; color: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 5000;
    transition: opacity 0.2s;
    opacity: 0;
}
#tooltip.visible, #flow-tooltip:not(.hidden) { opacity: 1; }
#flow-tooltip h4 { color: var(--primary); margin-bottom: 5px; font-size: 0.9rem; }
.tooltip-stat { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 3px; color: #cbd5e1; }
.tooltip-ratio { margin-top: 8px; font-weight: bold; color: var(--accent); border-top: 1px solid rgba(255,255,255,0.1); padding-top: 4px; }

/* Info box map */
.info-box {
    position: absolute;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    pointer-events: none;
    z-index: 10;
}
.info-box.hidden { opacity: 0; pointer-events: none; }
.info-box h3 { font-size: 0.9rem; color: var(--primary); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 1px; }

/* IA Stats Panel (Left Column) */
.ia-stats-panel {
    background: rgba(255,255,255,0.02);
    border-radius: 8px; padding: 15px;
    border: 1px solid rgba(255,255,255,0.05);
}
.ia-stats-panel h3 { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.9rem; color: #e2e8f0; }
.stat-val { font-weight: 700; }
.highlight { color: var(--primary); }

/* Timeline 3D Container */
.combined-container {
    position: relative; flex-grow: 1; display: flex; flex-direction: column; overflow: hidden;
}
.layer-3d { flex: 1; min-height: 0; width: 100%; position: relative; z-index: 1; }
.layer-2d { height: 120px; width: 100%; position: relative; z-index: 2; border-top: 1px solid rgba(255,255,255,0.05); background: rgba(0,0,0,0.2); padding-top: 10px; }
#scroll-overlay {
    position: absolute; top: 20px; right: 20px; text-align: right; pointer-events: none; z-index: 10;
}
#scroll-year { font-size: 3rem; font-weight: 800; color: rgba(255,255,255,0.1); line-height: 1; }
#scroll-value { font-size: 1.2rem; font-weight: 600; color: var(--primary); }
/* --- CORRECTIF INTRO --- */
.bg-step-1 { background: radial-gradient(circle at center, #22d3ee 0%, #000 90%); }
.bg-step-2 { background: radial-gradient(circle at center, #10b981 0%, #000 90%); }
.bg-step-3 { background: radial-gradient(circle at center, #d946ef 0%, #000 90%); }
.bg-step-4 { background: radial-gradient(circle at center, #fbbf24 0%, #000 90%); }
/* --- AMÉLIORATION 1 : FOND GRILLE TECHNIQUE --- */
#viz-analytic {
    /* Crée un motif de grille très subtil */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px; /* Taille des carreaux */
    border-radius: 8px;
    position: relative;
}

/* Ajoute un léger vignetage (coins sombres) pour le focus */
#viz-analytic::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle, transparent 40%, rgba(2, 6, 23, 0.4) 100%);
    pointer-events: none; /* Laisse passer les clics */
}
/* --- AMÉLIORATION 2 : CHIFFRES TECHNIQUES --- */
/* On cible les valeurs clés, les axes et les KPI */
.stat-val, 
.kpi-value, 
.donut-center-text span, 
.badge-code,
#scroll-year,
#scroll-value {
    font-family: 'Courier New', Courier, monospace; /* Ou une webfont comme 'JetBrains Mono' */
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums; /* Aligne parfaitement les chiffres */
}
/* --- AMÉLIORATION 3 : BORDURES VIVANTES --- */
@keyframes borderPulse {
    0% { border-color: rgba(255, 255, 255, 0.05); }
    50% { border-color: rgba(34, 211, 238, 0.2); box-shadow: 0 0 15px rgba(34, 211, 238, 0.05); }
    100% { border-color: rgba(255, 255, 255, 0.05); }
}

/* On applique ça uniquement au panneau principal de gauche pour le mettre en valeur */
.ia-grid-split > .dashboard-panel:first-child {
    animation: borderPulse 4s infinite ease-in-out;
    border-width: 1px;
}
/* --- CORRECTIF INTRO : IMAGES + COULEURS --- */
/* À COLLER À LA FIN DE STYLE.CSS */

/* ÉTAPE 1 : PERFORMANCE (Cyan) */
.bg-step-1 { 
    background: 
        /* Le filtre couleur (au-dessus) */
        radial-gradient(circle at center, rgba(34, 211, 238, 0.6) 0%, rgba(2, 6, 23, 0.95) 90%),
        /* L'image (en dessous) - J'utilise celle que j'ai vue dans vos fichiers */
        url('intelligence.jpg'); 
    background-size: cover;
    background-position: center;
}

/* ÉTAPE 2 : TERRITOIRE (Vert) */
.bg-step-2 { 
    background: 
        radial-gradient(circle at center, rgba(16, 185, 129, 0.6) 0%, rgba(2, 6, 23, 0.95) 90%),
        url('culture.jpg'); /* Changez le nom ici si vous avez une autre image */
    background-size: cover;
    background-position: center;
}

/* ÉTAPE 3 : MONUMENTS (Magenta) */
.bg-step-3 { 
    background: 
        radial-gradient(circle at center, rgba(217, 70, 239, 0.6) 0%, rgba(2, 6, 23, 0.95) 90%),
        url('paris.jpg'); /* Changez le nom ici si vous avez une autre image */
    background-size: cover;
    background-position: center;
}

/* ÉTAPE 4 : PATRIMOINE (Jaune) */
.bg-step-4 { 
    background: 
        radial-gradient(circle at center, rgba(251, 191, 36, 0.6) 0%, rgba(2, 6, 23, 0.95) 90%),
        url('patrimoine.jpg'); /* Changez le nom ici si vous avez une autre image */
    background-size: cover;
    background-position: center;
}