/* Design 2026 des modales du layout (#myModal, #myModalSecond, alertes, confirmations).
   Repris de la popin « Ask Claude » (ask_claude.css) : carte arrondie, en-tête en dégradé,
   champs aux coins arrondis, pied de modale avec action principale à droite.
   Portée : uniquement les modales portant la classe .wt-modal (posée dans layout.php),
   pour ne pas toucher les modales ad hoc des vues. Chargée après global.css. */
:root {
    --wt-accent: #4980b5;
    --wt-accent-dark: #3a6a98;
    --wt-accent-soft: #eaf2f9;
    --wt-ink: #263038;
    --wt-muted: #6b7682;
    --wt-line: #dde4eb;
    --wt-bg: #ffffff;
    --wt-bg-soft: #f6f8fa;
    /* échelle des arrondis, seule source des border-radius des feuilles *_2026.css */
    --wt-radius-line: 1px;     /* traits dessinés (croix de fermeture) */
    --wt-radius-xs: 4px;       /* petits contrôles : icônes d'action, pagination, boutons DataTables, champs -sm, sous-menus */
    --wt-radius-sm: 5px;      /* champs, boutons, entrées de sidebar, onglets */
    --wt-radius-md: 6px;      /* encarts : notes, messages, suivi des traductions, menus déroulants */
    --wt-radius-lg: 8px;      /* cartes : modales, bloc des filtres, bloc du tableau */
    --wt-radius-pill: 999px;   /* pastilles et champs de filtre arrondis */
    --wt-radius-circle: 50%;   /* boutons ronds (croix de fermeture) */
    --wt-header-pad-x: 24px;
    --wt-header-pad-y: 14px;
    --wt-label-width-wide: 200px;
}

/* ---------- cadre ---------- */
.wt-modal .modal-dialog.modal-lg {
    max-width: min(1040px, 94vw);
}

.wt-modal .modal-content {
    border: 0;
    border-radius: var(--wt-radius-lg);
    overflow: hidden;
    background: var(--wt-bg);
    box-shadow: 0 18px 50px rgba(20, 40, 60, .22);
    color: var(--wt-ink);
}

/* ---------- en-tête ---------- */
.wt-modal .modal-header {
    padding: var(--wt-header-pad-y) var(--wt-header-pad-x);
    border-bottom: 0;
    border-radius: 0;
    background: linear-gradient(135deg, #6194c1 0%, var(--wt-accent) 55%, var(--wt-accent-dark) 100%);
    color: #fff;
}

.wt-modal .modal-header > .d-flex {
    align-items: center;
    gap: 10px;
}

.wt-modal .modal-header h5.modal-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
}

.wt-modal .modal-header .close {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border-radius: var(--wt-radius-circle);
    background: rgba(255, 255, 255, .2);
    color: #fff;
    opacity: 1;
    text-shadow: none;
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
}

.wt-modal .modal-header .close {
    position: relative;
}

/* la croix est dessinée en CSS (deux traits croisés au centre exact du cercle) : le glyphe × de la
   police, décalé sous la ligne médiane, n'est jamais centré exactement. Il reste dans le HTML
   (aria-hidden) mais n'est plus affiché. */
.wt-modal .modal-header .close > span {
    font-size: 0;
}

.wt-modal .modal-header .close::before,
.wt-modal .modal-header .close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2px;
    border-radius: var(--wt-radius-line);
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.wt-modal .modal-header .close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.wt-modal .modal-header .close:hover {
    background: rgba(255, 255, 255, .35);
    color: #fff;
}

/* en-tête déplaçable (global.js modalMakeDraggable) : curseur de déplacement, sauf sur les
   sur les éléments interactifs (croix, onglets, langue) qui gardent leur curseur et ne déplacent pas */
.wt-modal .modal-draggable-handle {
    cursor: move;
    touch-action: none;
}

/* outils (agrandir, langue) : le margin-left:-15px inline de layout.php est compensé */
.wt-modal #myModalTools,
.wt-modal #myModalSecondTools {
    margin-left: 0 !important;
    padding: 0 !important;
    gap: 8px;
}

.wt-modal #myModalTools > .fa,
.wt-modal #myModalSecondTools > .fa {
    width: 30px;
    height: 30px;
    margin: 0;
    border: 0;
    border-radius: var(--wt-radius-xs);
    background: rgba(255, 255, 255, .16);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wt-modal #myModalTools > .fa:hover,
