/* ===== file: /assets/css/forgot.css =====
   FORGOT PASSWORD — CENTERED (desktop + mobile)
   ✅ Block centered in the middle
   ✅ Background sharp (never blurred)
   ✅ Mobile: name stays next to logo (like desktop)
   ✅ Scroll safe on small heights
==================================================== */

:root {
    --fp-mini-h: 52px;
    --fp-radius-xl: 24px;
    --fp-radius-lg: 16px;
}

/* =========================
   Scroll safe
========================= */
html,
body {
    height: 100%;
}

body.forgot-page {
    overflow-x: hidden;
    overflow-y: auto;

    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .35) rgba(2, 6, 23, .25);
}

/* Chrome / Edge */
body.forgot-page::-webkit-scrollbar {
    width: 10px;
}

body.forgot-page::-webkit-scrollbar-track {
    background: rgba(2, 6, 23, .25);
}

body.forgot-page::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .28);
    border-radius: 999px;
    border: 2px solid rgba(2, 6, 23, .25);
}

/* =========================
   Background (SHARP)
========================= */
.fp-bg {
    position: fixed;
    inset: 0;
    z-index: -3;
    overflow: hidden;
    background: #f7f4ec;
}

.fp-bg__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.35;

    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Voile blanc doux par-dessus le motif → motif estompé (option 1). */
.fp-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(247, 244, 236, 0.62));
}

.fp-bg__overlay {
    position: absolute;
    inset: 0;
    z-index: -2;
    background: transparent;
}

.fp-bg__grain {
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: .08;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

/* =========================
   Layout (CENTERED)
========================= */
.fp-wrap {
    min-height: 100vh;
    display: grid;

    /* ✅ center the whole block (align-content pour centrer VERTICALEMENT) */
    place-items: center;
    align-content: center;

    /* Réserve la hauteur du navbar fixe en haut. */
    padding: calc(var(--topbar-h, 74px) + 14px) 14px 14px;
}

.fp-shell {
    width: min(520px, 100%);
    display: grid;
    /* Gap plus visible (14px) — sans ça, le header et la card (même fond
       vert sombre) semblent collés en une seule grosse boîte. */
    gap: 14px;
}

/* =========================
   Mini header
========================= */
.fp-mini {
    min-height: var(--fp-mini-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 8px 12px;
    border-radius: var(--fp-radius-lg);

    /* Fond sombre solide (vert forêt, accord avec la marque VECTRA) :
       fait ressortir le texte blanc sur le fond beige à motifs marocains. */
    background: #0e3b2a;
    border: 1px solid rgba(255, 255, 255, .08);

    /* no blur inside */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;

    box-shadow: 0 14px 30px rgba(0, 0, 0, .22);

    transform: translateY(16px);
    opacity: 0;
    animation: fpFadeUp .65s ease-out forwards;
}

.fp-mini__brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: rgba(255, 255, 255, .98);
    min-width: 0;
}

.fp-mini__logo {
    width: auto;
    height: 36px;
    max-width: 140px;
    border-radius: 0;
    object-fit: contain;
    background: transparent;
    border: none;
    box-shadow: none;
    flex: 0 0 auto;
}

.fp-mini__name {
    font-weight: 1000;
    font-size: 14px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 520px;
}

.fp-mini__badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 1000;
    font-size: 12px;
    color: rgba(255, 255, 255, .95);

    /* Sur le mini header vert sombre, le badge utilise un blanc translucide
       plus marqué pour rester visible. */
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .14);
}

/* =========================
   Card
========================= */
.fp-card {
    border-radius: var(--fp-radius-xl);
    overflow: hidden;

    /* Carte claire « frosted » — cohérente avec login et les pages contenu. */
    background: rgba(255, 255, 255, .82);
    border: 1px solid rgba(255, 255, 255, .9);

    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;

    box-shadow:
        0 28px 64px rgba(2, 6, 23, .16),
        0 10px 24px rgba(2, 6, 23, .08);

    transform: translateY(16px);
    opacity: 0;
    animation: fpFadeUp .65s ease-out forwards;
}

/* Barre dégradée du haut retirée — redondante avec le fond vert sombre uni
   de la card. Garde le visuel propre et aéré. */
.fp-card::before {
    content: none;
}

.fp-card__head {
    text-align: center;
    padding: 14px 28px 0;
}

.fp-title {
    margin: 2px 0 0;
    font-size: 26px;
    font-weight: 900;
    color: #0b1b48;
}

