/* --- 1. Variables globales (Thème Salle de Commandes) --- */
:root {
    --bg-main: #0f172a;       /* Fond principal : Bleu nuit */
    --bg-panel: #1e293b;      /* Fond des cartes : Bleu ardoise */
    --text-light: #f8fafc;    /* Texte principal */
    --text-muted: #94a3b8;    /* Texte secondaire */
    --accent: #38bdf8;        /* Cyan futuriste */
    --accent-hover: #0284c7;  
    --border: #334155;        
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-light);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    animation: fadeIn 0.4s ease-out; /* Effet d'entrée fluide */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 3. Header & Nav --- */
.main-header {
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* AJOUT CRUCIAL : Force le header à servir de repère spatial */
    z-index: 1000;      /* AJOUT CRUCIAL : Force le menu à passer par-dessus TOUT le reste */
}

.logo h1 { font-size: 1.5rem; color: var(--accent); letter-spacing: 1px; }

nav ul { list-style: none; display: flex; gap: 1.5rem; }
nav a { color: var(--text-light); text-decoration: none; font-weight: 500; transition: 0.3s; }
nav a:hover { color: var(--accent); }

/* --- 4. Conteneur --- */
.container {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* --- 5. Dashboard (Nouveau Look) --- */
.dashboard-wrapper { margin-top: 1rem; }

.dashboard-intro {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
}

.btn-main {
    background: var(--accent);
    color: var(--bg-main);
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

/* Grille de statistiques moderne */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: 0.3s;
}

.stat-card:hover { border-color: var(--accent); }

.stat-icon {
    font-size: 2rem;
    background: rgba(56, 189, 248, 0.1);
    width: 60px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
}

.stat-value { font-size: 2rem; font-weight: 800; color: var(--accent); line-height: 1; }
.stat-label { color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; margin-top: 0.3rem; }

/* --- 6. Formulaires & Selects --- */
.form-section {
    background-color: var(--bg-panel);
    padding: 2rem; border-radius: 12px; border: 1px solid var(--border);
    max-width: 800px; margin: 0 auto;
}

.form-group { margin-bottom: 1.5rem; display: flex; flex-direction: column; }
.form-row { display: flex; gap: 1.5rem; }
.form-row .form-group { flex: 1; }

label { margin-bottom: 0.5rem; font-weight: bold; color: var(--text-muted); }

input[type="text"], input[type="number"], textarea, select {
    width: 100%; padding: 0.8rem;
    background-color: var(--bg-main); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-light);
}

input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

option { background-color: var(--bg-panel); color: var(--text-light); }

.btn-submit {
    background-color: var(--accent); color: var(--bg-main);
    border: none; padding: 1rem; font-size: 1.1rem; font-weight: bold;
    border-radius: 6px; cursor: pointer; transition: 0.3s; width: 100%;
}

.btn-submit:hover { background-color: var(--accent-hover); }

/* --- 7. Tableaux & Badges (CORRECTION BUGS) --- */
.recent-signals-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.table-container { overflow-x: auto; }

.signals-table { width: 100%; border-collapse: collapse; }
.signals-table th, .signals-table td { padding: 1.2rem; text-align: left; border-bottom: 1px solid var(--border); }
.signals-table th { background: rgba(0,0,0,0.1); color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; }

/* FIX : Empêcher le texte de se couper (À analyser) */
.status-badge {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap; /* EMPÊCHE LA TRONCATURE */
    border: 1px solid transparent;
}

.badge-a-analyser { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.badge-traite { background: rgba(34, 197, 94, 0.15); color: #4ade80; border-color: rgba(34, 197, 94, 0.3); }

/* Jauge de probabilité mini */
.prob-wrapper { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--text-muted); }
.mini-progress-bar { width: 50px; height: 6px; background: var(--bg-main); border-radius: 10px; overflow: hidden; }
.mini-progress-bar .fill { height: 100%; background: var(--accent); }

/* --- 8. Page d'Analyses (Cartes) --- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.analysis-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; display: flex; flex-direction: column; transition: 0.2s; }
.analysis-card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3); border-color: var(--accent); }
.card-title { font-size: 1.2rem; margin: 1rem 0; line-height: 1.3; color: var(--text-light); }
.btn-action { display: block; text-align: center; color: var(--accent); border: 1px solid var(--accent); padding: 0.6rem; border-radius: 6px; text-decoration: none; font-weight: bold; transition: 0.3s; }
.btn-action:hover { background: var(--accent); color: var(--bg-main); }

/* --- 9. Rapport PESTEL --- */
.report-container { background: var(--bg-panel); border-radius: 12px; padding: 2rem; max-width: 900px; margin: 0 auto; border: 1px solid var(--border); }
.report-box h3 { color: var(--accent); margin: 1.5rem 0 0.5rem 0; text-transform: uppercase; font-size: 1.1rem; }
.report-box ul { margin-left: 1.5rem; margin-bottom: 1.5rem; }
.report-box li { color: var(--text-muted); margin-bottom: 0.5rem; }

/* --- 10. Paramètres (Settings) --- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 2rem; }
.settings-panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; }
.settings-list { list-style: none; display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }
.settings-list li { background: var(--bg-main); padding: 1rem; border-radius: 8px; border: 1px solid var(--border); }

/* --- 11. Footer --- */
.main-footer { background: var(--bg-panel); text-align: center; padding: 1.5rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.85rem; margin-top: auto; }

/* --- 12. Spécificités Page Rapports --- */

.sidebar-reports { flex: 1; min-width: 300px; max-height: 70vh; overflow-y: auto; }
.main-report-view { flex: 3; min-height: 60vh; }
.report-link { display: block; text-decoration: none; color: inherit; }
.report-date { display: block; font-size: 0.75rem; color: var(--accent); margin-bottom: 0.2rem; }
.report-title-link { font-size: 0.95rem; line-height: 1.2; display: block; }

.active-report { border-color: var(--accent) !important; background-color: rgba(56, 189, 248, 0.05) !important; }
.active-report .report-title-link { color: var(--accent); }

.report-box-header { margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.full-date { font-size: 0.85rem; color: var(--text-muted); }
.synthese-content h3 { color: var(--accent); margin: 1.5rem 0 1rem 0; }
.synthese-content p { margin-bottom: 1rem; color: var(--text-light); opacity: 0.9; }

.empty-state-large { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); text-align: center; padding: 3rem; }
.icon-placeholder { font-size: 4rem; margin-bottom: 1rem; opacity: 0.3; }

/* --- 13. Menu Hamburger & Mode Responsive --- */

.hamburger {
    display: none; /* Toujours caché sur ordinateur */
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

/* Les 3 barres du menu */
.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--accent);
    transition: all 0.3s ease-in-out;
    border-radius: 3px;
}

/* --- Mode Mobile (Écrans inférieurs à 992px) --- */
@media (max-width: 992px) {
    /* Fait apparaitre l'icone hamburger */
    .hamburger {
        display: block; 
    }

    /* Boite contenant les liens du menu */
    #main-nav {
        position: absolute;
        top: 100%; /* S'aligne parfaitement sous le header */
        left: 0;
        width: 100%;
        background-color: var(--bg-panel);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
        
        /* Animation : il est d'abord caché vers le haut et transparent */
        transform: translateY(-20px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease-in-out;
    }

    /* L'état quand on appuie sur le bouton */
    #main-nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    /* Disposition des liens en colonne */
    #main-nav ul {
        flex-direction: column;
        align-items: center;
        padding: 1.5rem 0;
        gap: 1.5rem;
    }

    /* Animation du Hamburger en Croix (X) au clic */
    .hamburger.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    .hamburger.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}