/* ==========================================================================
   DMC Travel Agency — Authentification (login / register / reset)
   Feuille autonome : aucune dependance a Bootstrap ni a Font Awesome.
   Themes clair et sombre pilotes par les variables de la section 1.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    color-scheme: light;

    /* Identité DMC */
    --dmc-brand:        #4a68f9;
    --dmc-brand-strong: #355bd8;
    --dmc-brand-deep:   #1b2a86;
    --dmc-brand-ink:    #101a52;

    /* Dégradé du panneau de marque (assombri en thème sombre) */
    --brand-glow-1: #6d86ff;
    --brand-glow-2: #2438ae;
    --brand-grad-a: #2f49dd;
    --brand-grad-b: #1b2a86;
    --brand-grad-c: #101a52;

    /* Surfaces & texte */
    --bg:            #eef1f9;
    --surface:       #ffffff;
    --surface-muted: #f6f8fd;
    --field-bg:      #f7f9fe;
    --text:          #0f1730;
    --text-muted:    #64708f;
    --text-faint:    #939db8;
    --border:        #e3e8f4;
    --border-strong: #ccd5ec;

    /* Accent */
    --accent:      var(--dmc-brand);
    --accent-soft: rgba(74, 104, 249, .10);
    --ring:        rgba(74, 104, 249, .22);

    /* États */
    --danger: #d92d20;  --danger-bg: #fef3f2;  --danger-border: #fecdc9;
    --success:#067647;  --success-bg:#ecfdf3;  --success-border:#abefc6;
    --warning:#b54708;  --warning-bg:#fffaeb;  --warning-border:#fedf89;
    --info:   #175cd3;  --info-bg:   #eff8ff;  --info-border:   #b2ddff;

    /* Formes */
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow:    0 12px 32px -14px rgba(16, 24, 40, .22);

    --ease: cubic-bezier(.16, .84, .44, 1);
}

/* Repli sans JavaScript : on suit la préférence système. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --bg:            #070b18;
        --surface:       #0e1428;
        --surface-muted: #141c36;
        --field-bg:      #141c36;
        --text:          #e8ecf8;
        --text-muted:    #97a3c4;
        --text-faint:    #6c789a;
        --border:        #232e53;
        --border-strong: #33406e;
        --accent:      #7b92ff;
        --accent-soft: rgba(123, 146, 255, .14);
        --ring:        rgba(123, 146, 255, .28);
        --danger: #ff9d95;  --danger-bg: #2a1414;  --danger-border: #5c2420;
        --success:#6fddab;  --success-bg:#0c2419;  --success-border:#1c4d36;
        --warning:#fdcf7d;  --warning-bg:#2a1e0b;  --warning-border:#5a4118;
        --info:   #8fc7ff;  --info-bg:   #0c1c31;  --info-border:   #1c3a5c;
        --brand-glow-1: #4a63e0;
        --brand-glow-2: #16205c;
        --brand-grad-a: #1e2f9e;
        --brand-grad-b: #131d63;
        --brand-grad-c: #0a1038;
        --shadow: 0 12px 32px -14px rgba(0, 0, 0, .7);
    }
}

/* Thème résolu par le script de démarrage (auto | light | dark). */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg:            #070b18;
    --surface:       #0e1428;
    --surface-muted: #141c36;
    --field-bg:      #141c36;
    --text:          #e8ecf8;
    --text-muted:    #97a3c4;
    --text-faint:    #6c789a;
    --border:        #232e53;
    --border-strong: #33406e;
    --accent:      #7b92ff;
    --accent-soft: rgba(123, 146, 255, .14);
    --ring:        rgba(123, 146, 255, .28);
    --danger: #ff9d95;  --danger-bg: #2a1414;  --danger-border: #5c2420;
    --success:#6fddab;  --success-bg:#0c2419;  --success-border:#1c4d36;
    --warning:#fdcf7d;  --warning-bg:#2a1e0b;  --warning-border:#5a4118;
    --info:   #8fc7ff;  --info-bg:   #0c1c31;  --info-border:   #1c3a5c;
    --brand-glow-1: #4a63e0;
    --brand-glow-2: #16205c;
    --brand-grad-a: #1e2f9e;
    --brand-grad-b: #131d63;
    --brand-grad-c: #0a1038;
    --shadow: 0 12px 32px -14px rgba(0, 0, 0, .7);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.svg-sprite { display: none; }

