/* Two-Factor Authentication Styling - Website Design System */

/* ─── Local design tokens (--border is not in the global design system) ─── */
:root {
    --tfa-border: rgba(0, 0, 0, 0.14);
    --tfa-input-bg: #f5f6f8;
    --tfa-input-border: rgba(0, 0, 0, 0.18);
    --tfa-focus-ring: rgba(72, 117, 124, 0.18);
}

[data-theme="dark"] {
    --tfa-border: rgba(255, 255, 255, 0.1);
    --tfa-input-bg: #1c1f26;
    --tfa-input-border: rgba(255, 255, 255, 0.15);
    --tfa-focus-ring: rgba(72, 117, 124, 0.25);
}

/* ─── Container / Wrapper ─────────────────────────────────────────────────── */
.tfa-container {
    width: 70%;
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.tfa-wrapper {
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--tfa-border);
    overflow: hidden;
    max-width: 600px;
    margin: 0 auto;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
.tfa-header {
    padding: 2rem 2rem 1.5rem;
    background: var(--card);
    border-bottom: 1px solid var(--tfa-border);
}

.tfa-header h1 {
    margin: 0 0 0.5rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--fg);
    line-height: 1.2;
}

.tfa-header p {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.5;
}

/* ─── Discord-Login ───────────────────────────────────────────────────────── */
.tfa-discord-section {
    padding: 1.5rem 2rem 0;
}

.btn-discord {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.8rem 1rem;
    background: #5865f2;
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background 0.2s ease;
}

.btn-discord:hover {
    background: #4752c4;
    color: #fff;
}

.btn-discord-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

.tfa-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 2rem 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.tfa-divider::before,
.tfa-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid var(--tfa-border);
}

.tfa-divider span {
    padding: 0 0.75rem;
}

/* ─── Form ────────────────────────────────────────────────────────────────── */
.tfa-form {
    padding: 2rem;
}

.tfa-form-group {
    margin-bottom: 1.5rem;
}

.tfa-label {
    display: block;
    margin-bottom: 0.625rem;
    font-weight: 600;
    color: var(--fg);
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}

.required {
    color: #dc2626;
    margin-left: 0.25rem;
}

/* ─── Inputs ──────────────────────────────────────────────────────────────── */
.tfa-form input[type="text"],
.tfa-form input[type="password"],
.tfa-form input[type="tel"],
.tfa-form input[type="number"],
.tfa-form select {
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--tfa-input-border);
    border-radius: 10px;
    background: var(--tfa-input-bg);
    color: var(--fg);
    font-size: 1rem;
    font-family: var(--font-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
}

.tfa-form input:focus,
.tfa-form select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 4px var(--tfa-focus-ring);
    background: var(--tfa-input-bg);
}

/* Placeholder contrast */
.tfa-form input::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

.tfa-help {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted);
    font-style: italic;
}

/* ─── Actions Bar ─────────────────────────────────────────────────────────── */
.tfa-actions {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--tfa-border);
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-main);
    line-height: 1;
}

.btn-icon {
    font-size: 1.05rem;
}

.btn-primary {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.btn-primary:hover {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(72, 117, 124, 0.35);
    text-decoration: none;
    color: white;
}

.btn-secondary {
    background: transparent;
    color: var(--muted);
    border-color: var(--tfa-input-border);
}

.btn-secondary:hover {
    background: var(--tfa-input-bg);
    color: var(--fg);
    border-color: var(--muted);
    text-decoration: none;
}

/* ─── Info / Status Boxes ─────────────────────────────────────────────────── */
.tfa-info-box {
    background: rgba(72, 117, 124, 0.06);
    border: 1px solid rgba(72, 117, 124, 0.22);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
}

[data-theme="dark"] .tfa-info-box {
    background: rgba(72, 117, 124, 0.12);
    border-color: rgba(72, 117, 124, 0.3);
}

.tfa-info-box h3 {
    margin: 0 0 0.875rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--fg);
}

.tfa-info-box p {
    margin: 0;
    color: var(--fg);
    line-height: 1.65;
    font-size: 0.95rem;
}

