/* ============================================================
   VARIABLES GLOBALES & RESET
   ============================================================ */
:root {
    --bg-dark: #0a0b10;
    --sidebar-bg: #12141d;
    --card-bg: #1a1c26;
    --accent-blue: #1e3a8a;
    --light-blue: #3b82f6;
    --text-color: #e2e8f0;
    --border-color: #2d3748;
    --urgent-red: #991b1b;
    --warning-red: #ef4444;
    --success-green: #10b981;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto Mono', monospace;
    background-color: var(--bg-dark);
    color: var(--text-color);
    display: flex;
    height: 100vh;
    overflow: hidden;
}
* {
    box-sizing: border-box;
}

/* ============================================================
   1. VARIABLES GLOBALES & RESET
   ============================================================ */
:root {
    --bg-dark: #0a0b10;
    --sidebar-bg: #12141d;
    --card-bg: #1a1c26;
    --accent-blue: #1e3a8a;
    --light-blue: #3b82f6;
    --text-color: #e2e8f0;
    --border-color: #2d3748;
    --urgent-red: #991b1b;
    --warning-red: #ef4444;
    --success-green: #10b981;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto Mono', monospace;
    background-color: var(--bg-dark);
    color: var(--text-color);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   2. NAVIGATION (SIDEBAR)
   ============================================================ */
.sidebar {
    width: 250px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background-color: var(--sidebar-bg);
    border-right: 2px solid var(--border-color);
    flex-shrink: 0;
}

.logo {
    text-align: center;
    margin-bottom: 40px;
    color: var(--light-blue);
    font-weight: bold;
    font-size: 1.5rem;
}

.logo img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    margin-bottom: 10px;
}

.sidebar ul { list-style: none; padding: 0; }
.sidebar li {
    padding: 15px;
    margin-bottom: 10px;
    transition: 0.3s;
    cursor: pointer;
    border: 1px solid transparent;
}

.sidebar li:hover {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--light-blue);
}

.sidebar a {
    text-decoration: none;
    color: var(--text-color);
    text-transform: uppercase;
    font-size: 0.9rem;
}

.user-info {
    margin-top: auto;
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* ============================================================
   3. LAYOUT DU DASHBOARD
   ============================================================ */
.dashboard-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    border-bottom: 3px solid var(--light-blue);
    margin-bottom: 30px;
    padding-bottom: 10px;
}

.dashboard-header h1 {
    font-style: italic;
}

.dashboard-grid-container {
    display: grid;
    grid-template-columns: 1fr 450px; 
    gap: 30px;
    align-items: start;
}

.dashboard-card {
    background: var(--card-bg);
    border-left: 5px solid var(--accent-blue);
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    margin-bottom: 20px;
}

.dashboard-card h3 {
    margin-top: 0;
    color: var(--light-blue);
    font-size: 1.1rem;
    text-transform: uppercase;
}

/* ============================================================
   4. MODULES SUPÉRIEURS (ÉQUILIBRÉS)
   ============================================================ */
.dashboard-top-row {
    display: grid;
    /* Équilibre : 250px pour le bouton, le reste pour le signalement */
    grid-template-columns: 250px 1fr; 
    gap: 20px;
    margin-bottom: 20px;
    align-items: stretch; /* Les deux cartes feront la même hauteur */
}

/* Section ALERTE */
.dashboard-bip-section.compact {
    margin-bottom: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.dashboard-bip-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-bip-button {
    width: 100px; /* Taille augmentée */
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--warning-red); /* Bordure plus épaisse */
    background: #450a0a;
    color: white;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
    transition: all 0.2s ease-in-out;
    font-family: 'Roboto Mono', monospace;
}

.dashboard-bip-text { 
    font-size: 1.2rem; 
    font-weight: bold; 
}

.dashboard-bip-button:hover {
    transform: scale(1.05);
    background: #620d0d;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.dashboard-bip-button:active {
    transform: scale(0.95);
    background: var(--urgent-red);
}

/* Section DERNIER SIGNALEMENT */
.dashboard-empty-card {
    margin-bottom: 0;
    border-left: 5px solid var(--border-color);
}

.bip-display-module {
    display: flex;
    flex-direction: column;
    padding: 15px;
    min-height: 160px;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color) !important;
}

