/* ==========================================================================
   Auth pages (login, register, password reset)
   Shared design: dark zinc surface, indigo -> violet accent, aurora panel.
   ========================================================================== */

:root {
    --auth-bg: #09090b;
    --auth-surface: #0e0e12;
    --auth-field: rgba(255, 255, 255, 0.035);
    --auth-field-hover: rgba(255, 255, 255, 0.055);
    --auth-border: rgba(255, 255, 255, 0.09);
    --auth-border-strong: rgba(255, 255, 255, 0.16);
    --auth-text: #fafafa;
    --auth-muted: #a1a1aa;
    --auth-faint: #71717a;
    --auth-accent: #818cf8;
    --auth-accent-strong: #6366f1;
    --auth-violet: #8b5cf6;
    --auth-cyan: #22d3ee;
    --auth-danger: #fb7185;
    --auth-success: #34d399;
    --auth-radius: 12px;
    --auth-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --auth-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body {
    background-color: var(--auth-bg) !important;
    color: var(--auth-text);
    font-family: var(--auth-font);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* The default site navbar is not used on auth pages */
body:has(.login-container-custom) nav.navbar { display: none; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

main.py-4 { padding: 0 !important; flex: 1; display: flex; }

/* ---------- Layout ---------- */
.login-container-custom {
    display: grid;
    grid-template-columns: minmax(420px, 540px) 1fr;
    width: 100%;
    min-height: 100vh;
}

/* ---------- Form column ---------- */
.login-column-form {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 32px clamp(24px, 4vw, 56px) 32px;
    background: var(--auth-surface);
    border-right: 1px solid var(--auth-border);
    overflow: hidden;
}

/* Soft glow behind the form (also the only decoration on mobile) */
.login-column-form::before {
    content: '';
    position: absolute;
    top: -180px;
    left: -140px;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.22), transparent 65%);
    pointer-events: none;
}

.login-header-custom {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--auth-text);
    text-decoration: none;
}
.login-brand:hover { color: var(--auth-text); text-decoration: none; }
.login-brand-logo { height: 30px; width: auto; }
.login-brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.login-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--auth-border);
    border-radius: 999px;
    color: var(--auth-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color .2s, border-color .2s, background .2s;
}
.login-back-btn i { font-size: 10px; }
.login-back-btn:hover {
    color: var(--auth-text);
    border-color: var(--auth-border-strong);
    background: var(--auth-field);
    text-decoration: none;
}

.login-body-custom {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: auto;
    padding: 40px 0 24px;
    animation: authRise .6s cubic-bezier(.2, .7, .2, 1) both;
}

.login-title-area { margin-bottom: 28px; }
.login-title-area h2 {
    margin: 0 0 8px;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--auth-text);
}
.login-title-area p { margin: 0; color: var(--auth-muted); font-size: 15px; line-height: 1.55; }

/* ---------- Fields ---------- */
.form-row-custom { display: flex; gap: 14px; }
.flex-1 { flex: 1; min-width: 0; }

.form-group-custom { margin-bottom: 18px; }

.form-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}
.form-label-custom {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: #d4d4d8;
}
.form-forgot-link {
    font-size: 13px;
    color: var(--auth-accent);
    text-decoration: none;
    transition: color .2s;
}
.form-forgot-link:hover { color: #c7d2fe; text-decoration: none; }

.input-container-custom { position: relative; }

.form-input-custom {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background: var(--auth-field);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    color: var(--auth-text);
    font-family: inherit;
    font-size: 15px;
    transition: border-color .2s, background .2s, box-shadow .2s;
    -webkit-appearance: none;
    appearance: none;
}
.form-input-custom::placeholder { color: var(--auth-faint); }
.form-input-custom:hover { background: var(--auth-field-hover); }
.form-input-custom:focus {
    outline: none;
    background: var(--auth-field-hover);
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.18);
}
.form-input-custom.is-invalid {
    border-color: rgba(251, 113, 133, 0.6);
    background-image: none;
    padding-right: 16px;
}
.form-input-custom.is-invalid:focus { box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.16); }

/* Keep browser autofill on-theme */
.form-input-custom:-webkit-autofill,
.form-input-custom:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text);
    caret-color: var(--auth-text);
    box-shadow: 0 0 0 1000px #17171c inset;
    transition: background-color 9999s ease-out;
}

.input-container-custom:has(.password-toggle-custom) .form-input-custom { padding-right: 46px; }