.icon {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   3. Structure : split-screen plein écran
   -------------------------------------------------------------------------- */
.auth-shell {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}

/* --- 3a. Panneau de marque ------------------------------------------------ */
.auth-brand {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: clamp(2rem, 4vw, 3.75rem);
    color: #fff;
    background:
        radial-gradient(120% 95% at 8% -5%,   var(--brand-glow-1) 0%, transparent 55%),
        radial-gradient(100% 85% at 100% 105%, var(--brand-glow-2) 0%, transparent 60%),
        linear-gradient(158deg, var(--brand-grad-a) 0%, var(--brand-grad-b) 52%,
                                var(--brand-grad-c) 100%);
}

.auth-brand__decor {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Grain léger : casse le côté « aplat » du dégradé. */
.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: .15;
    mix-blend-mode: overlay;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.auth-brand > *:not(.auth-brand__decor) { position: relative; z-index: 1; }

.brand-mark { display: flex; align-items: center; gap: .75rem; }

.brand-mark__logo { width: 34px; height: 34px; flex: none; }

.brand-mark__name {
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.brand-body { max-width: 30rem; }

.brand-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: 1.25rem;
    padding: .3rem .8rem .3rem .6rem;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .10);
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: .04em;
    color: rgba(255, 255, 255, .9);
}

.brand-eyebrow .icon { width: 15px; height: 15px; }

.brand-title {
    margin: 0 0 1rem;
    font-size: clamp(2rem, 3.2vw, 2.9rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.025em;
}

.brand-lead {
    margin: 0 0 1.75rem;
    max-width: 26rem;
    font-size: 1.0125rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, .78);
}

.brand-quote {
    margin: 0;
    padding-left: 1.1rem;
    border-left: 2px solid rgba(255, 255, 255, .38);
    font-size: 1.05rem;
    font-style: italic;
    font-weight: 500;
    line-height: 1.5;
    color: rgba(255, 255, 255, .95);
}

.brand-quote cite {
    display: block;
    margin-top: .6rem;
    font-size: .8125rem;
    font-style: normal;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .55);
}

.brand-features {
    display: flex;
    flex-wrap: wrap;
    gap: .625rem;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .875rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    background: rgba(255, 255, 255, .10);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: .8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .92);
}

.brand-badge .icon { width: 16px; height: 16px; opacity: .85; }

/* --- 3b. Panneau formulaire ---------------------------------------------- */
.auth-main {
    position: relative;
    display: grid;
    place-items: center;
    padding: clamp(1.75rem, 4vw, 3rem);
    background: var(--surface);
}

.auth-card {
    width: 100%;
    max-width: 396px;
}

.auth-card__head { margin-bottom: 1.75rem; }

.auth-title {
    margin: 0 0 .4rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
}

.auth-subtitle {
    margin: 0;
    font-size: .9375rem;
    color: var(--text-muted);
}

.auth-foot {
    margin: 1.75rem 0 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: .8438rem;
    text-align: center;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   4. Bascule de thème
   -------------------------------------------------------------------------- */
.theme-toggle {
    position: absolute;
    top: clamp(1rem, 2vw, 1.5rem);
    right: clamp(1rem, 2vw, 1.5rem);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-muted);
    color: var(--text-muted);
    cursor: pointer;
    transition: color .18s var(--ease), border-color .18s var(--ease),
                background .18s var(--ease), transform .18s var(--ease);
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
}

/* On affiche l'icône de la destination : lune en clair, soleil en sombre. */
.theme-toggle .icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon--moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon--sun  { display: block; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-toggle .icon--moon { display: none; }
    :root:not([data-theme]) .theme-toggle .icon--sun  { display: block; }
}

/* --------------------------------------------------------------------------
   5. Formulaire
   -------------------------------------------------------------------------- */
.field { margin-bottom: 1.125rem; }

.field__label {
    display: block;
    margin-bottom: .4375rem;
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .005em;
    color: var(--text);
}

.control {
    position: relative;
    display: flex;
    align-items: center;
}

.control__icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-faint);
    pointer-events: none;
    transition: color .18s var(--ease);
}

.control:focus-within .control__icon { color: var(--accent); }

.input {
    width: 100%;
    height: 50px;
    padding: 0 14px 0 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--field-bg);
    color: var(--text);
    font: inherit;
    font-size: .9375rem;
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease),
                background .18s var(--ease);
}

.control--with-action .input { padding-right: 46px; }

.input::placeholder { color: var(--text-faint); }
.input:hover { border-color: var(--border-strong); }

.input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--ring);
}

/* Autofill Chrome : évite le jaune qui casse le thème. */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 40px var(--field-bg) inset;
    caret-color: var(--text);
}

.control__action {
    position: absolute;
    right: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    transition: color .18s var(--ease), background .18s var(--ease);
}

.control__action:hover { color: var(--accent); background: var(--accent-soft); }
.control__action .icon { width: 18px; height: 18px; }
.control__action .icon--eye-off { display: none; }
.control__action[aria-pressed="true"] .icon--eye     { display: none; }
.control__action[aria-pressed="true"] .icon--eye-off { display: block; }