.fp-subtitle {
    margin: 4px 0 0;
    color: #475569;
    font-size: 12.5px;
    line-height: 1.45;
}

/* =========================
   Form
========================= */
.fp-form {
    position: relative;
    padding: 12px 28px 18px;
}

.fp-field {
    margin-bottom: 8px;
}

.fp-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 900;
    font-size: 13.5px;
    color: #0f172a;
    text-align: right;
}

.fp-input {
    position: relative;
}

.fp-icon {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: rgba(15, 23, 42, .70);
    pointer-events: none;
    font-size: 15px;
}

.fp-input__el {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .14);
    background: #ffffff;
    padding: 0 44px 0 14px;
    font-size: 15px;
    color: #0f172a;
    -webkit-text-fill-color: #0f172a;
    outline: none;
    transition: .22s ease;
}

.fp-input__el::placeholder {
    /* !important + -webkit-text-fill-color requis pour passer au-dessus du
       -webkit-text-fill-color: #0f172a appliqué sur l'input lui-même
       (sans ça, Chrome/Safari affichent le placeholder en noir au lieu du gris). */
    color: rgba(15, 23, 42, .55) !important;
    -webkit-text-fill-color: rgba(15, 23, 42, .55) !important;
    opacity: 1;
}

.fp-ltr {
    direction: ltr;
    text-align: left;
}

.fp-input__el:focus {
    border-color: rgba(15, 118, 110, .85);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, .16);
    background: #ffffff;
}

.fp-error {
    margin: 4px 0 0;
    min-height: 0;
    font-size: 12px;
    font-weight: 800;
    color: #dc2626;
    text-align: right;
}
[dir="ltr"] .fp-error { text-align: left; }
.fp-error:empty { display: none; }

/* =========================
   Étapes (téléphone → code → mot de passe)
========================= */
.fp-form[hidden] { display: none; }

