/* ------------------------------------------------------------------
   Nexaid — design tokens (editorial + clean)
   ------------------------------------------------------------------ */

:root {
    /* Palette réduite — une seule couleur d'accent, beaucoup de noir/blanc */
    --nx-ink: #0B1220;           /* texte principal, presque noir */
    --nx-ink-soft: #475569;      /* texte secondaire */
    --nx-ink-muted: #94A3B8;     /* texte tertiaire, hints */
    --nx-surface: #FFFFFF;
    --nx-surface-alt: #F8FAFC;   /* fond des cards, zones alternées */
    --nx-surface-dark: #0B1220;  /* panneau brand foncé */
    --nx-surface-deep: #050A14;  /* encore plus foncé si besoin */
    --nx-border: #E2E8F0;
    --nx-border-strong: #CBD5E1;

    --nx-accent: #1E6BB8;        /* bleu Nexaid, seule couleur d'accent */
    --nx-accent-dark: #14518A;
    --nx-accent-soft: rgba(30,107,184,0.08);

    --nx-danger: #DC2626;
    --nx-success: #059669;
    --nx-warning: #D97706;

    /* Edges plus nets que le standard SaaS (6px au lieu de 12+) */
    --nx-radius: 6px;
    --nx-radius-lg: 10px;

    --nx-shadow-sm: 0 1px 2px rgba(11,18,32,0.04), 0 1px 3px rgba(11,18,32,0.03);
    --nx-shadow-md: 0 4px 12px rgba(11,18,32,0.06), 0 2px 4px rgba(11,18,32,0.04);
    --nx-shadow-lg: 0 20px 50px rgba(11,18,32,0.08);

    --nx-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--nx-font);
    color: var(--nx-ink);
    background: var(--nx-surface);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4 {
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.02em;
    /* pas de `color` ici : on laisse hériter du parent pour que les
       panneaux foncés (brand, CTA) affichent leur texte en blanc sans
       override explicite par titre. */
}

/* Buttons ----------------------------------------------------------- */
.nx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border-radius: var(--nx-radius);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.12s ease;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
}
.nx-btn:active { transform: translateY(1px); }

.nx-btn-primary {
    background: var(--nx-ink);
    color: #fff;
}
.nx-btn-primary:hover { background: #1E293B; color: #fff; text-decoration: none; }

.nx-btn-accent {
    background: var(--nx-accent);
    color: #fff;
}
.nx-btn-accent:hover { background: var(--nx-accent-dark); color: #fff; text-decoration: none; }

.nx-btn-outline {
    background: transparent;
    color: var(--nx-ink);
    border-color: var(--nx-border-strong);
}
.nx-btn-outline:hover { background: var(--nx-surface-alt); color: var(--nx-ink); text-decoration: none; }

.nx-btn-ghost {
    background: transparent;
    color: var(--nx-ink-soft);
}
.nx-btn-ghost:hover { background: var(--nx-surface-alt); color: var(--nx-ink); text-decoration: none; }

.nx-btn-lg { padding: 0.95rem 1.75rem; font-size: 0.95rem; }
.nx-btn-block { width: 100%; }

/* Forms ------------------------------------------------------------- */
.nx-input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--nx-ink);
    background: var(--nx-surface);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.nx-input:focus {
    outline: none;
    border-color: var(--nx-accent);
    box-shadow: 0 0 0 3px rgba(30,107,184,0.12);
}
.nx-input.is-invalid {
    border-color: var(--nx-danger);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

.nx-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--nx-ink);
    margin-bottom: 0.35rem;
}
.nx-label-req::after { content: " *"; color: var(--nx-danger); }

.nx-hint {
    font-size: 0.78rem;
    color: var(--nx-ink-muted);
    margin-top: 0.3rem;
}

