:root {
    /* --- COULEURS OFFICIELLES COCHLEAR --- */
    --primary: #FFD200;       /* Le jaune Cochlear principal */
    --primary-hover: #E6BD00; /* Un jaune légèrement plus sombre pour le survol */
    
    /* --- AUTRES COULEURS (Inchangées) --- */
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #22c55e; /* Vert pour le succès, on le garde */
    --dark: #1e293b;

                --cochlear: #FFD200;
            --dark: #1e293b;
            --light-bg: #f1f5f9;
            --border: #e2e8f0;
            --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
}

/* --- MENU FANCY --- */
        .top-nav {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 15px;
            padding: 12px 20px;
            background: var(--dark);
            box-shadow: var(--shadow);
            z-index: 1000;
            position: relative;
        }

        .fancy-btn {
            background: transparent;
            color: white;
            border: 2px solid var(--cochlear);
            padding: 8px 20px;
            border-radius: 25px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.85rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            transition: all 0.3s ease;
            white-space: nowrap;
        }

        .fancy-btn:hover {
            background: var(--cochlear);
            color: var(--dark);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(255, 210, 0, 0.4);
        }

        .fancy-btn.active {
            background: var(--cochlear);
            color: var(--dark);
        }

        /* --- LAYOUT DYNAMIQUE --- */
        #main-content {
            height: calc(100vh - 65px); /* Hauteur restante après le menu */
            width: 100%;
            position: relative;
            transition: opacity 0.3s ease;
        }

        .loading-state {
            opacity: 0.4;
            pointer-events: none;
        }

        /* Message d'accueil */
        .welcome-msg {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100%;
            text-align: center;
            color: #64748b;
        }

        /* --- RESPONSIVE --- */
        @media (max-width: 768px) {
            body { overflow: auto; } /* Permet le scroll sur mobile si contenu long */
            .top-nav {
                padding: 10px;
                gap: 8px;
                flex-wrap: wrap;
            }
            .fancy-btn {
                padding: 6px 12px;
                font-size: 0.7rem;
                flex: 1 1 30%;
            }
            #main-content {
                height: auto;
                min-height: calc(100vh - 100px);
            }
        }

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Barre de recherche collante */
.header-box {
    position: sticky;
    top: 0;
    background: var(--bg);
    padding: 10px 0 20px 0;
    z-index: 100;
}

h1 { 
    margin: 0 0 10px 0; 
    font-size: 1.5rem; 
    color: var(--dark);
}

#searchInput {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#searchInput:focus { 
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#resultCount { 
    font-weight: bold; 
    margin-top: 10px; 
    color: var(--dark); 
    font-size: 0.9rem; 
}

/* --- GESTION DU DÉBORDEMENT --- */
.table-wrapper {
    width: 100%;
    overflow-x: hidden; /* On empêche le scroll horizontal parasite */
    background: var(--card-bg);
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Force le respect des largeurs */
}

/* --- ADAPTATION DES COLONNES (Desktop) --- */
th:nth-child(1), td:nth-child(1) { width: 30%; } /* Praticien */
th:nth-child(2), td:nth-child(2) { width: 10%; } /* Dept */
th:nth-child(3), td:nth-child(3) { width: 45%; } /* Config */
th:nth-child(4), td:nth-child(4) { width: 15%; } /* Action */

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    word-wrap: break-word; /* Casse les mots trop longs */
    overflow-wrap: break-word;
}