.wt-modal #myModalSecondTools > .fa:hover {
    background: rgba(255, 255, 255, .3);
}

.wt-modal #myModalTools .js-modal-lang-wrapper,
.wt-modal #myModalTools .js-modal-lang-wrapper:hover {
    height: 30px;
    margin: 0;
    padding: 0 6px 0 8px;
    border: 0;
    border-radius: var(--wt-radius-xs);
    background: #fff;
}

/* onglets de la fiche (déplacés par la vue dans .modal-header-subtitle) :
   posés sur le bas de l'en-tête, l'onglet actif se fond dans le corps blanc */
.wt-modal .modal-header-subtitle:empty {
    display: none;
}

.wt-modal .modal-header-subtitle {
    margin: 12px 0 calc(-1 * var(--wt-header-pad-y));
}

.wt-modal .modal-header-subtitle .nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 4px;
    margin: 0 !important; /* la vue pose margin-bottom:-17px en style inline */
    border-bottom: 0;
}

.wt-modal .modal-header-subtitle .nav-tabs .nav-link {
    padding: 7px 14px;
    border: 0;
    border-radius: var(--wt-radius-sm) var(--wt-radius-sm) 0 0;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.wt-modal .modal-header-subtitle .nav-tabs .nav-link:hover {
    background: rgba(255, 255, 255, .28);
    color: #fff;
}

.wt-modal .modal-header-subtitle .nav-tabs .nav-link.active {
    background: var(--wt-bg);
    color: var(--wt-accent-dark);
}

/* ---------- corps ---------- */
.wt-modal .modal-body {
    padding: 20px 28px 8px;
}

.wt-modal #myModalMsg,
.wt-modal #myModalSecondMsg {
    border: 0;
    border-radius: var(--wt-radius-md);
    background: var(--wt-accent-soft);
    color: var(--wt-ink);
    padding: 12px 16px;
    margin-bottom: 16px;
}

/* global.js pose alert-warning (erreur de validation) ou alert-success sur le message */
.wt-modal #myModalMsg.alert-warning,
.wt-modal #myModalSecondMsg.alert-warning {
    background: #fdecea;
    color: #a3302a;
}

.wt-modal #myModalMsg.alert-success,
.wt-modal #myModalSecondMsg.alert-success {
    background: #e5f6ec;
    color: #1f7a45;
}

/* champ en erreur (is-invalid posé par global.js) */
.wt-modal .form-control.is-invalid {
    border-color: #d9534f;
    box-shadow: 0 0 0 3px rgba(217, 83, 79, .12);
}

.wt-modal .form-update {
    padding-top: 0;
}

/* libellés de toutes les fiches : seulement la typographie, la disposition reste celle de la vue */
.wt-modal .form-update .col-form-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--wt-ink);
}

/* grille des fiches produite par form_display_field() (rangées .wt-field-row) : rangées régulières,
   libellés alignés sur la première ligne du champ. Les fiches écrites à la main (ex. trip_update)
   ne portent pas cette classe et gardent leur propre disposition. */
.wt-modal .form-update .row.wt-field-row {
    margin-bottom: 14px;
}

.wt-modal .form-update .wt-field-row > .col-form-label {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 4px;
    padding-top: 9px;
    padding-bottom: 0;
    line-height: 1.35;
    text-align: right;
}

.wt-modal .form-update .col-form-label .fa-question-circle-o,
.wt-modal .form-update .form-check-label .fa-question-circle-o {
    color: var(--wt-accent);
    font-weight: 400;
    cursor: help;
}

/* champs */
.wt-modal .form-control {
    min-height: 38px;
    border: 1px solid var(--wt-line);
    border-radius: var(--wt-radius-sm);
    background-color: #fff;
    color: var(--wt-ink);
    font-size: 16px;
    transition: border-color .15s, box-shadow .15s;
}

.wt-modal .form-control-sm {
    min-height: 31px;
    border-radius: var(--wt-radius-xs);
    font-size: 14px;
}

.wt-modal .form-control:focus {
    border-color: var(--wt-accent);
    box-shadow: 0 0 0 3px rgba(73, 128, 181, .15);
}

.wt-modal .form-control::placeholder {
    color: #a0a9b2;
}

.wt-modal .form-update textarea.form-control {
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.45;
}

.wt-modal select.form-control {
    padding-right: 28px;
}

