/* ==========================================================================
   Écrans d'authentification (login / register / mot de passe)
   Feuille autonome : ne dépend ni de Bootstrap ni de develink.css
   ========================================================================== */

:root {
    --auth-bg: #ffffff;
    --auth-surface: #ffffff;
    --auth-text: #111827;
    --auth-muted: #6b7280;
    --auth-border: #e5e7eb;
    --auth-border-strong: #d1d5db;
    --auth-brand: #7bd0a9;
    --auth-brand-600: #3fb389;
    --auth-brand-700: #2b9a73;
    --auth-brand-900: #14513b;
    --auth-danger: #dc2626;
    --auth-danger-bg: #fef2f2;
    --auth-danger-border: #fecaca;
    --auth-success: #15803d;
    --auth-success-bg: #f0fdf4;
    --auth-success-border: #bbf7d0;
    --auth-radius: 12px;
    --auth-radius-sm: 10px;
    --auth-ring: 0 0 0 4px rgba(123, 208, 169, 0.28);
    --auth-side-width: 44%;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

.auth-body {
    margin: 0;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.auth-body a { color: var(--auth-brand-700); text-decoration: none; font-weight: 500; }
.auth-body a:hover { color: var(--auth-brand-900); text-decoration: underline; }

/* --------------------------------------------------------------------------
   Grille principale
   -------------------------------------------------------------------------- */

.auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1024px) {
    .auth--split {
        grid-template-columns: minmax(0, 1fr) minmax(0, var(--auth-side-width));
    }
}

.auth__main {
    display: flex;
    flex-direction: column;
    padding: 24px 16px 32px;
    min-width: 0;
}

@media (min-width: 640px) {
    .auth__main { padding: 32px 40px 48px; }
}

@media (min-width: 1024px) {
    .auth__main { padding: 40px 64px 56px; }
}

.auth__main { --auth-card-w: 420px; }
.auth__main--wide { --auth-card-w: 620px; }

/* en-tête et formulaire partagent la même largeur, centrés dans la colonne */
.auth__header,
.auth__card {
    width: 100%;
    max-width: var(--auth-card-w);
    margin-left: auto;
    margin-right: auto;
}

.auth__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.auth__logo { display: inline-flex; align-items: center; line-height: 0; }
.auth__logo img { height: 28px; width: auto; }

@media (min-width: 640px) {
    .auth__logo img { height: 32px; }
}

.auth__header-link {
    font-size: 14px;
    color: var(--auth-muted);
}
.auth__header-link a { margin-left: 4px; white-space: nowrap; }
/* colonne étroite (login / mot de passe) : on ne garde que le lien */
.auth__main:not(.auth__main--wide) .auth__header-link-q { display: none; }

.auth__body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 0 0;
}

@media (min-width: 1024px) {
    .auth__body { padding-top: 24px; }
}

.auth__card--wide { --auth-card-w: 620px; }

.auth__title {
    margin: 0 0 8px;
    font-size: 19px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--auth-text);
}

@media (min-width: 640px) {
    .auth__title { font-size: 22px; }
}

.auth__intro {
    margin: 0 0 28px;
    color: var(--auth-muted);
    font-size: 15px;
}

.auth__intro p { margin: 0; }
.auth__intro p + p { margin-top: 8px; }

/* HTML libre (left_content saisi dans l'admin loginpage) : on impose la typo de la page */
.auth__intro *,
.auth__intro [style*="font"],
.auth__intro font {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
}
.auth__intro b, .auth__intro strong { font-weight: 600; color: var(--auth-text) !important; }
.auth__intro a { color: var(--auth-brand-700) !important; }
.auth__intro h1, .auth__intro h2, .auth__intro h3, .auth__intro h4 { margin: 10px 0 4px; font-weight: 600; color: var(--auth-text) !important; }
.auth__intro ul, .auth__intro ol { margin: 8px 0; padding-left: 20px; }
.auth__intro li { margin: 2px 0; }
.auth__intro > :first-child { margin-top: 0; }
.auth__intro > :last-child { margin-bottom: 0; }
.auth__intro br + br { display: none; }

.auth__footer {
    margin-top: 28px;
    text-align: center;
    font-size: 14px;
    color: var(--auth-muted);
}

