/* ============================================================
   Modal d'authentification oPaddock
   Prefix : .auth-modal-*  +  réutilise .auth-* (form styles)
   Chargé sur toutes les pages via header.php
   ============================================================ */

/* ---- Variables partagées avec style_auth.css ---- */
.auth-modal,
.auth-modal * {
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-sizing: border-box;
}

/* ---- Overlay ---- */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s var(--ease-out);
}
.auth-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Backdrop clair (convention CLAUDE.md) */
.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}

/* ---- Boîte centrale ---- */
.auth-modal-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #fff;
    border-radius: 24px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, .06),
        0 8px 24px rgba(0, 0, 0, .08),
        0 32px 80px rgba(0, 0, 0, .14);
    padding: 0 0 32px;
    transform: translateY(16px) scale(.97);
    transition: transform .35s var(--ease-spring), opacity .3s var(--ease-out);
    scrollbar-width: none;
}
.auth-modal-box::-webkit-scrollbar { display: none; }
.auth-modal.is-open .auth-modal-box {
    transform: translateY(0) scale(1);
}

/* ---- Accent en-tête dégradé ---- */
.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
    margin-bottom: 20px;
}

.auth-modal-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.auth-modal-logo-mark {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 19px;
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), .35);
    flex-shrink: 0;
}
/* Marque du logo (cheval blanc transparent) incrustee dans le badge degrade. */
.auth-modal-logo-mark picture { display: flex; }
.auth-modal-logo-mark img { display: block; width: 28px; height: 25px; object-fit: contain; }
.auth-modal-logo-text {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.025em;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    background: var(--slate-100);
    color: var(--slate-500);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 16px;
    transition: all .2s ease;
    flex-shrink: 0;
}
.auth-modal-close:hover {
    background: var(--slate-200);
    color: var(--slate-800);
    transform: rotate(90deg);
}

/* Bandeau décoratif sous le header */
.auth-modal-accent {
    height: 3px;
    margin: 0 24px 24px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark), var(--blue-500));
    background-size: 200% 100%;
    animation: authModalAccentShift 4s ease infinite;
}
@keyframes authModalAccentShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---- Corps du modal : forms ---- */
.auth-modal-body {
    padding: 0 28px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Progress */
.auth-modal-body .auth-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}
.auth-modal-body .auth-progress-step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--slate-100);
    color: var(--slate-400);
    font-size: 15px;
    border: 2px solid transparent;
    transition: all .35s var(--ease-spring);
}
.auth-modal-body .auth-progress-step.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), .4);
    transform: scale(1.07);
}
.auth-modal-body .auth-progress-line {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: var(--slate-100);
    overflow: hidden;
    position: relative;
}
.auth-modal-body .auth-progress-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .55s var(--ease-out);
}
.auth-modal-body .auth-progress[data-progress="2"] .auth-progress-line::after {
    transform: scaleX(1);
}

/* Steps */
.auth-modal-body .auth-step {
    display: none;
    flex-direction: column;
    gap: 16px;
    animation: authModalStepIn .4s var(--ease-out) backwards;
}
.auth-modal-body .auth-step.is-current { display: flex; }
@keyframes authModalStepIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Title / subtitle */
.auth-modal-body .auth-head { position: relative; margin-bottom: 4px; }
.auth-modal-body .auth-back {
    position: absolute;
    top: 2px;
    left: -6px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: transparent;
    border: none;
    color: var(--slate-500);
    cursor: pointer;
    transition: all .2s ease;
}
.auth-modal-body .auth-back:hover {
    background: var(--slate-100);
    color: var(--primary-dark);
    transform: translateX(-2px);
}
.auth-modal-body .auth-back + .auth-title { padding-left: 36px; }
.auth-modal-body .auth-back + .auth-title + .auth-subtitle { padding-left: 36px; }
.auth-modal-body .auth-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--slate-900);
    letter-spacing: -.025em;
    line-height: 1.2;
    margin: 0 0 6px;
}
.auth-modal-body .auth-subtitle {
    font-size: 13.5px;
    color: var(--slate-500);
    line-height: 1.5;
    margin: 0;
}
.auth-modal-body .auth-subtitle strong {
    color: var(--primary-dark);
    font-weight: 600;
    word-break: break-all;
}

/* Champs */
.auth-modal-body .auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-modal-body .auth-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--slate-700);
    letter-spacing: -.003em;
}
.auth-modal-body .auth-optional { color: var(--slate-400); font-weight: 500; }
.auth-modal-body .auth-input-wrap { position: relative; display: flex; align-items: center; }
.auth-modal-body .auth-input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 44px;
    border: 1.5px solid var(--slate-200);
    border-radius: 13px;
    background: #fff;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14.5px;
    color: var(--slate-800);
    transition: all .2s ease;
}
.auth-modal-body .auth-input::placeholder { color: var(--slate-400); }
.auth-modal-body .auth-input:hover { border-color: var(--slate-300); }
.auth-modal-body .auth-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
}
.auth-modal-body .auth-input-icon {
    position: absolute;
    left: 14px;
    color: var(--slate-400);
    font-size: 17px;
    pointer-events: none;
    transition: color .2s ease;
}
.auth-modal-body .auth-input-wrap:focus-within .auth-input-icon { color: var(--primary); }

