/* Auth Pages Styles - Login / Register / Forgot Password */
/* Aurora Theme with Dark/Light Mode Support */

/* ============================================
   CSS Variables - Light Mode
   ============================================ */
:root {
    --auth-bg: #f1f5f9;
    --auth-card-bg: rgba(255, 255, 255, 0.95);
    --auth-card-border: rgba(255, 255, 255, 0.8);
    --auth-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --auth-text: #1e293b;
    --auth-text-secondary: rgba(30, 41, 59, 0.85); /* Increased contrast */
    --auth-text-muted: rgba(30, 41, 59, 0.65); /* Increased contrast */
    --auth-input-bg: rgba(241, 245, 249, 0.8);
    --auth-input-border: rgba(30, 41, 59, 0.2); /* Increased contrast */
    --auth-input-focus-bg: rgba(255, 255, 255, 1);
    --auth-input-focus-border: rgba(37, 99, 235, 0.8);
    --auth-input-focus-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
    --auth-footer-border: rgba(30, 41, 59, 0.1);
    --auth-gradient-1: #818cf8;
    --auth-gradient-2: #22d3ee;
    --auth-title-gradient: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    --auth-link-color: #2563eb;
    --auth-link-hover: #1d4ed8;
    --auth-success-bg: rgba(34, 197, 94, 0.1);
    --auth-success-border: rgba(34, 197, 94, 0.3);
    --auth-success-text: #16a34a;
}

/* ============================================
   CSS Variables - Dark Mode
   ============================================ */
[data-theme="dark"] {
    --auth-bg: #0f172a;
    --auth-card-bg: rgba(30, 41, 59, 0.7); /* Increased opacity for better contrast */
    --auth-card-border: rgba(255, 255, 255, 0.15);
    --auth-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --auth-text: #ffffff;
    --auth-text-secondary: rgba(255, 255, 255, 0.9); /* Improved contrast */
    --auth-text-muted: rgba(255, 255, 255, 0.6); /* Improved contrast */
    --auth-input-bg: rgba(0, 0, 0, 0.4); /* Darker input bg */
    --auth-input-border: rgba(255, 255, 255, 0.2);
    --auth-input-focus-bg: rgba(0, 0, 0, 0.6);
    --auth-input-focus-border: rgba(59, 130, 246, 0.8);
    --auth-input-focus-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    --auth-footer-border: rgba(255, 255, 255, 0.15);
    --auth-gradient-1: #4f46e5;
    --auth-gradient-2: #06b6d4;
    --auth-title-gradient: linear-gradient(135deg, #fff 0%, #e2e8f0 100%);
    --auth-link-color: #60a5fa;
    --auth-link-hover: #93c5fd;
    --auth-success-bg: rgba(34, 197, 94, 0.15);
    --auth-success-border: rgba(34, 197, 94, 0.4);
    --auth-success-text: #4ade80;
}

/* ============================================
   Base Layout
   ============================================ */
body {
    background: var(--auth-bg);
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family);
    overflow: hidden;
    position: relative;
    transition: background-color 0.3s ease;
}

/* Dynamic Background Animation */
body::before,
body::after {
    content: '';
    position: absolute;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.6;
    animation: drift 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
    transition: background 0.3s ease;
}

body::before {
    background: radial-gradient(circle, var(--auth-gradient-1) 0%, transparent 70%);
    top: -20%;
    left: -20%;
}

body::after {
    background: radial-gradient(circle, var(--auth-gradient-2) 0%, transparent 70%);
    bottom: -20%;
    right: -20%;
    animation-delay: -10s;
}

/* Light mode: reduce animation intensity */
:root body::before,
:root body::after {
    opacity: 0.4;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(10%, 10%) scale(1.1);
    }
}

/* ============================================
   Auth Card Container - Glassmorphism
   ============================================ */
.auth-modal {
    background: var(--auth-card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--auth-card-border);
    box-shadow: var(--auth-card-shadow);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    color: var(--auth-text);
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 10;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   Header
   ============================================ */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .icon {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.5));
    animation: float 6s ease-in-out infinite;
}

.auth-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 16px 0 8px;
    background: var(--auth-title-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    font-size: 0.95rem;
    color: var(--auth-text-secondary);
    font-weight: 400;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ============================================
   Form Elements
   ============================================ */
.auth-form {
    animation: fadeIn 0.3s ease;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--auth-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 4px;
}

.form-group label .required {
    color: #ef4444;
    margin-left: 2px;
}

.form-input {
    width: 100%;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    font-size: 1rem;
    color: var(--auth-text);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    background: var(--auth-input-focus-bg);
    border-color: var(--auth-input-focus-border);
    box-shadow: var(--auth-input-focus-shadow);
}

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

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--auth-text-muted);
    font-size: 0.8rem;
}

/* ============================================
   Buttons
   ============================================ */
.submit-button {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.5);
    position: relative;
    overflow: hidden;
    min-height: 48px;
    -webkit-appearance: none;
    appearance: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.submit-button::after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(59, 130, 246, 0.6);
}

.submit-button:hover::after {
    left: 100%;
}

.submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.text-button {
    background: transparent;
    border: none;
    color: var(--auth-text-secondary);
    padding: 12px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 16px auto 0;
    transition: color 0.2s;
}

.text-button:hover {
    color: var(--auth-link-color);
}

.text-button .icon {
    width: 16px;
    height: 16px;
}

/* ============================================
   Auth Links
   ============================================ */
.auth-links {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--auth-footer-border);
}

.auth-link {
    color: var(--auth-link-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

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

.auth-link-divider {
    color: var(--auth-text-muted);
    margin: 0 12px;
}

/* ============================================
   Footer
   ============================================ */
.auth-footer {
    padding-top: 20px;
    color: var(--auth-text-muted);
    font-size: 0.75rem;
    text-align: center;
    border-top: 1px solid var(--auth-footer-border);
    margin-top: 20px;
}

/* ============================================
   Messages
   ============================================ */
.error-message {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    text-align: center;
    font-size: 0.9rem;
    display: none;
    animation: shake 0.4s ease-in-out;
}

.error-message.show {
    display: block;
}

/* Light mode error */
:root .error-message {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.success-message {
    background: var(--auth-success-bg);
    border: 1px solid var(--auth-success-border);
    color: var(--auth-success-text);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    text-align: center;
    font-size: 0.9rem;
    display: none;
}

.success-message.show {
    display: block;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* ============================================
   Step Navigation (Forgot Password)
   ============================================ */
.auth-step {
    display: none;
}

.auth-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Loading Spinner
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 480px) {
    .auth-modal {
        padding: 30px 24px;
        margin: 20px;
        max-width: calc(100% - 40px);
    }

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

    .auth-link-divider {
        display: none;
    }

    .auth-links {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
}
