/* ---------------------------------------------------------------------------
   Onglet Synthèse (Outils neurologue) — .synthese-module.

   Reprend la densité et la palette du « Suivi des séances » (index-page.css,
   #psy-session-followup-pane) pour que les deux modules se ressemblent, mais
   avec ses propres jetons : les deux onglets peuvent diverger sans se casser.
   Markup : partials/index/section_synthese.html · JS : synapp/features/synthese.js
   --------------------------------------------------------------------------- */

.synthese-module {
    --syn-accent: #3b59df;
    --syn-accent-dark: #2543a0;
    --syn-accent-soft: #eef1fb;
    --syn-btn-bg-start: #e8efff;
    --syn-btn-bg-end: #d6e3ff;
    --syn-btn-border: #93aae8;
    --syn-btn-hover-shadow: rgba(59, 89, 223, 0.22);

    --syn-notes-color: #d97706;
    --syn-notes-soft: #fffbeb;

    --syn-border: #e2e8f0;
    --syn-muted: #718096;
}

/* ----- Typographie compacte, alignée sur Informations patient ----- */
.synthese-module .card-header,
.synthese-module .card-body {
    font-size: 0.8rem;
}

.synthese-module .card-header {
    padding: 10px 12px;
}

.synthese-module .card-header h5,
.synthese-module .card-header h6 {
    font-size: 0.85rem;
    font-weight: 600;
}

.synthese-module h6 {
    font-size: 0.8rem;
}

.synthese-module .form-label {
    font-size: 0.8rem;
    color: #4a5568;
    font-weight: 500;
}

.synthese-module .form-control,
.synthese-module .form-select {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}

.synthese-module .btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
}

.synthese-module .btn-sm {
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
}

.synthese-module p,
.synthese-module span,
.synthese-module label,
.synthese-module small {
    font-size: 0.8rem;
}

.synthese-module .compact-card.h-100 {
    margin-bottom: 0;
}

/* ----- Bouton d'action (ajouter, rédiger) ----- */
.synthese-module .synthese-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 31px;
    padding: 0 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border-radius: 0.375rem;
    border: 1px solid var(--syn-btn-border);
    color: var(--syn-accent);
    background: linear-gradient(180deg, var(--syn-btn-bg-start) 0%, var(--syn-btn-bg-end) 100%);
    box-shadow: 0 1px 3px rgba(59, 89, 223, 0.14);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease,
        color 0.15s ease, opacity 0.15s ease;
}

.synthese-module .synthese-action-btn i {
    font-size: 0.82rem;
}

.synthese-module .synthese-action-btn:hover:not(:disabled) {
    color: var(--syn-accent-dark);
    background: linear-gradient(180deg, #d6e3ff 0%, #c5d8ff 100%);
    border-color: #7a9ae8;
    box-shadow: 0 3px 10px var(--syn-btn-hover-shadow);
}

.synthese-module .synthese-action-btn:disabled {
    opacity: 0.82;
    color: #5a7fd4;
    cursor: not-allowed;
}

/* ----- Listes (consultations, synthèses) ----- */
.synthese-module .synthese-list {
    max-height: 420px;
    overflow-y: auto;
}

.synthese-module .synthese-list-toolbar {
    border-bottom: 1px solid var(--syn-border);
}

.synthese-module .synthese-list .synthese-item {
    border: 1px solid var(--syn-border);
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.6rem 0.7rem;
}

.synthese-module .synthese-list .synthese-item:hover {
    border-color: #6378da;
    box-shadow: 0 4px 12px rgba(99, 120, 218, 0.18);
    transform: translateY(-1px);
}

.synthese-module .synthese-list .synthese-item.active {
    background: linear-gradient(135deg, #4b63c9 0%, #6378da 100%);
    border-color: #4b63c9;
    color: #fff;
}

.synthese-module .synthese-list .synthese-item.active .synthese-item-date,
.synthese-module .synthese-list .synthese-item.active small,
.synthese-module .synthese-list .synthese-item.active .fw-semibold {
    color: #fff;
}

.synthese-module .synthese-item-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--syn-accent-soft);
    color: var(--syn-accent);
    font-size: 0.7rem;
    font-weight: 700;
}

.synthese-module .synthese-item.active .synthese-item-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.synthese-module .synthese-item-delete {
    align-self: stretch;
    padding: 0 0.5rem;
    border-radius: 0.375rem;
}

.synthese-module .synthese-item.active .synthese-item-delete {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
}

.synthese-module .synthese-item.active .synthese-item-delete:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* ----- Éditeur de consultation ----- */
.synthese-module .synthese-media-toolbar {
    border: 1px solid var(--syn-border);
    border-radius: 0.5rem;
    padding: 0.6rem;
    background: #f8fafc;
}

.synthese-module .synthese-media-audio {
    min-width: 240px;
    flex: 0 0 auto;
}

.synthese-module .synthese-playback-actions {
    display: flex;
    gap: 0.35rem;
}

