@layer pages {
/* ============================================
   Auth Page Styles (Login / Register)
   Premium, immersive login experience
   ============================================ */

/* --- Auth Page Background --- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Radial gradient ambient glow */
.auth-page::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Grid dot pattern */
.auth-page::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, var(--surface-2) 1px, transparent 0);
    background-size: 40px 40px;
    opacity: 0.3;
    pointer-events: none;
    mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, black 20%, transparent 70%);
    z-index: 0;
}

/* --- Auth Card (glass morphism) --- */
.auth-card {
    position: relative;
    z-index: var(--z-raised);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl, 24px);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow:
        var(--shadow-lg),
        0 0 80px rgba(59, 130, 246, 0.06);
    backdrop-filter: blur(8px);
    animation: auth-card-entrance 0.6s ease-out;
}

@keyframes auth-card-entrance {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.auth-header .brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg, 16px);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.15);
    margin-bottom: 1rem;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.auth-header .brand-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.2);
}

.auth-header .brand-icon svg {
    width: 28px;
    height: 28px;
}

.auth-header h1 {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-top: 0.5rem;
}

/* --- Auth Tabs --- */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: color var(--transition-fast), border-color var(--transition-fast);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    position: relative;
}

.auth-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

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

.auth-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: 4px 4px 0 0;
}

/* --- Auth Forms --- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form[hidden] {
    display: none;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-form .form-group label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.auth-form .form-group input {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--surface-1);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.auth-form .form-group input::placeholder {
    color: var(--text-muted);
}

.auth-form .form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--surface-2);
}

.auth-form .form-group input:hover:not(:focus) {
    border-color: var(--surface-3);
}

/* --- Password Strength Indicator --- */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.password-strength-bar {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--surface-2);
    transition: background var(--transition-fast);
}

.password-strength-bar.weak { background: var(--color-danger); }
.password-strength-bar.fair { background: var(--color-warning); }
.password-strength-bar.good { background: var(--color-success); }
.password-strength-bar.strong { background: var(--accent); }

.password-strength-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-align: right;
}

/* --- ToS Checkbox --- */
.form-group-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.form-group-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--surface-1);
    cursor: pointer;
    margin-top: 2px;
    transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
}

.form-group-checkbox input[type="checkbox"]:hover {
    border-color: var(--surface-3);
}

.form-group-checkbox input[type="checkbox"]:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group-checkbox input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.form-group-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.form-group-checkbox label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    cursor: pointer;
}

.form-group-checkbox label a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.form-group-checkbox label a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* --- Auth Submit Button --- */
.auth-submit {
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: var(--text-base);
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.auth-submit:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

/* Shine sweep on hover */
.auth-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.auth-submit:hover:not(:disabled)::before {
    left: 100%;
}

.auth-submit:active {
    transform: scale(0.98);
}

.auth-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading state spinner on submit */
.auth-submit.loading {
    color: transparent;
    pointer-events: none;
}

.auth-submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* spin animation: defined in animations.css */

/* --- Auth Error --- */
.auth-error {
    color: var(--color-danger);
    font-size: var(--text-sm);
    text-align: center;
    min-height: 1.2rem;
    transition: opacity var(--transition-fast);
}

.auth-error:empty {
    opacity: 0;
}

.auth-error:not(:empty) {
    opacity: 1;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

/* --- Auth Success --- */
.auth-success {
    color: var(--color-success);
    font-size: var(--text-sm);
    text-align: center;
    padding: 8px 12px;
    background: rgba(34, 197, 94, 0.08);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(34, 197, 94, 0.15);
}

/* --- Auth Forgot Password Link --- */
.auth-forgot {
    text-align: right;
    margin-top: -4px;
}

.auth-forgot a {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.auth-forgot a:hover {
    color: var(--accent);
}

/* --- Auth Divider --- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

/* --- OAuth Buttons --- */
.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--surface-1);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.oauth-btn:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--surface-3);
    box-shadow: var(--shadow-sm);
}

.oauth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.oauth-btn svg {
    width: 20px;
    height: 20px;
}

/* --- Auth page footer link --- */
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.auth-footer a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .auth-card {
        padding: 1.75rem;
        border-radius: var(--radius-lg, 16px);
    }

    .auth-header .brand-icon {
        width: 48px;
        height: 48px;
    }
}

/* --- Light Theme: Auth Page Refinements --- */
[data-theme="light"] .auth-card {
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .auth-page::before {
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
}

[data-theme="light"] .auth-page::after {
    opacity: 0.15;
}

[data-theme="light"] .auth-submit:hover {
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}

} /* end @layer pages */
