/* ==========================================================================
   Mon Espace Hanka : pages de connexion (connexion, inscription,
   mot de passe oublié, réinitialisation)
   ========================================================================== */

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

:root {
    --radius:        14px;
    --radius-card:   28px;
    --ease:          cubic-bezier(.16, 1, .3, 1);
    --transition:    .25s cubic-bezier(.4, 0, .2, 1);

    --clr-primary:   #9C4221;
    --clr-primary-2: #B8572F;
    --clr-gold:      #C9975B;
    --clr-violet:    #5B52E0;
    --clr-success:   #2F8F5B;
    --clr-error:     #D64545;

    --font-ui:       'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display:  'Cormorant Garamond', 'Times New Roman', serif;
}

/* Thème clair (par défaut) */
:root, [data-theme="light"] {
    --clr-bg:        #F7F3EC;
    --clr-bg-2:      #EFE7DB;
    --clr-card:      rgba(255, 255, 255, .78);
    --clr-card-solid:#FFFFFF;
    --clr-border:    rgba(156, 66, 33, .12);
    --clr-text:      #2E1F1A;
    --clr-muted:     #7A6A64;
    --clr-input:     rgba(247, 243, 236, .9);
    --clr-input-hover: #F2ECE2;
    --clr-dots:      rgba(62, 39, 35, .045);
    --orb-1:         rgba(201, 151, 91, .30);
    --orb-2:         rgba(156, 66, 33, .18);
    --orb-3:         rgba(91, 82, 224, .12);
    --shadow-card:   0 1px 0 rgba(255,255,255,.9) inset, 0 30px 80px -20px rgba(62, 39, 35, .28), 0 12px 30px -12px rgba(62, 39, 35, .18);
}

[data-theme="dark"] {
    --clr-bg:        #0A1020;
    --clr-bg-2:      #0E1628;
    --clr-card:      rgba(18, 27, 46, .72);
    --clr-card-solid:#121B2E;
    --clr-border:    rgba(200, 214, 245, .09);
    --clr-text:      #E8EDF7;
    --clr-muted:     #97A3BA;
    --clr-input:     rgba(26, 37, 64, .85);
    --clr-input-hover: #202C48;
    --clr-dots:      rgba(255, 255, 255, .035);
    --orb-1:         rgba(201, 151, 91, .12);
    --orb-2:         rgba(66, 98, 214, .24);
    --orb-3:         rgba(120, 90, 230, .16);
    --shadow-card:   0 1px 0 rgba(255,255,255,.04) inset, 0 40px 100px -20px rgba(0, 0, 0, .7), 0 12px 30px -12px rgba(0, 0, 0, .5);
}

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

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    color: var(--clr-text);
    background: radial-gradient(120% 90% at 50% 0%, var(--clr-bg) 0%, var(--clr-bg-2) 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}

/* ── Fond : orbes lumineux + trame de points ─────────────────────────────── */
.auth-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.auth-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--clr-dots) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 100%);
            mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 100%);
}

.auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    will-change: transform;
}

.auth-orb--1 { width: 520px; height: 520px; top: -160px; left: -120px; background: var(--orb-1); animation: orb1 22s ease-in-out infinite alternate; }
.auth-orb--2 { width: 460px; height: 460px; bottom: -180px; right: -100px; background: var(--orb-2); animation: orb2 26s ease-in-out infinite alternate; }
.auth-orb--3 { width: 340px; height: 340px; top: 40%; left: 60%; background: var(--orb-3); animation: orb3 30s ease-in-out infinite alternate; }

@keyframes orb1 { to { transform: translate(90px, 70px) scale(1.08); } }
@keyframes orb2 { to { transform: translate(-80px, -60px) scale(1.12); } }
@keyframes orb3 { to { transform: translate(-140px, 50px) scale(.9); } }

/* ── Carte ───────────────────────────────────────────────────────────────── */
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 44px 40px 32px;
    background: var(--clr-card);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
            backdrop-filter: blur(24px) saturate(1.3);
    animation: cardIn .8s var(--ease) both;
}

.auth-card--large { max-width: 560px; }

/* Liseré doré en haut de la carte */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--clr-gold), transparent);
    opacity: .7;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(24px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

/* ── Bouton thème ────────────────────────────────────────────────────────── */
.auth-theme {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid var(--clr-border);
    padding: 0;
    line-height: 0;
    background: transparent;
    color: var(--clr-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.auth-theme:hover { color: var(--clr-primary); background: rgba(156, 66, 33, .07); transform: rotate(-12deg); }
.auth-theme svg { width: 18px; height: 18px; display: block; }
.auth-theme .icon-sun { display: none; }
[data-theme="dark"] .auth-theme .icon-sun { display: block; }
[data-theme="dark"] .auth-theme .icon-moon { display: none; }

/* ── En-tête : logo et marque ────────────────────────────────────────────── */
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    position: relative;
    width: 108px;
    height: 108px;
    margin-bottom: 18px;
    animation: logoIn 1s var(--ease) .1s both;
}

.auth-logo::before {
    content: '';
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 151, 91, .28) 0%, transparent 70%);
    animation: halo 5s ease-in-out infinite;
}