/* cases à cocher des rangées form_display_field() : même hauteur que les champs voisins */
.wt-modal .form-update .wt-field-row .form-check {
    display: flex;
    align-items: center;
    min-height: 38px;
    margin-left: 0 !important;
    padding-left: 0;
}

.wt-modal .form-update .wt-field-row .form-check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--wt-ink);
    cursor: pointer;
}

.wt-modal .form-update .wt-field-row .form-check-input {
    position: static;
    margin: 0;
}

.wt-modal input[type="checkbox"],
.wt-modal input[type="radio"] {
    flex: 0 0 16px; /* ne rétrécit pas quand le libellé passe sur deux lignes */
    width: 16px;
    height: 16px;
    accent-color: var(--wt-accent);
    cursor: pointer;
}

/* modales larges (édition de bloc modal-90, modale agrandie modal-xlg) : en col-2, la colonne
   de libellé suivrait la largeur de la modale (environ 350 px sur un grand écran) et éloignerait
   les libellés de leurs champs. Elle est plafonnée à une largeur fixe, identique sur toutes les
   rangées pour garder l'alignement ; les colonnes de champs gardent leur largeur de base (col-N)
   et se partagent la place libérée (flex-grow), sans dépasser la rangée. */
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > label.col-form-label,
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > label.col-form-label {
    flex: 0 0 var(--wt-label-width-wide);
    max-width: var(--wt-label-width-wide);
}

.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > [class*="col-"]:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > [class*="col-"]:not(.col-form-label) {
    flex-grow: 1;
}