.forgot-page .fp-linklike {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    color: #0f766e;
    text-decoration: underline;
    text-underline-offset: 2px;
    display: block;
    margin: 8px auto 0;
    text-align: center;
}
.forgot-page .fp-linklike:hover { color: #0b5e57; }
.forgot-page .fp-linklike:disabled { color: #94a3b8; cursor: not-allowed; text-decoration: none; }

/* Code OTP centré */
.forgot-page #otpCode {
    text-align: center;
    letter-spacing: 10px;
    font-size: 22px;
    font-weight: 800;
    padding: 0 14px;
    direction: ltr;
}

/* Toggle mot de passe */
.forgot-page .fp-input.has-toggle .fp-input__el { padding-inline-end: 48px; }
.forgot-page .fp-pass-toggle {
    position: absolute;
    top: 50%;
    inset-inline-end: 6px;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    color: rgba(15, 23, 42, .45);
    transition: color .18s ease, background .18s ease;
}
.forgot-page .fp-pass-toggle:hover { color: rgba(15, 118, 110, .95); background: rgba(15, 118, 110, .08); }
.forgot-page .fp-pass-toggle.is-on { color: rgba(15, 118, 110, 1); background: rgba(15, 118, 110, .10); }

/* =========================
   Sélecteur pays à drapeaux (identique signup/login, scopé .forgot-page)
========================= */
.forgot-page .su-phone-field {
    position: relative;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    gap: 12px;
    direction: ltr;
    align-items: stretch;
    overflow: visible;
}
.forgot-page .su-phone-field > * { min-width: 0; }
.forgot-page .su-country-select { position: relative; z-index: 60; min-width: 0; overflow: visible; }
.forgot-page .su-country-trigger {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, .14);
    background: #ffffff;
    cursor: pointer;
    font: inherit;
    color: #0f172a;
    transition: 0.18s ease;
}
.forgot-page .su-country-trigger:hover { border-color: rgba(15, 23, 42, .22); }
.forgot-page .su-country-trigger:focus-visible {
    outline: none;
    border-color: rgba(15, 118, 110, .85);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, .16);
}
.forgot-page .su-country-trigger-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.forgot-page .su-country-flag {
    width: 28px; height: 20px; object-fit: cover; border-radius: 4px;
    background: #fff; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.10); flex: 0 0 auto;
}
.forgot-page .su-country-meta { display: flex; align-items: center; gap: 7px; min-width: 0; direction: ltr; }
.forgot-page .su-country-dial {
    flex: 0 0 auto; font-size: 13px; font-weight: 1000; color: #008037; white-space: nowrap;
    background: rgba(0, 128, 55, 0.10); border: 1px solid rgba(0, 128, 55, 0.18);
    padding: 2px 7px; border-radius: 7px;
}
.forgot-page .su-country-name {
    display: block; min-width: 0; font-size: 13px; font-weight: 900; color: #334155;
    direction: rtl; text-align: left; unicode-bidi: plaintext;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.forgot-page .su-country-caret {
    width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent;
    border-top: 9px solid #1e293b; flex: 0 0 auto; transition: transform 0.18s ease;
}
.forgot-page .su-country-select.open .su-country-caret { transform: rotate(180deg); }
.forgot-page .su-country-menu {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 9999; display: none;
    max-height: 300px; overflow-y: auto; overflow-x: hidden; padding: 8px; border-radius: 18px;
    background: rgba(255, 255, 255, 0.98); border: 1px solid rgba(15, 23, 42, 0.10);
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.22);
}
.forgot-page .su-country-select.open .su-country-menu { display: block; }
.forgot-page .su-country-option {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 12px; border: 0; background: transparent; border-radius: 14px; cursor: pointer;
    font: inherit; transition: 0.16s ease;
}
.forgot-page .su-country-option:hover,
.forgot-page .su-country-option:focus-visible,
.forgot-page .su-country-option.is-active { outline: none; background: rgba(0, 128, 55, 0.10); }
.forgot-page .su-country-option-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; direction: ltr; }
.forgot-page .su-country-option-name {
    min-width: 0; flex: 1 1 auto; font-size: 13px; font-weight: 900; color: #0f172a;
    direction: rtl; text-align: left; unicode-bidi: plaintext;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.forgot-page .su-country-option-dial { font-size: 14px; font-weight: 1000; color: #008037; white-space: nowrap; }
.forgot-page .su-phone-field #phone { padding: 0 14px; direction: ltr; text-align: left; }

@media (max-width: 520px) {
    .forgot-page .su-phone-field { grid-template-columns: 1fr; gap: 10px; }
    .forgot-page .su-country-trigger,
    .forgot-page .su-phone-field #phone { height: 38px; }
    .forgot-page .su-country-menu { max-height: 260px; }
}

/* FR (LTR), UNIQUEMENT en 2 colonnes (≥521px) : input à gauche (sous le label
   téléphone), indicatif à droite. En mobile (≤520px) le champ s'empile normalement
   (indicatif en haut, input en bas), comme login. L'arabe reste inchangé. */
@media (min-width: 521px) {
    [dir="ltr"] .forgot-page .su-phone-field {
        grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
    }
    [dir="ltr"] .forgot-page .su-phone-field > #phone { order: 1; }
    [dir="ltr"] .forgot-page .su-phone-field > #countrySelect { order: 2; }
}

.fp-input__el.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .15);
}

.fp-actions {
    display: grid;
    gap: 8px;
    margin: 10px 0 4px;
}

.fp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    border-radius: 14px;
    font-weight: 900;
    cursor: pointer;
    border: none;
    text-decoration: none;
    font-size: 14.5px;
    transition: .25s ease;
}

.fp-btn--primary {
    color: #fff;
    background: linear-gradient(135deg, #0f766e, #0891b2);
    box-shadow: 0 18px 36px rgba(8, 145, 178, .28);
}

.fp-btn--primary:hover {
    transform: translateY(-2px) scale(1.01);
    filter: brightness(1.08);
}

.fp-btn--ghost {
    background: rgba(15, 23, 42, .05);
    border: 1px solid rgba(15, 23, 42, .1);
    color: #334155;
}

.fp-btn--ghost:hover {
    background: rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}

.fp-msg {
    margin: 8px 0 0;
    min-height: 0;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 12px;
    padding: 0;
    text-align: center;
    transition: all 0.3s ease;
}
.fp-msg:empty { display: none; }

.fp-msg.is-success {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    padding: 14px 16px;
    text-align: right;
    border-radius: 14px;
}

.fp-msg.is-success::before {
    content: "✅";
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1.4;
}

.fp-msg.is-error {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    padding: 14px 16px;
    text-align: right;
    border-radius: 14px;
}

.fp-msg.is-error::before {
    content: "❌";
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1.4;
}

.fp-msg.is-info {
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.12);
    color: #334155;
    padding: 12px 16px;
}

.fp-glow {
    position: absolute;
    inset: auto 0 0 0;
    height: 92px;
    background: radial-gradient(260px 92px at 50% 100%, rgba(8, 145, 178, .10), transparent 65%);
    pointer-events: none;
}

