:root {
    --primary: #2c3e50;    /* Bleu sombre médical */
    --accent: #3498db;     /* Bleu clair Oxymed */
    --success: #27ae60;    /* Vert conformité */
    --warning: #f1c40f;    /* Alerte AHI/Fuites */
    --danger: #e74c3c;
    --bg: #f4f7f6;
    --white: #ffffff;
    --text: #333;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: var(--bg); 
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
}

.container { 
    display: flex; 
    width: 100%; 
    min-height: 100vh; 
}

/* --- SIDEBAR --- */
.sidebar { 
    width: var(--sidebar-width); 
    background: var(--primary); 
    color: white; 
    padding: 25px 15px; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    z-index: 1001;
}

.logo h2 { font-size: 1.5rem; font-weight: 300; letter-spacing: 1px; text-align: center; }
.logo span { color: var(--accent); font-weight: 700; }

.sidebar ul { list-style: none; margin-top: 40px; }
.sidebar li { 
    padding: 12px 15px; 
    margin-bottom: 8px;
    cursor: pointer; 
    transition: all 0.3s ease; 
    border-radius: 8px; 
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
}

.sidebar li i { width: 20px; font-size: 1.1rem; }
.sidebar li:hover { background: rgba(52, 152, 219, 0.2); }
.sidebar li.active { 
    background: var(--accent); 
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3); 
    color: white; 
}

.sidebar-footer { 
    font-size: 0.8rem; 
    color: #bdc3c7; 
    border-top: 1px solid rgba(255,255,255,0.1); 
    padding-top: 15px;
    text-align: center;
}

/* --- MAIN CONTENT --- */
.content { 
    flex: 1; 
    padding: 30px; 
    max-width: 100%;
    transition: all 0.3s ease;
}

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

h1 { font-weight: 600; font-size: 1.6rem; color: var(--primary); }
.user-info { font-size: 0.9rem; font-weight: 500; }

/* --- CARDS & STATS --- */
.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 20px; 
    margin-bottom: 30px;
}

.card { 
    background: var(--white); 
    padding: 20px; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    text-align: center;
    transition: transform 0.2s;
}

.card:hover { transform: translateY(-5px); }
.card h3 { margin-bottom: 8px; font-size: 0.85rem; color: #7f8c8d; text-transform: uppercase; }
.card p { font-size: 1.8rem; font-weight: 700; color: var(--primary); }

/* --- MODULES & TABLES --- */
.module { animation: fadeIn 0.4s ease-out; }

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

.actions { margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 10px; }

/* Boutons */
.btn-add, .btn-serve, .btn-save {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add { background: var(--accent); color: white; }
.btn-serve { background: var(--success); color: white; }
.btn-save { background: var(--accent); color: white; width: 100%; justify-content: center; }
.btn-cancel { background: #eee; color: var(--text); border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; }

.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.1rem; transition: 0.2s; }
.btn-icon:hover { transform: scale(1.2); }

/* --- GESTION MÉDECINS & APPAREILS --- */
.medecin-stats-list ul { list-style: none; padding: 0; }
.medecin-stats-list li {
    background: white;
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* --- TABLEAUX --- */
.table-container {
    width: 100%;
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    min-width: 800px; /* Augmenté pour les nouvelles colonnes */
}

th, td { padding: 15px; text-align: left; border-bottom: 1px solid #f1f1f1; font-size: 0.9rem; }
th { background: #f8f9fa; color: var(--primary); font-weight: 600; }

/* --- BADGES --- */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: rgba(39, 174, 96, 0.1); color: var(--success); }
.badge-warning { background: rgba(241, 196, 15, 0.1); color: var(--warning); }
.badge-info { background: rgba(52, 152, 219, 0.1); color: var(--accent); border: 1px solid rgba(52, 152, 219, 0.2); }

/* --- FORMULAIRES & MODAL --- */
.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    outline: none;
}
.form-group input:focus { border-color: var(--accent); }

.modal { 
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background: rgba(44, 62, 80, 0.7); 
    backdrop-filter: blur(4px);
}

.modal-content { 
    background: white; 
    margin: 5% auto; 
    padding: 25px; 
    width: 90%;
    max-width: 450px; 
    border-radius: 15px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.close { float: right; cursor: pointer; font-size: 1.5rem; color: #95a5a6; }
.close:hover { color: var(--danger); }

/* --- RESPONSIVE --- */
@media (max-width: 992px) {
    .sidebar { width: 80px; }
    .sidebar h2, .sidebar li span, .sidebar-footer { display: none; }
    .sidebar li { justify-content: center; }
}

@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; flex-direction: row; padding: 10px; }
    .sidebar ul { margin-top: 0; display: flex; width: 100%; justify-content: space-around; }
    .sidebar-footer, .logo { display: none; }
    .content { padding: 15px; }
    .stats-grid { grid-template-columns: 1fr; }
}