/* ============================================
   WEEKIVOIRE — PAGES D'AUTHENTIFICATION
   Connexion · Inscription · Mot de passe oublié · Réinitialisation
   ============================================ */

:root {
    --wk-orange: #F7931E;
    --wk-orange-dark: #D97A0B;
    --wk-green: #2E8B1E;
    --wk-ink: #1E1E1E;
    --wk-muted: #5F6670;
    --wk-line: #E6E1D8;
    --wk-bg: #FAF7F2;
    --wk-danger: #C62828;
    --wk-success: #1E7B34;
    --wk-radius: 14px;
    --wk-focus: 0 0 0 4px rgba(247, 147, 30, .22);
}

body.auth-body {
    background: var(--wk-bg);
    color: var(--wk-ink);
}

.auth-shell {
    min-height: calc(100vh - var(--header-height, 72px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
}

/* ---------- Panneau visuel ---------- */
.auth-visual {
    position: relative;
    overflow: hidden;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 48px;
    background: #1E1E1E center / cover no-repeat;
}
.auth-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(20, 20, 20, .15) 0%, rgba(20, 20, 20, .55) 55%, rgba(20, 20, 20, .88) 100%);
}
.auth-visual > * { position: relative; }
.auth-visual .eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
    background: rgba(255, 255, 255, .14); backdrop-filter: blur(6px);
    padding: 6px 12px; border-radius: 999px; width: fit-content; margin-bottom: 18px;
}
.auth-visual h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.2; margin: 0 0 14px; font-weight: 700; color: #fff; }
.auth-visual h2 span { color: var(--wk-orange); }
.auth-visual p { color: rgba(255, 255, 255, .86); max-width: 460px; margin: 0 0 24px; }
.auth-perks { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-perks li { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.auth-perks i {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: rgba(247, 147, 30, .95); color: #fff; font-size: 14px; flex-shrink: 0;
}

/* ---------- Colonne formulaire ---------- */
.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px 56px;
}
.auth-card {
    width: 100%;
    max-width: 460px;
}
.auth-card.wide { max-width: 560px; }

.auth-card .auth-logo { width: 56px; height: 56px; margin-bottom: 18px; }
.auth-card h1 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 700; margin: 0 0 6px; line-height: 1.25; color: var(--wk-ink); }
.auth-card .lead { color: var(--wk-muted); margin: 0 0 28px; font-size: 15px; }

