/* Auth Module Styles - Login, Register, Forgot Password, Reset Password */

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: rgba(59, 130, 246, 0.1);
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --text: #f8fafc;
    --text-secondary: #94a3b8;
    --error: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

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

body.auth-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image:
        radial-gradient(ellipse at top, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
}

/* Container */
.login-container,
.register-container,
.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}

/* Header */
.login-header,
.register-header,
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo,
.register-logo,
.auth-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3);
}

.login-title,
.register-title,
.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle,
.register-subtitle,
.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Card */
.login-card,
.register-card,
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

/* Error & Success Messages */
.message-box {
    padding: 0.875rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    display: none;
    align-items: flex-start;
    gap: 0.625rem;
}

.message-box.visible {
    display: flex;
}

.message-box.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.message-box.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.message-box svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-input.error {
    border-color: var(--error);
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Checkbox */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-input {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkbox-input:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-input:checked + .checkbox-custom svg {
    display: block;
}

.checkbox-custom svg {
    display: none;
    color: white;
}

.forgot-link {
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.forgot-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-text {
    transition: opacity 0.2s ease;
}

.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading .spinner {
    display: block;
}

.spinner {
    display: none;
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 1.75rem 0;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

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

.divider span {
    padding: 0 1rem;
}

/* Social Login */
.social-login {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.social-btn {
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    transition: all 0.2s ease;
}

.social-btn:hover {
    border-color: var(--primary);
    background: var(--surface-hover);
}

.social-btn:active {
    transform: scale(0.98);
}

.social-btn.google:hover {
    border-color: #ea4335;
}

.social-btn.microsoft:hover {
    border-color: #00a4ef;
}

.social-btn.github:hover {
    border-color: #6e5494;
}

.social-btn.apple:hover {
    border-color: #a2aaad;
}

/* Footer */
.login-footer,
.register-footer,
.auth-footer {
    text-align: center;
    margin-top: 1.75rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.login-footer a,
.register-footer a,
.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

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

/* 2FA Section */
.twofa-section {
    display: none;
}

.twofa-section.visible {
    display: block;
}

.twofa-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.twofa-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    background: var(--primary-light);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.twofa-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.twofa-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.code-input-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.code-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    transition: all 0.2s ease;
}

.code-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.code-input.filled {
    border-color: var(--primary);
    background: var(--primary-light);
}

.resend-section {
    text-align: center;
    margin-top: 1rem;
}

.resend-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.resend-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
}

.resend-btn:hover {
    text-decoration: underline;
}

.resend-btn:disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
    text-decoration: none;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0;
    margin-top: 1.25rem;
}

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

/* Trust Device */
.trust-device {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 1.25rem;
}

.trust-device input {
    margin-top: 0.125rem;
}

.trust-device-text {
    flex: 1;
}

.trust-device-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.125rem;
}

.trust-device-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background-color 0.3s;
}

.strength-fill.weak { width: 25%; background: var(--error); }
.strength-fill.fair { width: 50%; background: var(--warning); }
.strength-fill.good { width: 75%; background: #3b82f6; }
.strength-fill.strong { width: 100%; background: var(--success); }

.strength-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Password Requirements */
.password-requirements {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.requirement:last-child {
    margin-bottom: 0;
}

.requirement.met {
    color: var(--success);
}

.requirement svg {
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .login-container,
    .register-container,
    .auth-container {
        padding: 1rem;
    }

    .login-card,
    .register-card,
    .auth-card {
        padding: 1.25rem;
    }

    .social-login {
        grid-template-columns: 1fr;
    }

    .code-input {
        width: 42px;
        height: 50px;
        font-size: 1.25rem;
    }
}