.auth-logo img {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 10px 30px -8px rgba(156, 66, 33, .35);
}

[data-theme="dark"] .auth-logo img { box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .6), 0 0 0 1px rgba(200, 214, 245, .08); }

@keyframes logoIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes halo { 50% { transform: scale(1.08); opacity: .7; } }

.auth-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--clr-gold);
    margin-bottom: 6px;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -.01em;
    color: var(--clr-text);
}

.auth-subtitle {
    margin-top: 10px;
    font-size: 14px;
    color: var(--clr-muted);
    max-width: 340px;
}

/* ── Messages ────────────────────────────────────────────────────────────── */
.auth-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: var(--radius);
    font-size: 13.5px;
    line-height: 1.45;
    border: 1px solid;
    animation: alertIn .45s var(--ease) both;
}

.auth-alert svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.auth-alert ul { margin: 6px 0 0 18px; }
.auth-alert--danger  { color: var(--clr-error);   background: rgba(214, 69, 69, .08); border-color: rgba(214, 69, 69, .22); animation-name: alertShake; }
.auth-alert--success { color: var(--clr-success); background: rgba(47, 143, 91, .08); border-color: rgba(47, 143, 91, .22); }
.auth-alert--info    { color: var(--clr-primary); background: rgba(156, 66, 33, .06); border-color: rgba(156, 66, 33, .18); }

@keyframes alertIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes alertShake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* ── Formulaire ──────────────────────────────────────────────────────────── */
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.auth-field { margin-bottom: 16px; }

.auth-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--clr-muted);
    letter-spacing: .01em;
}

.auth-label a {
    font-weight: 500;
    color: var(--clr-primary);
    text-decoration: none;
}

.auth-label a:hover { text-decoration: underline; text-underline-offset: 3px; }
[data-theme="dark"] .auth-label a { color: var(--clr-gold); }

.auth-input {
    position: relative;
}

.auth-input > svg {
    position: absolute;
    left: 15px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: var(--clr-muted);
    opacity: .7;
    pointer-events: none;
    transition: color var(--transition), opacity var(--transition);
}

.auth-input input {
    width: 100%;
    height: 50px;
    padding: 0 16px 0 44px;
    font-family: inherit;
    font-size: 15px;
    color: var(--clr-text);
    background: var(--clr-input);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    -webkit-appearance: none;
            appearance: none;
}

.auth-input input[type="date"] { padding-right: 12px; }
.auth-input input::placeholder { color: var(--clr-muted); opacity: .6; }
.auth-input input:hover { background: var(--clr-input-hover); }

.auth-input input:focus {
    background: var(--clr-card-solid);
    border-color: rgba(156, 66, 33, .55);
    box-shadow: 0 0 0 4px rgba(156, 66, 33, .10);
}

.auth-input:focus-within > svg { color: var(--clr-primary); opacity: 1; }
[data-theme="dark"] .auth-input:focus-within > svg { color: var(--clr-gold); }
[data-theme="dark"] .auth-input input { color-scheme: dark; }

.auth-input--password input { padding-right: 48px; }

/* Champ en erreur */
.auth-input.is-invalid input { border-color: rgba(214, 69, 69, .6); box-shadow: 0 0 0 4px rgba(214, 69, 69, .10); }
.auth-input.is-invalid > svg { color: var(--clr-error); opacity: 1; }
.auth-error-text { margin-top: 6px; font-size: 12px; color: var(--clr-error); min-height: 0; }
.auth-error-text:empty { display: none; }

.auth-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--clr-muted);
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}

.auth-eye:hover { color: var(--clr-text); background: rgba(156, 66, 33, .07); }
.auth-eye svg { width: 18px; height: 18px; }
.auth-eye .icon-eye-off { display: none; }
.auth-eye.is-visible .icon-eye { display: none; }
.auth-eye.is-visible .icon-eye-off { display: block; }

/* Force du mot de passe */
.auth-strength {
    display: flex;
    gap: 5px;
    margin-top: 9px;
}

.auth-strength span {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--clr-border);
    transition: background var(--transition);
}

.auth-strength-text {
    margin-top: 6px;
    font-size: 12px;
    color: var(--clr-muted);
    min-height: 18px;
}

.auth-strength[data-level="1"] span:nth-child(-n+1) { background: var(--clr-error); }
.auth-strength[data-level="2"] span:nth-child(-n+2) { background: #E08A3C; }
.auth-strength[data-level="3"] span:nth-child(-n+3) { background: var(--clr-gold); }
.auth-strength[data-level="4"] span:nth-child(-n+4) { background: var(--clr-success); }

/* Case à cocher */
.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 22px;
    font-size: 13.5px;
    color: var(--clr-muted);
    cursor: pointer;
    user-select: none;
}