/* ---------- Alertes ---------- */
.auth-alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; margin-bottom: 20px;
}
.auth-alert i { margin-top: 3px; }
.auth-alert.error { background: #FDECEC; color: #8E1C1C; border: 1px solid #F5C2C2; }
.auth-alert.success { background: #E8F5EC; color: #145523; border: 1px solid #BFE3C9; }
.auth-alert.info { background: #FFF5E8; color: #7A4608; border: 1px solid #F8D9B0; }
.auth-alert a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---------- Champs ---------- */
.auth-form { display: grid; gap: 18px; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--wk-ink); }
.field label .opt { font-weight: 400; color: var(--wk-muted); }
.field-control { position: relative; }
.field-control > i.lead-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: #9AA0A6; font-size: 15px; pointer-events: none;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"] {
    width: 100%;
    height: 50px;
    padding: 0 44px 0 42px;
    border: 1.5px solid var(--wk-line);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: 15px;
    color: var(--wk-ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: #A5A9AE; }
.field input:hover { border-color: #D2CBBF; }
.field input:focus { outline: none; border-color: var(--wk-orange); box-shadow: var(--wk-focus); }
.field.has-error input { border-color: var(--wk-danger); }
.field.has-error input:focus { box-shadow: 0 0 0 4px rgba(198, 40, 40, .15); }
.field .field-error { color: var(--wk-danger); font-size: 13px; display: flex; gap: 6px; align-items: flex-start; }
.field .field-error a { color: inherit; font-weight: 600; }
.field .hint { color: var(--wk-muted); font-size: 12.5px; }

.toggle-password {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border: 0; background: none; border-radius: 8px;
    color: #7B8187; cursor: pointer; display: grid; place-items: center;
}
.toggle-password:hover { background: #F4F1EC; color: var(--wk-ink); }
.toggle-password:focus-visible { outline: none; box-shadow: var(--wk-focus); }

/* Indicateur de robustesse du mot de passe */
.strength { display: grid; gap: 6px; }
.strength-bar { height: 6px; border-radius: 99px; background: #EEE9E1; overflow: hidden; }
.strength-bar span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .25s ease, background .25s ease; }
.strength-rules { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--wk-muted); }
.strength-rules li { display: flex; align-items: center; gap: 6px; }
.strength-rules li i { font-size: 11px; color: #C5C0B8; }
.strength-rules li.ok { color: var(--wk-success); }
.strength-rules li.ok i { color: var(--wk-success); }

/* Choix du type de compte */
.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border: 0; padding: 0; margin: 0; }
.role-picker legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; padding: 0; }
.role-option { position: relative; }
.role-option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.role-option label {
    display: flex; gap: 12px; align-items: flex-start; height: 100%;
    border: 1.5px solid var(--wk-line); border-radius: 12px; padding: 14px; cursor: pointer; background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.role-option label i { font-size: 18px; color: var(--wk-orange); margin-top: 2px; }
.role-option label strong { display: block; font-size: 14px; }
.role-option label small { color: var(--wk-muted); font-size: 12.5px; line-height: 1.4; }
.role-option input:checked + label { border-color: var(--wk-orange); background: #FFF8EF; box-shadow: var(--wk-focus); }
.role-option input:focus-visible + label { box-shadow: var(--wk-focus); }

/* Cases à cocher */
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--wk-ink); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--wk-orange); flex-shrink: 0; }
.check a { color: var(--wk-orange-dark); font-weight: 600; }

.auth-options { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.link { color: var(--wk-orange-dark); font-weight: 600; font-size: 14px; }
.link:hover { color: var(--wk-orange); text-decoration: underline; }

/* ---------- Boutons ---------- */
.btn-primary-wk {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; height: 52px; border: 0; border-radius: 12px; cursor: pointer;
    background: var(--wk-orange); color: #fff; font: inherit; font-size: 16px; font-weight: 600;
    transition: background .15s ease, transform .05s ease, box-shadow .15s ease;
    box-shadow: 0 8px 20px rgba(247, 147, 30, .28);
}
.btn-primary-wk:hover { background: var(--wk-orange-dark); color: #fff; }
.btn-primary-wk:active { transform: translateY(1px); }
.btn-primary-wk:focus-visible { outline: none; box-shadow: var(--wk-focus); }
.btn-primary-wk[disabled] { opacity: .7; cursor: progress; }
.btn-primary-wk .spinner {
    width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff;
    border-radius: 50%; animation: wkspin .7s linear infinite; display: none;
}
.btn-primary-wk.loading .spinner { display: inline-block; }
.btn-primary-wk.loading i { display: none; }
@keyframes wkspin { to { transform: rotate(360deg); } }

.btn-ghost-wk {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; height: 50px; border-radius: 12px; border: 1.5px solid var(--wk-line);
    background: #fff; color: var(--wk-ink); font-weight: 600; font-size: 15px;
}
.btn-ghost-wk:hover { border-color: var(--wk-orange); color: var(--wk-orange-dark); }

.auth-switch { text-align: center; margin-top: 26px; font-size: 14.5px; color: var(--wk-muted); }
.auth-switch a { color: var(--wk-orange-dark); font-weight: 600; }

.auth-legal { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--wk-muted); }
.auth-legal i { color: var(--wk-green); margin-right: 4px; }

/* Écran de confirmation (email envoyé, mot de passe changé) */
.auth-done { text-align: center; }
.auth-done .done-icon {
    width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center;
    background: #FFF1DF; color: var(--wk-orange); font-size: 28px;
}
.auth-done .done-icon.green { background: #E6F4EA; color: var(--wk-success); }
.auth-done .lead { margin-bottom: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
    .auth-main { padding: 28px 16px 48px; align-items: flex-start; }
}
@media (max-width: 520px) {
    .auth-row, .role-picker { grid-template-columns: 1fr; }
    .auth-card h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