@keyframes fpFadeUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* =========================
   Mobile (CENTERED + keep name next to logo)
========================= */
@media (max-width: 520px) {

    /* Réserve le navbar fixe en haut + espacement latéral. */
    .fp-wrap {
        padding: calc(var(--topbar-h, 64px) + 6px) 16px 8px;
    }

    /* logo à gauche, badge à droite sur mobile */
    .fp-mini {
        justify-content: space-between;
        gap: 7px;
        padding: 6px 8px;
    }

    /* Badge "Récupération sécurisée" caché sur mobile pour libérer la place
       au logo VECTRA et au bouton retour (3 éléments ne tenaient pas tous). */
    .fp-mini__badge {
        display: none !important;
    }

    .fp-mini__logo {
        height: 30px;
        width: auto;
        max-width: 110px;
    }

    .fp-mini__name {
        max-width: 240px;
        font-size: 12.5px;
    }

    .fp-card__head {
        padding: 12px 14px 0;
    }

    .fp-title {
        font-size: 21px;
    }

    .fp-subtitle {
        font-size: 11.5px;
        line-height: 1.4;
        padding: 0 4px;
    }

    .fp-form {
        padding: 10px 14px 12px;
    }

    /* Label compact + input 40px (cohérent avec login/signup). */
    .fp-field label {
        font-size: 13px;
        margin-bottom: 3px;
    }

    .fp-input__el {
        height: 40px;
        border-radius: 11px;
        font-size: 14px;
    }

    .fp-btn {
        height: 40px;
        font-size: 13.5px;
        border-radius: 12px;
    }

    .fp-actions {
        gap: 7px;
        margin: 8px 0 4px;
    }
}

@media (max-width: 380px) {
    .fp-wrap {
        padding: calc(var(--topbar-h, 60px) + 4px) 12px 6px;
    }

    .fp-mini__badge {
        padding: 3px 7px;
        font-size: 10px;
    }

    .fp-title {
        font-size: 19px;
    }
}



/* =========================
   FORGOT MESSAGES PREMIUM
========================= */

#forgotMsg {
    min-height: 0;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    text-align: center;
    font-weight: 900;
    font-size: 13.5px;
    line-height: 1.5;
    letter-spacing: 0;
    border: 1px solid transparent;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
    transition: all 0.25s ease;
}

#forgotMsg:empty {
    display: none;
}

/* Banners adaptés à la card CLAIRE (fond clair + texte foncé). */
#forgotMsg.is-success {
    color: #166534;
    background: #f0fdf4;
    border-color: #86efac;
    box-shadow: 0 10px 24px rgba(22, 101, 52, 0.12);
}

/* Error message */
#forgotMsg.is-error {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fca5a5;
    box-shadow: 0 10px 24px rgba(185, 28, 28, 0.12);
}

/* Info message */
#forgotMsg.is-info {
    color: #155e75;
    background: #ecfeff;
    border-color: #a5f3fc;
    box-shadow: 0 10px 24px rgba(8, 145, 178, 0.12);
}

/* Inline email error */
#emailError {
    display: block;
    min-height: 20px;
    margin-top: 8px;
    padding-inline: 4px;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.7;
    opacity: 0;
    transform: translateY(-3px);
    transition: all 0.22s ease;
}

#emailError.is-on {
    opacity: 1;
    transform: translateY(0);
}

#emailError.is-error {
    color: #dc2626;
}

/* Input border when error */
#email.is-error {
    border-color: rgba(248, 113, 113, 0.95) !important;
    box-shadow:
        0 0 0 4px rgba(239, 68, 68, 0.16),
        0 10px 24px rgba(239, 68, 68, 0.14) !important;
}
/* ── LTR (French) overrides ── */
[dir="ltr"] .fp-field label { text-align: left; }

/* Forgot mobile : on RÉ-AFFICHE « Créer un compte » dans le menu burger (le navbar le
   masque par défaut sur forgot). Bouton secondaire (blanc + bordure bleue) ; le
   « Se connecter » reste via le bouton bleu en bas (post-ad-btn--nav). */
@media (max-width: 1024px) {
  body.forgot-page .topbar #mobileLinks .mobile-signup-btn,
  body.forgot-page .topbar #mobileLinks a.mobile-signup-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    margin-top: auto;
    margin-bottom: 8px;
    padding: 12px 16px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 800;
    font-size: 15px;
    color: #1d4ed8 !important;
    background: #fff;
    border: 2px solid #2563eb;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.14);
  }
}
