/* ============================================================
   CanaanVault — Auth Page  ·  Redesigned 2025
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
    /* Brand */
    --red:         #d3131d;
    --red-bright:  #e25962;
    --red-dim:     #a90f18;
    --red-glow:    rgba(211, 19, 29, .12);

    /* Surface */
    --bg-base:     #f8fafc;
    --bg-surface:  #ffffff;
    --bg-raised:   #ffffff;
    --bg-input:    #ffffff;
    --bg-input-f:  #fffafa;

    /* Borders */
    --border-dim:  #e2e8f0;
    --border-mid:  #d7dee8;
    --border-hi:   rgba(211,19,29,.18);
    --border-red:  rgba(211,19,29,.24);

    /* Text */
    --txt-primary:    #0f172a;
    --txt-secondary:  #64748b;
    --txt-muted:      #94a3b8;
    --txt-red:        #a90f18;

    /* Geometry */
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   18px;
    --radius-xl:   24px;

    /* Motion */
    --ease:        cubic-bezier(.22, 1, .36, 1);
    --dur-fast:    140ms;
    --dur-mid:     260ms;

    /* Fonts */
    --font-head:  'Roboto', system-ui, sans-serif;
    --font-body:  'Roboto', system-ui, sans-serif;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--txt-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Ambient Background ──────────────────────────────────── */
.bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(211,19,29,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(211,19,29,.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(180deg, rgba(0,0,0,.65) 0%, transparent 100%);
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .5;
}
.bg-orb--1 {
    width: 600px; height: 600px;
    top: -200px; right: -200px;
    background: radial-gradient(circle, rgba(211,19,29,.15), transparent 70%);
}
.bg-orb--2 {
    width: 500px; height: 500px;
    bottom: -150px; left: -150px;
    background: radial-gradient(circle, rgba(15,118,110,.1), transparent 70%);
}
.bg-orb--3 {
    display: none;
}

/* ── Page Shell ─────────────────────────────────────────── */
.page-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(390px, 1fr);
    min-height: 100vh;
    padding: 0 clamp(24px, 5vw, 72px);
}

/* ═════════════════════════════════════════════════════════
   BRAND PANEL  (left)
   ═════════════════════════════════════════════════════════ */
.brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 40px 32px 40px 0;
    overflow: hidden;
    background: transparent;
    border-right: 1px solid var(--border-dim);
}

/* ── Nav back (desktop) ── */
.nav-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .8rem;
    font-weight: 500;
    color: var(--txt-secondary);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition:
        color var(--dur-fast) var(--ease),
        background var(--dur-fast) var(--ease),
        border-color var(--dur-fast) var(--ease);
    align-self: flex-start;
    margin-bottom: auto;
}
.nav-back:hover {
    color: var(--txt-primary);
    background: var(--bg-surface);
    border-color: var(--border-mid);
}
.nav-back--mobile { display: none; }

/* ── Brand inner ── */
.brand-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 40px;
    max-width: 540px;
    width: 100%;
    align-self: center;
}

.brand-logo-wrap {
    margin-bottom: 44px;
}
.brand-logo {
    display: block;
    width: min(100%, 420px);
    height: auto;
    border-radius: var(--radius-md);
}

.brand-headline {
    font-family: var(--font-head);
    font-size: clamp(2.2rem, 3.2vw, 3rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: 0;
    color: var(--txt-primary);
    margin-bottom: 18px;
}
.brand-headline--accent {
    color: transparent;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-bright) 55%, var(--red-dim) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.brand-body {
    font-size: .97rem;
    line-height: 1.65;
    color: var(--txt-secondary);
    max-width: 400px;
    margin-bottom: 40px;
}

/* ── Feature list ── */
.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .88rem;
    font-weight: 500;
    color: var(--txt-secondary);
    transition: color var(--dur-fast) var(--ease);
}
.feature-item:hover { color: var(--txt-primary); }

.feature-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-red);
    background: rgba(211,19,29,.08);
    color: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--dur-fast) var(--ease);
}
.feature-item:hover .feature-icon {
    background: rgba(211,19,29,.18);
}

/* ── Decorative geometry ── */
.brand-deco {
    position: absolute;
    bottom: -80px;
    right: -80px;
    width: 340px;
    height: 340px;
    pointer-events: none;
}
.deco-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(211,19,29,.15);
}
.deco-ring--lg {
    inset: 0;
    animation: spin 40s linear infinite;
}
.deco-ring--sm {
    inset: 50px;
    border-color: rgba(211,19,29,.08);
    animation: spin 28s linear infinite reverse;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.deco-dot-grid {
    position: absolute;
    inset: 60px;
    background-image: radial-gradient(circle, rgba(211,19,29,.25) 1px, transparent 1px);
    background-size: 20px 20px;
    border-radius: 50%;
    mask-image: radial-gradient(circle, black 30%, transparent 70%);
}

/* ═════════════════════════════════════════════════════════
   FORM PANEL  (right)
   ═════════════════════════════════════════════════════════ */
.form-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: transparent;
}

/* ── Glass card ── */
.form-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-dim);
    border-radius: var(--radius-xl);
    padding: 38px 36px;
    box-shadow:
        0 20px 60px rgba(0,0,0,.12),
        0 8px 24px rgba(0,0,0,.08);
    animation: card-in var(--dur-mid) var(--ease) both;
}
@keyframes card-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Card header ── */
.card-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-head);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--red);
    background: rgba(211,19,29,.1);
    border: 1px solid rgba(211,19,29,.25);
    border-radius: 999px;
    padding: 4px 12px;
    margin-bottom: 20px;
}
.card-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--red);
    animation: pulse-dot 2.4s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .5; transform: scale(.75); }
}

