/* ============ CHECKOUT — IDENTITÉ / AUTH TUNNEL ============
 * Lot 4 (2026-05-08) — feat/theme-v1
 * Step 1 du tunnel : tabs « Créer un compte / Se connecter », formulaires
 * login + register inline, panneau « connecté en tant que » pour user
 * loggé, transitions et focus DS.
 * Loaded at priority 66 (after alter-checkout-stepper=64, before
 * alter-cms=65... non : avant alter-cms 65 ? non — apres mais avant account 70).
 * Final priority 66.
 */

/* ---------- Tabs « Créer un compte | Se connecter » ---------- */
body#checkout #checkout-personal-information-step .nav-inline,
body#checkout #checkout-personal-information-step ul.nav-inline,
body#checkout .nav-inline.my-2 {
    list-style: none;
    margin: 0 0 28px 0;
    padding: 0;
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid var(--as-hairline);
    text-align: left;
}

body#checkout #checkout-personal-information-step .nav-item {
    display: flex;
    margin: 0;
}

body#checkout #checkout-personal-information-step .nav-separator {
    display: none;
}

body#checkout #checkout-personal-information-step .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    color: var(--as-grey-300) !important;
    font-family: var(--as-font-family);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none !important;
    text-underline-offset: 0 !important;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}

body#checkout #checkout-personal-information-step .nav-link:hover {
    color: var(--as-grey-700) !important;
    text-decoration: none !important;
}

body#checkout #checkout-personal-information-step .nav-link.active,
body#checkout #checkout-personal-information-step .nav-link[aria-selected="true"] {
    color: var(--as-grey-900) !important;
    border-bottom-color: var(--as-amaranth);
    font-weight: 600;
}

body#checkout #checkout-personal-information-step .nav-link:focus-visible {
    outline: 2px solid var(--as-amaranth);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Tab content ---------- */
body#checkout #checkout-personal-information-step .tab-content {
    padding: 0;
}

body#checkout #checkout-personal-information-step .tab-pane {
    display: none;
}

body#checkout #checkout-personal-information-step .tab-pane.active {
    display: block;
}

/* ---------- Reset alter-checkout.css text-align center sur form ---------- */
body#checkout #checkout-personal-information-step form,
body#checkout #checkout-personal-information-step .form {
    text-align: left;
}

/* Container limite la largeur des forms pour la lisibilité */
body#checkout #checkout-personal-information-step .tab-pane > form,
body#checkout #checkout-personal-information-step .tab-pane > div > form,
body#checkout #checkout-login-form form,
body#checkout #checkout-guest-form form {
    max-width: 540px;
    margin: 0 auto;
}

/* ---------- Login form ---------- */
body#checkout #checkout-login-form .form-fields > .form-group,
body#checkout #checkout-login-form .form-group {
    margin-bottom: 18px;
}

body#checkout #checkout-login-form .forgot-password {
    margin: 6px 0 24px 0;
    text-align: right;
}

body#checkout #checkout-login-form .forgot-password a,
body#checkout #checkout-login-form a[href*="password-recovery"] {
    font-size: 14px;
    font-weight: 500;
    color: var(--as-grey-900);
    text-decoration: underline;
    text-decoration-color: var(--as-amaranth);
    text-decoration-thickness: 2px;
    text-underline-offset: 6px;
}

body#checkout #checkout-login-form .forgot-password a:hover {
    text-decoration-thickness: 3px;
}

/* ---------- Register / Customer form ---------- */
body#checkout #checkout-guest-form .form-informations,
body#checkout #checkout-guest-form .form-informations-title {
    display: block;
    margin: 0 0 8px 0;
    font-family: var(--as-font-family);
}

body#checkout #checkout-guest-form .form-informations {
    margin: 24px 0 12px 0;
    padding: 16px 18px;
    background-color: var(--as-grey-100);
    border-radius: 8px;
    border-left: 3px solid var(--as-amaranth);
}

body#checkout #checkout-guest-form .form-informations-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--as-grey-900);
}

body#checkout #checkout-guest-form .form-informations-option {
    font-size: 14px;
    color: var(--as-grey-500);
    font-style: italic;
}

body#checkout #checkout-guest-form .form-informations-subtitle {
    display: block;
    margin-top: 4px;
    font-size: 14px;
    color: var(--as-grey-500);
    font-style: normal;
}

/* Civilité radios — inline */
body#checkout .form-group [class*="radio-inline"],
body#checkout .form-group .radio-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 24px;
    font-weight: 400;
    color: var(--as-grey-700);
    cursor: pointer;
}