/* ── Champ telephone a prefixe, dans la modale ────────────────────────────
   Le composant `opd-phone-prefix` est dimensionne pour les pages pleines
   (52 px, rayon 14). Dans la modale, les champs voisins font 48 px et 13 px de
   rayon : le laisser plus grand le faisait deborder de la colonne de champs et
   renforcait l'impression qu'il « colle » au reste. On aligne, sans toucher au
   composant -- les trois autres ecrans qui l'emploient gardent leur taille. */
.auth-modal-body .opd-tel-wrap  { border-radius: 13px; }
.auth-modal-body .opd-tel-btn,
.auth-modal-body .opd-tel-input,
.auth-modal-body .opd-tel-native { height: 45px; }   /* 48 - les 1,5 px de bordure du groupe */
.auth-modal-body .opd-tel-input  { font-size: 14.5px; }
.auth-modal-body .auth-input-toggle {
    position: absolute;
    right: 8px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: none;
    background: transparent;
    color: var(--slate-400);
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s ease;
}
.auth-modal-body .auth-input-toggle:hover { background: var(--slate-100); color: var(--slate-700); }
.auth-modal-body .auth-field-error {
    font-size: 12px;
    color: #b91c1c;
    margin: 0;
    min-height: 0;
    line-height: 1.4;
}

/* Grille 2 cols (prénom/nom) */
.auth-modal-body .auth-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Lien mot de passe oublié */
.auth-modal-body .auth-row { display: flex; justify-content: flex-end; margin-top: -4px; }
.auth-modal-body .auth-link {
    font-size: 12.5px;
    color: var(--primary-dark);
    font-weight: 500;
    text-decoration: none;
    transition: color .2s;
}
.auth-modal-body .auth-link:hover { color: var(--primary-darker); text-decoration: underline; }

/* Force mot de passe */
.auth-modal-body .auth-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px;
}
.auth-modal-body .auth-strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--slate-100);
    position: relative;
    overflow: hidden;
}
.auth-modal-body .auth-strength-bar::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: var(--strength, 0%);
    background: var(--strength-color, #ef4444);
    border-radius: 4px;
    transition: width .3s ease, background .3s ease;
}
.auth-modal-body .auth-strength-label {
    font-size: 11px;
    color: var(--slate-500);
    font-weight: 600;
    letter-spacing: .02em;
    min-width: 56px;
    text-align: right;
}

/* Checkbox CGU */
.auth-modal-body .auth-checkbox {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--slate-600);
    line-height: 1.5;
    user-select: none;
}
.auth-modal-body .auth-checkbox input { display: none; }
.auth-modal-body .auth-checkbox-box {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--slate-300);
    background: #fff;
    display: grid;
    place-items: center;
    color: transparent;
    font-size: 12px;
    transition: all .2s ease;
}
.auth-modal-body .auth-checkbox input:checked + .auth-checkbox-box {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 3px 8px rgba(var(--primary-rgb), .3);
}
.auth-modal-body .auth-checkbox-text a { color: var(--primary-dark); font-weight: 500; }
.auth-modal-body .auth-checkbox-text a:hover { text-decoration: underline; }

/* Bouton principal */
.auth-modal-body .auth-btn-primary {
    position: relative;
    height: 50px;
    padding: 0 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 13px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(var(--primary-rgb), .32);
    transition: all .25s ease;
    overflow: hidden;
}
.auth-modal-body .auth-btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,.15), transparent);
    transform: translateX(-100%);
    transition: transform .6s;
}
.auth-modal-body .auth-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(var(--primary-rgb), .42);
}
.auth-modal-body .auth-btn-primary:hover::before { transform: translateX(100%); }
.auth-modal-body .auth-btn-primary:active { transform: translateY(0); }
.auth-modal-body .auth-btn-primary:disabled { opacity: .65; cursor: wait; transform: none; }
.auth-modal-body .auth-btn-icon { font-size: 17px; transition: transform .25s ease; }
.auth-modal-body .auth-btn-primary:hover .auth-btn-icon { transform: translateX(3px); }
.auth-modal-body .auth-btn-spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authModalSpin .7s linear infinite;
}
.auth-modal-body .auth-btn-primary.is-loading .auth-btn-label,
.auth-modal-body .auth-btn-primary.is-loading .auth-btn-icon { display: none; }
.auth-modal-body .auth-btn-primary.is-loading .auth-btn-spinner { display: inline-block; }
@keyframes authModalSpin { to { transform: rotate(360deg); } }

