/* --- VARIABLES & RESET --- */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --sidebar-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-app: #f1f5f9;
    --border: #e2e8f0;
    --white: #ffffff;
    --sidebar-width: 280px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* { box-sizing: border-box; }

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
}

/* --- LAYOUT PRINCIPAL --- */
.dashboard-body {
    display: flex;
    overflow: hidden;
}

#mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
}

#mobile-overlay.visible { display: block; }

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.sidebar-header {display: flex;
    flex-direction: column;
    align-items: flex-start; /* Aligné à gauche */
}


.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-circle {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: 8px;
}

.logo-wrapper h1 {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
}

.logo-wrapper h1 span { color: var(--primary); }

.mobile-close {
    display: none;
    background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted);
}

/* --- BOUTON NOUVEAU PATIENT (FANCY) --- */
.sidebar-actions { margin-bottom: 1.5rem; }

.btn-new-fancy {
    width: 100%;
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.8rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
    transition: all 0.2s;
}
.btn-import
{
    margin-top: 10px;
    font-weight: 400;
    padding: 0.5rem;
}
#patient-id-clinical[readonly] {
    background-color: #f3f4f6; /* Gris léger pour indiquer l'inactivité */
    color: #6b7280;            /* Texte estompé */
    cursor: not-allowed;       /* Le curseur "rond barré" 🚫 */
    border: 1px solid #e5e7eb;
    user-select: none;         /* Empêche la sélection du texte pour renforcer l'idée */
}

/* Optionnel : un petit effet au survol pour confirmer le blocage */
#patient-id-clinical[readonly]:hover {
    border-color: #d1d5db;
    box-shadow: none;          /* Pas d'ombre bleue au survol */
}

#type-surdite[readonly] {
    background-color: #f3f4f6; /* Gris léger pour indiquer l'inactivité */
    color: #6b7280;            /* Texte estompé */
    cursor: not-allowed;       /* Le curseur "rond barré" 🚫 */
    border: 1px solid #e5e7eb;
    user-select: none;         /* Empêche la sélection du texte pour renforcer l'idée */
    text-align: center;
}

/* Optionnel : un petit effet au survol pour confirmer le blocage */
#type-surdite[readonly]:hover {
    border-color: #d1d5db;
    box-shadow: none;          /* Pas d'ombre bleue au survol */
}

.btn-new-fancy:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

/* --- RECHERCHE & LISTE --- */
.search-container { margin-bottom: 1.5rem; }

.search-container input {
    width: 100%;
    padding: 0.6rem 1rem;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    font-size: 0.9rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05rem;
    margin-bottom: 1rem;
}

.patient-list { flex: 1; overflow-y: auto; }

.patient-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: background 0.2s;
}

.patient-item:hover { background: var(--bg-app); }

.patient-item.active {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
}

.patient-avatar {
    width: 50px;
    height: 50px;
    background: var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    margin-right: 12px;
}

