﻿/* ============================================================
   Composants — pages d'authentification (CSS pur, sans Bootstrap).
   Conserve le vocabulaire de classes historique des vues
   (form-control, btn-login, alert, row/col, …) + nouveaux
   composants direction A (segmented, stepper, chip, choice).
   ============================================================ */

/* ---------- Utilitaires conservés (ex-Bootstrap) ---------- */
.row {
    display: flex;
    flex-wrap: wrap;
}

.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
}

.col, .col-12, .col-xs-12, .col-xs-8, .col-xs-4,
.col-sm-4, .col-sm-6, .col-sm-8, .col-lg-auto {
    width: 100%;
}

.d-flex { display: flex !important; }
.d-block { display: block !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.gap-3 { gap: 1rem !important; }
.ms-auto { margin-left: auto !important; }
.me-2 { margin-right: .5rem !important; }
.m-0 { margin: 0 !important; }
.mt-3 { margin-top: 1rem !important; }
.mb-2 { margin-bottom: .5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.w-100 { width: 100% !important; }
.text-center { text-align: center !important; }
.text-muted { color: var(--muted) !important; }
.font-weight-medium { font-weight: 500; }
.feather-sm { width: 18px; height: 18px; flex: none; }
.text-danger { color: var(--danger) !important; }
.border-danger { border-color: var(--danger) !important; }
.text-primary { color: var(--brand) !important; }

/* ---------- Titres ---------- */
.form-title {
    margin-bottom: 22px;
}

.form-title h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--brand-ink);
}

.form-title h3 {
    font-size: 14px;
    font-weight: 400;
    color: var(--muted);
    margin-top: 4px;
}

.welcome-page h1, .welcome-page h3 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--brand-ink);
    margin-bottom: 18px;
}

/* Page de confirmation : titre + sous-titre (remplace le pavé en gras) */
.welcome-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--brand-ink);
    margin: 0 0 8px;
}

.welcome-subtitle {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
    color: var(--muted);
    max-width: 340px;
    margin: 0 auto 20px;
}

.auth-box-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--brand-ink);
    text-align: center;
    margin-bottom: 16px;
}

.auth-box-s-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--brand-ink);
}

.auth-box-s-title-description {
    font-size: 13.5px;
    font-weight: 400;
    color: var(--muted);
    margin: 4px 0 14px;
}

/* ---------- Formulaires ---------- */
.form-group {
    margin-bottom: 18px;
}

.form-label,
.form-group > label,
.form-group .form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--label);
    margin: 0 0 6px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 12px 15px;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--input-text);
    background-color: var(--input-bg);
    border: 1.5px solid var(--input-border);
    appearance: none;
    border-radius: var(--input-radius);
    box-shadow: none;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.form-control:hover:not(:focus):not(:disabled) {
    border-color: var(--input-border-hover);
}

.form-control:focus, .form-control.focus {
    outline: none;
    background-color: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .14);
}

.form-control:disabled {
    background-color: #EEF2F6;
    color: var(--muted);
    cursor: not-allowed;
}

.form-control::placeholder {
    color: var(--input-placeholder);
    font-weight: 400;
}

/* champ avec icône (œil mot de passe) */
.input-wrap {
    position: relative;
}

.input-wrap .form-control {
    padding-right: 46px;
}

.field-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    cursor: pointer;
    opacity: .65;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.field-icon:hover {
    opacity: 1;
}

.field-icon.fa-eye {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2390A7B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}

.field-icon.fa-eye-slash {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2390A7B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E");
}

/* intl-tel-input : pleine largeur */
.iti.iti--allow-dropdown {
    width: 100%;
}

/* ---------- Case à cocher (compat .material-inputs) ---------- */
.checkbox {
    display: flex;
    align-items: center;
}

[type=checkbox].material-inputs {
    position: static;
    left: auto;
    opacity: 1;
    appearance: auto;
    accent-color: var(--brand);
    width: 17px;
    height: 17px;
    margin: 0 8px 0 0;
    cursor: pointer;
    flex: none;
}

[type=checkbox].material-inputs + label {
    position: static;
    padding-left: 0;
    height: auto;
    line-height: 1.4;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--muted);
    cursor: pointer;
    display: inline-block;
    user-select: none;
    margin: 0;
}

[type=checkbox].material-inputs + label::before,
[type=checkbox].material-inputs + label::after {
    content: none;
    display: none;
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-block;
    padding: 12px 18px;
    min-height: 44px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--muted);
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: transparent;
    border: 1.5px solid transparent;
    border-radius: var(--radius-btn);
    transition: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, filter .15s ease;
}

.btn + .btn {
    margin-top: 10px;
}

