/* ============================================================================
 * kdCommun/css/modals.css
 * Design system partagé pour les modales kdFast.
 *
 * Usage minimal :
 *   <div class="kdModal kdModalPrimary">     (ou kdModalDanger / Success / Info / Warning)
 *     <div class="kdModalHeader">
 *       <div class="kdModalHeaderLeft">
 *         <div class="kdModalHeaderIcon"><i class="fa-duotone fa-..."></i></div>
 *         <div>
 *           <div class="kdModalHeaderTitle">Titre</div>
 *           <div class="kdModalHeaderSub">Sous-titre</div>
 *         </div>
 *       </div>
 *       <button class="kdModalHeaderClose" onclick="close_del_screen()">
 *         <i class="fa-solid fa-xmark"></i>
 *       </button>
 *     </div>
 *     <div class="kdModalBody">  ... formulaire / récap ...  </div>
 *     <div class="kdModalFooter"> ... boutons ... </div>
 *   </div>
 *
 * Tailles : ajouter .kdModalSm (480px) / .kdModalMd (560px, default) /
 *           .kdModalLg (720px) / .kdModalXl (960px).
 *
 * Les variables --kd-accent / --kd-accent-bg / --kd-accent-strong sont
 * définies par la classe de type et consommées par forms.css (focus inputs,
 * gradients de boutons primary, etc.).
 * ============================================================================ */

/* === Wrapper === */
.kdModal {
    width: 560px;
    max-width: 96vw;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.3);
    font-family: inherit;
    /* defaults (overridden par les classes de type) */
    --kd-accent: #8b5cf6;
    --kd-accent-strong: #7c3aed;
    --kd-accent-bg: rgba(139, 92, 246, 0.18);
    --kd-accent-shadow: rgba(139, 92, 246, 0.35);
}
.kdModalSm { width: 480px; }
.kdModalMd { width: 560px; }
.kdModalLg { width: 720px; }
.kdModalXl { width: 960px; }

