/* ============================================================================
   Cabinet ORL — feuille de style applicative
   ----------------------------------------------------------------------------
   Bootstrap 5.1 fournit la base ; ce fichier porte l'identité visuelle.

   Auparavant, la couleur #0d6efd (le bleu primaire par défaut de Bootstrap)
   était répétée en dur sur le bandeau, les en-têtes de cartes, les en-têtes de
   tables et les onglets actifs. Deux conséquences : aucune identité propre, et
   une saturation telle que plus rien ne ressortait — quand tout est mis en
   avant, rien ne l'est.

   La palette ci-dessous est centralisée dans des variables CSS : changer une
   teinte se fait à un seul endroit.
   ========================================================================== */

/* ------------------------------------------------------------- Police ---- */
/* Open Sans est servie depuis wwwroot/fonts : aucun appel à Google Fonts,
   le cabinet doit rester fonctionnel sans accès Internet (même contrainte
   que Bootstrap et Bootstrap Icons, servis localement eux aussi).
   Quatre graisses suffisent — 400, 400 italique, 600, 700 ; tout le reste
   est synthétisé par le navigateur et n'apporterait que du poids. */

@font-face {
    font-family: 'Open Sans';
    src: url('../fonts/OpenSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Open Sans';
    src: url('../fonts/OpenSans-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Open Sans';
    src: url('../fonts/OpenSans-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Open Sans';
    src: url('../fonts/OpenSans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Structure — pétrole profond, calme, lisible toute une journée */
    --orl-brand: #0f4c5c;
    --orl-brand-dark: #0b3b47;
    --orl-brand-soft: #e7f0f2;

    /* Action — turquoise clinique, réservé à ce qui est cliquable */
    --orl-accent: #177f91;
    --orl-accent-dark: #12697a;
    --orl-accent-soft: #e3f2f4;

    /* Neutres, légèrement froids pour s'accorder au pétrole */
    --orl-ink: #16262b;
    --orl-ink-2: #3d5259;
    --orl-muted: #6b8189;
    --orl-line: #dbe4e6;
    --orl-line-soft: #eef3f4;
    --orl-surface: #ffffff;
    --orl-page: #f4f7f8;

    /* Sémantique — la couleur porte du sens, elle ne décore pas */
    --orl-success: #1f6f4e;
    --orl-success-soft: #e6f3ec;
    --orl-warning: #8a5a00;
    --orl-warning-soft: #fbf1de;
    --orl-danger: #a63328;
    --orl-danger-soft: #faeae8;

    --orl-radius: 10px;
    --orl-radius-sm: 7px;
    --orl-shadow: 0 1px 2px rgba(22, 38, 43, .06), 0 4px 12px rgba(22, 38, 43, .06);
}

/* ---------------------------------------------------------------- Base ---- */

body {
    background-color: var(--orl-page);
    color: var(--orl-ink);
    font-family: 'Open Sans', 'Segoe UI', Roboto, -apple-system, Arial, sans-serif;
}

h1, h2, h3, h4, h5 {
    color: var(--orl-ink);
    text-wrap: balance;
}

a {
    color: var(--orl-accent-dark);
    text-underline-offset: 2px;
}

a:hover { color: var(--orl-brand); }

/* ------------------------------------------------------------- Bandeau ---- */

.header-orl {
    background-color: var(--orl-brand);
    color: #fff;
    padding: 9px 18px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* La navbar suit immédiatement le bandeau : pas de seconde ombre portée,
   sinon on lit deux barres empilées au lieu d'un seul en-tête. */
.navbar {
    border-bottom: 1px solid var(--orl-line);
    box-shadow: none !important;
}

.navbar-brand {
    font-size: 17px;
    font-weight: 700;
    color: var(--orl-brand) !important;
}

.navbar .nav-link {
    font-weight: 500;
    color: var(--orl-ink-2) !important;
    border-radius: var(--orl-radius-sm);
    padding: .4rem .7rem !important;
}

.navbar .nav-link:hover {
    color: var(--orl-brand) !important;
    background-color: var(--orl-brand-soft);
}

/* Onglet correspondant à la page courante */
.navbar .nav-link.is-current {
    color: var(--orl-brand) !important;
    background-color: var(--orl-brand-soft);
    font-weight: 600;
}

.navbar .nav-link i { opacity: .75; }

/* --------------------------------------------------------------- Cartes ---- */

.card {
    border: 1px solid var(--orl-line);
    border-radius: var(--orl-radius);
    box-shadow: var(--orl-shadow);
}

.card-header {
    background-color: var(--orl-brand);
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
    border-bottom: none;
    border-top-left-radius: calc(var(--orl-radius) - 1px);
    border-top-right-radius: calc(var(--orl-radius) - 1px);
}

.card-header a { color: #cfe6ea; }

.card-body {
    background-color: var(--orl-surface);
    padding: 20px;
}

.section-block {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--orl-surface);
    border: 1px solid var(--orl-line);
    border-radius: var(--orl-radius);
    box-shadow: var(--orl-shadow);
}

/* -------------------------------------------------------------- Boutons ---- */
/* Bootstrap 5.1 code les couleurs des boutons en dur : on les redéfinit
   explicitement plutôt que via --bs-primary, qui n'agit pas ici. */

.btn {
    border-radius: var(--orl-radius-sm);
    padding: .4rem .85rem;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--orl-accent);
    border-color: var(--orl-accent);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--orl-accent-dark) !important;
    border-color: var(--orl-accent-dark) !important;
}

.btn-outline-primary {
    color: var(--orl-accent-dark);
    border-color: var(--orl-accent);
}

.btn-outline-primary:hover,
.btn-outline-primary:active {
    background-color: var(--orl-accent) !important;
    border-color: var(--orl-accent) !important;
    color: #fff !important;
}

.btn-outline-secondary {
    color: var(--orl-ink-2);
    border-color: var(--orl-line);
}

.btn-outline-secondary:hover {
    background-color: var(--orl-brand-soft);
    border-color: var(--orl-line);
    color: var(--orl-brand);
}

.btn-outline-danger { color: var(--orl-danger); border-color: #e3b7b2; }
.btn-outline-danger:hover { background-color: var(--orl-danger); border-color: var(--orl-danger); }

.btn-link { color: var(--orl-accent-dark); }

.btn:focus-visible,
.form-control:focus-visible,
a:focus-visible {
    outline: 2px solid var(--orl-accent);
    outline-offset: 2px;
    box-shadow: none;
}

/* -------------------------------------------------------------- Tables ---- */

.table {
    border-radius: var(--orl-radius);
    overflow: hidden;
    color: var(--orl-ink);
}

/* En-têtes clairs à texte sombre. L'ancienne règle imposait du blanc sur fond
   bleu vif pour toutes les tables ; combinée à une table à fond clair, elle
   rendait les libellés de colonnes illisibles (blanc sur gris). */
.table thead th {
    background-color: var(--orl-line-soft);
    color: var(--orl-ink-2);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--orl-line);
    white-space: nowrap;
}

.table tbody tr:hover { background-color: var(--orl-brand-soft); }

/* Le curseur « main » était appliqué à toutes les lignes, y compris celles qui
   ne sont pas cliquables : il annonçait une interaction inexistante. */
.table tbody tr.is-clickable { cursor: pointer; }

.table-modern {
    width: 100%;
    background: var(--orl-surface);
    border-radius: var(--orl-radius);
    overflow: hidden;
    box-shadow: var(--orl-shadow);
}

.table-modern thead { background: var(--orl-line-soft); font-weight: 600; }
.table-modern th, .table-modern td { padding: 12px 16px; vertical-align: middle; }
.table-modern tbody tr { border-bottom: 1px solid var(--orl-line-soft); }
.table-modern tbody tr:hover { background: var(--orl-brand-soft); }
.table-modern .btn-sm { padding: 4px 8px; font-size: .85rem; }

.action-btn, .table-modern .action-btn { margin-right: 6px; }

.table-scroll-xs, .table-scroll-s {
    overflow-y: auto;
    overflow-x: hidden;
    display: block;
    border: 1px solid var(--orl-line);
    border-radius: var(--orl-radius-sm);
    box-shadow: var(--orl-shadow);
    padding: 0;
}

.table-scroll-xs { max-height: 400px; }
.table-scroll-s { max-height: 600px; }

/* -------------------------------------------------------------- Onglets ---- */

.nav-tabs {
    border-bottom: 1px solid var(--orl-line);
    gap: .25rem;
}

.nav-tabs .nav-link {
    font-weight: 600;
    padding: .55rem 1rem;
    color: var(--orl-muted);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}

.nav-tabs .nav-link:hover {
    background-color: var(--orl-brand-soft);
    color: var(--orl-brand);
}

/* Onglet actif souligné plutôt que rempli de bleu : moins lourd, et la couleur
   reste disponible pour signaler ce qui compte vraiment. */
.nav-tabs .nav-link.active {
    background-color: transparent;
    color: var(--orl-brand);
    border-bottom-color: var(--orl-accent);
}

/* --------------------------------------------------------- Formulaires ---- */

.form-control, .form-select {
    border-radius: var(--orl-radius-sm);
    border-color: var(--orl-line);
    color: var(--orl-ink);
}

.form-control:focus, .form-select:focus {
    border-color: var(--orl-accent);
    box-shadow: 0 0 0 .2rem rgba(23, 127, 145, .18);
}

label, .form-label {
    font-weight: 600;
    font-size: .875rem;
    color: var(--orl-ink-2);
    margin-bottom: .3rem;
}

/* .form-group a été supprimée en Bootstrap 5 : elle ne produit plus aucun
   espacement. Les vues sont converties en « mb-3 » ; cette règle sert de
   filet pour tout gabarit qui l'utiliserait encore. */
.form-group { margin-bottom: 1rem; }

.text-danger { color: var(--orl-danger) !important; font-size: .85rem; }

/* --------------------------------------------------- Notifications ---- */

.orl-toasts {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: min(24rem, calc(100vw - 2rem));
}

.orl-toast {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    background: var(--orl-surface);
    border: 1px solid var(--orl-line);
    border-left: 4px solid var(--orl-accent);
    border-radius: var(--orl-radius-sm);
    box-shadow: 0 .5rem 1.25rem rgba(22, 38, 43, .16);
    padding: .7rem .9rem;
    font-size: .9rem;
    animation: orl-toast-in .18s ease-out;
}

.orl-toast.is-success { border-left-color: var(--orl-success); background: var(--orl-success-soft); }
.orl-toast.is-error   { border-left-color: var(--orl-danger);  background: var(--orl-danger-soft); }
.orl-toast.is-warning { border-left-color: var(--orl-warning); background: var(--orl-warning-soft); }

.orl-toast i { font-size: 1rem; line-height: 1.35; }
.orl-toast.is-success i { color: var(--orl-success); }
.orl-toast.is-error i   { color: var(--orl-danger); }
.orl-toast.is-warning i { color: var(--orl-warning); }

.orl-toast .btn-close { margin-left: auto; font-size: .6rem; opacity: .5; }

@keyframes orl-toast-in {
    from { opacity: 0; transform: translateY(-.4rem); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .orl-toast { animation: none; }
    * { transition: none !important; }
}

/* ------------------------------------------------------- États vides ---- */

.orl-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--orl-muted);
    background: var(--orl-surface);
    border: 1px dashed var(--orl-line);
    border-radius: var(--orl-radius);
}

.orl-empty i {
    font-size: 1.75rem;
    display: block;
    margin-bottom: .5rem;
    opacity: .5;
}

/* ------------------------------------------------------------ Badges ---- */

.orl-pill {
    display: inline-block;
    font-size: .75rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.orl-pill.is-neutral { background: var(--orl-line-soft); color: var(--orl-ink-2); border-color: var(--orl-line); }
.orl-pill.is-success { background: var(--orl-success-soft); color: var(--orl-success); }
.orl-pill.is-warning { background: var(--orl-warning-soft); color: var(--orl-warning); }
.orl-pill.is-danger  { background: var(--orl-danger-soft); color: var(--orl-danger); }

/* ----------------------------------------------------------- Utilitaires ---- */

.text-brand { color: var(--orl-brand); }
.text-accent { color: var(--orl-accent-dark); }

/* En-tête de dossier patient : le praticien doit savoir en permanence de qui
   il est question, sans remonter en haut de page. */
.orl-patient-bar {
    display: flex;
    align-items: center;
    gap: .9rem;
    background: var(--orl-surface);
    border: 1px solid var(--orl-line);
    border-left: 4px solid var(--orl-brand);
    border-radius: var(--orl-radius);
    padding: .8rem 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--orl-shadow);
}

/* Pastille d'initiales, utilisable seule (listes) ou dans l'en-tête patient. */
.orl-avatar {
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--orl-brand-soft);
    color: var(--orl-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    letter-spacing: .02em;
}

.orl-patient-bar .orl-avatar {
    width: 2.5rem;
    height: 2.5rem;
    font-size: .9rem;
}

.orl-patient-bar .orl-name {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
}

.orl-patient-bar .orl-meta {
    color: var(--orl-muted);
    font-size: .85rem;
}

/* Le bloc « Onglets en cadre » (.orl-frame) a ete supprime avec les iframes.
   Les onglets du dossier patient sont desormais des vues partielles rendues
   dans la page : plus de hauteur a deviner, plus de double barre de defilement,
   et le contenu reprend le flux normal du document. */

/* ------------------------------------------------------------ Footer ---- */

.footer {
    border-top: 1px solid var(--orl-line);
    color: var(--orl-muted);
    font-size: .85rem;
}

/* ------------------------------------------------------ Espace compte ---- */
/* Les pages de gestion du compte proviennent du gabarit ASP.NET Identity :
   titres surdimensionnés, bouton « Save » pleine largeur en btn-lg, menu en
   nav-pills bleu vif. Rien de tout cela ne correspond au reste de
   l'application, et l'ensemble criait plus fort que le dossier patient — qui
   est pourtant l'écran qui compte.

   Le parti pris ici : la couleur ne sert qu'à désigner la page courante et
   l'unique bouton d'envoi. Tout le reste est en neutres. */

.orl-account {
    max-width: 52rem;
}

.orl-account-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: .15rem;
}

.orl-account-intro {
    color: var(--orl-muted);
    font-size: .875rem;
    margin-bottom: 1.5rem;
}

/* Menu latéral : filet de sélection à gauche plutôt qu'une pastille pleine.
   Même principe que les onglets du dossier patient, pour que les deux
   navigations se lisent de la même manière. */
.orl-account-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--orl-line);
}