.auth__legal {
    margin-top: 40px;
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Panneau latéral (témoignage / image)
   -------------------------------------------------------------------------- */

.auth__side {
    position: relative;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(150deg, #8fdbb9 0%, var(--auth-brand) 35%, var(--auth-brand-700) 100%);
    display: none;
}

.auth__side--mobile { display: block; padding: 32px 16px 40px; }

@media (min-width: 1024px) {
    .auth__side, .auth__side--mobile {
        display: flex;
        flex-direction: column;
        padding: 40px 48px;
        position: sticky;
        top: 0;
        height: 100vh;
        height: 100dvh;
        overflow-y: auto; /* contenu loginpage long : on scrolle dans le panneau, rien n'est coupé */
        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,.4) transparent;
    }
    /* calé en bas quand il reste de la place, sans jamais couper le haut */
    .auth__side .testimonial { margin-top: auto; }
}

.auth__side-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    display: none;
}

.auth__side-img::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(17, 24, 39, 0.82) 0%, rgba(17, 24, 39, 0.35) 45%, rgba(17, 24, 39, 0.05) 100%);
}

@media (min-width: 1024px) {
    .auth__side-img { display: block; }
}

/* Visuel de page personnalisée : affiché en entier, au-dessus du témoignage */
.auth__side-figure {
    position: relative;
    z-index: 1;
    margin: 0 0 20px;
    display: flex;
    justify-content: center;
    flex: none;
}
.auth__side-figure img {
    display: block;
    width: 100%;
    max-width: 560px;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}
@media (min-width: 1024px) {
    .auth__side--visual { padding-top: 32px; }
    .auth__side-figure { margin-bottom: 24px; }
    .auth__side-figure img {
        width: auto;
        max-width: 100%;
        max-height: 56vh;
        max-height: 56dvh;
    }
    .auth__side--visual .testimonial { max-width: 560px; }
}

/* motif décoratif quand il n'y a pas d'image */
.auth__side-deco {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.auth__side-deco::before,
.auth__side-deco::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
}
.auth__side-deco::before { width: 520px; height: 520px; top: -160px; right: -140px; }
.auth__side-deco::after  { width: 360px; height: 360px; bottom: 120px; left: -160px; background: rgba(20, 81, 59, 0.18); }

.testimonial {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    margin-left: auto;  /* centré dans le panneau : marges gauche/droite identiques */
    margin-right: auto;
    padding: 24px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    overflow-wrap: anywhere;
}

/* Contenu long (bloc marketing) : plus compact */
.testimonial--long { max-width: 560px; }
.testimonial--long .testimonial__title { font-size: 20px; }
.testimonial--long .testimonial__content,
.testimonial--long .testimonial__content p { font-size: 14px; line-height: 1.55; }
@media (min-width: 1024px) {
    .testimonial--long { padding: 24px 28px; }
    .testimonial--long .testimonial__title { font-size: 22px; }
    .testimonial--long .testimonial__content,
    .testimonial--long .testimonial__content p { font-size: 15px; }
}

@media (min-width: 1024px) {
    .testimonial { padding: 32px; }
}

.testimonial__title {
    margin: 0 0 14px;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

@media (min-width: 1024px) {
    .testimonial__title { font-size: 28px; }
}

.testimonial__content,
.testimonial__content p {
    margin: 0;
    font-size: 15px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.95);
}

@media (min-width: 1024px) {
    .testimonial__content, .testimonial__content p { font-size: 17px; }
}

.testimonial__content p + p { margin-top: 10px; }

/* HTML libre saisi dans l'admin loginpage */
.testimonial__content h1, .testimonial__content h2,
.testimonial__content h3, .testimonial__content h4 {
    margin: 14px 0 8px;
    font-size: 1.15em;
    line-height: 1.3;
    font-weight: 700;
    color: #fff;
}
.testimonial__content > :first-child { margin-top: 0; }
.testimonial__content > :last-child { margin-bottom: 0; }
.testimonial__content ul, .testimonial__content ol { margin: 8px 0; padding-left: 22px; }
.testimonial__content li { margin: 2px 0; }
.testimonial__content br + br { display: none; }
.testimonial__content a { color: #fff; text-decoration: underline; }
.testimonial__content img { max-width: 100%; height: auto; border-radius: 8px; }
.testimonial__content *,
.testimonial__content font {
    font-family: inherit !important;
    font-size: inherit !important;
    color: inherit !important;
}
.testimonial__content h1, .testimonial__content h2,
.testimonial__content h3, .testimonial__content h4 { font-size: 1.15em !important; }
.testimonial__content b, .testimonial__content strong { color: #fff; font-weight: 700; }

.testimonial__author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.testimonial__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.6);
    flex: none;
}