.synthese-module .synthese-consultation-tabs {
    border-bottom: 1px solid var(--syn-border);
}

.synthese-module .synthese-consultation-tabs .nav-link {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--syn-muted);
    padding: 0.35rem 0.8rem;
    border: 1px solid transparent;
    border-bottom: none;
}

.synthese-module .synthese-consultation-tabs .nav-link.active {
    color: var(--syn-accent);
    background: #fff;
    border-color: var(--syn-border) var(--syn-border) #fff;
}

.synthese-module #synthese-notes-tab.active {
    color: var(--syn-notes-color);
}

.synthese-module #synthese-notes-tab:hover {
    background: var(--syn-notes-soft);
    color: var(--syn-notes-color);
}

.synthese-module .synthese-consultation-tab-content {
    border: 1px solid var(--syn-border);
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    padding: 0.6rem;
}

.synthese-module .synthese-textarea {
    font-size: 0.8rem;
    line-height: 1.45;
    resize: vertical;
}

/* ----- Tableau de sélection contexte / cible ----- */
.synthese-module .synthese-selection-block {
    border: 1px solid var(--syn-border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.6rem;
    background: #f8fafc;
}

.synthese-module .synthese-selection-scroll {
    /* Pas de scroll interne : la carte / la page grandissent avec le tableau. */
    max-height: none;
    overflow-y: visible;
}

/* Cases du tableau Contexte/Synthèse : taille cliquable.
   Ne pas appliquer aux .form-switch (sinon le curseur gauche/droite devient un carré). */
.synthese-module .synthese-selection-table .form-check-input {
    width: 0.95rem;
    height: 0.95rem;
    margin-top: 0.15rem;
    border-color: #94a3b8;
}

.synthese-module .synthese-selection-table .form-check-input:disabled {
    border-color: #cbd5e0;
}

.synthese-module .form-switch {
    display: flex;
    align-items: center;
    padding-left: 2.5em;
    min-height: 1.5rem;
}

.synthese-module .form-switch .form-check-input {
    width: 2.25em;
    height: 1.15em;
    margin-left: -2.5em;
    margin-top: 0;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
    background-position: left center;
    border-radius: 2em;
    border-color: #94a3b8;
    cursor: pointer;
    transition: background-position 0.15s ease-in-out, background-color 0.15s ease-in-out,
        border-color 0.15s ease-in-out;
}

.synthese-module .form-switch .form-check-input:focus {
    border-color: var(--syn-btn-border);
    box-shadow: 0 0 0 0.2rem rgba(59, 89, 223, 0.2);
}

.synthese-module .form-switch .form-check-input:checked {
    background-color: var(--syn-accent);
    border-color: var(--syn-accent);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    background-position: right center;
}

.synthese-module .form-switch .form-check-label {
    cursor: pointer;
    user-select: none;
}

.synthese-module .synthese-selection-table th {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--syn-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: #f8fafc;
}

.synthese-module .synthese-selection-table td {
    font-size: 0.78rem;
    vertical-align: middle;
}

.synthese-module .synthese-doc-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
}

.synthese-module .synthese-doc-type-icon {
    flex: 0 0 auto;
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
}

.synthese-module .synthese-selection-table .form-check-inline {
    margin-right: 0.6rem;
}

.synthese-module .synthese-selection-table .form-check-label {
    font-size: 0.74rem;
}

.synthese-module .synthese-selection-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--syn-muted);
    background: #eef2f7;
}

.synthese-module .synthese-selection-unavailable {
    color: #a0aec0;
    font-style: italic;
}

/* Œil d'aperçu : visible seulement quand l'IA a déjà extrait le document. */
.synthese-module .synthese-doc-eye {
    color: var(--syn-accent);
    line-height: 1;
    vertical-align: baseline;
    text-decoration: none;
}

.synthese-module .synthese-doc-eye:hover {
    color: var(--syn-accent-dark);
}

/* ----- Assistant IA (sous le texte généré) -----
   Le bloc partagé fait 440 px minimum ; ici il est secondaire, le texte de la
   synthèse reste l'objet principal de la colonne. */
.synthese-module #synthese-chatbot-container {
    height: auto;
    min-height: 0;
    max-height: 320px;
}

.synthese-module #synthese-chatbot-messages {
    min-height: 130px;
    max-height: 250px;
}

/* ----- Barre de versions ----- */
.synthese-module .synthese-version-bar {
    display: none;
    border: 1px solid var(--syn-border);
    border-radius: 0.5rem;
    padding: 0.35rem 0.5rem;
    background: #f8fafc;
}

.synthese-module .synthese-version-bar:not(.d-none) {
    display: flex;
}

/* ----- Petits écrans ----- */
@media (max-width: 767.98px) {
    .synthese-module .synthese-media-audio {
        min-width: 100%;
    }

    .synthese-module .synthese-list {
        max-height: 260px;
    }
}