/* Validation ------------------------------------------------------------- */
.field__error {
    display: none;
    align-items: center;
    gap: .375rem;
    margin: .4375rem 0 0;
    font-size: .8125rem;
    color: var(--danger);
}

.field__error .icon { width: 15px; height: 15px; }

.was-validated .input:invalid {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.was-validated .input:invalid:focus {
    box-shadow: 0 0 0 4px rgba(217, 45, 32, .18);
}

.was-validated .control:has(.input:invalid) + .field__error { display: flex; }

/* Indice Verr. Maj. ------------------------------------------------------- */
.field__hint {
    display: flex;
    align-items: center;
    gap: .375rem;
    margin: .4375rem 0 0;
    font-size: .8125rem;
    color: var(--warning);
}

.field__hint .icon { width: 15px; height: 15px; }
.field__hint[hidden] { display: none !important; }

/* Ligne « se souvenir / mot de passe oublié » ----------------------------- */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.25rem 0 1.5rem;
    font-size: .8438rem;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
}

.checkbox input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.link {
    position: relative;
    font-weight: 550;
    color: var(--accent);
}

.link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width .25s var(--ease);
}

.link:hover::after { width: 100%; }

/* --------------------------------------------------------------------------
   6. Bouton principal
   -------------------------------------------------------------------------- */
.btn-primary {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--dmc-brand), var(--dmc-brand-strong));
    color: #fff;
    font: inherit;
    font-size: .9375rem;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 10px 24px -12px rgba(74, 104, 249, .95);
    transition: transform .18s var(--ease), box-shadow .18s var(--ease),
                filter .18s var(--ease);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px -12px rgba(74, 104, 249, 1);
    filter: saturate(1.06);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--ring), 0 10px 24px -12px rgba(74, 104, 249, .95);
}

/* Bloque (trop de tentatives) : le curseur doit dire « non », pas « patiente ». */
.btn-primary[disabled] {
    cursor: not-allowed;
    opacity: .6;
    transform: none;
    box-shadow: none;
}

.btn-primary[disabled]:hover { transform: none; filter: none; }

/* Envoi en cours : la, « patiente » est le bon message. */
.btn-primary.is-loading[disabled] {
    cursor: progress;
    opacity: .8;
}

.btn-primary .icon { transition: transform .18s var(--ease); }
.btn-primary:hover .icon { transform: translateX(2px); }

.btn__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;
}

.btn-primary:not(.is-loading) .btn__spinner { display: none; }
.btn-primary.is-loading .btn__label,
.btn-primary.is-loading .icon { display: none; }

/* --------------------------------------------------------------------------
   7. Alertes
   -------------------------------------------------------------------------- */
.messages { margin-bottom: 1.25rem; display: grid; gap: .625rem; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .8125rem .875rem;
    border: 1px solid;
    border-radius: var(--radius);
    font-size: .875rem;
    line-height: 1.45;
    animation: alert-in .35s var(--ease) both;
}

.alert__text { flex: 1 1 auto; min-width: 0; }

.alert__close {
    flex: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    opacity: .6;
    cursor: pointer;
    transition: opacity .18s var(--ease);
}

.alert__close:hover { opacity: 1; }
.alert__close .icon { width: 16px; height: 16px; }

.alert--danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger-border); }
.alert--success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.alert--warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.alert--info,
.alert--debug   { color: var(--info);    background: var(--info-bg);    border-color: var(--info-border); }

/* --------------------------------------------------------------------------
   8. Animations
   -------------------------------------------------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes alert-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

@keyframes flight { to { stroke-dashoffset: -320; } }

.auth-card      { animation: rise .55s var(--ease) both; }
.brand-body     { animation: rise .65s var(--ease) .08s both; }
.brand-features { animation: rise .65s var(--ease) .16s both; }
.auth-card.has-error { animation: shake .5s var(--ease) both; }

.decor-path {
    stroke-dasharray: 5 9;
    animation: flight 26s linear infinite;
}

/* --------------------------------------------------------------------------
   9. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .auth-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .auth-brand {
        gap: 1.25rem;
        padding: 1.5rem clamp(1.25rem, 5vw, 2rem) 1.75rem;
    }

    .brand-body { max-width: none; }
    .brand-title { font-size: 1.5rem; margin-bottom: .5rem; }
    .brand-lead  { margin-bottom: 0; font-size: .9375rem; }
    .brand-eyebrow, .brand-quote, .brand-features { display: none; }

    .auth-main { padding: 4rem 1.25rem 3rem; align-items: start; }
    .auth-card { animation-delay: .05s; }
}

@media (max-width: 420px) {
    .form-row { flex-direction: column; align-items: flex-start; gap: .625rem; }
    .auth-title { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .btn-primary:hover { transform: none; }
}