.testimonial__name { font-weight: 600; font-size: 15px; color: #fff; display: block; }
.testimonial__role { font-size: 13px; color: rgba(255, 255, 255, 0.85); display: block; }

/* --------------------------------------------------------------------------
   Formulaires
   -------------------------------------------------------------------------- */

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 16px;
}

@media (min-width: 560px) {
    .form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.field { margin-bottom: 18px; min-width: 0; }

.field__label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--auth-text);
}

.field__label .optional {
    font-weight: 400;
    color: var(--auth-muted);
}

.input {
    display: block;
    width: 100%;
    height: 46px;
    padding: 0 14px;
    font: inherit;
    font-size: 15px;
    color: var(--auth-text);
    background: var(--auth-surface);
    border: 1px solid var(--auth-border-strong);
    border-radius: var(--auth-radius-sm);
    appearance: none;
    -webkit-appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input::placeholder { color: #9ca3af; }

.input:hover { border-color: #9ca3af; }

.input:focus {
    outline: none;
    border-color: var(--auth-brand-600);
    box-shadow: var(--auth-ring);
}

.field--error .input { border-color: var(--auth-danger); }
.field--error .input:focus { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18); }

.field__error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    font-size: 13px;
    color: var(--auth-danger);
}

.field__error svg { flex: none; width: 15px; height: 15px; margin-top: 2px; }

.field__hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--auth-muted);
}

/* champ mot de passe avec bouton œil */
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 46px; }

.toggle-password {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
}
.toggle-password:hover { background: #f3f4f6; color: var(--auth-text); }
.toggle-password:focus-visible { outline: none; box-shadow: var(--auth-ring); }
.toggle-password svg { width: 20px; height: 20px; }
.toggle-password .icon-eye-off { display: none; }
.toggle-password.is-visible .icon-eye { display: none; }
.toggle-password.is-visible .icon-eye-off { display: block; }

/* cases à cocher (input natif masqué, case dessinée en CSS) */
.check {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--auth-text);
    cursor: pointer;
}

.check input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.check__box {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border: 1.5px solid var(--auth-border-strong);
    border-radius: 6px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.check__box svg {
    width: 12px;
    height: 12px;
    stroke: #fff;
    opacity: 0;
    transform: scale(.6);
    transition: opacity .12s ease, transform .12s ease;
}

.check:hover .check__box { border-color: var(--auth-brand-600); }
.check input:focus-visible + .check__box { box-shadow: var(--auth-ring); border-color: var(--auth-brand-600); }
.check input:checked + .check__box { background: var(--auth-brand-700); border-color: var(--auth-brand-700); }
.check input:checked + .check__box svg { opacity: 1; transform: scale(1); }
.field--error .check__box { border-color: var(--auth-danger); }

.check__text { color: var(--auth-muted); }
.check__text a { font-weight: 500; }
.check input:checked ~ .check__text { color: var(--auth-text); }


.check--muted { color: var(--auth-muted); }

.field--check { margin: 4px 0 22px; }

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.field-row .check { margin: 0; }
.field-row a { font-size: 14px; }

/* boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 46px;
    padding: 0 18px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--auth-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none !important;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
}

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--auth-ring); }

.btn--primary { background: var(--auth-text); color: #fff !important; }
.btn--primary:hover { background: #1f2937; }

.btn--brand { background: var(--auth-brand-700); color: #fff !important; }
.btn--brand:hover { background: var(--auth-brand-900); }

.btn--secondary { background: #fff; color: var(--auth-text) !important; border-color: var(--auth-border-strong); }
.btn--secondary:hover { background: #f9fafb; border-color: #9ca3af; }

.btn svg { width: 18px; height: 18px; }

.btn.is-loading { opacity: .7; cursor: progress; }

.btn + .btn { margin-top: 10px; }

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    font-size: 13px;
    color: var(--auth-muted);
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--auth-border); }

/* alertes */
.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0 0 20px;
    padding: 12px 14px;
    border-radius: var(--auth-radius-sm);
    font-size: 14px;
    line-height: 1.45;
    border: 1px solid;
}
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.alert p { margin: 0; }
.alert--success { color: var(--auth-success); background: var(--auth-success-bg); border-color: var(--auth-success-border); }
.alert--error   { color: var(--auth-danger);  background: var(--auth-danger-bg);  border-color: var(--auth-danger-border); }

