/* Modern Authentication Styles */
:root {
    --auth-primary: #f59e0b;
    --auth-primary-dark: #d97706;
    --auth-primary-light: #fcd34d;
    --auth-primary-x-light: #fcd34d66;
    --auth-primary-xx-light: #fcd34d22;
    
    --auth-success: #10b981;
    --auth-error: #ef4444;
    --auth-warning: #f59e0b;
    
    --auth-text-primary: #111827;
    --auth-text-secondary: #6b7280;
    --auth-text-muted: #9ca3af;
    
    --auth-bg-primary: #ffffff;
    --auth-bg-secondary: #f9fafb;
    --auth-bg-tertiary: #f3f4f6;
    
    --auth-border: #e5e7eb;
    --auth-border-light: #f3f4f6;
    
    --auth-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --auth-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --auth-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --auth-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --auth-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --auth-radius-sm: 0.375rem;
    --auth-radius: 0.5rem;
    --auth-radius-md: 0.75rem;
    --auth-radius-lg: 1rem;
    --auth-radius-xl: 1.5rem;
    
    --auth-spacing-xs: 0.25rem;
    --auth-spacing-sm: 0.5rem;
    --auth-spacing: 1rem;
    --auth-spacing-lg: 1.5rem;
    --auth-spacing-xl: 2rem;
    --auth-spacing-2xl: 3rem;
}

/* Dark mode variables */
.dark-mode {   
    --auth-text-primary: #f9fafb;
    --auth-text-secondary: #d1d5db;
    --auth-text-muted: #9ca3af;
    
    --auth-bg-primary: #1f2937;
    --auth-bg-secondary: #111827;
    --auth-bg-tertiary: #374151;
    
    --auth-border: #374151;
    --auth-border-light: #4b5563;
}

/* Main container */
.auth-container {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--auth-primary-xx-light) 0%, var(--auth-bg-secondary) 50%, var(--auth-primary-x-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--auth-spacing);
    position: relative;
    overflow: hidden;
}

/* Animated background */
.auth-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.auth-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, var(--auth-primary-x-light) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, var(--auth-primary-xx-light) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, var(--auth-primary-x-light) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* Auth card */
.auth-card {
    background: var(--auth-bg-primary);
    border-radius: var(--auth-radius-xl);
    padding: var(--auth-spacing-2xl);
    box-shadow: var(--auth-shadow-xl);
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 1;
    border: 1px solid var(--auth-border-light);
    backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Header */
.auth-header {
    text-align: center;
    margin-bottom: var(--auth-spacing-2xl);
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--auth-spacing-sm);
    margin-bottom: var(--auth-spacing-lg);
}

.logo:not(footer .logo) {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
    border-radius: var(--auth-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--auth-shadow-lg);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: var(--auth-shadow-lg);
    }
    50% { 
        transform: scale(1.05); 
        box-shadow: 0 20px 40px -12px rgba(245, 158, 11, 0.4);
    }
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--auth-text-primary);
    letter-spacing: -0.025em;
}

