/* ============================================================
   LOGIN / REGISTER — split-screen auth
   Brand panel (deep ocean → sunset horizon) + clean form panel.
   All colors flow through base.css tokens so both themes work.
   ============================================================ */

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.auth-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Brand panel ─────────────────────────────────────────────── */

.auth-brand {
    position: relative;
    flex: 1 1 52%;
    display: flex;
    align-items: center;
    overflow: hidden;
    color: #fdf6ec;
    background:
        radial-gradient(120% 90% at 85% 110%, rgba(255, 107, 53, 0.45) 0%, rgba(255, 107, 53, 0) 55%),
        linear-gradient(160deg, #0d3b4f 0%, #0a2e40 55%, #143047 100%);
}

#route-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.auth-brand-glow {
    position: absolute;
    left: -20%;
    top: -30%;
    width: 70%;
    height: 70%;
    background: radial-gradient(closest-side, rgba(0, 168, 204, 0.22), transparent);
    pointer-events: none;
}

.auth-brand-inner {
    position: relative;
    z-index: 1;
    padding: 4rem clamp(2.5rem, 6vw, 6rem);
    max-width: 620px;
    display: flex;
    flex-direction: column;
    gap: 2.75rem;
}

.auth-wordmark {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.auth-wordmark-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 0.4rem;
}

.auth-wordmark-name {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.14em;
}

.auth-wordmark-name em,
.auth-mobile-wordmark em {
    font-style: normal;
    color: var(--sunset-orange-light, #ff9e6d);
}

.auth-wordmark-sub {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: rgba(253, 246, 236, 0.65);
}

.auth-headline {
    font-family: 'Lora', Georgia, serif;
    font-weight: 500;
    font-size: clamp(2rem, 3.4vw, 2.9rem);
    line-height: 1.18;
    margin: 0;
    text-wrap: balance;
}

.auth-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    max-width: 30rem;
}

.auth-points li {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.auth-points li i {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1rem;
    color: var(--sunset-orange-light, #ff9e6d);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.auth-points strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.auth-points span {
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(253, 246, 236, 0.7);
}

/* ── Form panel ──────────────────────────────────────────────── */

.auth-panel {
    flex: 1 1 48%;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    min-width: 0;
}

.auth-panel-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem 0;
}

.auth-mobile-wordmark {
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    font-size: 1rem;
    color: var(--text-primary);
}

.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: background 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.auth-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 2rem 1.5rem 2.5rem;
    box-sizing: border-box;
    animation: auth-enter 0.45s ease both;
}

@keyframes auth-enter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

/* ── Tabs ── */

.auth-tabs {
    position: relative;
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1.75rem;
}

.auth-tab {
    background: none;
    border: none;
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.auth-tab:hover { color: var(--text-primary); }
.auth-tab.active { color: var(--text-primary); }

.auth-tab-ink {
    position: absolute;
    bottom: -1px;
    left: 0;
    height: 2.5px;
    width: 0;
    border-radius: 2px;
    background: var(--sunset-orange);
    transition: transform 0.25s ease, width 0.25s ease;
}

/* ── Headings ── */

.auth-form-title {
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
    font-size: 1.6rem;
    margin: 0 0 0.3rem;
}

.auth-form-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

/* ── Social button ── */

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.72rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.social-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.google-g { flex-shrink: 0; }

/* ── Divider ── */

.form-divider {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin: 1.25rem 0;
    color: var(--text-light);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

/* ── Fields ── */

.form-group { margin-bottom: 1.1rem; }

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
}

.form-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-label-hint {
    font-size: 0.75rem;
    font-weight: 600;
}

.form-label-hint[data-level="weak"]   { color: var(--danger-color); }
.form-label-hint[data-level="fair"]   { color: var(--warning-color); }
.form-label-hint[data-level="good"]   { color: var(--ocean-teal); }
.form-label-hint[data-level="strong"] { color: var(--adventure-green); }

.form-input {
    width: 100%;
    box-sizing: border-box;
    height: 46px;
    padding: 0 0.9rem;
    border-radius: 10px;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input::placeholder { color: var(--text-light); }

.form-input:focus {
    outline: none;
    border-color: var(--sunset-orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}

.password-input-wrapper { position: relative; }

.password-input-wrapper .form-input { padding-right: 2.9rem; }

.password-toggle-btn {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-light);
    font-size: 0.9rem;
    transition: color 0.15s ease;
}

.password-toggle-btn:hover { color: var(--text-secondary); }

/* remember / forgot row */
.form-row-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0.25rem 0 1.4rem;
}

.form-checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--sunset-orange);
    cursor: pointer;
}