.patient-details { display: flex; flex-direction: column; flex: 1; }
.p-name { font-size: 0.9rem; font-weight: 600; }
.p-id { font-size: 0.75rem; color: var(--text-muted);font-style: italic; }
.p-audio { font-size: 0.75rem; color: var(--text-muted);font-style: italic; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.green { background: #10b981; }

/* --- FOOTER SIDEBAR --- */
.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.user-name-label { font-size: 0.85rem; font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.footer-actions { display: flex; gap: 8px; }

.icon-btn-fancy {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.icon-btn-fancy:hover { color: var(--primary); border-color: var(--primary); }
.icon-btn-fancy.logout:hover { color: #ef4444; border-color: #ef4444; }

/* --- CONTENU PRINCIPAL --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.top-nav {
    height: 64px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    justify-content: space-between;
}

.sandwich-btn {
    display: none;
    background: none; border: none; font-size: 1.5rem; cursor: pointer; margin-right: 1rem;
}

.header-actions { display: flex; gap: 12px; }

.btn-unarchive {
    background: transparent; border: 1px solid var(--border); padding: 0.6rem 1.2rem; border-radius: 8px; cursor: pointer; font-weight: 600;
}
.btn-archive {
    background: transparent; border: 1px solid var(--border); padding: 0.6rem 1.2rem; border-radius: 8px; cursor: pointer; font-weight: 600;
}
.btn-save {
    background: transparent; border: 1px solid var(--border); padding: 0.6rem 1.2rem; border-radius: 8px; cursor: pointer; font-weight: 600;
}
.btn-primary-fancy {
    background: var(--primary); color: white; border: none; padding: 0.6rem 1.2rem; border-radius: 8px; cursor: pointer; font-weight: 600;
}

.workspace {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.welcome-overlay {
 position: absolute; /* Fondamental */
    top: 50px;
    left: 280px;
    width: calc(100% - 280px);
    height: 100%;
    background: #f8fafc;
    z-index: 100;
    display: flex;
    justify-content: center;
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sandwich-btn, .mobile-close { display: block; }
    .welcome-overlay { width: 100%; left : 0px; }
    
}

/* Intégration des panneaux dans le workspace */
.clinical-info-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.grid-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    text-align: center;
}

.q-input label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.q-input input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.9rem;

    text-align: center;
}
/* On réutilise tes styles existants en ajoutant .q-select */
.q-input label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.q-select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    background-color: white;
    cursor: pointer;
    
    /* Pour l'alignement centré comme ton input */
    text-align: center;
    text-align-last: center; /* Important pour centrer le texte dans un select */
    
    appearance: none; /* Enlève le style par défaut du navigateur */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}

.q-select:focus {
    outline: none;
    border-color: var(--primary); /* Ou la couleur de ton thème */
}

.section-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 2rem 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* On s'assure que les panels ne dépassent pas */
.clinical-panel {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    min-height: 350px; /* Ajuste selon ton moteur de graph */
}

.chat-section {
    background: var(--card-bg); /* Utilise tes variables existantes */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    margin-top: 20px;
}

.chat-history {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-bubble {
    background: #f1f5f9;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    border-left: 4px solid #3b82f6; /* Petite barre bleue pour le côté pro */
}

[data-theme='dark'] .chat-bubble {
    background: #1e293b;
    color: #f1f5f9;
}

.chat-date {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    margin-bottom: 4px;
}

/* La bille de notification sur la sidebar */
.notif-bille {
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    display: inline-block;
    margin-left: 8px;
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.5);
}

/* Container de saisie pour aligner le texte et le bouton */
.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: var(--card-bg-light, #ffffff);
}

/* Style du bouton "Envoyer" */
#btn-send-comment {
    background-color: #3b82f6; /* Bleu médical dynamique */
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

#btn-send-comment:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#btn-send-comment:active {
    transform: translateY(0);
}

/* Style du Textarea pour qu'il s'étende */
#chat-new-message {
    flex-grow: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    resize: none;
    background: #f8fafc;
    transition: border-color 0.2s;
}

#chat-new-message:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
}

/* Mode sombre */
[data-theme='dark'] #chat-new-message {
    background: #0f172a;
    border-color: #334155;
    color: white;
}

[data-theme='dark'] .chat-input-container {
    background: #1e293b;
    border-color: #334155;
}

.chat-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 11px;
}

.chat-author {
    font-weight: bold;
    color: #3b82f6; /* Bleu pour le côté pro */
    text-transform: uppercase;
}

.chat-date {
    color: #94a3b8;
}

#temp-patient-item {
    border-left: 4px solid #f39c12; /* Bordure orange pour dire "non sauvé" */
    font-style: italic;
}

#notification-banner {
    border-left: 4px solid #10b981;
    position: fixed;
    top: -60px; /* Un peu plus haut pour bien cacher l'ombre au repos */
    left: 50%;
    transform: translateX(-50%); /* Le secret du centrage parfait */
    height: 40px;
    width: 35%;
    min-width: 300px; /* Sécurité pour les petits écrans */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border-radius: 0 0 10px 10px; /* Optionnel: arrondis le bas pour le style */
    transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Effet rebond pro */
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}


.timeline-point.active {
    transform: scale(1.5); /* Il grossit un peu */
    border: 2px solid #fff;
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
    z-index: 10;
}



