/* ============================================================
   Authentication pages — slice D.17
   ------------------------------------------------------------
   High-contrast split shell: dark gray-900 left rail with brand
   identity + product value pillars (anchored to DOCTRINE.md
   corollaries), white right rail with the form. Zero lilac,
   zero blue→purple gradients. Stripe / Linear / Vercel quality.
   ============================================================ */

:root {
    --auth-dark: #0f172a;        /* slate-900 — even calmer than gray-900 */
    --auth-dark-soft: #1e293b;   /* slate-800 */
    --auth-accent: var(--nexus-green);
}

.auth-body {
    margin: 0;
    background: var(--gray-50);
    color: var(--gray-900);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* ---------- Shell ---------- */
.auth-shell {
    height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    overflow: hidden;
}

/* ============================================================
   Left rail — brand + product value
   ============================================================ */
.auth-brand {
    position: relative;
    background: var(--auth-dark);
    color: #fff;
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
}

/* Hide scrollbar in the dark rail — content is meant to fit; this only
   surfaces on very short viewports without making the rail look broken. */
.auth-brand::-webkit-scrollbar {
    width: 0;
}

/* Ambient green glow — subtle, no harsh gradient */
.auth-brand-glow {
    position: absolute;
    top: -20%;
    right: -15%;
    width: 28rem;
    height: 28rem;
    background: radial-gradient(
        circle at center,
        rgba(16, 185, 129, 0.22) 0%,
        rgba(16, 185, 129, 0.06) 35%,
        transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(8px);
}

.auth-brand::before {
    /* Soft grain so the dark surface feels material, not flat plastic */
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 3px 3px;
    opacity: 0.6;
    pointer-events: none;
    z-index: 0;
}

.auth-brand > * {
    position: relative;
    z-index: 1;
}

/* ----- Brand header ----- */
.auth-brand-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Logo takes the top space — large mark + wordmark sitting on the
   dark surface, framed by the ambient green glow above. */
.auth-brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    color: #fff;
    text-decoration: none;
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    transition: opacity 0.15s ease;
}

.auth-brand-logo:hover {
    opacity: 0.92;
    color: #fff;
}

.auth-brand-logo img {
    height: 2.75rem;
    width: auto;
    object-fit: contain;
}

/* ----- Brand body ----- */
.auth-brand-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
    max-width: 28rem;
}

.auth-brand-tagline {
    margin: 0;
    font-size: 1.95rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: #fff;
}

.auth-brand-tagline span {
    color: var(--auth-accent);
}

.auth-brand-pillars {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.auth-brand-pillars li {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.auth-brand-pillar-icon {
    width: 1.75rem;
    height: 1.75rem;
    background: rgba(16, 185, 129, 0.16);
    color: var(--auth-accent);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.25);
}

.auth-brand-pillar-title {
    margin: 0 0 0.15rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.auth-brand-pillar-text {
    margin: 0;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.5;
}

/* ----- Brand footer ----- */
.auth-brand-footer {
    margin-top: auto;
}

.auth-brand-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 500;
}

.auth-brand-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--auth-accent);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
    animation: auth-pulse 2.4s ease-in-out infinite;
}

@keyframes auth-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18); }
    50%      { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.05); }
}

/* ============================================================
   Right rail — form panel
   ============================================================ */
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.75rem 2rem;
    background: #fff;
    height: 100vh;
    overflow-y: auto;
}

.auth-form-panel::-webkit-scrollbar {
    width: 0;
}

.auth-form-wrap {
    width: 100%;
    max-width: 26rem;
    animation: auth-fade-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes auth-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-form-header {
    margin-bottom: 1.2rem;
}

.auth-form-title {
    margin: 0 0 0.25rem;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.auth-form-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.5;
}

/* ---------- Form ---------- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* Two-column row for tightly-paired fields (e.g. first / last name) */
.auth-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
    letter-spacing: -0.005em;
}

/* Input shell with leading icon and optional trailing button */
.auth-input-shell {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: 0.6rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}

.auth-input-shell:hover:not(:focus-within) {
    border-color: var(--gray-400);
}

.auth-input-shell:focus-within {
    border-color: var(--nexus-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.auth-input-shell.is-invalid {
    border-color: var(--nexus-red);
}

.auth-input-shell.is-invalid:focus-within {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.auth-input-icon {
    color: var(--gray-400);
    width: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    pointer-events: none;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.auth-input-shell:focus-within .auth-input-icon {
    color: var(--nexus-blue);
}

.auth-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.75rem 0.9rem 0.75rem 0;
    font-size: 0.95rem;
    color: var(--gray-900);
    outline: none;
    font-family: inherit;
    line-height: 1.4;
    min-width: 0;
}

.auth-input::placeholder {
    color: var(--gray-400);
}

.auth-input-toggle {
    background: transparent;
    border: none;
    color: var(--gray-400);
    padding: 0.5rem 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.auth-input-toggle:hover {
    color: var(--gray-700);
}

.auth-input-toggle:focus-visible {
    outline: none;
    color: var(--nexus-blue);
}

.auth-input-toggle i {
    font-size: 1rem;
}

.auth-form-error {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--nexus-red);
    line-height: 1.4;
}

.auth-form-error i {
    font-size: 0.85rem;
}

/* ---------- Row: remember me + forgot ---------- */
.auth-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: -0.25rem 0 0.5rem;
}

/* Custom checkbox */
.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray-700);
    cursor: pointer;
    user-select: none;
    position: relative;
}

.auth-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.auth-checkbox-box {
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 0.3rem;
    border: 1px solid var(--gray-300);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 0.85rem;
    transition: background-color 0.12s ease, border-color 0.12s ease;
    flex-shrink: 0;
}

.auth-checkbox:hover .auth-checkbox-box {
    border-color: var(--gray-400);
}