.form-checkbox-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.terms-check { margin: 0.35rem 0 1.4rem; align-items: flex-start; }
.terms-check .form-checkbox { margin-top: 2px; }

.form-link {
    color: var(--sunset-orange);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.form-link:hover { text-decoration: underline; }
.form-link.muted { color: var(--text-muted); font-weight: 500; }

/* ── Submit ── */

.form-submit-btn {
    position: relative;
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--sunset-orange), var(--sunset-orange-dark));
    color: #fff;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 14px rgba(255, 107, 53, 0.28);
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.15s ease;
}

.form-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 107, 53, 0.36);
}

.form-submit-btn:active:not(:disabled) { transform: none; }

.form-submit-btn:disabled { opacity: 0.75; }

.form-submit-btn .btn-loading {
    display: none;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}

.form-submit-btn.loading .btn-text { visibility: hidden; }
.form-submit-btn.loading .btn-loading { display: block; }

@keyframes auth-spin { to { transform: rotate(360deg); } }

/* ── Messages ── */

.form-message {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    font-size: 0.88rem;
    line-height: 1.45;
    margin-bottom: 1.1rem;
}

.form-message .message-icon { margin-top: 2px; flex-shrink: 0; }

.form-message.error {
    background: rgba(255, 0, 110, 0.08);
    border: 1px solid rgba(255, 0, 110, 0.25);
    color: var(--danger-color);
}

.form-message.success {
    background: rgba(56, 176, 0, 0.08);
    border: 1px solid rgba(56, 176, 0, 0.3);
    color: var(--adventure-green);
}

/* ── Password strength ── */

.password-strength {
    display: flex;
    gap: 5px;
    margin-top: 0.55rem;
}

.strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--border-subtle);
    transition: background 0.2s ease;
}

.strength-bar.weak   { background: var(--danger-color); }
.strength-bar.fair   { background: var(--warning-color); }
.strength-bar.good   { background: var(--ocean-teal); }
.strength-bar.strong { background: var(--adventure-green); }

/* ── Two-factor step ── */

.twofa-head { text-align: center; margin-bottom: 1.25rem; }

.twofa-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.9rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: var(--sunset-orange);
    background: rgba(255, 107, 53, 0.1);
}

.twofa-input {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    font-size: 1.7rem;
    letter-spacing: 0.55em;
    text-indent: 0.55em; /* recenters despite trailing letter-spacing */
    padding: 0.7rem 0;
    border-radius: 12px;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.twofa-input:focus {
    outline: none;
    border-color: var(--sunset-orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}

.twofa-back { text-align: center; margin: 1.1rem 0 0; }

/* ── Footer ── */

.auth-panel-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 1.4rem;
    padding: 1.25rem 1.5rem 1.5rem;
    font-size: 0.78rem;
    color: var(--text-light);
}

.auth-panel-foot a {
    color: var(--text-muted);
    text-decoration: none;
}

.auth-panel-foot a:hover { color: var(--text-primary); }

/* ── Toast ── */

.auth-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translate(-50%, 12px);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.2rem;
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 100;
}

.auth-toast.show { opacity: 1; transform: translate(-50%, 0); }
.auth-toast.success i { color: var(--adventure-green); }
.auth-toast.error i   { color: var(--danger-color); }
.auth-toast.info i    { color: var(--exploration-blue); }

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 900px) {
    .auth-brand { display: none; }
    .auth-mobile-wordmark { display: flex; }
    .auth-panel-body { justify-content: flex-start; padding-top: 1.5rem; }
}

@media (max-width: 480px) {
    .form-grid-2 { grid-template-columns: 1fr; gap: 0 0.9rem; }
}

/* ── Motion preferences ── */

@media (prefers-reduced-motion: reduce) {
    .auth-panel-body { animation: none; }
    .auth-tab-ink { transition: none; }
    .form-submit-btn { transition: none; }
}