.bip-header, .bip-footer {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.bip-time-top {
    font-size: 0.9rem;
    font-weight: bold;
    color: #3b82f6; /* Bleu plus vif pour la visibilité */
}

.bip-issuer-top {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
}

.bip-main-info {
    margin: 10px 0;
    text-align: left;
    font-size: 0.95rem;
}

.bip-info-row {
    margin-bottom: 6px;
    color: white;
}

.statut-editor {
    background: #1e293b;
    border: 1px solid var(--accent-blue);
    color: var(--warning-red);
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 2px;
}

.bip-update-bottom, .bip-editor-bottom {
    font-size: 0.65rem; /* Un peu plus grand que 0.55 pour la lisibilité */
    color: #64748b;
    text-transform: uppercase;
    font-style: italic;
}

/* ============================================================
   5. MODULE RENDEZ-VOUS
   ============================================================ */
.dashboard-rdv-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-rdv-item:last-child { border-bottom: none; }

.dashboard-rdv-time {
    font-weight: bold;
    color: var(--light-blue);
    min-width: 100px;
}

.dashboard-rdv-info { flex-grow: 1; display: flex; flex-direction: column; }
.dashboard-patient-name { font-weight: bold; text-transform: uppercase; }
.dashboard-motif { font-size: 0.8rem; color: #94a3b8; }

/* ============================================================
   6. DOCUMENT A4
   ============================================================ */
.dashboard-a4-document {
    background: #f8fafc;
    color: #1e293b;
    padding: 40px;
    aspect-ratio: 1 / 1.414;
    width: 100%;
    box-shadow: 10px 10px 25px rgba(0,0,0,0.7);
    border-radius: 2px;
    position: relative;
}

.dashboard-a4-header {
    text-align: center;
    border-bottom: 2px solid #1e293b;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.dashboard-a4-badge {
    width: 60px;
    filter: grayscale(100%) contrast(150%);
    margin-bottom: 10px;
}

.dashboard-a4-content {
    font-size: 0.9rem;
    line-height: 1.6;
    font-family: 'Times New Roman', serif;
}

.dashboard-a4-footer {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    font-weight: bold;
    opacity: 0.5;
}

/* ============================================================
   7. BOUTONS & STATUTS
   ============================================================ */
.btn-mdt {
    padding: 12px;
    background: var(--accent-blue);
    color: white;
    border: 1px solid var(--light-blue);
    border-radius: 2px;
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
}

.btn-small { width: auto; padding: 5px 10px; font-size: 0.7rem; }

.btn-mdt:hover {
    background: var(--light-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.status-bar { font-size: 0.7rem; color: var(--success-green); margin-top: 5px; }

/* Style de la Modale */
.modal-overlay {
    display: none; /* Caché par défaut */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 500px;
    max-width: 90%;
    border: 2px solid var(--accent-blue);
    animation: modalFadeIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--urgent-red);
    font-weight: bold;
    cursor: pointer;
    font-family: 'Roboto Mono', monospace;
}

/* Formulaire interne */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 0.75rem;
    color: var(--light-blue);
    font-weight: bold;
}

.form-group input, .form-group textarea, .form-group select {
    background: #0f172a;
    border: 1px solid var(--border-color);
    padding: 10px;
    color: white;
    font-family: 'Roboto Mono', monospace;
    outline: none;
}

.form-group input:focus { border-color: var(--accent-blue); }

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

/* ============================================================
   SECTION : DASHBOARD (NAVIGATION & CONTENU)
   ============================================================ */

/* Barre latérale */
/* On s'assure que le conteneur de l'include prend toute la hauteur */
.nav-container {
    height: 100vh;
    display: flex; /* Permet à la .sidebar à l'intérieur de s'étirer */
}

/* On s'assure que la sidebar elle-même est bien en 100% */
.sidebar {
    width: 250px;
    height: 100vh; /* Prend toute la hauteur de l'écran */
    display: flex;
    flex-direction: column; /* Aligne les éléments verticalement */
    padding: 20px;
    background-color: var(--sidebar-bg);
    border-right: 2px solid var(--border-color);
    flex-shrink: 0;
    /* Box-sizing est crucial ici si tu as mis height: 100vh */
    box-sizing: border-box; 
}

.logo {
    text-align: center;
    margin-bottom: 40px;
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--light-blue);
    /* Remove aspect-ratio from here */
    width: 100%; /* Or whatever width you want the logo to be */
    margin-left: auto;
    margin-right: auto;
}

.logo img {
    width: 100%;
    aspect-ratio: 1 / 1; /* Forces the image to be square */
    object-fit: contain; /* Ensures the seal isn't cropped or stretched */
    display: block;
    margin-bottom: 10px;
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar li {
    margin-bottom: 10px;
    border: 1px solid transparent;
    transition: 0.3s;
    cursor: pointer;
}

.sidebar li.active, .sidebar li:hover {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--light-blue);
}

.sidebar a {
    padding: 15px;
    text-decoration: none;
    color: var(--text-color);
    text-transform: uppercase;
    font-size: 0.9rem;
}

/* Zone principale */
.content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
}

header {
    border-bottom: 3px solid var(--light-blue);
    margin-bottom: 30px;
    padding-bottom: 10px;
}

.status-bar {
    font-size: 0.7rem;
    color: var(--success-green);
    margin-top: 5px;
}

