/* auth.css - Shared styles for login, forgot-password, reset-password, verify-2fa.
   Built entirely on the design tokens from enhanced-theme-styles.css so these
   pages automatically match the main app's light/dark theme instead of
   carrying their own fixed light-only palette. */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.auth-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    position: relative;
}

/* Theme toggle lands here automatically (enhanced-theme-manager.js looks for
   .header-icon-group, then .header-actions) — no extra JS needed. */
.auth-corner-actions {
    position: absolute;
    top: 16px;
    right: 16px;
}

.auth-corner-actions .theme-toggle {
    background: none;
    border: none;
    font-size: 1.1em;
    line-height: 1;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--border-radius-sm);
    color: var(--text-light);
}

.auth-corner-actions .theme-toggle:hover {
    background: var(--bg-hover);
}

.auth-logo {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 12px;
    background: var(--accent-primary);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    font-weight: 700;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header h1 {
    color: var(--text-primary);
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-light);
    font-size: 0.9em;
}

.back-link {
    position: absolute;
    top: 18px;
    left: 18px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.85em;
}

.back-link:hover {
    color: var(--text-secondary);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9em;
}

.form-group input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1em;
    transition: border-color var(--transition-duration) var(--transition-easing);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.82em;
}

input[type="checkbox"] {
    accent-color: var(--accent-primary);
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.remember-row input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.remember-row label {
    margin: 0;
    cursor: pointer;
}

.auth-btn {
    display: block;
    width: 100%;
    background: var(--accent-primary);
    color: var(--text-inverse);
    border: none;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    font-size: 1em;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-duration) var(--transition-easing);
}

.auth-btn:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-btn-green {
    background: var(--accent-secondary);
}

.auth-btn-green:hover {
    background: var(--accent-secondary-hover);
}

.verify-btn {
    width: 100%;
    margin-bottom: 15px;
}

/* Status messages — reuse the app's own themed status-color tokens */
.error {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 12px 14px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 18px;
    border-left: 3px solid var(--error-border);
    font-size: 0.9em;
}

.message, .success {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 12px 14px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 18px;
    border-left: 3px solid var(--success-border);
    font-size: 0.9em;
}

.message.error {
    background: var(--error-bg);
    color: var(--error-text);
    border-left-color: var(--error-border);
}

/* Shared info/warning callouts (admin-info, user-info, recovery-warning, timer) */
.info-box {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
    border-radius: var(--border-radius-sm);
    padding: 14px 16px;
    margin-top: 18px;
    font-size: 0.85em;
}

.info-box h3 {
    font-size: 0.95em;
    margin-bottom: 6px;
}

.user-info {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 14px;
    margin-bottom: 22px;
    text-align: center;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.user-badge {
    display: inline-block;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 500;
    margin: 8px 0;
}

.warning-box, .timer, .recovery-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 18px;
    border-left: 3px solid var(--accent-warning);
    font-size: 0.88em;
    text-align: center;
}

.timer.warning {
    background: var(--error-bg);
    color: var(--error-text);
    border-left-color: var(--error-border);
    font-weight: 600;
    animation: auth-pulse 1s infinite;
}

.timer #countdown {
    font-family: ui-monospace, 'SF Mono', Consolas, monospace;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    margin: 0 4px;
}

@keyframes auth-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.verification-input {
    width: 100%;
    padding: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1.3em;
    font-family: ui-monospace, 'SF Mono', Consolas, monospace;
    text-align: center;
    letter-spacing: 0.3em;
    transition: border-color var(--transition-duration) var(--transition-easing);
}

.verification-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

.recovery-input {
    font-family: ui-monospace, 'SF Mono', Consolas, monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.alternative-options {
    text-align: center;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
}

.alternative-options a {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.9em;
}

.alternative-options a:hover {
    text-decoration: underline;
}

.help-text {
    font-size: 0.85em;
    color: var(--text-light);
    text-align: center;
    margin-top: 14px;
    line-height: 1.4;
}

.auth-footer {
    text-align: center;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
}

.auth-footer p {
    color: var(--text-light);
    font-size: 0.85em;
    margin-bottom: 8px;
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    margin: 0 5px;
}

.auth-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 30px 22px;
    }
}