/* --- LE BANDEAU DE NOTIFICATION --- */
#notification-banner.show { top: 10px; }
.bg-success { background-color: #1e293b; }
.bg-error { background-color: #e74c3c; }

/* --- LES SECTIONS ACCORDÉON --- */
.graph-section {
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, opacity 0.4s ease-in-out;
    max-height: 2000px;
    opacity: 1;
}
.section-hidden {
    max-height: 0 !important;
    opacity: 0 !important;
    /* On force la suppression des marges internes quand c'est caché */
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
/* Optionnel : ajouter un petit padding uniquement quand la section est OUVERTE 
   pour que les graphiques ne collent pas au titre */
.graph-section:not(.section-hidden) {
    padding-top: 15px;
    padding-bottom: 10px;
}


.section-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa; /* Ou la couleur de ton choix */
    border-radius: 8px;
    margin-bottom: 5px;
}

.arrow {
    display: inline-block;
    transition: transform 0.4s ease;
    margin-right: 12px;
    color: #666;
    font-size: 0.8em;
}

.arrow-rotated {
    transform: rotate(-90deg);
}

.section-container {
    margin-bottom: 8px !important; /* Espace serré entre les box repliées */
}

.clickable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    /* On force une hauteur minimale pour que les deux soient identiques */
    min-height: 60px; 
    
    padding: 5px 15px; /* On réduit un peu le padding vertical */
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 5px;
    box-sizing: border-box; /* Pour que le padding ne s'ajoute pas à la hauteur */
}

/* On s'assure que les titres ne poussent pas la hauteur différemment */
.section-title {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.2; 
    display: flex;
    align-items: center;
}



.clickable-header:hover {
    background: #f1f3f5;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-container {
    background: white;
    padding: 25px 20px 10px 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    margin-bottom: 20px;
}

.timeline-axis {
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
}

.timeline-line {
    width: 100%;
    height: 3px;
    background: #e0e0e0;
    border-radius: 2px;
}

.timeline-point {
 position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid white;
    cursor: pointer;
    
    /* --- AJOUTS ICI --- */
    top: 50%; /* On le place au milieu du parent */
    /* On combine le centrage horizontal ET vertical */
    transform: translate(-50%, -50%); 
    /* ------------------ */

    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.timeline-point.author { background-color: #3498db; }
.timeline-point.expert { background-color: #27ae60; }

.timeline-point:hover { transform: translate(-50%, -50%) scale(1.4); }
.timeline-point.active {
transform: translate(-50%, -50%) scale(1.4);
    border-color: #333 !important;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}
.timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    color: #888;
    font-size: 0.8rem;
}
/* Panneau d'analyse de la version */
.version-analysis-panel {
    background: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
    padding-bottom: 10px;
}

.analysis-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #2c3e50;
}

#selected-version-date {
    color: #3498db;
    font-weight: bold;
}

/* Le textarea pour l'expert */
#version-comment {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 1px solid #dcdde1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s;
    background-color: #fcfcfc;
    box-sizing: border-box; /* Important pour ne pas déborder */
}

#version-comment:focus {
    outline: none;
    border-color: #3498db;
    background-color: #fff;
}

