/* Deep Space Purple Theme - Gen Z Design */
:root {
    --primary-purple: #6366f1;
    --deep-purple: #4338ca;
    --space-dark: #0f0f23;
    --space-medium: #1a1a2e;
    --space-light: #16213e;
    --cosmic-pink: #ec4899;
    --stellar-blue: #06b6d4;
    --nebula-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --cosmic-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--space-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Animated Space Background */
.space-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
}

.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 20px 30px, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(1px 1px at 40px 70px, rgba(255, 255, 255, 0.2), transparent),
        radial-gradient(0.5px 0.5px at 90px 40px, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(0.5px 0.5px at 130px 80px, rgba(255, 255, 255, 0.2), transparent),
        radial-gradient(1px 1px at 160px 30px, rgba(255, 255, 255, 0.25), transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: twinkle 6s infinite;
    opacity: 0.4;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.4; }
}

.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: var(--cosmic-gradient);
    filter: blur(40px);
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 200px;
    height: 200px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 150px;
    height: 150px;
    top: 60%;
    right: 20%;
    animation-delay: 2s;
}

.shape-3 {
    width: 100px;
    height: 100px;
    bottom: 20%;
    left: 60%;
    animation-delay: 4s;
}

.shape-4 {
    width: 120px;
    height: 120px;
    top: 30%;
    right: 10%;
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(120deg); }
    66% { transform: translateY(10px) rotate(240deg); }
}

/* Auth Container */
.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

/* Auth Card */
.auth-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem 2.5rem 2rem 2.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 60px rgba(99, 102, 241, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideIn 0.8s ease-out;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--cosmic-gradient);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo */
.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo i {
    font-size: 3rem;
    background: var(--cosmic-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    display: block;
    animation: rocket 2s ease-in-out infinite;
}

@keyframes rocket {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--cosmic-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--cosmic-pink);
}

/* Page Indicator */
.page-indicator {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: inline-block;
}

.indicator-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Container */
.form-container {
    animation: fadeIn 0.5s ease-out;
}

.form-container.hidden {
    display: none;
}

/* Login Form Specific Styling */
#loginForm {
    border-left: 3px solid var(--stellar-blue);
    padding-left: 1.5rem;
}

#loginForm h2 {
    color: var(--stellar-blue);
}

/* Signup Form Specific Styling */
#signupForm {
    border-left: 3px solid var(--cosmic-pink);
    padding-left: 1.5rem;
}

#signupForm h2 {
    color: var(--cosmic-pink);
}

/* Single Page Form Styling - Remove borders when only one form */
body:has(.form-container:only-of-type) .form-container {
    border-left: none;
    padding-left: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1rem;
    font-weight: 400;
}

/* Form Styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group i {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    z-index: 2;
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: rgba(255, 255, 255, 0.15);
}

.input-group input::placeholder {
    color: var(--text-secondary);
}

.toggle-password {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: var(--text-primary);
}

/* Optional Field Styling */
.optional-field {
    position: relative;
    margin-top: 0.5rem;
}

.optional-field input {
    font-size: 0.9rem;
    padding: 0.8rem 1rem 0.8rem 3rem;
    opacity: 0.8;
}

/* Auth Button */
.auth-btn {
    background: linear-gradient(135deg, var(--primary-purple), var(--cosmic-pink));
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-top: 1.5rem;
    min-height: 48px;
    width: 100%;
    z-index: 10; /* Ensure button is clickable */
    pointer-events: auto; /* Explicitly enable pointer events */
    touch-action: manipulation; /* Better touch support */
}

.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, var(--text-secondary), var(--text-secondary));
    pointer-events: none;
}

.auth-btn:not(:disabled):hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 8px 25px rgba(99, 102, 241, 0.4),
        0 0 20px rgba(236, 72, 153, 0.3);
}

.auth-btn:not(:disabled):active {
    transform: translateY(0) scale(0.98);
    transition: transform 0.1s ease;
}

/* Loading Animation */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading .auth-btn {
    background: var(--text-secondary);
}

.loading .auth-btn::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Form Footer */
.form-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.form-footer a {
    color: var(--primary-purple);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.form-footer a:hover {
    color: var(--cosmic-pink);
}

/* Social Proof */
.social-proof {
    display: flex;
    gap: 2rem;
    margin-top: 3rem;
    padding: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    animation: slideUp 1s ease-out 0.5s both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat {
    text-align: center;
    flex: 1;
}

.stat .number {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--cosmic-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.stat .label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .auth-container {
        padding: 1rem;
    }
    
    .auth-card {
        padding: 2rem;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .social-proof {
        flex-direction: column;
        gap: 1rem;
    }
    
    .shape {
        display: none;
    }
}

/* Loading Animation */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading .auth-btn {
    background: var(--text-secondary);
}

.loading .auth-btn::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Form Styles */

/* Name Row - Side by side */
.name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 480px) {
    .name-row {
        grid-template-columns: 1fr;
    }
}

/* Input Field Container */
.input-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-field label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

/* Enhanced Input Groups */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 2.75rem; /* More right padding to accommodate icons */
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    min-height: 48px;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: rgba(255, 255, 255, 0.12);
}

/* Validation Icons */
.validation-icon {
    position: absolute;
    right: 0.5rem; /* Moved closer to edge */
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: none;
    z-index: 4; /* Higher z-index than toggle button */
}

.validation-icon.valid {
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
}

.validation-icon.valid::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.validation-icon.invalid {
    background: var(--error);
    display: flex;
    align-items: center;
    justify-content: center;
}

.validation-icon.invalid::after {
    content: '✗';
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Enhanced Field Hints */
.field-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-top: 0.25rem;
}

.field-hint.error {
    color: var(--error);
    opacity: 1;
}

.field-hint.success {
    color: var(--success);
    opacity: 1;
}

.error-message {
    min-height: 1.2rem;
    font-size: 0.75rem;
    color: var(--error);
    margin-top: 0.25rem;
}

/* Password Requirements */
.password-requirements {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.requirement {
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.requirement.met {
    color: var(--success);
}

/* Password Strength Meter */
.password-strength {
    margin-top: 0.75rem;
}

.strength-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1.5px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 1.5px;
}

.strength-fill.weak {
    background: var(--error);
    width: 25%;
}

.strength-fill.fair {
    background: var(--warning);
    width: 50%;
}

.strength-fill.good {
    background: var(--success);
    width: 75%;
}

.strength-fill.strong {
    background: var(--success);
    width: 100%;
}

/* Enhanced Toggle Password */
.toggle-password {
    position: absolute;
    right: 2.25rem; /* Moved left to make room for validation icon */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s ease;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.toggle-password:hover {
    color: var(--text-primary);
}

/* Special case for password fields - adjust validation icon when toggle button is present */
.input-group:has(.toggle-password) .validation-icon {
    right: 0.25rem; /* Even closer to edge when toggle button is present */
}

/* Trust Line */
.trust-line {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    opacity: 0.8;
}

/* Enhanced Form Footer */
.form-footer {
    text-align: center;
    margin-top: 2rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.footer-link {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--text-primary);
}

.security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    opacity: 0.7;
}

/* Enhanced Auth Button */
.auth-btn {
    background: linear-gradient(135deg, var(--primary-purple), var(--cosmic-pink));
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-top: 1.5rem;
    min-height: 48px;
    width: 100%;
}

.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, var(--text-secondary), var(--text-secondary));
}

.auth-btn:not(:disabled):hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 8px 25px rgba(99, 102, 241, 0.4),
        0 0 20px rgba(236, 72, 153, 0.3);
}