/* État « soumission en cours » : bouton grisé et non cliquable
   (anti double-envoi d'emails/SMS — voir prevent-double-submit.js) */
.btn:disabled,
.btn.is-submitting,
.auth-choice:disabled,
.auth-choice.is-submitting {
    opacity: .6;
    cursor: default;
    pointer-events: none;
    box-shadow: none;
    filter: none;
}

.btn-login {
    color: #fff;
    background-color: var(--brand);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 30%, transparent);
}

.btn-login:hover {
    filter: brightness(1.07);
    color: #fff;
}

.btn-login > a {
    color: #fff;
}

.btn-secondary {
    color: var(--muted);
    border-color: var(--input-border);
}

.btn-secondary:hover {
    color: var(--brand);
    border-color: color-mix(in srgb, var(--brand) 45%, var(--input-border));
}

/* ---------- Segmented control (onglets Email / Téléphone) ---------- */
.auth-seg {
    display: flex;
    gap: 4px;
    background: #F0F3F8;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 22px;
}

.auth-seg-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 8px;
    min-height: 44px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.auth-seg-btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.auth-seg-btn.on {
    background: #fff;
    color: var(--brand);
    box-shadow: 0 2px 8px rgba(24, 54, 95, .12);
}

/* ---------- Stepper (wizard inscription) ---------- */
.auth-stepper {
    display: flex;
    align-items: stretch;
    /* 5px d'air au-dessus (séparation avec le titre du formulaire) */
    margin-top: 5px;
    /* espace réduit avec le titre d'étape en dessous */
    margin-bottom: 12px;
}

.auth-step {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--input-placeholder);
}

.auth-step .lbl {
    display: block;
    height: 2.4em;
    overflow: hidden;
}

.auth-step i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0 0 6px;
    border-radius: 50%;
    background: #F0F3F8;
    color: var(--input-placeholder);
    font-style: normal;
    font-size: 12.5px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    transition: background-color .2s ease, color .2s ease;
}

.auth-step::before {
    content: "";
    position: absolute;
    top: 14px;
    left: -50%;
    right: 50%;
    height: 2px;
    background: #E7ECF3;
}

.auth-step:first-child::before {
    display: none;
}

.auth-step.done i, .auth-step.cur i {
    background: var(--brand);
    color: #fff;
}

.auth-step.cur {
    color: var(--brand);
}

.auth-step.done::before, .auth-step.cur::before {
    background: var(--brand);
}

/* ---------- En-tête d'étape (wizard) : titre + sous-titre centrés ---------- */
.reg-step-head {
    text-align: center;
    margin-bottom: 22px;
}

.reg-step-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--brand-ink);
    margin: 0;
}

.reg-step-subtitle {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--brand);
    margin: 5px 0 0;
}

/* ---------- Corps du wizard : hauteur d'étape fixe ---------- */
.reg-body {
    position: relative;
    min-height: 460px;
    /* espace réduit entre le stepper et le titre de l'étape */
    padding-top: 4px;
}

/* Étape à inputs : hauteur constante + boutons ancrés en bas.
   Le contenu remplit une hauteur fixe et le dernier bloc (les boutons)
   est poussé tout en bas via margin-top:auto — ainsi Enregistrer /
   Suivant / Annuler gardent la même position quel que soit le nombre
   de champs de l'étape. */
.reg-step {
    display: flex;
    flex-direction: column;
    min-height: 448px;
}

.reg-step > .form-group:last-child {
    /* .my-3 pose un margin-top !important, d'où le !important ici */
    margin-top: auto !important;
}

.reg-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    width: 340px;
    max-width: calc(100vw - 40px);
    z-index: 1000;
    pointer-events: none;
}

.reg-messages .list-auth-info {
    pointer-events: auto;
    margin: 0 0 8px;
}

.reg-messages .list-auth-info li {
    background: #fff;
    box-shadow: 0 12px 32px rgba(24, 54, 95, .18);
}