/* Bouton "Graver" (Sensation de verrouillage) */
.btn-save-analysis {
    margin-top: 15px;
    background-color: #2c3e50; /* Couleur sombre "Expert" */
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save-analysis:hover {
    background-color: #1a252f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-save-analysis:active {
    transform: translateY(0);
}

.dot { height: 8px; width: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot.blue { background: #3498db; }
.dot.green { background: #27ae60; }

/* Couleurs selon le message */
.bg-error { background-color: #e74c3c; }



.welcome-content {
    text-align: center;
    max-width: 1000px;
    padding: 2rem;
}

.welcome-logo {
    font-size: 3rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 1rem;
    letter-spacing: -1px;
}

.subtitle { color: #64748b; font-size: 1.2rem; margin-bottom: 3rem; }

/* Style de base du badge */
.has-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 50px; /* Forme pilule */
    font-size: 0.85rem;
    font-weight: 600;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* État Alerte (Critère atteint) */
.has-badge.alert {
    background-color: #fffbeb; /* Jaune très clair */
    color: #b45309;            /* Ambre foncé */
    border: 1px solid #fde68a;
}

/* État Stable */
.has-badge.stable {
    background-color: #f0fdf4; /* Vert très clair */
    color: #15803d;            /* Vert foncé */
    border: 1px solid #bbf7d0;
}

/* Animation de "pop" à l'apparition */
@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.tuto-grid {
    display: flex;
    flex-direction:row;
    grid-template-columns: repeat(3, 1fr);
        margin-top: 20px;
    gap: 20px;
}
@media (max-width: 767px) {
.tuto-grid { flex-direction:column;}
}

.tuto-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.tuto-card i { font-size: 1.5rem; color: #3b82f6; margin-bottom: 10px; }
.tuto-card h3 { font-size: 1rem; margin-bottom: 8px; color: #1e293b; }
.tuto-card p { font-size: 0.85rem; color: #64748b; line-height: 1.4; }
.hidden {
  display: none;
}

/* Classe pour masquer l'accueil */
.hidden-welcome {
    opacity: 0;
    pointer-events: none;
    display: none;
}
.logo-link {
    text-decoration: none; /* Enlève le soulignement bleu */
    color: inherit;       /* Garde la couleur de ton h1 */
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.logo-link:hover {
    opacity: 0.8; /* Petit effet visuel au survol */
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}


.small-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.readonly-comment {
    background-color: #f1f5f9; /* Gris léger */
    border-left: 4px solid #3b82f6; /* Ligne bleue pour le côté "Expert" */
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #1e293b;
    line-height: 1.5;
    margin-bottom: 15px;
    min-height: 50px;
    font-style: italic;
}

.analysis-input-group textarea {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    resize: vertical;
}

.welcome-container {
    
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px); /* Effet flou moderne */
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

.welcome-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.brand-name {
  font-size: 4rem;
    font-weight: 900;
    letter-spacing: 12px;
    /* Dégradé contrasté : Bleu Marine vers Bleu Électrique */
    background: linear-gradient(to right, #1e3a8a, #3b82f6); 
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    /* Option de secours si le dégradé échoue */
    color: #1e3a8a; 
    text-transform: uppercase;
    margin: 0;
    line-height: 1;
    padding-top : 20px;
}

.divider {
    height: 2px;
    width: 60px;
    background: #7c3aed;
    border-radius: 2px;
    animation: scaleWidth 1.2s ease-out;
}

.baseline {
    font-size: 1.1rem;
    font-style: italic;
    color: #4b5563;
    font-weight: 300;
    letter-spacing: 1px;
    animation: fadeInUp 1s ease-out 0.5s both;
}
.brand-name {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 12px;
    display: flex;
    gap: 5px;
    margin: 0;
}

.brand-name span {
    display: inline-block;
    background: linear-gradient(to right, #1e3a8a, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: translateY(20px);
    animation: revealLetter 0.5s ease-out forwards;
}

/* Délai pour chaque lettre pour l'effet "pas d'un coup" */
.brand-name span:nth-child(1) { animation-delay: 0.2s; }
.brand-name span:nth-child(2) { animation-delay: 0.4s; }
.brand-name span:nth-child(3) { animation-delay: 0.6s; }
.brand-name span:nth-child(4) { animation-delay: 0.8s; }

.divider {
    height: 4px;
    width: 0; /* Part de 0 */
    background: #3b82f6;
    margin: 15px 0;
    animation: extendDivider 0.8s ease-out forwards;
    animation-delay: 1.2s; /* Commence après les lettres */
}

.baseline {
    opacity: 0;
    color: #4b5563;
    font-style: italic;
    animation: fadeIn 1s ease-out forwards;
    animation-delay: 1.8s; /* Apparaît en dernier */
}

/* Keyframes */
@keyframes revealLetter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes extendDivider {
    to { width: 100px; }
}

@keyframes fadeIn {
    to { opacity: 1; }
}
/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleWidth {
    from { width: 0; }
    to { width: 60px; }
}


.arch { 
    background-image: url('arch.png'); 
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background-color: #f3f4f6; /* Fond de secours */
    
    /* Chargement de ton icône */
    background-size: 110%; /* Ajuste la taille de l'icône à l'intérieur */
    background-repeat: no-repeat;
    background-position: center;
    
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}

.AA { 
    background-image: url('AA.png'); 
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background-color: #f3f4f6; /* Fond de secours */
    
    /* Chargement de ton icône */
    background-size: 110%; /* Ajuste la taille de l'icône à l'intérieur */
    background-repeat: no-repeat;
    background-position: center;
    
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}
.AI { 
    background-image: url('AI.png'); 
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background-color: #f3f4f6; /* Fond de secours */
    
    /* Chargement de ton icône */
    background-size: 110%; /* Ajuste la taille de l'icône à l'intérieur */
    background-repeat: no-repeat;
    background-position: center;
    
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}


.CI { 
    background-image: url('CI.png'); 
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background-color: #f3f4f6; /* Fond de secours */
    
    /* Chargement de ton icône */
    background-size: 120%; /* Ajuste la taille de l'icône à l'intérieur */
    background-repeat: no-repeat;
    background-position: center;
    
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}
.share-icon-wrapper {
    width: 45px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Aligne le carré à droite */
    position: relative;
    padding-right: 5px;
}
.share-icon-wrapper::before, 
.share-icon-wrapper::after {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-out;
}

.share-icon-wrapper:hover::before, 
.share-icon-wrapper:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Le carré (Le centre référent) */
.apex-share-icon {
    width: 14px;
    height: 14px;
    border: 2px solid #1e3a8a; /* Bleu marine Apex */
    border-radius: 3px;
    position: relative;
    background: white;
    z-index: 2;
}

/* Le trait pointillé animé qui arrive dans le carré */
.apex-share-icon::before {
    content: '';
    position: absolute;
    right: 14px; /* Part de la gauche du carré */
    top: 50%;
    width: 25px; /* Longueur du flux */
    height: 2px;
    transform: translateY(-50%);
    background: repeating-linear-gradient(
        to right,
        #3b82f6,
        #3b82f6 4px,
        transparent 4px,
        transparent 8px
    );
    background-size: 16px 100%;
    animation: flowIn 1.5s linear infinite;
}

/* Animation de translation du pointillé vers la droite */
@keyframes flowIn {
    from { background-position: -16px 0; }
    to { background-position: 0 0; }
}
/* Bouton Générer QR */
.btn-qr {
    background: #e0f2fe; /* Bleu très clair */
    color: #0c4a6e; /* Bleu foncé pour le texte */
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 10px; /* Espace avant le bouton Enregistrer */
}
.btn-qr:hover {
    background: #bae6fd;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.btn-qr .icon-qr::before {
    content: '📱'; /* Un émoji de téléphone pour l'icône QR */
    font-size: 1.1em;
}

/* Overlay QR Code */
.qr-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Fond semi-transparent */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000; /* Assure qu'il est au-dessus de tout */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.qr-overlay.active {
    opacity: 1;
    visibility: visible;
}

.qr-popup {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 90%;
    width: 350px;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.qr-overlay.active .qr-popup {
    transform: scale(1);
}

.qr-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.8em;
    color: #666;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}
.qr-close-btn:hover {
    color: #333;
}

.qr-title {
    color: #1e3a8a;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.4em;
}

.qr-info {
    color: #64748b;
    font-size: 0.9em;
    margin-bottom: 20px;
}

.qrcode-display {
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: inline-block; /* Pour centrer le QR lui-même */
    margin-bottom: 15px;
    background: #f8fafc;
}
.qrcode-display img {
    max-width: 100% !important; /* Pour s'assurer que le QR code s'adapte */
    height: auto !important;
}

.qr-link-display {
    font-size: 0.8em;
    color: #94a3b8;
    word-break: break-all; /* Pour les longues URLs */
    margin-bottom: 10px;
}

.btn-copy-link {
    background: #3b82f6;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.3s ease;
}
.btn-copy-link:hover {
    background: #2563eb;
}
.hidden-qr {
    display: none !important;
}

.hidden-archive{
    display: none !important;
}
.hidden-unarchive{
    display: none !important;
}
/* Pour le QR code lib */
canvas { display: block; } /* Pour éviter un espace sous le canvas */

/* Container du profil */
.user-profile-nav {
    margin: 5px 0px 25px 0px;
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* Séparation légère */
}

/* Lien principal */
.user-info-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.user-info-link:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

/* Avatar avec initiale */
.user-avatar-small {
    width: 32px;
    height: 32px;
    background: linear-gradient(135, #3b82f6 0%, #1e3a8a 100%);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    margin-right: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Texte (Nom et Rôle) */
.user-details-mini {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 2px;
}

.user-name-label {
    opacity: 0.5;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.user-role-tag {
    color: #94a3b8;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Icône engrenage */
.icon-settings-gear {
    font-style: normal;
    font-size: 0.9rem;
    opacity: 0.5;
}

.user-info-link:hover .icon-settings-gear {
    opacity: 1;
    transform: rotate(90deg);
}

.fancy-select {
    width: 100%;
    text-align: center;
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: #f8fafc;
    color: #1e293b;
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none; /* Supprime la flèche par défaut du navigateur */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    transition: all 0.2s ease;
}

.fancy-select:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.fancy-select:disabled {
    background-color: #f1f5f9;
    cursor: not-allowed;
}

.dashboard-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

.dashboard-card h3 {
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    border-left: 4px solid #3b82f6;
    padding-left: 12px;
}

.legend-item {
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.legend-item:hover {
    background: #e2e8f0;
    border-color: #3b82f6;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 3px; /* Carré arrondi plus moderne que le rond */
    margin-right: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.label {
    font-weight: 500;
    color: #475569;
}

.value {
    color: #3b82f6;
    background: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
}
.alldata{
display: flex;
flex-wrap: wrap;       /* Permet de passer à la ligne sur petit écran */
    gap: 30px;             /* L'espace magique entre tes boîtes */
    justify-content: center; /* Centre les graphs dans la page */
    padding: 20px;
    align-items: flex-start;
    }

/* Le Canvas lui-même */
canvas#barChart {
    width: 100% !important;
    height: auto !important;
    /* On évite que le texte soit flou sur écran Retina */
    image-rendering: -webkit-optimize-contrast;
}

.d-none { display: none !important; }

/* --- Overlay de la Modal --- */
#modal-pref {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7); /* Bleu nuit profond transparent */
    backdrop-filter: blur(8px); /* Effet de flou derrière la modal */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* --- Masquage --- */
.modal-hidden {
    display: none !important;
}

/* --- La Carte de Préférences --- */
.pref-card {
    background: #ffffff;
    width: 95%;
    max-width: 480px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Header --- */
.modal-header {
    padding: 20px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #ef4444;
}

/* --- Corps de la Modal --- */
.pref-body {
    padding: 24px;
}

.pref-section {
    margin-bottom: 24px;
}

.pref-section:last-child {
    margin-bottom: 0;
}

.pref-section label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 8px;
}

/* --- Inputs & Selects --- */
.fancy-input, .fancy-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #1e293b;
    background: #fdfdfd;
    transition: all 0.2s ease;
}

.fancy-input:focus, .fancy-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: #fff;
}

/* Bouton Annuler / Fermer */
.btn-secondary {
    background-color: #ffffff;
    color: #64748b; /* Gris-bleu ardoise */
    border: 1px solid #e2e8f0;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background-color: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.btn-secondary:active {
    transform: translateY(1px);
}

/* Ajustement du bouton Enregistrer pour qu'il soit assorti */
.btn-save {
    background-color: #3b82f6; /* Bleu Apex */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

.btn-save:hover {
    background-color: #2563eb;
    box-shadow: 0 6px 10px -1px rgba(59, 130, 246, 0.3);
}

.btn-save:active {
    transform: translateY(1px);
}

/* Conteneur pour aligner les deux */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    background-color: #f8fafc;
}
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    background: #1e293b; /* Bleu nuit */
    color: white;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #ef4444; }

.toast-icon { font-size: 1.2rem; }
/* --- Footer & Bout