/* Auth page overrides built on reusable foundation */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-pulse {
    position: relative;
    width: 88px;
    height: 88px;
}

.loader-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: pulse-ring 1.5s ease-out infinite;
}

.loader-ring:nth-child(2) { animation-delay: 0.3s; }
.loader-ring:nth-child(3) { animation-delay: 0.6s; }

@keyframes pulse-ring {
    0% { width: 18px; height: 18px; opacity: 1; }
    100% { width: 88px; height: 88px; opacity: 0; }
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem) 1.5rem;
    background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.18), transparent 50%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.18), transparent 50%),
        var(--color-bg);
}

.auth-container {
    width: min(100%, 520px);
    display: grid;
    gap: 2rem;
}

.auth-logo img {
    width: 3.5rem;
    height: 3.5rem;
}

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: -40% 20% auto;
    height: 140%;
    background: var(--gradient-glow);
    filter: blur(60px);
    opacity: 0.3;
    pointer-events: none;
}

.auth-card-body {
    position: relative;
    z-index: 1;
}

.auth-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.35rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.auth-form {
    display: grid;
    gap: 1.25rem;
}

.form-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.form-input {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    color: var(--color-text);
    transition: border var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
    background: var(--color-surface);
}

.form-error {
    font-size: 0.85rem;
    color: var(--color-danger);
    margin-top: 0.25rem;
}

.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 3.2rem;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

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

.forgot-link {
    font-size: 0.95rem;
    color: var(--color-primary);
}

.forgot-link:hover {
    color: var(--color-primary-600);
}

.form-row {
    display: flex;
    justify-content: flex-end;
}

.form-terms {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.terms-label {
    color: var(--color-text-muted);
}

.terms-link {
    color: var(--color-primary);
    font-weight: 600;
}

.terms-link:hover {
    color: var(--color-primary-600);
}

.auth-link {
    color: var(--color-primary);
    font-weight: 600;
}

.auth-link:hover {
    color: var(--color-primary-600);
}

.alert {
    border-left: 4px solid rgba(124, 58, 237, 0.6);
}

.alert-warning { border-left-color: rgba(245, 158, 11, 0.6); }
.alert-danger { border-left-color: rgba(239, 68, 68, 0.6); }
.alert-success { border-left-color: rgba(22, 163, 74, 0.6); }

.error-alert {
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--color-danger);
    padding: 0.9rem 1rem;
    font-weight: 600;
    font-size: 0.82rem;
}

.success-alert {
    border-radius: var(--radius-sm);
    background: rgba(22, 163, 74, 0.12);
    border: 1px solid rgba(22, 163, 74, 0.4);
    color: var(--color-success);
    padding: 0.9rem 1rem;
    font-weight: 600;
    font-size: 0.82rem;
}

.otp-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

.otp-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 58, 237, 0.12);
    color: var(--color-primary);
    font-size: 1.25rem;
}

.otp-instruction {
    text-align: center;
    color: var(--color-text-muted);
    margin: 0;
}

.otp-inputs {
    display: flex;
    gap: 0.6rem;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.otp-resend {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.5rem;
}

.otp-resend .resend-otp {
    color: var(--color-primary);
    cursor: pointer;
}

.otp-resend .resend-otp.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.otp-timer {
    color: var(--color-text-soft);
    font-size: 0.9rem;
}

.otp-expiry {
    margin-bottom: 1rem;
}

.expiry-timer {
    color: var(--color-danger);
    font-weight: 600;
    font-size: 0.95rem;
}

.auth-form .btn {
    width: 100%;
}

.auth-footer {
    margin-top: 1.5rem;
}

@media (max-width: 640px) {
    .auth-logo {
        font-size: 1.3rem;
    }

    .auth-title {
        font-size: 1.6rem;
    }

    .auth-card {
        padding: 2rem 1.5rem;
    }
    .error-alert {
    font-size: 0.69rem;
}
}