.reg-messages .list-auth-info.error li {
    background: color-mix(in srgb, var(--danger) 7%, #fff);
}

.reg-messages .list-auth-info.success li {
    background: color-mix(in srgb, var(--success) 9%, #fff);
}

.reg-messages .list-auth-info:empty {
    display: none;
}

/* ---------- Illustrations SVG (activation, confirmations…) ---------- */
.activation-illustration,
.auth-illustration {
    color: var(--brand);
    width: 148px;
    max-width: 55%;
    margin: 0 auto 18px;
}

.activation-illustration svg,
.auth-illustration svg {
    display: block;
    width: 100%;
    height: auto;
}

/* ---------- Champ avec action intégrée (envoyer le code) ---------- */
.input-with-action {
    position: relative;
}

.input-with-action .form-control {
    padding-right: 52px;
}

.input-action {
    position: absolute;
    right: 6px;
    top: 6px;
    bottom: 6px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--brand);
    border-radius: 9px;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

.input-action svg {
    width: 19px;
    height: 19px;
}

.input-action:hover:not(:disabled) {
    background: color-mix(in srgb, var(--brand) 12%, transparent);
}

.input-action:disabled {
    cursor: default;
}

/* Requête en cours (ou action bloquée) : l'icône se grise et n'est plus
   cliquable. On préserve le vert vif de l'état « code envoyé » (.is-sent). */
.input-action:disabled:not(.is-sent) {
    opacity: .45;
    color: var(--input-placeholder);
}

.input-action.is-sent {
    color: var(--success);
}

/* ---------- Lien « renvoyer le code » ---------- */
.resend-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand);
    cursor: pointer;
}

/* ---------- Chip identité (étape mot de passe) ---------- */
.auth-chip-id {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #F4F7FB;
    border-radius: 999px;
    padding: 6px 16px 6px 6px;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 22px;
}

.auth-chip-id .av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.auth-chip-id .av svg {
    width: 15px;
    height: 15px;
}

.auth-chip-id .id {
    min-width: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--label);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-chip-id a {
    font-size: 12.5px;
    font-weight: 600;
    flex: none;
}

/* ---------- Séparateur avec libellé ---------- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--input-placeholder);
    font-size: 12.5px;
    margin: 22px 0 14px;
}

.auth-divider::before, .auth-divider::after {
    content: "";
    height: 1px;
    background: #E7ECF3;
    flex: 1;
}

/* ---------- Cartes de choix (2FA) ---------- */
.auth-choice-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 6px 0 10px;
}

.auth-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 130px;
    padding: 18px 14px;
    background: #fff;
    border: 1.5px solid var(--input-border);
    border-radius: 14px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--label);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, color .15s ease;
}

.auth-choice svg {
    width: 26px;
    height: 26px;
    color: var(--brand);
}

.auth-choice:hover {
    border-color: var(--brand);
    color: var(--brand);
    box-shadow: 0 6px 16px rgba(var(--brand-rgb), .15);
}

/* ---------- Alertes & erreurs ---------- */
.alert {
    position: relative;
    padding: 14px 16px;
    margin-bottom: 18px;
    border: 1.5px solid var(--input-border);
    border-radius: 12px;
    font-size: 14px;
    background: #fff;
}

.alert.border-danger {
    background: color-mix(in srgb, var(--danger) 6%, #fff);
}

.validation-summary-errors ul, .danger ul {
    margin: 0;
    padding-left: 18px;
}

.login-input-error {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--danger);
    font-size: 13.5px;
    margin-top: 10px;
}

.login-input-error svg {
    flex: none;
}

.list-auth-info {
    list-style: none;
    padding: 0;
    margin: 0 0 6px;
}

.list-auth-info li {
    border: 1.5px solid var(--brand);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--brand);
    padding: 10px 14px 10px 38px;
    margin-bottom: 6px;
    position: relative;
    list-style: none;
}

.list-auth-info li::before {
    content: "i";
    position: absolute;
    left: 12px;
    top: 12px;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-size: 11px;
    line-height: 14px;
    text-align: center;
    font-style: normal;
}

.list-auth-info.error li {
    border-color: var(--danger);
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 5%, #fff);
}

.list-auth-info.error li::before {
    content: "!";
}

.list-auth-info.error ul {
    padding: 0;
}

.list-auth-info.success li {
    border-color: var(--success);
    color: var(--success);
    background: color-mix(in srgb, var(--success) 6%, #fff);
}

.list-auth-info.success li::before {
    content: "✓";
}

/* ---------- Erreurs de champ (inline, sous l'input) ---------- */
.field-error,
.field-validation-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--danger);
}

.field-error::before,
.field-validation-error::before {
    content: "";
    width: 14px;
    height: 14px;
    flex: none;
    margin-top: 2px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D93636' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.field-error:empty,
.field-validation-error:empty,
.field-validation-valid {
    display: none;
}

.form-control.is-invalid,
.form-control.input-validation-error {
    border-color: var(--danger);
    background-color: color-mix(in srgb, var(--danger) 4%, #fff);
}

.form-control.is-invalid:focus,
.form-control.input-validation-error:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 14%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
    .field-error, .field-validation-error {
        animation: field-error-in .18s ease;
    }

    @keyframes field-error-in {
        from { opacity: 0; transform: translateY(-3px); }
        to { opacity: 1; transform: none; }
    }
}

/* ---------- Divers héritage ---------- */
.text-conformite {
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
}

.text-conformite > b {
    font-weight: 700;
}