.password-toggle-custom {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--auth-faint);
    cursor: pointer;
    transition: color .2s, background .2s;
}
.password-toggle-custom:hover { color: var(--auth-text); background: rgba(255, 255, 255, 0.06); }
.password-toggle-custom:focus-visible { outline: 2px solid var(--auth-accent); }

/* Password strength meter (register) */
.pw-strength { display: flex; gap: 4px; margin-top: 10px; }
.pw-strength span {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    transition: background .3s;
}
.pw-strength[data-level="1"] span:nth-child(-n+1) { background: var(--auth-danger); }
.pw-strength[data-level="2"] span:nth-child(-n+2) { background: #fbbf24; }
.pw-strength[data-level="3"] span:nth-child(-n+3) { background: var(--auth-cyan); }
.pw-strength[data-level="4"] span:nth-child(-n+4) { background: var(--auth-success); }
.pw-strength-label { margin-top: 6px; font-size: 12px; color: var(--auth-faint); min-height: 16px; }

/* ---------- Messages ---------- */
.errors-wrapper-custom {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid rgba(251, 113, 133, 0.25);
    background: rgba(251, 113, 133, 0.08);
    border-radius: var(--auth-radius);
}
.error-item-custom {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #fda4af;
    font-size: 13.5px;
    line-height: 1.5;
}
.error-item-custom + .error-item-custom { margin-top: 6px; }
.error-item-custom i { margin-top: 3px; }
.error-item-custom strong { font-weight: 500; }

/* ---------- Checkbox ---------- */
.remember-container-custom { margin: 4px 0 22px; }
.checkbox-label-custom {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    cursor: pointer;
    user-select: none;
    color: var(--auth-muted);
    font-size: 14px;
}
.checkbox-label-custom .form-check-input {
    position: absolute;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}
.custom-checkbox-box {
    position: relative;
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid var(--auth-border-strong);
    background: var(--auth-field);
    transition: background .2s, border-color .2s, box-shadow .2s;
}
.custom-checkbox-box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1.5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform .15s ease;
}
.checkbox-label-custom:hover .custom-checkbox-box { border-color: var(--auth-accent); }
.form-check-input:checked + .custom-checkbox-box {
    background: linear-gradient(135deg, var(--auth-accent-strong), var(--auth-violet));
    border-color: transparent;
}
.form-check-input:checked + .custom-checkbox-box::after { transform: rotate(45deg) scale(1); }
.form-check-input:focus-visible + .custom-checkbox-box { box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.25); }

/* ---------- Submit ---------- */
.submit-btn-custom {
    position: relative;
    display: block;
    width: 100%;
    height: 50px;
    margin-top: 8px;
    border: 0;
    border-radius: var(--auth-radius);
    background: linear-gradient(135deg, var(--auth-accent-strong), var(--auth-violet));
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.005em;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 8px 24px -8px rgba(99, 102, 241, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform .2s, box-shadow .2s, filter .2s;
}
.submit-btn-custom::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform .7s ease;
}
.submit-btn-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px -8px rgba(99, 102, 241, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.submit-btn-custom:hover::before { transform: translateX(120%); }
.submit-btn-custom:active { transform: translateY(0); filter: brightness(.95); }
.submit-btn-custom:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.submit-btn-custom.is-loading { pointer-events: none; color: transparent; }
.submit-btn-custom.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin .7s linear infinite;
}

.login-footer-custom { margin-top: 28px; text-align: center; }
.login-footer-custom p { margin: 0; color: var(--auth-muted); font-size: 14px; }
.login-footer-custom a {
    color: var(--auth-text);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--auth-border-strong);
    transition: border-color .2s, color .2s;
}
.login-footer-custom a:hover { color: var(--auth-accent); border-color: var(--auth-accent); text-decoration: none; }

/* ---------- Visual panel ---------- */
.login-column-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: var(--auth-bg);
    overflow: hidden;
    isolation: isolate;
}