/* ─── Success Box ─────────────────────────────────────────────────────────── */
.tfa-success-box {
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.22);
    border-radius: 12px;
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    text-align: center;
}

[data-theme="dark"] .tfa-success-box {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.tfa-success-icon {
    font-size: 3rem;
    color: #16a34a;
    margin-bottom: 0.875rem;
}

[data-theme="dark"] .tfa-success-icon {
    color: #4ade80;
}

.tfa-success-message {
    font-size: 1.05rem;
    color: var(--fg);
    margin: 0;
    font-weight: 500;
}

/* ─── Warning Box ─────────────────────────────────────────────────────────── */
.tfa-warning-box {
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.22);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
}

[data-theme="dark"] .tfa-warning-box {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

.tfa-warning-icon {
    font-size: 3rem;
    margin-bottom: 0.875rem;
    text-align: center;
}

.tfa-warning-box p {
    margin: 0;
    color: var(--fg);
    font-size: 0.95rem;
    line-height: 1.6;
}

.tfa-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    margin-top: 1rem;
    color: #b45309;
    font-weight: 500;
    font-size: 0.9rem;
}

[data-theme="dark"] .tfa-warning {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fbbf24;
}

/* ─── Error Messages ──────────────────────────────────────────────────────── */
.tfa-errors {
    margin-bottom: 1.5rem;
}

.tfa-error {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.22);
    border-radius: 8px;
    padding: 0.875rem 1.125rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
    font-size: 0.9rem;
}

[data-theme="dark"] .tfa-error {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

/* ─── QR Code ─────────────────────────────────────────────────────────────── */
.tfa-qr-section {
    margin-bottom: 2rem;
}

.tfa-instruction {
    font-weight: 500;
    color: var(--fg);
    margin-bottom: 1rem;
}

.tfa-qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: var(--tfa-input-bg);
    border: 1px solid var(--tfa-input-border);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.tfa-qr-code {
    max-width: 240px;
    height: auto;
    border-radius: 8px;
}

.tfa-manual-entry {
    background: var(--tfa-input-bg);
    border: 1px solid var(--tfa-input-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    text-align: center;
}

.tfa-manual-entry p {
    margin: 0 0 0.875rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.tfa-secret {
    display: block;
    background: var(--card);
    border: 2px solid var(--tfa-input-border);
    border-radius: 8px;
    padding: 0.875rem 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: var(--fg);
    letter-spacing: 2px;
    user-select: all;
}

/* ─── Backup Tokens ───────────────────────────────────────────────────────── */
.tfa-backup-tokens {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.875rem;
    margin: 1.5rem 0;
}

.tfa-backup-token-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.tfa-backup-token {
    display: block;
    background: var(--tfa-input-bg);
    border: 2px solid var(--tfa-input-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--fg);
    text-align: center;
    letter-spacing: 1px;
    user-select: all;
}

.tfa-token-used {
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    font-style: italic;
}

/* ─── Footer / Links ──────────────────────────────────────────────────────── */
.tfa-footer {
    padding: 1.25rem 2rem 1.5rem;
    background: var(--tfa-input-bg);
    border-top: 1px solid var(--tfa-border);
    text-align: center;
}

.tfa-footer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.tfa-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.tfa-link:hover {
    color: var(--blue-dark);
    text-decoration: underline;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .tfa-container {
        width: 85%;
    }
}

@media (max-width: 600px) {
    .tfa-container {
        width: 95%;
        padding: 1rem 0 2rem;
    }

    .tfa-header {
        padding: 1.5rem 1.25rem 1.125rem;
    }

    .tfa-header h1 {
        font-size: 1.6rem;
    }

    .tfa-form {
        padding: 1.25rem;
    }

    .tfa-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .tfa-form-group {
        margin-bottom: 1.25rem;
    }

    .tfa-backup-tokens {
        grid-template-columns: 1fr 1fr;
    }

    .tfa-qr-container {
        padding: 1.25rem;
    }

    .tfa-qr-code {
        max-width: 200px;
    }
}