.auth-header h1 {
    margin: 0 0 var(--auth-spacing-sm);
    color: var(--auth-text-primary);
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.auth-header p {
    margin: 0;
    color: var(--auth-text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}

/* Form tabs */
.form-tabs {
    display: flex;
    margin-bottom: var(--auth-spacing-xl);
    background: var(--auth-bg-tertiary);
    border-radius: var(--auth-radius-lg);
    padding: 4px;
    border: 1px solid var(--auth-border);
}

.tab-btn {
    flex: 1;
    padding: var(--auth-spacing) var(--auth-spacing-lg);
    background: transparent;
    border: none;
    border-radius: var(--auth-radius-md);
    color: var(--auth-text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--auth-spacing-sm);
}

.tab-btn.active {
    background: var(--auth-bg-primary);
    color: var(--auth-primary);
    box-shadow: var(--auth-shadow-sm);
    transform: translateY(-1px);
}

.tab-btn:hover:not(.active) {
    color: var(--auth-text-primary);
    background: var(--auth-bg-secondary);
}

/* Form containers */
.form-container {
    display: none;
}

.form-container.active {
    display: block;
    animation: slideInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Form steps */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-header {
    text-align: center;
    margin-bottom: var(--auth-spacing-xl);
}

.step-header h3 {
    margin: 0 0 var(--auth-spacing-sm);
    color: var(--auth-text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.step-header p {
    margin: 0;
    color: var(--auth-text-secondary);
    font-size: 0.875rem;
}

/* Form groups */
.form-group {
    margin-bottom: var(--auth-spacing-lg);
    position: relative;
}

.form-row {
    display: flex;
    gap: var(--auth-spacing);
}

.form-row .form-group {
    flex: 1;
    margin-bottom: var(--auth-spacing-lg);
}

/* Input wrapper */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper.focused .input-icon {
    color: var(--auth-primary);
    transform: scale(1.1);
}

.input-wrapper.focused .floating-label {
    color: var(--auth-primary);
    /* transform: translateY(-50%) scale(0.85); */
    transform: translateY(-170%) scale(0.85);
}

/* Input icon */
.input-icon {
    position: absolute;
    left: var(--auth-spacing);
    color: var(--auth-text-muted);
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
}

/* Form input */
.form-input {
    width: 100%;
    padding: var(--auth-spacing) var(--auth-spacing) var(--auth-spacing) 2.75rem;
    border: 2px solid var(--auth-border);
    border-radius: var(--auth-radius-lg);
    background: var(--auth-bg-primary);
    color: var(--auth-text-primary);
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    font-family: inherit;
}

.form-input:not(.no-hover):focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px var(--auth-primary-xx-light);
    transform: translateY(-1px);
}

.form-input#recover-email{
    padding: 0.8em 2em;
    margin: 0.5em 0;
}

.form-input.valid {
    border-color: var(--auth-success);
    background: rgba(16, 185, 129, 0.05);
}

.form-input.invalid {
    border-color: var(--auth-error);
    background: rgba(239, 68, 68, 0.05);
}

.form-input.error {
    border-color: var(--auth-error);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Floating labels */
.floating-label {
    position: absolute;
    left: 2.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-text-muted);
    font-size: 1rem;
    font-weight: 500;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--auth-bg-primary);
    padding: 0 var(--auth-spacing-xs);
    z-index: 1;
}

.form-input:focus + .floating-label,
.form-input:not(:placeholder-shown) + .floating-label {
    /* transform: translateY(-50%) scale(0.85); */
    transform: translateY(-170%) scale(0.85);
    color: var(--auth-primary);
}

/* Password toggle */
.password-toggle {
    position: absolute;
    right: var(--auth-spacing);
    color: var(--auth-text-muted);
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
}

.password-toggle:hover {
    color: var(--auth-primary);
    transform: scale(1.1);
}

/* Password strength */
.password-strength {
    margin-top: var(--auth-spacing-sm);
}

.strength-bar {
    height: 4px;
    background: var(--auth-border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--auth-spacing-xs);
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.strength-text {
    font-size: 0.75rem;
    color: var(--auth-text-muted);
    font-weight: 500;
}

/* Form options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--auth-spacing-lg);
    font-size: 0.875rem;
}

/* Custom checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: var(--auth-spacing-sm);
}

.custom-checkbox {
  opacity: 0;
  position: absolute;
  left: 0; /* or clip it with clip-path */
}


.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--auth-spacing-sm);
    cursor: pointer;
    color: var(--auth-text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.checkbox-label:hover {
    color: var(--auth-text-primary);
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.custom-checkbox:checked + .checkbox-label .checkmark {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
}

.custom-checkbox:checked + .checkbox-label .checkmark::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Forgot link */
.forgot-link {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.forgot-link:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

/* Buttons */
.auth-button {
    width: 100%;
    padding: var(--auth-spacing) var(--auth-spacing-lg);
    border: none;
    border-radius: var(--auth-radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--auth-spacing-sm);
    font-family: inherit;
    margin-bottom: var(--auth-spacing-lg);
}

.primary-button {
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
    color: white;
    box-shadow: var(--auth-shadow-md);
}

.primary-button:hover {
    background: linear-gradient(135deg, var(--auth-primary-dark) 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: var(--auth-shadow-lg);
}

.secondary-button {
    background: var(--auth-bg-secondary);
    color: var(--auth-text-primary);
    border: 2px solid var(--auth-border);
    box-shadow: var(--auth-shadow-sm);
}

.secondary-button:hover {
    background: var(--auth-bg-tertiary);
    border-color: var(--auth-primary);
    transform: translateY(-1px);
    box-shadow: var(--auth-shadow);
}

.outline-button {
    background: transparent;
    color: var(--auth-text-secondary);
    border: 2px solid var(--auth-border);
}

.outline-button:hover {
    background: var(--auth-bg-secondary);
    color: var(--auth-text-primary);
    border-color: var(--auth-primary);
}

.button-text {
    transition: all 0.3s ease;
}

.button-icon {
    transition: all 0.3s ease;
}

.auth-button:hover .button-icon {
    transform: translateX(2px);
}

.auth-button:active {
    transform: translateY(0);
}

/* Loading state */
.auth-button.loading {
    pointer-events: none;
    opacity: 0.8;
}

.auth-button.loading .button-text {
    opacity: 0;
}

.auth-button.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Step navigation */
.step-navigation {
    display: flex;
    gap: var(--auth-spacing);
}

.step-navigation .auth-button {
    flex: 1;
    margin-bottom: 0;
}

/* Divider */
.divider {
    text-align: center;
    margin: var(--auth-spacing-lg) 0;
    position: relative;
    color: var(--auth-text-muted);
    font-size: 0.875rem;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--auth-border);
}

.divider span {
    background: var(--auth-bg-primary);
    padding: 0 var(--auth-spacing);
    position: relative;
    z-index: 1;
}

/* Social login */
.social-login {
    display: flex;
    gap: var(--auth-spacing-sm);
    margin-bottom: var(--auth-spacing-lg);
}

.social-btn {
    flex: 1;
    padding: var(--auth-spacing);
    border: 2px solid var(--auth-border);
    border-radius: var(--auth-radius-lg);
    background: var(--auth-bg-primary);
    color: var(--auth-text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--auth-spacing-sm);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
}

.social-btn:hover {
    border-color: var(--auth-primary);
    background: var(--auth-bg-secondary);
    color: var(--auth-primary);
    transform: translateY(-2px);
    box-shadow: var(--auth-shadow);
}

/* Field errors */
.field-error {
    color: var(--auth-error);
    font-size: 0.75rem;
    margin-top: var(--auth-spacing-xs);
    font-weight: 500;
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .auth-container {
        padding: var(--auth-spacing-sm);
        min-height: 100dvh;
    }
    
    .auth-card {
        padding: var(--auth-spacing-xl);
        margin: var(--auth-spacing) 0;
        border-radius: var(--auth-radius-lg);
        max-width: 100%;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .social-login {
        flex-direction: column;
    }
    
    .form-input {
        padding: var(--auth-spacing) var(--auth-spacing) var(--auth-spacing) 2.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .step-navigation {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: var(--auth-spacing-xs);
    }
    
    .auth-card {
        padding: var(--auth-spacing-lg);
    }
    
    .logo:not(footer .logo) {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
}

/* Dark mode adjustments */
.dark-mode .auth-card {
    background: var(--auth-bg-primary);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.dark-mode .form-input {
    /* background: var(--auth-bg-secondary); */
    border-color: var(--auth-border);
}

.dark-mode .form-input:focus {
    background: var(--auth-bg-primary);
}

.dark-mode .social-btn {
    background: var(--auth-bg-secondary);
    border-color: var(--auth-border);
}

.dark-mode .form-tabs {
    background: var(--auth-bg-tertiary);
}

.dark-mode .tab-btn.active {
    background: var(--auth-bg-primary);
}

.dark-mode .floating-label {
    background: var(--auth-bg-primary);
}

.dark-mode .divider span {
    background: var(--auth-bg-primary);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.auth-button:focus,
.form-input:not(.no-hover):focus,
.tab-btn:focus,
.social-btn:focus {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .auth-card {
        border: 2px solid var(--auth-text-primary);
    }
    
    .form-input {
        border-width: 2px;
    }
    
    .auth-button {
        border: 2px solid currentColor;
    }
}