.orl-account-nav a {
    display: block;
    padding: .45rem .85rem;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--orl-ink-2);
    font-size: .9rem;
    text-decoration: none;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}

.orl-account-nav a:hover {
    color: var(--orl-brand);
    background-color: var(--orl-brand-soft);
}

.orl-account-nav a.is-current {
    color: var(--orl-brand);
    border-left-color: var(--orl-accent);
    font-weight: 600;
}

/* Panneau de contenu : une simple surface, sans ombre ni en-tête coloré —
   il n'y a qu'un panneau par page, le distinguer n'apporte rien. */
.orl-account-panel {
    background: var(--orl-surface);
    border: 1px solid var(--orl-line);
    border-radius: var(--orl-radius);
    padding: 1.5rem;
}

.orl-account-panel h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .15rem;
}

/* Texte d'aide sous un champ : explique à quoi il sert, plutôt que de laisser
   deviner. Volontairement discret — on le lit une fois. */
.orl-hint {
    display: block;
    color: var(--orl-muted);
    font-size: .8125rem;
    margin-top: .3rem;
    line-height: 1.45;
}

/* Champ non modifiable : il doit se lire comme une information, pas comme une
   saisie possible. Bootstrap grise le texte, ce qui ne suffit pas à le dire. */
.orl-account .form-control:disabled,
.orl-account .form-control[readonly] {
    background-color: var(--orl-line-soft);
    color: var(--orl-ink-2);
    border-style: dashed;
}