/* --------------------------------------------------------------------------
   Widgets tiers
   -------------------------------------------------------------------------- */

/* intl-tel-input */
.iti { width: 100%; display: block; }
.iti__flag-container { border-radius: var(--auth-radius-sm) 0 0 var(--auth-radius-sm); }
.iti__selected-flag { border-radius: var(--auth-radius-sm) 0 0 var(--auth-radius-sm); padding: 0 10px 0 12px; }
.iti__selected-flag:hover, .iti__selected-flag:focus { background: #f3f4f6; }
.iti__selected-dial-code { font-size: 14px; }
.iti__country-list { border-radius: var(--auth-radius-sm); border-color: var(--auth-border); box-shadow: 0 10px 30px rgba(0,0,0,.12); }

/* bloc repliable (code parrainage) */
.disclosure { margin: 0 0 18px; }
.disclosure__summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--auth-brand-700);
    user-select: none;
}
.disclosure__summary::-webkit-details-marker { display: none; }
.disclosure__summary:hover { color: var(--auth-brand-900); text-decoration: underline; }
.disclosure__summary:focus-visible { outline: none; border-radius: 6px; box-shadow: var(--auth-ring); }
.disclosure__summary svg { width: 16px; height: 16px; transition: transform .15s ease; }
.disclosure[open] .disclosure__summary svg { transform: rotate(45deg); }
.disclosure__summary b { font-weight: 600; color: var(--auth-text); }
.disclosure__body { padding-top: 12px; }
.disclosure__body .field { margin-bottom: 0; }

/* reCAPTCHA : tient dans 320 px de large */
.captcha-wrap { margin: 4px 0 22px; }
@media (max-width: 359px) {
    .g-recaptcha { transform: scale(.9); transform-origin: 0 0; }
}

/* Variante logo centré : en-tête sans lien, le lien reste sous le formulaire */
.auth--logo-center .auth__header { justify-content: center; }
.auth--logo-center .auth__header-link { display: none !important; }
.auth--logo-center .auth__footer--mobile { display: block !important; }
.auth--logo-center .auth__logo img { height: 34px; }
@media (min-width: 640px) {
    .auth--logo-center .auth__logo img { height: 38px; }
}

/* --------------------------------------------------------------------------
   Visibilité responsive
   -------------------------------------------------------------------------- */
.auth__header-link { display: none; }
@media (min-width: 640px) {
    .auth__header-link { display: block; }
    .auth__footer--mobile { display: none; }
}

/* --------------------------------------------------------------------------
   Vérification de l'email (code à 6 chiffres)
   -------------------------------------------------------------------------- */
.verify-icon {
    width: 56px;
    height: 56px;
    margin: 0 0 18px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(123, 208, 169, 0.18);
    color: var(--auth-brand-900);
}
.verify-icon svg { width: 28px; height: 28px; }

.input--code {
    height: 60px;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 0.4em;
    text-align: center;
    font-variant-numeric: tabular-nums;
    padding-left: calc(14px + 0.4em); /* compense le letter-spacing du dernier caractère */
}
.input--code::placeholder { letter-spacing: 0.4em; color: #d1d5db; font-weight: 400; }

.verify-resend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 22px;
    font-size: 14px;
    color: var(--auth-muted);
}
.verify-resend form { display: inline; }
.btn-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 500;
    color: var(--auth-brand-700);
    cursor: pointer;
}
.btn-link:hover { color: var(--auth-brand-900); text-decoration: underline; }
.btn-link:disabled { color: var(--auth-muted); cursor: default; text-decoration: none; }
