/* Importation de la police via Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Alex+Brush&display=swap');

h1 {
    color : white;
}
:root {
    --bg-preview: #f1f5f9;
    --omc-dark: #0a192f;
    --omc-cyan: #00d2ff;
    --omc-bg: #112240;
    --omc-card: #112240;
}

[data-theme="dark"] {
    /* Mode Sombre */
    --bg-preview: #0f172a !important; /* Bleu nuit profond */
    --text-preview: #f8fafc;
}

body {
    font-family: 'Segoe UI', sans-serif;
    margin: 0; background: var(--omc-bg);
    height: 100vh; display: flex; overflow: hidden;
}

/* Importation de la police Great Vibes via Google Fonts */
.signature-line {
    margin-top: 60px;
    border-top: 2px solid #000; 
    display: inline-block;
    min-width: 250px;
    float: right;
    text-align: right;
    padding-top: 5px;
    clear: both;
    
    /* Typographie style "Stylo fin" */
    font-family: 'Alex Brush', cursive;
    font-size: 30px; /* Taille optimale pour cette police fine */
    font-weight: 400;
    color: #1a1a1a;
    letter-spacing: 0px;
    
    /* Petit décalage pour ne pas être parfaitement aligné sur la ligne */
    padding-right: 10px;
    transform: rotate(-1.5deg) translateY(-2px);
}

/* Cache les sections et lignes non utilisées */
.section { display: none; }
.section.active { display: block !important; margin-bottom: 20px; }