/* Submit centered en mobile, gauche en desktop */
body#checkout #checkout-personal-information-step .form-footer,
body#checkout #checkout-personal-information-step .form-buttons,
body#checkout #checkout-personal-information-step .keep-going-container {
    display: flex;
    justify-content: center;
    margin-top: 28px;
    text-align: center;
}

body#checkout #checkout-personal-information-step .keep-going-container .btn-primary,
body#checkout #checkout-personal-information-step .form-buttons .btn-primary {
    min-width: 240px;
}

/* ---------- Conditions / opt-in checkboxes form register ---------- */
body#checkout #checkout-guest-form .form-group [type="checkbox"] + label,
body#checkout #checkout-guest-form label[for*="psgdpr"],
body#checkout #checkout-guest-form label[for*="newsletter"],
body#checkout #checkout-guest-form label[for*="optin"] {
    display: inline;
    font-weight: 400;
    color: var(--as-grey-700);
    font-size: 14px;
    line-height: 1.5;
}

body#checkout #checkout-guest-form .form-group:has([type="checkbox"]) {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

body#checkout #checkout-guest-form .form-group:has([type="checkbox"]) .custom-checkbox {
    flex-shrink: 0;
    margin-top: 2px;
}

/* ---------- Panneau « connecté en tant que » ---------- */
body#checkout #checkout-personal-information-step p.identity {
    margin: 0 0 16px 0;
    padding: 16px 18px;
    background-color: var(--as-grey-100);
    border-radius: 8px;
    border-left: 3px solid var(--as-success);
    font-size: 15px;
    color: var(--as-grey-900);
}

body#checkout #checkout-personal-information-step p.identity a {
    color: var(--as-grey-900);
    text-decoration: underline;
    text-decoration-color: var(--as-amaranth);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    font-weight: 500;
}

/* ---------- Erreurs inline form auth ---------- */
body#checkout #checkout-login-form .help-block,
body#checkout #checkout-login-form .form-control-comment,
body#checkout #checkout-guest-form .help-block,
body#checkout #checkout-guest-form .form-control-comment {
    font-size: 13px;
    color: var(--as-grey-500);
    margin-top: 6px;
}

body#checkout .help-block li.error,
body#checkout #checkout-login-form .has-error .help-block,
body#checkout #checkout-guest-form .has-error .help-block {
    color: var(--as-amaranth);
    font-weight: 500;
}

/* ---------- Mobile (≤ 575px) ---------- */
@media (max-width: 575.98px) {
    body#checkout #checkout-personal-information-step .nav-inline {
        margin-bottom: 20px;
    }

    body#checkout #checkout-personal-information-step .nav-link {
        padding: 12px 16px;
        font-size: 15px;
        flex: 1 1 0;
    }

    body#checkout #checkout-personal-information-step .nav-item {
        flex: 1 1 0;
    }

    body#checkout #checkout-personal-information-step .keep-going-container .btn-primary,
    body#checkout #checkout-personal-information-step .form-buttons .btn-primary {
        min-width: 100%;
        width: 100%;
    }

    body#checkout #checkout-login-form .forgot-password {
        text-align: left;
    }
}

/* ---------- Tablet/desktop layout 2 col pour fields « name » ---------- */
@media (min-width: 768px) {
    body#checkout #checkout-guest-form .form-group[data-grouped-firstname-lastname],
    body#checkout #checkout-guest-form .form-group:has(input[name="firstname"]):has(input[name="lastname"]) {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
}

/* =====================================================================
   Refonte structurelle V2 — Étape Identité (2026-06-25)
   Aligne la STRUCTURE de l'étape 1 sur la maquette « Checkout V2 » :
   - toggle « segmented » (pilules dans un fond gris) au lieu d'onglets ;
   - formulaires EMPILÉS : label au-dessus, champ pleine largeur ;
   - largeur de form élargie + alignée à gauche (fini le 540px centré).
   Scope checkout-only. Markup PS inchangé (override CSS des colonnes).
   ===================================================================== */

/* ---- Toggle « segmented » : pilules dans un fond gris, actif blanc ----
   Markup PS : ul.nav-inline > 3× li.nav-item (compte | séparateur vide |
   connexion). On masque le séparateur et on étire les 2 onglets réels à
   50/50 en flex. Largeur alignée sur le form (720px). */
body#checkout #checkout-personal-information-step .nav-inline {
    display: flex;
    gap: 4px;
    max-width: 720px;
    margin: 0 0 24px 0;
    padding: 4px;
    background: var(--as-grey-100);
    border: none;
    border-radius: 10px;
}