/* --- MOBILE FIRST : Passage en mode "Cards" --- */
@media (max-width: 992px) {
    table, thead, tbody, th, td, tr {
        display: block; /* On casse la structure tableau */
    }

    thead { display: none; } /* On cache les titres de colonnes */

    .doctor-row {
        margin-bottom: 20px;
        border: 2px solid var(--border);
        border-radius: 15px;
        padding: 10px;
        background: #fff;
    }

    td {
        width: 100% !important;
        padding: 8px 10px;
        text-align: left;
        border: none;
    }

    /* Ajout de labels automatiques pour mobile */
    td:nth-child(1) { border-bottom: 1px solid #f1f5f9; padding-bottom: 15px; }
    
    /* On ajuste les groupes de checkbox pour qu'ils ne sortent pas */
    .form-group {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* 2 colonnes sur mobile */
        gap: 10px;
    }

    .btn-update {
        width: 100%;
        padding: 15px;
        font-size: 1rem;
    }
}

/* Style pour le petit bouton de sauvegarde de la description */
.btn-update-small {
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-update-small:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
    color: #111827;
}

.btn-update-small:active {
    background-color: #d1d5db;
    transform: translateY(1px);
}

/* Style pour le textarea de description */
.desc-input {
    display: block;
    width: 100%;
    margin-top: 5px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    line-height: 1.4;
    color: #4b5563;
    resize: vertical; /* Permet à l'utilisateur d'agrandir la zone si besoin */
    transition: border-color 0.2s;
}

.desc-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.audio-mapping-container { background: #fdfdfd; padding: 10px; border-radius: 5px; border: 1px dashed #ccc; }
.audio-tags-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }

/* Le petit Badge style moderne */
.badge-audio {
    background: #e2e8f0; color: #475569; padding: 3px 8px;
    border-radius: 15px; font-size: 0.75rem; display: flex; align-items: center;
}
.badge-audio i { margin-left: 5px; cursor: pointer; color: #ef4444; font-weight: bold; }

.audio-search-input { width: 100%; padding: 5px; border: 1px solid #ddd; border-radius: 4px; font-size: 0.8rem; }

/* Liste de résultats flottante */
.search-results {
    position: absolute; background: white; border: 1px solid #ddd;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); z-index: 10; max-height: 200px; overflow-y: auto;
    width: 250px;
}
.search-item { padding: 8px; cursor: pointer; font-size: 0.8rem; border-bottom: 1px solid #f0f0f0; }
.search-item:hover { background: #FFD200; }

.button-group {
    display: flex;       /* Aligne les éléments sur une ligne */
    gap: 10px;          /* Espace de 10px entre les deux boutons */
    align-items: center; /* Aligne les boutons verticalement si leur hauteur diffère */
}

/* Optionnel : pour que les boutons fassent la même taille sur mobile */
@media (max-width: 600px) {
    .button-group {
        flex-direction: row; /* Garde la ligne même sur petit écran */
        justify-content: center;
    }
}

th {
    background: var(--dark);
    color: white;
    padding: 15px;
    font-size: 0.85rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 15px;
    vertical-align: middle; /* <-- C'est cette ligne qui fait tout le travail */
    border-bottom: 1px solid var(--border);
}

tr:hover { background-color: #f1f5f9; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--dark);
    border: 1px solid var(--border);
    margin-bottom: 5px;
}

.badge-dept { background: var(--dark); color: white; }

.doc-name { display: block; font-weight: 700; font-size: 1.05rem; margin: 4px 0; }
.doc-addr { font-size: 0.85rem; color: var(--text-muted); display: block; }

/* Groupes de formulaires */
.opt-section { margin-bottom: 15px; }

.opt-title {
    display: block;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--dark);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.form-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.form-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.form-item input { 
    cursor: pointer; 
    width: 18px; 
    height: 18px; 
    margin: 0; 
}

.separator { 
    border-bottom: 1px solid var(--border); 
    margin: 12px 0; 
}

/* Boutons */
.btn-update {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    width: 100%;
        color: var(--dark) !important; /* Texte foncé sur fond jaune */
    font-weight: 700; /* On renforce le gras pour la lisibilité */
}



.btn-update:hover { background: var(--primary-hover);color: var(--dark) !important; transform: translateY(-1px); }
.btn-update:active { transform: translateY(0); }
.btn-update:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-success { background: var(--success) !important; }

@media (max-width: 768px) {
    body { padding: 10px; }
    .header-box h1 { font-size: 1.2rem; }
}