/* === Header (structure commune) === */
.kdModalHeader {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 24px;
    color: #fff;
}
.kdModalHeaderLeft {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}
.kdModalHeaderIcon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.kdModalHeaderTitle {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.kdModalHeaderSub {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
    font-weight: 400;
}
.kdModalHeaderClose {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.kdModalHeaderClose:hover { background: rgba(255, 255, 255, 0.3); }

/* === Variantes de type (gradient header + accent) === */

/* DANGER — Suppression / destructif */
.kdModalDanger {
    --kd-accent: #dc2626;
    --kd-accent-strong: #b91c1c;
    --kd-accent-bg: rgba(220, 38, 38, 0.18);
    --kd-accent-shadow: rgba(220, 38, 38, 0.35);
}
.kdModalDanger .kdModalHeader {
    background: linear-gradient(135deg, #991b1b 0%, #dc2626 60%, #ef4444 100%);
}

/* PRIMARY — Création / modification (violet) */
.kdModalPrimary {
    --kd-accent: #8b5cf6;
    --kd-accent-strong: #7c3aed;
    --kd-accent-bg: rgba(139, 92, 246, 0.18);
    --kd-accent-shadow: rgba(139, 92, 246, 0.35);
}
.kdModalPrimary .kdModalHeader {
    background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 60%, #a78bfa 100%);
}

/* SUCCESS — Validation positive (vert) */
.kdModalSuccess {
    --kd-accent: #10b981;
    --kd-accent-strong: #059669;
    --kd-accent-bg: rgba(16, 185, 129, 0.18);
    --kd-accent-shadow: rgba(16, 185, 129, 0.35);
}
.kdModalSuccess .kdModalHeader {
    background: linear-gradient(135deg, #047857 0%, #10b981 60%, #34d399 100%);
}

/* INFO — Résolution / clôture (bleu) */
.kdModalInfo {
    --kd-accent: #3b82f6;
    --kd-accent-strong: #1d4ed8;
    --kd-accent-bg: rgba(59, 130, 246, 0.18);
    --kd-accent-shadow: rgba(59, 130, 246, 0.35);
}
.kdModalInfo .kdModalHeader {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 60%, #60a5fa 100%);
}

/* WARNING — Annulation / admin (orange) */
.kdModalWarning {
    --kd-accent: #ea580c;
    --kd-accent-strong: #c2410c;
    --kd-accent-bg: rgba(234, 88, 12, 0.18);
    --kd-accent-shadow: rgba(234, 88, 12, 0.35);
}
.kdModalWarning .kdModalHeader {
    background: linear-gradient(135deg, #9a3412 0%, #ea580c 60%, #fb923c 100%);
}

/* === Body === */
.kdModalBody {
    padding: 22px 24px 18px;
    max-height: 74vh;
    overflow-y: auto;
    background: #fafbfc;
}

/* === Alertes inline === */
.kdModalAlert {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
}
.kdModalAlertIcon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.kdModalAlertTitle { font-size: 13.5px; font-weight: 700; margin-bottom: 2px; }
.kdModalAlertText  { font-size: 12.5px; }

.kdModalAlertWarning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
}
.kdModalAlertWarning .kdModalAlertIcon  { background: #fbbf24; }
.kdModalAlertWarning .kdModalAlertTitle { color: #92400e; }
.kdModalAlertWarning .kdModalAlertText  { color: #a16207; }

.kdModalAlertDanger {
    background: #fef2f2;
    border: 1px solid #fecaca;
}
.kdModalAlertDanger .kdModalAlertIcon  { background: #ef4444; }
.kdModalAlertDanger .kdModalAlertTitle { color: #991b1b; }
.kdModalAlertDanger .kdModalAlertText  { color: #b91c1c; }

.kdModalAlertInfo {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}
.kdModalAlertInfo .kdModalAlertIcon  { background: #3b82f6; }
.kdModalAlertInfo .kdModalAlertTitle { color: #1e3a8a; }
.kdModalAlertInfo .kdModalAlertText  { color: #1d4ed8; }

.kdModalAlertSuccess {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}
.kdModalAlertSuccess .kdModalAlertIcon  { background: #10b981; }
.kdModalAlertSuccess .kdModalAlertTitle { color: #065f46; }
.kdModalAlertSuccess .kdModalAlertText  { color: #047857; }

/* === Carte récap (lecture seule) === */
.kdModalCard {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 8px;
}
.kdModalCardHead {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #eef2f6;
}
.kdModalCardDoc {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: #1e40af;
    letter-spacing: 0.4px;
    flex: 1;
    min-width: 0;
}
.kdModalCardBadges {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}
.kdModalCardGrid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}
@media (max-width: 520px) {
    .kdModalCardGrid { grid-template-columns: 1fr 1fr; }
}
.kdModalCardField { min-width: 0; }
.kdModalCardFieldLabel {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}
.kdModalCardFieldLabel i {
    color: var(--kd-accent);
    font-size: 11px;
}
.kdModalCardFieldValue {
    font-size: 13.5px;
    color: #0f172a;
    font-weight: 600;
    word-break: break-word;
    line-height: 1.4;
}
.kdModalCardFieldValue small {
    display: block;
    font-size: 11.5px;
    color: #64748b;
    font-weight: 400;
    margin-top: 1px;
}

/* === Badges (in/out, pôles, génériques) === */
.kdBadge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.kdBadgeIn   { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.kdBadgeOut  { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.kdBadgeOpp  { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.kdBadgeMpe  { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.kdBadgeNeutral { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }

/* === Divider numéroté (séparateur d'étapes) === */
.kdModalDivider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 12px;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.kdModalDivider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e3e8ef;
    margin-left: 6px;
}

/* Pastille numérotée (1, 2, 3) — couleur = accent de la modale */
.kdStepBadge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--kd-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* === Bloc encadré (regroupement de champs) === */
.kdModalBlock {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 12px;
    padding: 14px 16px;
}
.kdModalBlockLabel {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* === Footer === */
.kdModalFooter {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 24px;
    background: #fff;
    border-top: 1px solid #e3e8ef;
}