/* Séparateur = li.nav-item sans lien → masqué */
body#checkout #checkout-personal-information-step .nav-item:not(:has(.nav-link)) {
    display: none;
}

/* Les 2 onglets réels s'étirent à 50/50 */
body#checkout #checkout-personal-information-step .nav-item:has(.nav-link) {
    flex: 1 1 0;
    display: flex;
    margin: 0;
}

body#checkout #checkout-personal-information-step .nav-link {
    width: 100%;
    padding: 12px 14px;
    margin: 0;
    border: none !important;
    border-radius: 8px;
    background: transparent;
    color: var(--as-grey-500) !important;
    font-weight: 600;
    transition: background-color .15s ease, color .15s ease,
                box-shadow .15s ease;
}

body#checkout #checkout-personal-information-step .nav-link:hover {
    background: rgba(255, 255, 255, 0.55);
    color: var(--as-grey-900) !important;
}

body#checkout #checkout-personal-information-step .nav-link.active,
body#checkout #checkout-personal-information-step .nav-link[aria-selected="true"] {
    background: #ffffff !important;
    color: var(--as-grey-900) !important;
    border: none !important;
    box-shadow: 0 1px 2px rgba(15, 15, 15, 0.10);
}

/* ---- Largeur de form : pleine colonne, alignée à gauche ---- */
body#checkout #checkout-personal-information-step .tab-pane > form,
body#checkout #checkout-personal-information-step .tab-pane > div > form,
body#checkout #checkout-login-form form,
body#checkout #checkout-guest-form form {
    max-width: 720px;
    margin: 0;
}

/* ---- Formulaires EMPILÉS : label au-dessus, champ pleine largeur ----
   Le markup PS rend les champs en grille Bootstrap (.form-group.row >
   label.col-* + .col-*). On neutralise les colonnes pour empiler.
   On EXCLUT les groupes case à cocher (CGV / opt-in) qui restent en
   ligne (case + label), gérés plus haut dans ce fichier. */
body#checkout #checkout-personal-information-step .form-group:not(:has([type="checkbox"])),
body#checkout #checkout-personal-information-step .form-group.row:not(:has([type="checkbox"])) {
    display: block;
    margin: 0 0 16px 0;
}

body#checkout #checkout-personal-information-step .form-group:not(:has([type="checkbox"])) > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

/* Label AU-DESSUS, style V2 (petit, uppercase, gris muted). On cible la
   classe PS standard .form-control-label (pas les labels de case). */
body#checkout #checkout-personal-information-step .form-group .form-control-label,
body#checkout #checkout-personal-information-step .form-group label.col-form-label {
    display: block;
    width: 100%;
    max-width: 100%;
    text-align: left !important;
    margin: 0 0 6px 0;
    padding: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--as-grey-500);
    line-height: 1.3;
}

/* Champs pleine largeur dans la grille neutralisée */
body#checkout #checkout-personal-information-step .form-group .form-control,
body#checkout #checkout-personal-information-step .form-group input[type="text"],
body#checkout #checkout-personal-information-step .form-group input[type="email"],
body#checkout #checkout-personal-information-step .form-group input[type="password"],
body#checkout #checkout-personal-information-step .form-group input[type="tel"],
body#checkout #checkout-personal-information-step .form-group select {
    width: 100%;
}

/* Bouton de validation aligné à DROITE façon V2 (au lieu de centré) */
body#checkout #checkout-personal-information-step .form-footer,
body#checkout #checkout-personal-information-step .form-buttons,
body#checkout #checkout-personal-information-step .keep-going-container {
    justify-content: flex-end;
    text-align: right;
}

@media (max-width: 575.98px) {
    body#checkout #checkout-personal-information-step .form-footer,
    body#checkout #checkout-personal-information-step .form-buttons,
    body#checkout #checkout-personal-information-step .keep-going-container {
        justify-content: center;
    }
}

/* ---- Prénom / Nom sur 2 colonnes (≥768px), façon maquette V2 ----
   Les deux champs sont des .form-group.row SÉPARÉS (markup PS : firstname,
   lastname). On les juxtapose en float 50/50, puis le champ suivant
   (e-mail) repasse pleine largeur via clear. */
@media (min-width: 768px) {
    body#checkout #checkout-guest-form .form-group:has(input[name="firstname"]),
    body#checkout #checkout-guest-form .form-group:has(input[name="lastname"]) {
        float: left;
        width: calc(50% - 8px);
    }

    body#checkout #checkout-guest-form .form-group:has(input[name="firstname"]) {
        margin-right: 16px;
    }

    body#checkout #checkout-guest-form .form-group:has(input[name="email"]) {
        clear: both;
    }
}