/* ------------------------------------------------------ Fil d'Ariane ---- */
/* Affiché uniquement sur les écrans situés sous le dossier patient. Sur le
   dossier lui-même, la barre patient porte déjà le retour à la liste : deux
   chemins de retour concurrents se seraient contredits.

   Volontairement discret — c'est un repère, pas une action. */

.orl-fil {
    font-size: .8125rem;
    margin-bottom: .5rem;
    padding: 0;
    background: transparent;
}

.orl-fil .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--orl-muted);
    padding-right: .4rem;
}

.orl-fil a {
    color: var(--orl-muted);
    text-decoration: none;
}

.orl-fil a:hover {
    color: var(--orl-brand);
    text-decoration: underline;
}

.orl-fil .breadcrumb-item.active {
    color: var(--orl-ink-2);
    font-weight: 600;
}

/* ------------------------------------------------ Recherche patient ---- */
/* Champ permanent dans la barre de navigation. Discret au repos — c'est un
   outil, pas une action mise en avant — et souligné d'accent au focus. */

.orl-recherche {
    position: relative;
    flex: 0 1 22rem;
    margin-right: 1rem;
}

.orl-recherche .form-control {
    padding-left: 2.1rem;
    padding-right: 2.2rem;
    height: 2.2rem;
    font-size: .875rem;
    background-color: var(--orl-page);
}