.auth-checkbox input:checked + .auth-checkbox-box {
    background: var(--nexus-blue);
    border-color: var(--nexus-blue);
    color: #fff;
}

.auth-checkbox input:focus-visible + .auth-checkbox-box {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* Block variant — used by the Terms-of-Service agreement on signup
   where the text wraps over two lines and needs proper alignment. */
.auth-checkbox--block {
    align-items: flex-start;
    line-height: 1.5;
}

.auth-checkbox--block .auth-checkbox-box {
    margin-top: 0.15rem;
}

/* ---------- Primary CTA ---------- */
.auth-btn-primary {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.78rem 1.2rem;
    background: var(--nexus-blue);
    color: #fff;
    border: 1px solid transparent;
    border-radius: 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    cursor: pointer;
    font-family: inherit;
    box-shadow:
        0 2px 4px rgba(37, 99, 235, 0.22),
        inset 0 -2px 0 rgba(0, 0, 0, 0.14);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, gap 0.15s ease;
    margin-top: 0.25rem;
}

.auth-btn-primary:hover {
    background: var(--nexus-blue-dark);
    transform: translateY(-1px);
    gap: 0.65rem;
    box-shadow:
        0 12px 24px -4px rgba(37, 99, 235, 0.38),
        inset 0 -2px 0 rgba(0, 0, 0, 0.14);
}

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

.auth-btn-primary i {
    font-size: 0.9rem;
}

/* ---------- Divider ---------- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 1.1rem 0 0.85rem;
    color: var(--gray-400);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

/* ---------- OAuth button ---------- */
.auth-btn-oauth {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    padding: 0.7rem 1.2rem;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: 0.6rem;
    color: var(--gray-900);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-btn-oauth:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
    color: var(--gray-900);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px -2px rgba(15, 23, 42, 0.08);
}

.auth-btn-oauth svg {
    width: 1.1rem;
    height: 1.1rem;
}

/* ---------- Links ---------- */
.auth-link {
    color: var(--nexus-blue);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
}

.auth-link:hover {
    color: var(--nexus-blue-dark);
}

.auth-link-quiet {
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.85rem;
}

.auth-link-quiet:hover {
    color: var(--nexus-blue);
}

.auth-link-signup {
    margin: 1rem 0 0;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.85rem;
}

.auth-link-signup a {
    color: var(--nexus-blue);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease, gap 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.auth-link-signup a:hover {
    color: var(--nexus-blue-dark);
    gap: 0.4rem;
}

.auth-link-signup a i {
    font-size: 0.8rem;
}

/* ---------- Success state (password reset done, etc.) ---------- */
.auth-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.auth-success-icon {
    width: 4rem;
    height: 4rem;
    display: inline-grid;
    place-items: center;
    border-radius: 1rem;
    background: rgba(16, 185, 129, 0.12);
    color: var(--nexus-green, #10b981);
    font-size: 1.85rem;
    margin-bottom: 0.5rem;
}

.auth-success-icon--info {
    background: rgba(37, 99, 235, 0.12);
    color: var(--nexus-blue, #2563eb);
}

.auth-success-icon--warn {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.auth-success-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--gray-900, #0f172a);
}

.auth-success-text {
    margin: 0;
    color: var(--gray-600, #475569);
    font-size: 0.92rem;
    line-height: 1.55;
}

.auth-success-hint {
    margin: 1rem 0 0;
    padding: 0.7rem 0.85rem;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 0.6rem;
    color: var(--gray-600, #475569);
    font-size: 0.82rem;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.auth-success-hint i {
    color: var(--nexus-blue, #2563eb);
    margin-top: 0.15rem;
}

/* ---------- Legal ---------- */
.auth-legal {
    margin: 1.2rem 0 0;
    text-align: center;
    font-size: 0.7rem;
    color: var(--gray-400);
    line-height: 1.55;
}

.auth-legal a {
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
}

.auth-legal a:hover {
    color: var(--gray-900);
    text-decoration: underline;
}

/* ---------- Messages ---------- */
.auth-messages {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.auth-alert {
    padding: 0.65rem 0.85rem;
    border-radius: 0.55rem;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    line-height: 1.45;
}

.auth-alert i {
    font-size: 0.95rem;
    flex-shrink: 0;
}

.auth-alert-error {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.25);
    color: #991b1b;
}

.auth-alert-success {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.25);
    color: #065f46;
}

.auth-alert-info {
    background: rgba(37, 99, 235, 0.06);
    border-color: rgba(37, 99, 235, 0.2);
    color: var(--nexus-blue-dark);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 960px) {
    /* On narrow viewports we stop pinning the shell to 100vh and let
       the page scroll naturally — the dark rail and form panel stack
       vertically, so a fixed-height grid would just hide content. */
    .auth-body {
        overflow: auto;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .auth-brand,
    .auth-form-panel {
        height: auto;
        overflow: visible;
    }

    .auth-brand {
        padding: 2rem 1.5rem;
        min-height: auto;
    }

    .auth-brand-body {
        margin: 1.5rem 0;
        gap: 1.25rem;
    }

    .auth-brand-tagline {
        font-size: 1.6rem;
    }

    .auth-brand-pillars {
        gap: 0.75rem;
    }

    .auth-form-panel {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .auth-brand {
        padding: 1.5rem 1.25rem;
    }

    .auth-brand-tagline {
        font-size: 1.4rem;
    }

    .auth-form-panel {
        padding: 1.5rem 1.25rem;
    }

    .auth-form-title {
        font-size: 1.5rem;
    }

    .auth-form-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Stack First / Last name on very narrow viewports so labels
       don't truncate awkwardly. */
    .auth-form-grid {
        grid-template-columns: 1fr;
    }
}