.nx-alert {
    padding: 0.75rem 0.9rem;
    border-radius: var(--nx-radius);
    font-size: 0.88rem;
    border: 1px solid transparent;
}
.nx-alert-danger  { background: #fef2f2; color: #7f1d1d; border-color: #fecaca; }
.nx-alert-success { background: #ecfdf5; color: #064e3b; border-color: #bbf7d0; }
.nx-alert-info    { background: var(--nx-accent-soft); color: var(--nx-accent-dark); border-color: #cbe2f5; }
.nx-alert-warning { background: #fffbeb; color: #78350f; border-color: #fde68a; }

.nx-pw-toggle {
    cursor: pointer;
    user-select: none;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--nx-ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.nx-pw-toggle:hover { color: var(--nx-accent); }

.nx-pw-strength {
    height: 3px;
    border-radius: 2px;
    background: var(--nx-border);
    margin-top: 0.35rem;
    overflow: hidden;
}
.nx-pw-strength .bar {
    height: 100%;
    width: 0;
    transition: width 0.15s ease, background 0.15s ease;
}

/* Language switcher ------------------------------------------------- */
.nx-lang {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--nx-ink-soft);
    user-select: none;
}
.nx-lang__flag { font-size: 1rem; line-height: 1; }
.nx-lang__btn {
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    font-weight: 500;
    color: var(--nx-ink-muted);
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    transition: color 0.1s ease;
}
.nx-lang__btn:hover { color: var(--nx-ink); }
.nx-lang__btn--active { color: var(--nx-ink); font-weight: 600; }
.nx-lang__sep { color: var(--nx-border-strong); }
.nx-lang--on-dark { color: rgba(255,255,255,0.75); }
.nx-lang--on-dark .nx-lang__btn { color: rgba(255,255,255,0.55); }
.nx-lang--on-dark .nx-lang__btn:hover { color: #fff; }
.nx-lang--on-dark .nx-lang__btn--active { color: #fff; }
.nx-lang--on-dark .nx-lang__sep { color: rgba(255,255,255,0.25); }

/* Split auth layout ------------------------------------------------- */
.nx-auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--nx-surface);
}

.nx-auth-brand {
    position: relative;
    background: var(--nx-accent);
    color: #fff;
    padding: 3rem 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
.nx-auth-brand__header {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nx-auth-brand__logo {
    height: 32px;
    width: auto;
    filter: brightness(0) invert(1);
}
.nx-auth-brand__symbol {
    position: absolute;
    left: -200px;
    top: 20%;
    width: 620px;
    height: 620px;
    max-width: 110%;
    opacity: 0.09;
    filter: brightness(0) invert(1);
    pointer-events: none;
    z-index: 1;
}

/* Portrait en carte — encadre délibérément le fond blanc de la JPG pour
   qu'il soit lu comme un "cadre" plutôt qu'un rectangle orphelin sur le
   fond bleu. Positionné au coin inférieur droit du panneau brand. */
.nx-auth-brand__portrait {
    position: absolute;
    right: 2.5rem;
    bottom: 2.5rem;
    width: 210px;
    height: 270px;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow:
        0 1.5rem 2.5rem -0.5rem rgba(0, 0, 0, 0.35),
        0 0 0 6px rgba(255, 255, 255, 0.1);
    z-index: 2;
    transform: rotate(2deg);
    transition: transform 0.3s ease;
}
.nx-auth-brand__portrait:hover { transform: rotate(0deg) scale(1.02); }
.nx-auth-brand__portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
    display: block;
}
.nx-auth-brand__portrait-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.75rem 0.9rem;
    background: linear-gradient(180deg, transparent 0%, rgba(11, 18, 32, 0.75) 60%, rgba(11, 18, 32, 0.9) 100%);
    color: #fff;
    font-size: 0.72rem;
    line-height: 1.35;
}
.nx-auth-brand__portrait-caption strong {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 0.1rem;
}
.nx-auth-brand__copy {
    position: relative;
    z-index: 2;
    max-width: 460px;
}
.nx-auth-brand__eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.55);
    margin: 0 0 0.75rem;
}
.nx-auth-brand__slogan {
    font-size: clamp(2rem, 3.2vw, 3rem);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0 0 1rem;
}
.nx-auth-brand__sub {
    font-size: 1rem;
    line-height: 1.55;
    color: rgba(255,255,255,0.72);
    margin: 0;
}
.nx-auth-brand__trust {
    position: relative;
    z-index: 2;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    border-top: 1px solid rgba(255,255,255,0.12);
    padding-top: 1.25rem;
    max-width: 460px;
}

.nx-auth-form {
    display: flex;
    flex-direction: column;
    padding: 2.5rem 3rem;
    background: var(--nx-surface);
}
.nx-auth-form__top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: auto;
}
.nx-auth-form__inner {
    width: 100%;
    max-width: 420px;
    margin: auto;
}
.nx-auth-form__back {
    font-size: 0.82rem;
    color: var(--nx-ink-muted);
    margin-bottom: 1.5rem;
    display: inline-block;
}
.nx-auth-form__title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
    letter-spacing: -0.02em;
}
.nx-auth-form__sub {
    font-size: 0.95rem;
    color: var(--nx-ink-soft);
    margin: 0 0 1.75rem;
}
.nx-auth-form .nx-form-row { margin-bottom: 0.9rem; }
.nx-auth-form .nx-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.nx-auth-form__footer {
    text-align: center;
    color: var(--nx-ink-muted);
    font-size: 0.85rem;
    margin-top: 1.5rem;
}
.nx-auth-form__extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.5rem 0 1.25rem;
    font-size: 0.85rem;
}

.nx-splash {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    color: var(--nx-ink-muted);
}
.nx-spinner {
    width: 2.25rem;
    height: 2.25rem;
    border: 2.5px solid var(--nx-border);
    border-top-color: var(--nx-accent);
    border-radius: 50%;
    animation: nx-spin 0.8s linear infinite;
}
@keyframes nx-spin { to { transform: rotate(360deg); } }

/* Responsive -------------------------------------------------------- */
@media (max-width: 1023px) {
    .nx-auth { grid-template-columns: 1fr 1fr; }
    .nx-auth-brand { padding: 2.5rem; }
    .nx-auth-brand__symbol { width: 500px; height: 500px; left: -160px; }
    .nx-auth-brand__portrait { width: 170px; height: 220px; right: 1.5rem; bottom: 1.5rem; }
    .nx-auth-form { padding: 2.5rem 2rem; }
}

@media (max-width: 767px) {
    .nx-auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .nx-auth-brand {
        padding: 1.5rem;
        min-height: auto;
    }
    .nx-auth-brand__logo { height: 28px; }
    .nx-auth-brand__symbol,
    .nx-auth-brand__portrait { display: none; }
    .nx-auth-brand__copy { margin: 1.25rem 0; }
    .nx-auth-brand__slogan { font-size: 1.5rem; }
    .nx-auth-brand__sub { font-size: 0.9rem; }
    .nx-auth-brand__trust { font-size: 0.75rem; padding-top: 1rem; }
    .nx-auth-form { padding: 2rem 1.5rem; }
    .nx-auth-form__inner { max-width: none; }
    .nx-auth-form .nx-row { grid-template-columns: 1fr; }
}