.orl-recherche .form-control:focus {
    background-color: var(--orl-surface);
}

.orl-recherche-icone {
    position: absolute;
    left: .7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--orl-muted);
    font-size: .85rem;
    pointer-events: none;
}

.orl-recherche-raccourci {
    position: absolute;
    right: .55rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--orl-line-soft);
    border: 1px solid var(--orl-line);
    border-radius: 4px;
    color: var(--orl-muted);
    font-size: .7rem;
    padding: 0 .3rem;
    pointer-events: none;
}

/* Le raccourci disparait des que le champ sert : il n'a plus rien a apprendre. */
.orl-recherche .form-control:focus ~ .orl-recherche-raccourci { display: none; }

.orl-recherche-resultats {
    position: absolute;
    top: calc(100% + .3rem);
    left: 0;
    right: 0;
    z-index: 1080;
    margin: 0;
    padding: .25rem;
    list-style: none;
    background: var(--orl-surface);
    border: 1px solid var(--orl-line);
    border-radius: var(--orl-radius-sm);
    box-shadow: 0 .5rem 1.25rem rgba(22, 38, 43, .16);
    max-height: 22rem;
    overflow-y: auto;
}

.orl-recherche-item {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .4rem .6rem;
    border-radius: 5px;
    cursor: pointer;
}