/* Aurora blobs */
.aurora { position: absolute; inset: 0; z-index: -2; filter: blur(70px) saturate(130%); opacity: .85; }
.aurora i {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}
.aurora i:nth-child(1) {
    width: 520px; height: 520px; top: -12%; left: -8%;
    background: radial-gradient(circle, #4f46e5 0%, transparent 68%);
    animation: auroraA 18s ease-in-out infinite alternate;
}
.aurora i:nth-child(2) {
    width: 460px; height: 460px; bottom: -14%; right: -6%;
    background: radial-gradient(circle, #9333ea 0%, transparent 68%);
    animation: auroraB 22s ease-in-out infinite alternate;
}
.aurora i:nth-child(3) {
    width: 380px; height: 380px; top: 38%; left: 42%;
    background: radial-gradient(circle, #0891b2 0%, transparent 68%);
    opacity: .7;
    animation: auroraC 26s ease-in-out infinite alternate;
}

/* Dot grid fading out toward the edges */
.login-column-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}

.visual-stack { width: 100%; max-width: 460px; animation: authRise .8s .1s cubic-bezier(.2, .7, .2, 1) both; }

.marketing-heading {
    margin: 0 0 28px;
    font-size: clamp(36px, 4.2vw, 56px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.04em;
    color: var(--auth-text);
    min-height: 1.1em;
}
.gradient-text {
    background: linear-gradient(100deg, #a5b4fc 0%, #c4b5fd 45%, #67e8f9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.typing-cursor {
    display: inline-block;
    width: 3px;
    height: .9em;
    margin-left: 4px;
    vertical-align: -0.08em;
    background: var(--auth-accent);
    border-radius: 2px;
    animation: authBlink .9s steps(1) infinite;
}

/* Glass code card */
.code-card {
    position: relative;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    overflow: hidden;
    animation: authFloat 7s ease-in-out infinite;
}
.code-card-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.code-card-bar span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.code-card-bar em {
    margin-left: auto;
    font-style: normal;
    font-family: var(--auth-mono);
    font-size: 11.5px;
    color: var(--auth-faint);
}
.code-card pre {
    margin: 0;
    padding: 18px 20px 20px;
    background: transparent;
    font-family: var(--auth-mono);
    font-size: 13.5px;
    line-height: 1.75;
    color: #d4d4d8;
    white-space: pre;
    overflow: hidden;
    box-sizing: border-box;
    min-height: calc(8 * 1.75em + 38px);
    transition: opacity .18s ease;
}
.code-card pre.is-swapping { opacity: 0; }
.code-card .k { color: #c4b5fd; }
.code-card .s { color: #86efac; }
.code-card .n { color: #67e8f9; }
.code-card .c { color: var(--auth-faint); }

.visual-points {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
}
.visual-points li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    color: #d4d4d8;
    font-size: 13px;
    font-weight: 500;
}
.visual-points li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--auth-cyan);
    box-shadow: 0 0 10px var(--auth-cyan);
}

.visual-join-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
    padding: 12px 20px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    color: var(--auth-text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s, border-color .2s, transform .2s;
}
.visual-join-btn i { font-size: 12px; transition: transform .2s; }
.visual-join-btn:hover {
    color: var(--auth-text);
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
    text-decoration: none;
}
.visual-join-btn:hover i { transform: translateX(3px); }

/* ---------- Motion ---------- */
@keyframes authRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes authSpin { to { transform: rotate(360deg); } }
@keyframes authBlink { 50% { opacity: 0; } }
@keyframes authFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes auroraA { to { transform: translate(120px, 80px) scale(1.15); } }
@keyframes auroraB { to { transform: translate(-100px, -90px) scale(1.1); } }
@keyframes auroraC { to { transform: translate(-140px, 60px) scale(1.25); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .login-container-custom { grid-template-columns: 1fr; }
    .login-column-visual { display: none; }
    .login-column-form { border-right: 0; padding: 24px 20px; }
    .login-body-custom { padding-top: 28px; }
}

@media (max-width: 480px) {
    .form-row-custom { flex-direction: column; gap: 0; }
    .login-title-area h2 { font-size: 26px; }
    .login-brand-name { font-size: 14px; }
}

/* ---------- Email Verification Page ---------- */
.verify-icon-orb {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(139, 92, 246, 0.22));
    border: 1px solid rgba(129, 140, 248, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--auth-accent);
    margin-bottom: 20px;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.3);
}

.verify-card {
    background: var(--auth-field);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 22px;
    margin-bottom: 24px;
    text-align: left;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.verify-email-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(129, 140, 248, 0.12);
    border: 1px solid rgba(129, 140, 248, 0.28);
    color: #e0e7ff;
    font-family: var(--auth-mono);
    font-size: 13.5px;
    font-weight: 500;
    word-break: break-all;
    margin-bottom: 14px;
}
.verify-email-badge i {
    color: var(--auth-cyan);
    font-size: 13px;
}

.verify-steps {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.verify-step-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--auth-muted);
    font-size: 13.5px;
    line-height: 1.5;
}
.verify-step-num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.verify-alert-success {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--auth-radius);
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: #a7f3d0;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
    animation: authRise .4s ease-out;
}
.verify-alert-success i {
    color: var(--auth-success);
    font-size: 18px;
    flex-shrink: 0;
}