.auth-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--clr-primary);
    cursor: pointer;
}

/* ── Bouton principal ────────────────────────────────────────────────────── */
.auth-btn {
    position: relative;
    width: 100%;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    color: #fff;
    background: linear-gradient(120deg, var(--clr-primary) 0%, var(--clr-primary-2) 45%, var(--clr-violet) 130%);
    background-size: 160% 100%;
    box-shadow: 0 10px 28px -10px rgba(156, 66, 33, .65), inset 0 1px 0 rgba(255, 255, 255, .18);
    cursor: pointer;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), background-position .6s var(--ease);
}

/* Reflet qui balaie le bouton au survol */
.auth-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent);
    transform: skewX(-20deg);
    transition: left .7s var(--ease);
}

.auth-btn:hover { transform: translateY(-2px); background-position: 100% 0; box-shadow: 0 16px 34px -12px rgba(156, 66, 33, .7), inset 0 1px 0 rgba(255, 255, 255, .2); }
.auth-btn:hover::after { left: 120%; }
.auth-btn:active { transform: translateY(0); }
.auth-btn:focus-visible { outline: 3px solid rgba(201, 151, 91, .6); outline-offset: 3px; }
.auth-btn svg { width: 18px; height: 18px; transition: transform var(--transition); }
.auth-btn:hover svg { transform: translateX(3px); }

.auth-btn[disabled] { cursor: wait; opacity: .85; transform: none; }

.auth-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pied de carte ───────────────────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 26px 0 18px;
    font-size: 12px;
    color: var(--clr-muted);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--clr-border);
}

.auth-alt {
    text-align: center;
    font-size: 14px;
    color: var(--clr-muted);
}

.auth-link {
    font-weight: 600;
    color: var(--clr-primary);
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size .35s var(--ease);
}

.auth-link:hover { background-size: 100% 1px; }
[data-theme="dark"] .auth-link { color: var(--clr-gold); }

.auth-footer {
    margin-top: 26px;
    text-align: center;
    font-size: 11.5px;
    letter-spacing: .02em;
    color: var(--clr-muted);
    opacity: .75;
}

.auth-hint {
    margin: -6px 0 18px;
    font-size: 12px;
    color: var(--clr-muted);
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
    body { padding: 16px; align-items: flex-start; }
    .auth-card { padding: 36px 22px 26px; border-radius: 24px; margin-top: 12px; }
    .auth-title { font-size: 30px; }
    .auth-logo { width: 92px; height: 92px; }
    .auth-row { grid-template-columns: 1fr; gap: 0; }
    .auth-orb { filter: blur(60px); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Bouton principal utilisé comme lien (page 404) */
a.auth-btn, a.auth-btn:hover, a.auth-btn:focus { text-decoration: none; color: #fff; }
.auth-alt--404 { margin-top: 28px; }

/* Relance « Veux-tu rester en contact ? » : choix en cartes */
.hk-rester { display: grid; gap: 12px; }
.hk-rester-choix { position: relative; display: flex; align-items: flex-start; gap: 14px; margin: 0; padding: 16px 18px; border: 1.5px solid var(--clr-border); border-radius: var(--radius); background: var(--clr-input); cursor: pointer; transition: border-color var(--transition), background var(--transition), box-shadow var(--transition); }
.hk-rester-choix:hover { background: var(--clr-input-hover); }
.hk-rester-choix input { position: absolute; opacity: 0; pointer-events: none; }
.hk-rester-rond { flex: none; width: 20px; height: 20px; margin-top: 1px; border: 2px solid var(--clr-muted); border-radius: 50%; transition: border-color var(--transition), box-shadow var(--transition); }
.hk-rester-txt { display: flex; flex-direction: column; gap: 3px; }
.hk-rester-txt b { font-size: 15px; font-weight: 600; color: var(--clr-text); }
.hk-rester-txt small { font-size: 13px; line-height: 1.5; color: var(--clr-muted); }
.hk-rester-choix:has(input:checked) { border-color: var(--clr-primary); background: var(--clr-card-solid); box-shadow: 0 0 0 4px rgba(156, 66, 33, .08); }
.hk-rester-choix:has(input:checked) .hk-rester-rond { border-color: var(--clr-primary); box-shadow: inset 0 0 0 4px var(--clr-card-solid), inset 0 0 0 10px var(--clr-primary); }
.hk-rester-choix.is-danger:has(input:checked) { border-color: var(--clr-error); box-shadow: 0 0 0 4px rgba(214, 69, 69, .08); }
.hk-rester-choix.is-danger:has(input:checked) .hk-rester-rond { border-color: var(--clr-error); box-shadow: inset 0 0 0 4px var(--clr-card-solid), inset 0 0 0 10px var(--clr-error); }
.hk-rester-choix:has(input:focus-visible) { outline: 2px solid var(--clr-primary); outline-offset: 2px; }
.hk-rester .auth-btn { margin-top: 8px; }