.orl-recherche-item:hover,
.orl-recherche-item.is-active {
    background: var(--orl-brand-soft);
}

.orl-recherche-nom {
    font-weight: 600;
    font-size: .875rem;
    color: var(--orl-ink);
}

.orl-recherche-meta {
    font-size: .78rem;
    color: var(--orl-muted);
}

.orl-recherche-vide {
    padding: .6rem;
    font-size: .85rem;
    color: var(--orl-muted);
    text-align: center;
}

/* Sous la barre repliee, le champ passe en pleine largeur plutot que de
   comprimer les liens de navigation. */
@media (max-width: 991.98px) {
    .orl-recherche {
        flex: 1 1 100%;
        margin: .5rem 0;
    }
}

/* ------------------------------------------------------ Pagination ---- */
/* Bootstrap code le bleu de ses liens de pagination en dur, comme pour les
   boutons : on realigne sur la palette du cabinet. */

.pagination .page-link {
    color: var(--orl-accent-dark);
    border-color: var(--orl-line);
}

.pagination .page-link:hover {
    background-color: var(--orl-brand-soft);
    border-color: var(--orl-line);
    color: var(--orl-brand);
}

.pagination .page-item.active .page-link {
    background-color: var(--orl-accent);
    border-color: var(--orl-accent);
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    color: var(--orl-muted);
    background-color: transparent;
    border-color: var(--orl-line-soft);
}