/* Mention légale */
.auth-modal-body .auth-legal {
    font-size: 11.5px;
    color: var(--slate-500);
    text-align: center;
    line-height: 1.5;
    margin: 2px 0 0;
}
.auth-modal-body .auth-legal a { color: var(--primary-dark); font-weight: 500; }
.auth-modal-body .auth-legal a:hover { text-decoration: underline; }

/* Erreurs serveur */
.auth-modal-errors {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.auth-modal-error {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(239, 68, 68, .06);
    border: 1px solid rgba(239, 68, 68, .2);
    color: #b91c1c;
    font-size: 13px;
    line-height: 1.4;
}
.auth-modal-error i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* État succès */
.auth-modal-body .auth-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    padding: 12px 0 4px;
}
.auth-modal-body .auth-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(var(--primary-rgb),.15), rgba(var(--primary-rgb),.05));
    color: var(--primary-dark);
    display: grid;
    place-items: center;
    font-size: 28px;
    animation: authModalSuccessPop .5s var(--ease-spring) backwards;
}
@keyframes authModalSuccessPop {
    from { transform: scale(.4); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .auth-modal { padding: 12px; align-items: flex-end; }
    .auth-modal-box {
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        transform: translateY(100%);
    }
    .auth-modal.is-open .auth-modal-box { transform: translateY(0); }
    .auth-modal-body .auth-grid-2 { grid-template-columns: 1fr; }
    .auth-modal-body .auth-input { height: 50px; font-size: 16px; }
}

/* Encart « vous avez déjà un compte » (2026-09-11)
   -----------------------------------------------------------------------------
   oPaddock et Equimondo partagent UN SEUL compte. Quelqu'un qui arrive par la
   marketplace et se voit demander un mot de passe qu'il n'a jamais choisi POUR
   oPaddock croit s'être trompé — et repart. L'encart lui dit d'où vient ce
   compte, en une phrase, à l'endroit exact où la question se pose.
   Volontairement discret : c'est une explication, pas une alerte.

   SANS prefixe de surface, volontairement : le meme encart sert la MODALE
   (.auth-modal-body) et la PAGE d'authentification, qui n'est pas dedans. Ce
   fichier est charge par header.php sur toutes les pages, donc une seule
   definition suffit -- la dupliquer dans style_auth.css la ferait diverger
   (CLAUDE.md 00a). */
.auth-note {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    margin: 0 0 18px;
    padding: 13px 15px;
    border-radius: 13px;
    background: linear-gradient(135deg,
        rgba(var(--primary-rgb), .07), rgba(var(--primary-rgb), .12));
    border: 1px solid rgba(var(--primary-rgb), .22);
}
.auth-note-icon {
    flex: none;
    width: 30px; height: 30px;
    border-radius: 9px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(var(--primary-rgb), .3);
}
.auth-note-text { min-width: 0; }
.auth-note-title {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--primary-darker, #047857);
    margin-bottom: 2px;
}
.auth-note-body {
    display: block;
    font-size: 12.8px;
    line-height: 1.5;
    color: var(--slate-600, #475569);
}

/* ── Choix « cavalier / professionnel » (inscription, 11/09/2026) ────────────
   Deux cartes, pas un <select> : le choix commande la suite du formulaire, il
   doit se voir d'un coup d'oeil et se toucher au pouce (cible >= 44px, §17).
   La puce radio native est masquee mais RESTE dans le DOM et focusable : c'est
   elle qui porte l'etat, le clavier et les lecteurs d'ecran. */
.auth-profil { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-profil-opt {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 44px;
    padding: 12px 14px;
    border: 1.5px solid var(--etb-slate-200, #e2e8f0);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease;
}
.auth-profil-opt input[type="radio"] {
    /* Masquee VISUELLEMENT seulement : `display:none` la retirerait de la
       navigation clavier et des lecteurs d'ecran. */
    position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0;
}
.auth-profil-opt i { font-size: 1.15rem; color: var(--etb-slate-500, #64748b); }
.auth-profil-nom { font-weight: 600; font-size: .95rem; color: var(--etb-slate-900, #0f172a); }
.auth-profil-sub { font-size: .78rem; line-height: 1.35; color: var(--etb-slate-500, #64748b); }
.auth-profil-opt:hover { border-color: var(--primary); }
.auth-profil-opt.is-on {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), .07);
}
.auth-profil-opt.is-on i,
.auth-profil-opt.is-on .auth-profil-nom { color: var(--primary-dark, var(--primary)); }
/* Le focus clavier doit se voir SUR LA CARTE, la puce etant invisible. */
.auth-profil-opt:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Mention « vos identifiants vous seront envoyes par e-mail » : elle remplace le
   champ mot de passe, elle doit donc rassurer sans peser. */
.auth-note {
    display: flex; align-items: flex-start; gap: 8px;
    margin: 0 0 4px;
    font-size: .84rem; line-height: 1.45;
    color: var(--etb-slate-600, #475569);
}
.auth-note i { color: var(--primary); font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

@media (max-width: 420px) { .auth-profil { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .auth-profil-opt { transition: none; } }
