/* Shared styles for the authentication pages (login, signup, etc.) - Polished Cinematic Version */

body {
    /* Auth pages center their content */
    display: grid;
    place-items: center;
    padding: 2rem;
    min-height: 100vh;
    
    /* 1. Base Background (The "Wall" behind everything) */
    background-color: var(--color-background);
    background-image: radial-gradient(circle at 50% 0%, var(--color-surface) 0%, var(--color-background) 80%);
    
    margin: 0;
    box-sizing: border-box;
    position: relative;
    overflow-x: hidden;
}

/* 2. Particle Canvas - Sits ON TOP of the background, but BEHIND content */
#welcome-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0; /* Not -1, so it sits on top of body bg */
    pointer-events: none;
}

/* 3. Content - Sits ON TOP of Canvas */
.auth-container {
    position: relative;
    z-index: 1; /* Explicitly above canvas */
    
    width: 100%;
    max-width: 440px; 
    text-align: center;
    
    /* Glassmorphism Polish */
    background: rgba(var(--color-surface-rgb), 0.75); 
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    
    padding: 3rem 2.5rem;
    border-radius: 24px;
    
    /* Subtle Border */
    border: 1px solid rgba(var(--color-border-rgb), 0.5);
    
    /* Deep Premium Shadow */
    box-shadow: 0 30px 60px -12px rgba(0,0,0, 0.25), 
                0 18px 36px -18px rgba(0,0,0, 0.3);
                
    box-sizing: border-box;
    
    /* Entry Animation */
    animation: scaleIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: scale(0.95) translateY(10px);
}

@keyframes scaleIn {
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-header {
    margin-bottom: 2rem;
}

.auth-header .headline {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--color-text);
    letter-spacing: -0.03em;
}

.auth-header .subheadline {
    font-size: 1.05rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* --- Input Groups & Icons --- */
.input-group {
    position: relative;
    margin-bottom: 1.25rem; 
}

/* Icon Container (Left) */
.input-icon {
    position: absolute;
    left: 1.25rem; /* Indent slightly more */
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    width: 20px;
    height: 20px;
    transition: color 0.2s ease;
    z-index: 2;
    opacity: 0.7;
}

/* Increased Specificity to override base.css input styles */
.input-group .form-input {
    width: 100%;
    padding: 1rem 1.25rem;
    padding-left: 3.5rem; /* Increased padding to account for icon */
    
    /* Match Onboarding Input Style */
    background: rgba(var(--color-background-rgb), 0.6); 
    border: 1px solid var(--color-border);
    border-radius: 14px; 
    
    color: var(--color-text);
    font-size: 1rem;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* Highlight icon when input is focused */
.form-input:focus + .input-icon,
.input-group:focus-within .input-icon {
    color: var(--color-primary);
    opacity: 1;
}

.input-group .form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.15);
    background: var(--color-surface);
    transform: translateY(-1px); 
}

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

/* Password Toggle Button Styles */
.password-toggle {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: color 0.2s;
    opacity: 0.7;
}

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

.password-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* --- Error Messages --- */
.error-message-container {
    background-color: rgba(var(--color-error-rgb), 0.08);
    border: 1px solid rgba(var(--color-error-rgb), 0.15);
    border-radius: 12px;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    text-align: center;
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

#error-message, .error-text {
    color: var(--color-error);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

/* --- Buttons --- */
.cta-button {
    width: 100%;
    display: flex; 
    justify-content: center;
    align-items: center;
    padding: 1rem;
    font-size: 1.05rem;
    border-radius: 14px;
    background-color: var(--color-primary);
    color: white;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.25);
}

.cta-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--color-primary-rgb), 0.35);
    filter: brightness(105%);
}

.cta-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.2);
}

.cta-button:disabled {
    background-color: var(--color-surface); 
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.secondary-link {
    color: var(--color-text-muted);
    text-decoration: none;
    margin-top: 1.5rem;
    display: inline-block;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.secondary-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* --- Social Sign-in --- */
.social-signin {
    margin-bottom: 1.5rem;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.9rem 1rem;
    background-color: var(--color-surface); 
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.social-btn svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.social-btn:hover {
    background-color: var(--color-background);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    border-color: var(--color-text-muted); 
}

/* --- Divider --- */
.divider {
    text-align: center;
    margin: 1.5rem 0;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0.6;
}

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

.form-footer {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

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

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

/* Legal Footer */
.legal-footer {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 2rem;
    line-height: 1.5;
    opacity: 0.8;
}

.legal-footer a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s;
    border-bottom: 1px solid transparent;
}

.legal-footer a:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    body {
        padding: 1rem;
        background: var(--color-background); /* Simplify gradient on mobile */
    }

    .auth-container {
        padding: 2rem 1.5rem;
        border: none; 
        box-shadow: none;
        background: transparent; 
        backdrop-filter: none;
        flex-grow: 1; 
        display: flex;
        flex-direction: column;
        justify-content: center;
        max-width: none;
    }
    
    .auth-header .headline {
        font-size: 1.8rem;
    }
}