.card-title {
    font-family: var(--font-head);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 0;
    color: var(--txt-primary);
    margin-bottom: 6px;
}

.card-subtitle {
    font-size: .875rem;
    color: var(--txt-secondary);
    line-height: 1.55;
    margin-bottom: 30px;
}

/* ── Alert ── */
.alert {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-size: .83rem;
    font-weight: 500;
    margin-bottom: 22px;
    animation: alert-in var(--dur-fast) var(--ease) both;
}
.alert[hidden] {
    display: none;
}
@keyframes alert-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert--error {
    color: var(--txt-red);
    background: rgba(211,19,29,.1);
    border: 1px solid rgba(211,19,29,.3);
}
.alert--error svg { flex-shrink: 0; color: var(--red); }

/* ── Login form ── */
.login-form { display: flex; flex-direction: column; gap: 0; }

/* ── Field ── */
.field { margin-bottom: 20px; }

.field__label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .03em;
    color: var(--txt-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.field__labelrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.field__labelrow .field__label { margin-bottom: 0; }

.link-subtle {
    font-size: .78rem;
    font-weight: 500;
    color: var(--txt-secondary);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease);
}
.link-subtle:hover { color: var(--red); }

.field__wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.field__icon {
    position: absolute;
    left: 14px;
    color: var(--txt-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    transition: color var(--dur-fast) var(--ease);
}

.field__input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 44px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-dim);
    border-radius: var(--radius-md);
    font-size: .95rem;
    font-family: var(--font-body);
    color: var(--txt-primary);
    outline: none;
    transition:
        border-color var(--dur-fast) var(--ease),
        background var(--dur-fast) var(--ease),
        box-shadow var(--dur-fast) var(--ease);
    caret-color: var(--red);
}
.field__input::placeholder { color: var(--txt-muted); }
.field__input:hover {
    border-color: var(--border-mid);
    background: var(--bg-input);
}
.field__input:focus {
    border-color: var(--border-red);
    background: var(--bg-input-f);
    box-shadow: 0 0 0 3px var(--red-glow);
}
.field__input:focus + .field__icon,
.field__wrap:focus-within .field__icon {
    color: var(--red);
}

.field__input--pw {
    padding-right: 52px;
}

/* ── Password toggle ── */
.pw-toggle {
    position: absolute;
    right: 6px;
    width: 38px; height: 38px;
    background: none;
    border: none;
    color: var(--txt-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.pw-toggle:hover {
    color: var(--txt-primary);
    background: #f1f5f9;
}

/* ── Submit button ── */
.btn-submit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 50px;
    margin-top: 8px;
    margin-bottom: 22px;
    padding: 0 24px;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dim) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-head);
    font-size: .97rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .01em;
    position: relative;
    overflow: hidden;
    transition:
        transform var(--dur-fast) var(--ease),
        box-shadow var(--dur-fast) var(--ease),
        opacity var(--dur-fast) var(--ease);
}
/* Shimmer sweep on hover */
.btn-submit::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg,
        transparent 30%,
        rgba(255,255,255,.12) 50%,
        transparent 70%);
    transform: translateX(-100%);
    transition: transform .5s var(--ease);
}
.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(211,19,29,.28);
}
.btn-submit:hover::after { transform: translateX(100%); }
.btn-submit:active { transform: translateY(0); box-shadow: none; }
.btn-submit:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

.btn-submit__text { position: relative; }
.btn-submit__arrow {
    display: flex;
    align-items: center;
    transition: transform var(--dur-fast) var(--ease);
}
.btn-submit:hover .btn-submit__arrow { transform: translateX(3px); }

/* ── Card footnote ── */
.card-footnote {
    text-align: center;
    font-size: .75rem;
    color: var(--txt-muted);
    line-height: 1.5;
    padding-top: 10px;
    border-top: 1px solid var(--border-dim);
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .page-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        padding: 0 24px;
    }

    .brand-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-dim);
        padding: 32px 28px 36px;
        min-height: auto;
    }

    /* Hide desktop back on mobile, show mobile one */
    .nav-back:not(.nav-back--mobile) { display: none; }
    .nav-back--mobile {
        display: inline-flex;
        align-self: flex-start;
        margin-bottom: 24px;
    }

    .brand-inner {
        align-self: center;
        max-width: 540px;
        padding-bottom: 0;
    }
    .brand-logo-wrap { margin-bottom: 28px; }
    .brand-logo { width: min(100%, 220px); }
    .brand-headline { font-size: 1.8rem; }
    .brand-deco { display: none; }

    .form-panel {
        align-items: center;
        padding: 36px 20px;
    }
    .form-card {
        max-width: 100%;
        padding: 30px 24px;
        border-radius: var(--radius-lg);
    }
}

@media (max-width: 480px) {
    .page-shell { padding: 0; }
    .brand-panel { padding: 24px 20px 28px; }
    .form-panel { padding: 24px 16px; }
    .form-card { padding: 26px 20px; }
    .brand-headline { font-size: 1.55rem; }
}

/* ── Cinematic login intro ──────────────────────────────── */
/* Full-screen video "loader" shown after a successful login, before the
   app opens. No controls/progress/timer/buttons and not interactive. */
.intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.intro-overlay[hidden] {
    display: none;
}

.intro-video {
    width: 100%;
    height: 100%;
    object-fit: cover;      /* fill the entire screen edge-to-edge */
    background: #000;
    pointer-events: none;   /* not clickable / seekable */
}
