/* ═══════════════════════════════════════════════════
   AUTH & SECURITY STYLES
   ═══════════════════════════════════════════════════ */

/* ── AUTH SCREEN ── */
.auth-screen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #F8F6F3 0%, #FDF9F6 50%, #FBE8E3 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.auth-screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: var(--space-6);
    animation: authFadeIn 0.5s ease;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Brand */
.auth-brand {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-brand__icon {
    width: 64px;
    height: 64px;
    background: var(--color-primary);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    border-radius: var(--radius-xl);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
    box-shadow: 0 8px 24px rgba(232, 131, 107, 0.3);
}

.auth-brand__title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    letter-spacing: -0.5px;
}

.auth-brand__tagline {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    margin-top: var(--space-1);
}

/* Card */
.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-6);
    border: 1px solid var(--color-border-light);
}

/* Tabs */
.auth-tabs {
    display: flex;
    gap: var(--space-1);
    background: var(--color-surface-muted);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: var(--space-5);
}

.auth-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: transparent;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.auth-tab.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-xs);
}

/* Panels */
.auth-panel {
    display: none;
}

.auth-panel.active {
    display: block;
    animation: authFadeIn 0.3s ease;
}

/* Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.auth-form__desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: var(--space-2);
}

/* Error / Success */
.auth-error {
    font-size: var(--font-size-xs);
    color: var(--color-error);
    min-height: 16px;
    text-align: center;
}

.auth-success {
    font-size: var(--font-size-xs);
    color: var(--color-success);
    min-height: 16px;
    text-align: center;
}

/* Footer */
.auth-footer {
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    margin-top: var(--space-6);
}


/* ── MFA CHALLENGE OVERLAY ── */
.mfa-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(26, 29, 46, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.mfa-overlay.active {
    display: flex;
}

.mfa-card {
    background: var(--color-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: authFadeIn 0.4s ease;
}

.mfa-card__icon {
    width: 56px;
    height: 56px;
    background: var(--color-info-bg);
    color: var(--color-info);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.mfa-card__icon svg {
    width: 28px;
    height: 28px;
}

.mfa-card__title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.mfa-card__desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-5);
}

.mfa-code-input {
    width: 100%;
    text-align: center;
    font-size: 32px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 12px;
    padding: var(--space-4);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-muted);
    font-family: 'Inter', monospace;
    outline: none;
    transition: border-color var(--transition-fast);
    margin-bottom: var(--space-3);
}

.mfa-code-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(232, 131, 107, 0.15);
}


/* ── BALANCE GATE MODAL ── */
.balance-gate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(26, 29, 46, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}

.balance-gate-overlay.active {
    display: flex;
}

.balance-gate-card {
    background: var(--color-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: authFadeIn 0.4s ease;
}

.balance-gate-card__icon {
    width: 56px;
    height: 56px;
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
}

.balance-gate-card__icon svg {
    width: 28px;
    height: 28px;
}

.balance-gate-card__title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.balance-gate-card__desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-5);
    line-height: var(--line-height-relaxed);
}

.balance-gate-card__desc strong {
    color: var(--color-primary-dark);
}


/* ── MFA SETUP PANEL (Profile) ── */
.mfa-setup-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: var(--color-bg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: authFadeIn 0.3s ease;
}

.mfa-setup-panel.active {
    display: block;
}

.mfa-setup-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
    position: sticky;
    top: 0;
    z-index: 1;
}

.mfa-setup-panel__header h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.mfa-setup-panel__close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-surface-muted);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    transition: background var(--transition-fast);
}

.mfa-setup-panel__close:hover {
    background: var(--color-border);
}

.mfa-setup-panel__close svg {
    width: 18px;
    height: 18px;
}

.mfa-setup-panel__body {
    padding: var(--space-6);
    max-width: 480px;
    margin: 0 auto;
}

/* Status row */
.mfa-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    margin-bottom: var(--space-4);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
}

.mfa-status-badge {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.mfa-status-badge--active {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.mfa-status-badge--inactive {
    background: var(--color-error-bg);
    color: var(--color-error);
}

.mfa-setup-desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-5);
    line-height: var(--line-height-relaxed);
}

/* QR Container */
.mfa-qr-container {
    margin-top: var(--space-5);
    padding: var(--space-5);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
}

.mfa-qr-wrap {
    text-align: center;
    padding: var(--space-4) 0;
}

.mfa-qr-img {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
}

.mfa-secret-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    text-align: center;
    margin: var(--space-3) 0 var(--space-2);
}

.mfa-secret-text {
    display: block;
    text-align: center;
    font-size: var(--font-size-sm);
    font-family: 'Inter', monospace;
    background: var(--color-surface-muted);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    word-break: break-all;
    letter-spacing: 1px;
    color: var(--color-text-primary);
    user-select: all;
}

/* ── Desktop overrides ── */
@media (min-width: 1024px) {
    .auth-container {
        max-width: 480px;
    }

    .mfa-setup-panel__body {
        max-width: 520px;
    }
}