.row { display: none; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #eee; }.row.active { 
    display: grid !important; 
    grid-template-columns: 2fr 1fr 1.5fr;
    padding: 5px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.interface-container {
    display: flex !important; /* Force les deux colonnes côte à côte */
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 420px;
    min-width: 420px;
    background-color: #0a1324; /* Ton bleu sombre habituel */
    padding: 25px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid #1e293b;
}

#input-panel { width: 480px; background: var(--omc-dark); color: white; padding: 25px; overflow-y: auto; border-right: 1px solid #233554; }
.back-link { color: var(--omc-cyan); text-decoration: none; font-size: 11px; font-weight: bold; margin-bottom: 15px; display: inline-block; }
.input-group { margin-bottom: 15px; border-bottom: 1px solid #1d3354; padding-bottom: 10px; }
label { display: block; font-size: 0.8em; font-weight: bold; color: #ccd6f6; margin-bottom: 5px; }
input, textarea, select { width: 100%; padding: 10px; border-radius: 4px; border: 1px solid #233554; background: #0a192f; color: white; box-sizing: border-box; }
#preview-area, .preview-area { 
    flex-grow: 1; 
    display: block !important;
    flex-direction: column; /* Pour empiler silhouette + feuille */
    align-items: center;
    padding: 40px; 
    overflow-y: auto; 
    background-color: var(--bg-preview) !important; /* Utilise la variable */
    transition: background-color 0.2s ease-in-out;
}

/* Espace entre la signature et les boutons d'action */
.signature-input-group {
    margin-bottom: 25px !important; /* Ajoute l'espace demandé */
}

/* Si tu n'as pas de classe, utilise l'ID du champ */
#doctor-signature {
    margin-bottom: 25px;
}
#document {
    width: 800px !important;
    min-width: 800px !important;
    
    /* HAUTEUR AUTOMATIQUE : S'adapte au contenu */
    height: auto !important;       
    min-height: 500px !important;  /* Juste pour pas qu'il soit minuscule si vide */
    
    background: white !important;
    color: #000 !important;
    
    /* PADDING : On met 60px en bas pour être sûr que la signature respire */
    padding: 40px 40px 60px 40px !important; 
    
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
    box-sizing: border-box;
    overflow: visible !important; /* IMPORTANT pour ne pas couper */
}
#print-btn, #discord-btn { width: 100%; padding: 15px; background: var(--omc-cyan); border: none; font-weight: bold; cursor: pointer; margin-top: 12px; border-radius: 5px; }
#discord-btn { background: #5865F2; color: white; }

.btn-print {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #ccc !important;
    text-transform: uppercase;
    font-size: 11px;
    padding: 10px !important;
    cursor: pointer;
    width: 100%;
    margin-top: 15px;
}

.btn-print:hover {
    background: #f0f0f0 !important;
}
@media print { #input-panel, .back-link, button { display: none !important; } body { display: block !important; } #preview-area { background: white; padding: 0; } #document { box-shadow: none !important; width: 210mm !important; } }




/* =========================================
   VERSION MOBILE (SMARTPHONE & TABLETTE)
   ========================================= */
@media screen and (max-width: 1024px) {

    /* 1. On débloque la hauteur totale */
    body, html {
        height: auto !important;
        overflow-y: auto !important; /* Scroll vertical autorisé partout */
    }

    /* 2. Le conteneur principal empile les blocs */
    .interface-container {
        flex-direction: column !important; /* Haut vers Bas */
        height: auto !important; /* La hauteur s'adapte au contenu */
        min-height: 100vh;
        overflow: visible !important; /* Surtout pas de hidden ! */
        display: flex;
    }

    /* 3. La Barre Latérale (Inputs) */
    .sidebar {
        width: 100% !important;
        height: auto !important; /* Pas de hauteur fixe */
        min-height: auto !important;
        position: relative !important;
        border-right: none;
        border-bottom: 4px solid #1e293b;
        padding: 20px;
        box-sizing: border-box;
        z-index: 10;
        background: #0f172a; /* On assure le fond sombre */
    }
    
    /* Titres sidebar */
    .sidebar-title {
        text-align: center;
        margin-top: 10px;
    }

    /* 4. La zone de prévisualisation (Fond bleu derrière la feuille) */
    .preview-area {
        width: 100% !important;
        height: auto !important;
        display: block !important; /* Important pour le scroll */
        padding: 20px 0 !important;
        margin: 0 !important;
        
        /* C'est ICI le secret : on autorise le scroll horizontal */
        overflow-x: auto !important; 
        overflow-y: visible !important;
        
        background: #0f172a;
        flex-grow: 0 !important; /* Ne cherche pas à remplir le vide */
    }

    /* 5. Le Document Blanc (A4) */
    #document .document {
        margin: 40px auto 50px auto !important;
        /* Si l'écran est petit, l'utilisateur scrollera vers la droite */
        
        /* On force l'affichage */
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important; /* Pas de zoom bizarre qui casse la capture */
    }

    /* 6. Ajustements des champs de formulaire */
    .row-group {
        flex-direction: column;
        gap: 0;
    }
    .form-group {
        margin-bottom: 15px;
        width: 100%;
    }
    
    /* Menu Principal (Index) */
    .menu-grid {
        grid-template-columns: 1fr;
        padding: 10px;
    }
}


/* --- AUTOCOMPLETE (GLOBAL) --- */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.autocomplete-item {
    padding: 10px 15px;
    border-bottom: 1px solid #334155;
    cursor: pointer;
    color: #e2e8f0;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: #3b82f6; /* Bleu OMC au survol */
    color: white;
}

.autocomplete-item strong { display: block; font-size: 13px; }
.autocomplete-item small { color: #94a3b8; }
.autocomplete-item:hover small { color: #e2e8f0; }

/* ============================================================
   GESTION DU THÈME (LIGHT MODE)
   ============================================================ */

/* 1. PAR DÉFAUT (Mode Sombre) */
/* On cible .preview-area (Labo/Constat...) ET .dashboard-area (Dossiers) */
.preview-area, .dashboard-area {
    background-color: #0f172a !important; /* Bleu nuit sombre par défaut */
    transition: background-color 0.3s ease;
}

/* 2. MODE CLAIR (Activé par le bouton) */
/* On change le fond des deux types de zones */
body.light-mode .preview-area,
body.light-mode .dashboard-area {
    background-color: #d1d5db !important; /* Gris clair bureau */
}

/* 3. PROTECTION ABSOLUE DE LA SIDEBAR */
/* On s'assure que rien ne change à gauche */
body.light-mode .sidebar,
body.light-mode .sidebar input,
body.light-mode .sidebar select,
body.light-mode .sidebar textarea,
body.light-mode .sidebar button:not(#theme-btn-toggle), 
body.light-mode .sidebar label,
body.light-mode .sidebar h1 {
    /* On ne touche à RIEN ici pour garder le menu sombre */
}


/* --- CORRECTION ICÔNE CALENDRIER (DATE) --- */
/* Inverse les couleurs de l'icône pour qu'elle soit blanche sur fond sombre */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.8;
}

/* Change aussi le curseur au survol */
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