/* Grilles et Cartes */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: var(--card-bg);
    border-left: 5px solid var(--accent-blue);
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.card h3 {
    margin-top: 0;
    color: var(--light-blue);
    font-size: 1.1rem;
    text-transform: uppercase;
}

/* Infos Utilisateur (Bas de Sidebar) */
.user-info {
    margin-top: auto;
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto; /* Pousse les infos utilisateur tout en bas */
    padding-top: 20px;
}

.badge {
    color: #94a3b8;
}

/* ============================================================
   SECTION : LOGIN (AUTHENTIFICATION)
   ============================================================ */

/* À ajouter sur la balise <body> de la page login uniquement */
.login-body {
    justify-content: center;
    align-items: center;
}

.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 255, 0, 0.06));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    z-index: 10;
}

.login-container {
    width: 400px;
    background: var(--sidebar-bg);
    border: 2px solid var(--border-color);
    padding: 40px;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    z-index: 20;
}

.login-container::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: var(--light-blue);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    margin-bottom: 10px;
}

.login-header h2 {
    font-size: 1.2rem;
    letter-spacing: 2px;
    margin-top: 15px;
    color: var(--light-blue);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 8px;
    color: #94a3b8;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: white;
    font-family: 'Roboto Mono', monospace;
    box-sizing: border-box;
}

.input-group input:focus {
    outline: none;
    border-color: var(--light-blue);
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 0.65rem;
    color: #4b5563;
}

.warning {
    color: var(--warning-red);
    font-weight: bold;
    margin-top: 10px;
}

/* ============================================================
   SECTION : COMPOSANTS COMMUNS (BOUTONS)
   ============================================================ */

.btn-mdt {
    width: 100%;
    padding: 12px;
    background: var(--accent-blue);
    color: white;
    border: 1px solid var(--light-blue);
    border-radius: 2px;
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s;
}

.btn-mdt:hover {
    background: var(--light-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.btn-urgent {
    background: var(--urgent-red);
    border-color: #ef4444;
}

.btn-urgent:hover {
    background: #b91c1c;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

/* --- Ajustements Calendrier pour le style MDT --- */
#calendar-container {
    background: #1a1c26;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    margin-top: 20px;
    height: calc(100vh - 280px); 
    min-height: 400px;
}

#calendar {
    height: 100%;
}

.content {
    overflow: hidden; /* Empêche la page entière de scroller */
    display: flex;
    flex-direction: column;
}

/* Forçage des couleurs FullCalendar */
:root {
    --fc-border-color: #2d3748;
    --fc-daygrid-event-dot-color: var(--light-blue);
    --fc-page-bg-color: #1a1c26;
    --fc-list-event-hover-bg-color: rgba(59, 130, 246, 0.1);
}

.fc { font-family: 'Roboto Mono', monospace; color: var(--text-color); }
.fc-header-toolbar h2 { font-size: 1.2rem !important; text-transform: uppercase; color: var(--light-blue); }

/* Style des boutons du calendrier */
.fc-button-primary {
    background-color: var(--accent-blue) !important;
    border: 1px solid var(--light-blue) !important;
    text-transform: uppercase;
    font-size: 0.8rem !important;
    border-radius: 2px !important;
}

.fc-button-primary:hover { background-color: var(--light-blue) !important; }

/* Style des créneaux (événements) */
.fc-event {
    background-color: rgba(59, 130, 246, 0.2) !important;
    border: 1px solid var(--light-blue) !important;
    color: var(--text-color) !important;
    padding: 2px 5px;
}

.fc-timegrid-slot { height: 2em !important; border-bottom: 1px solid #2d3748 !important; }
.fc-col-header-cell { background: var(--sidebar-bg); padding: 10px 0; }

/* Scrollbar pour le calendrier */
.fc-scroller::-webkit-scrollbar { width: 8px; }
.fc-scroller::-webkit-scrollbar-track { background: var(--bg-dark); }
.fc-scroller::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }

/* Supprime le fond jaune/doré du jour actuel */
.fc-day-today {
    background-color: transparent !important;
}

/* Style des en-têtes de colonnes (les jours) */
.fc-col-header-cell {
    background-color: var(--sidebar-bg); /* Ton gris foncé */
    padding: 10px 0 !important;
}

/* Indiquer le jour d'aujourd'hui uniquement dans l'en-tête */
.fc-col-header-cell.fc-day-today {
    background-color: var(--accent-blue) !important; /* Fond bleu pour l'en-tête */
    border-bottom: 2px solid var(--light-blue);
}

.fc-col-header-cell-cushion {
    color: var(--text-color);
    text-transform: uppercase;
    text-decoration: none;
}

/* Optionnel : La ligne rouge qui indique l'heure actuelle */
.fc-timegrid-now-indicator-line {
    border-color: var(--light-blue) !important; /* Change le rouge en bleu LSPD */
}