/* ===== GénéFoncier — Modales standard =====
   Source de vérité unique du style des modales (édition / création /
   confirmation / iframe). Une modale adopte ce style via la classe .gf-modal.
   Chargé après bootstrap-theme.css. Aucune couleur en dur : tokens uniquement. */

/* Voile */
.modal-backdrop.show { background: var(--ink-900); opacity: .55; }

/* Contenu — parchemin */
.gf-modal .modal-content {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* Header — plaque ardoise/brune, texte doré (patron fiche-modal-header) */
.gf-modal .modal-header {
    background: var(--ink-700);
    color: var(--brass-100);
    border-bottom: 2px solid var(--brass-700);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 12px 18px;
}
.gf-modal .modal-title {
    color: var(--brass-100);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--text-md);
}
.gf-modal .modal-header .btn-close {
    filter: invert(1) sepia(1) saturate(0) brightness(1.6);
    opacity: .8;
}
.gf-modal .modal-header .btn-close:hover { opacity: 1; }

/* Corps */
.gf-modal .modal-body { padding: 18px 20px; }

/* Pied */
.gf-modal .modal-footer {
    background: transparent;
    border-top: 1px solid var(--border-subtle);
    padding: 12px 20px;
    gap: 8px;
}
.gf-modal .gf-modal-danger {
    color: var(--danger);
    text-decoration: none;
    margin-right: auto;
    padding-left: 0;
}

/* ---- Labels « notched » (label posé sur la bordure du champ) ---- */
.gf-field { position: relative; padding-top: 8px; }
.gf-field > label,
.gf-field > .form-label {
    position: absolute; top: 8px; left: 10px; transform: translateY(-50%);
    margin: 0; padding: 0 5px; z-index: 2;
    font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap;
    color: var(--ink-500);
    pointer-events: none;
    background: linear-gradient(var(--gf-field-bg, var(--surface-card)) 50%, var(--paper-0) 50%);
}
.gf-panel .gf-field > label { --gf-field-bg: var(--surface-sunken); }
.gf-field .form-control,
.gf-field .form-select { background: var(--paper-0); }
.gf-field .gf-req { color: var(--brass-600); }
/* crispy layouts opt in with wrapper_class="gf-field"; the asterisk element is
   named by crispy, not by us. */
.gf-field .asteriskField { color: var(--brass-600); margin-left: 2px; }

/* Select2 / gendate inside a notched field: the label must clear the select2
   container (z-index 5000 in select2-fixes.css), and both widgets need the same
   border + field background as a plain control. */
.gf-field > label,
.gf-field > .form-label { z-index: 5100; }
.gf-field > .select2-container--default .select2-selection,
.gf-field > .gendate-container {
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    background: var(--paper-0);
}
.gf-field .select2-container { width: 100% !important; }

/* texte d'aide sous un champ */
.gf-hint {
    font-size: var(--text-xs);
    color: var(--text-subtle);
    margin-top: 4px;
}

/* contrôle segmenté (ex. choix du genre) : radios rendus en segments joints */
.gf-seg {
    display: inline-flex; flex-wrap: wrap; gap: 0;
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--paper-0);
}
.gf-seg label {
    display: flex; align-items: center; gap: 7px;
    padding: 8px 14px;
    font-size: var(--text-sm);
    color: var(--text-muted);
    cursor: pointer;
    border-right: 1px solid var(--border-subtle);
    margin: 0;
}
.gf-seg label:last-child { border-right: 0; }
.gf-seg input { display: none; }
.gf-seg input:checked + label,
.gf-seg label.on { background: var(--ink-700); color: var(--brass-100); }
.gf-seg label.on i { color: var(--brass-300); }

/* groupe composite bordé (ex. dates gendate) */
.gf-fieldgroup {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    border: 1px solid var(--border-default); border-radius: var(--radius);
    background: var(--paper-0); padding: 8px;
}

/* ---- Panneaux de section dans un form long ---- */
.gf-panel {
    background: var(--surface-sunken);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.gf-panel > .gf-panel-title {
    display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid var(--border-default);
    padding-bottom: 8px; margin-bottom: 12px;
    font-family: var(--font-display); font-weight: 600; color: var(--text-heading);
}
.gf-panel > .gf-panel-title i { color: var(--accent-strong); }

/* ---- Onglets de premier niveau d'une modale (saisie standard / liste) ----
   Ciblé sur l'enfant direct du .modal-content pour ne pas repeindre les
   onglets d'un contenu embarqué (fiche en iframe, modales data-viz). */
.gf-modal .modal-content > .nav-tabs {
    border-bottom: 1px solid var(--border-default);
    padding: 8px 18px 0;
    gap: 4px;
}
/* base_fiche.html habille la barre d'onglets de la fiche avec `.nav-tabs .nav-item
   { max-width: 150px }` et `.nav-tabs .nav-link { white-space: normal !important }` ;
   ces règles cascadent jusqu'ici et coupent le libellé en deux. On les neutralise
   pour les seuls onglets de modale (d'où le !important, qui répond au leur). */
.gf-modal .modal-content > .nav-tabs .nav-item { max-width: none; }
.gf-modal .modal-content > .nav-tabs .nav-link {
    border: 0; border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 6px 10px;
    white-space: nowrap !important;
    color: var(--ink-500);
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
}
.gf-modal .modal-content > .nav-tabs .nav-link:hover { color: var(--ink-700); }
.gf-modal .modal-content > .nav-tabs .nav-link.active {
    background: transparent;
    color: var(--ink-800);
    border-bottom-color: var(--brass-500);
}

/* ---- Liste à cocher (choisir N entités d'un coup) ---- */
.gf-picklist {
    max-height: 380px; overflow-y: auto;
    background: var(--paper-0);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 4px;
}
.gf-picklist-row {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    cursor: pointer;
}
.gf-picklist-row:hover { background: var(--surface-sunken); }
.gf-picklist-row input:checked ~ span { font-weight: var(--weight-semibold); }

/* ---- Cas iframe : l'iframe remplit le corps, pas de double chrome ---- */
.gf-modal.gf-modal-iframe .modal-body { padding: 0; }
.gf-modal.gf-modal-iframe iframe {
    display: block; width: 100%; border: 0;
    min-height: min(70vh, 640px);
    background: var(--surface-card);
    border-radius: 0 0 var(--radius) var(--radius);
}