/* chaque champ peut s'élargir au plus de la place libérée par un libellé col-2 plafonné :
   un champ seul sur sa rangée (ex. col-4) ne s'étire donc pas sur toute la largeur */
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row,
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row {
    --wt-label-free: calc(16.6667% - var(--wt-label-width-wide));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-1:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-1:not(.col-form-label) {
    max-width: calc(8.3333% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-2:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-2:not(.col-form-label) {
    max-width: calc(16.6667% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-3:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-3:not(.col-form-label) {
    max-width: calc(25.0% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-4:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-4:not(.col-form-label) {
    max-width: calc(33.3333% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-5:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-5:not(.col-form-label) {
    max-width: calc(41.6667% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-6:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-6:not(.col-form-label) {
    max-width: calc(50.0% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-7:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-7:not(.col-form-label) {
    max-width: calc(58.3333% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-8:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-8:not(.col-form-label) {
    max-width: calc(66.6667% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-9:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-9:not(.col-form-label) {
    max-width: calc(75.0% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-10:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-10:not(.col-form-label) {
    max-width: calc(83.3333% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-11:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-11:not(.col-form-label) {
    max-width: calc(91.6667% + var(--wt-label-free));
}
.wt-modal .modal-dialog.modal-90 .form-update .row.wt-field-row > .col-12:not(.col-form-label),
.wt-modal .modal-dialog.modal-xlg .form-update .row.wt-field-row > .col-12:not(.col-form-label) {
    max-width: calc(100.0% + var(--wt-label-free));
}

/* sélecteur de langue au-dessus d'un champ multilingue */
.wt-modal .js-field-lang-wrapper,
.wt-modal .js-field-lang-wrapper:hover {
    height: 26px;
    margin: 0 0 6px;
    padding: 0 6px 0 8px;
    border: 1px solid var(--wt-line);
    border-radius: var(--wt-radius-pill);
    background: var(--wt-bg-soft);
}

/* les listes de langue (entête et champ) gardent leur hauteur compacte : la hauteur
   minimale des .form-control ci-dessus les ferait déborder de leur cadre */
.wt-modal select.js-field-lang,
.wt-modal select.js-modal-lang {
    min-height: 0;
    height: 20px;
    padding: 0 18px 0 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background-color: transparent;
    font-size: 12px;
    line-height: 20px;
}

.wt-modal select.js-field-lang:focus,
.wt-modal select.js-modal-lang:focus {
    box-shadow: none;
}

/* le libellé d'un champ multilingue reçoit padding-top:32px en inline pour se caler sous ce
   sélecteur : on le recale sur la hauteur réelle (26px + 6px de marge + 9px d'alignement) */
.wt-modal .form-update .row.wt-field-row > .col-form-label[style*="padding-top:32px"] {
    padding-top: 41px !important;
}

/* liste de cases d'une table liée (select_linked_table) : filtre centré, cases en grille */
.wt-modal .form-update .row.m-0 > .col-form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    padding: 6px 10px;
    border-radius: var(--wt-radius-xs);
    font-weight: 400;
    text-align: left;
    cursor: pointer;
}

.wt-modal .form-update .row.m-0 > .col-form-label:hover {
    background: var(--wt-accent-soft);
}

.wt-modal .form-update .linked-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin-bottom: 12px;
    padding: 0 10px;
}

.wt-modal .form-update .linked-table-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    min-width: 0;
}

.wt-modal .form-update .linked-table-title strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--wt-ink);
}

.wt-modal .form-update .linked-table-help {
    font-size: 13px;
    color: var(--wt-muted);
}

.wt-modal .form-update .linked-table-help i {
    color: var(--wt-accent);
}

.wt-modal .form-update .linked-table-filter {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    width: auto;
    margin-left: auto;
}

.wt-modal .form-update .linked-table-filter > .form-control {
    flex: 0 0 220px;
    width: 220px;
    border-radius: var(--wt-radius-pill) !important;
    padding-left: 14px;
}

/* note d'aide en tête de fiche */
.wt-modal .wt-note {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: var(--wt-radius-md);
    background: var(--wt-accent-soft);
    font-size: 13.5px;
    color: var(--wt-ink);
}

.wt-modal .wt-note i {
    color: var(--wt-accent);
    margin-right: 6px;
}

/* suivi des traductions (global.js translation_tracking) : pastilles */
.wt-modal #translation_tracking {
    gap: 6px;
    margin: 0 0 16px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--wt-radius-md);
    background: var(--wt-bg-soft);
    font-size: 13px;
    color: var(--wt-muted);
}

.wt-modal #translation_tracking > span {
    font-weight: 600;
    margin-right: 2px;
}

.wt-modal #translation_tracking > div {
    margin: 0;
    padding: 2px 10px;
    border: 1px solid var(--wt-line);
    border-radius: var(--wt-radius-pill);
    background: #fff;
    color: var(--wt-ink);
}

/* éditeur HTML : mêmes arrondis que les champs */
.wt-modal .sun-editor {
    border-color: var(--wt-line);
    border-radius: var(--wt-radius-sm);
    overflow: hidden;
}

/* ---------- pied ---------- */
.wt-modal .modal-footer {
    gap: 10px;
    padding: 14px 28px 18px;
    border-top: 1px solid var(--wt-line);
    background: var(--wt-bg-soft);
}

.wt-modal .modal-footer > * {
    margin: 0;
}

.wt-modal .modal-footer .btn {
    padding: 9px 22px;
    border-radius: var(--wt-radius-pill);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    transition: background .15s, transform .1s, box-shadow .15s;
}

.wt-modal .modal-footer .btn:active {
    transform: translateY(1px);
}

/* bouton secondaire (Cancel, Close...) : discret */
.wt-modal .modal-footer .btn-secondary {
    border: 1px solid var(--wt-line);
    background: #fff;
    color: var(--wt-muted);
    box-shadow: none;
}

.wt-modal .modal-footer .btn-secondary:hover {
    border-color: #c6d0da;
    background: #fff;
    color: var(--wt-ink);
}

/* action principale (Save / Confirm / Close d'alerte) : pleine, à droite */
.wt-modal .modal-footer #myModalSave,
.wt-modal .modal-footer #myModalSecondSave,
.wt-modal .modal-footer #myModalConfirmConfirm,
.wt-modal .modal-footer .btn-primary {
    order: 10;
    border: 0;
    background: var(--wt-accent);
    color: #fff;
    box-shadow: 0 6px 16px rgba(73, 128, 181, .32);
}

.wt-modal .modal-footer #myModalSave:hover,
.wt-modal .modal-footer #myModalSecondSave:hover,
.wt-modal .modal-footer #myModalConfirmConfirm:hover,
.wt-modal .modal-footer .btn-primary:hover {
    background: var(--wt-accent-dark);
    color: #fff;
}

.wt-modal .modal-footer #myModalSave:disabled,
.wt-modal .modal-footer #myModalSecondSave:disabled {
    opacity: .6;
    cursor: wait;
}

/* ---------- petites modales (alerte, info, confirmation) ---------- */
.wt-modal-small .modal-dialog.modal-sm {
    max-width: 420px;
}

.wt-modal-small .modal-header {
    padding: 16px 22px;
}

.wt-modal-small .modal-body {
    padding: 20px 22px;
    font-size: 15px;
}

.wt-modal-small .modal-footer {
    padding: 12px 22px 16px;
}
