/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 50%, #f0fdf4 100%);
    overflow-x: hidden;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-container {
    width: 100%;
    max-width: 28rem;
}

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

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #2563eb;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.back-btn:hover {
    color: #1d4ed8;
}

.back-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.auth-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: #6b7280;
    font-size: 1rem;
}

.auth-form-container {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    border: 1px solid #e5e7eb;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: #9ca3af;
    z-index: 1;
}

.form-input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:invalid {
    border-color: #dc2626;
}

.form-input:invalid:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 2;
    padding: 0.25rem;
}

.password-toggle:hover {
    color: #6b7280;
}

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

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: #2563eb;
    cursor: pointer;
}

.checkbox-label {
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
}

.forgot-password {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 0.875rem;
    cursor: pointer;
    transition: color 0.2s ease;
    font-weight: 500;
}

.forgot-password:hover {
    color: #1d4ed8;
}

.btn-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #2563eb;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    min-height: 3rem;
}

.btn-auth:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-auth:active:not(:disabled) {
    transform: translateY(0);
}

.btn-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-auth-green {
    background: #059669;
}

.btn-auth-green:hover:not(:disabled) {
    background: #047857;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-spinner {
    width: 1.25rem;
    height: 1.25rem;
}

.spinner {
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.auth-footer p {
    color: #6b7280;
    font-size: 0.875rem;
}

.auth-link {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
    font-size: inherit;
}

.auth-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.terms-link {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    transition: color 0.2s ease;
    font-size: inherit;
    text-decoration: underline;
}

.terms-link:hover {
    color: #1d4ed8;
}

/* Success Overlay */
.success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.6s ease;
}

.success-content {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    text-align: center;
    animation: slideUp 0.4s ease;
    max-width: 20rem;
    margin: 1rem;
}

.success-emoji {
    font-size: 3.75rem;
    margin-bottom: 1rem;
}

.success-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.success-message {
    color: #6b7280;
    font-size: 1rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* Responsive Design */
@media (max-width: 640px) {
    .auth-page {
        padding: 0.5rem;
    }
    
    .auth-container {
        max-width: 100%;
    }
    
    .auth-form-container {
        padding: 1.5rem;
    }
    
    .auth-title {
        font-size: 1.5rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Focus Styles for Accessibility */
.back-btn:focus,
.forgot-password:focus,
.auth-link:focus,
.terms-link:focus,
.btn-auth:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.checkbox:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .success-overlay {
        display: none !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .form-input {
        border-width: 2px;
    }
    
    .btn-auth {
        border: 2px solid transparent;
    }
    
    .btn-auth:focus {
        border-color: white;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (if needed in future) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here */
}

/* Loading States */
.form-input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

/* Validation States */
.form-input.error {
    border-color: #dc2626;
    background-color: #fef2f2;
}

.form-input.success {
    border-color: #059669;
    background-color: #f0fdf4;
}

/* Password Strength Indicator (for future enhancement) */
.password-strength {
    margin-top: 0.5rem;
    height: 0.25rem;
    background-color: #e5e7eb;
    border-radius: 0.125rem;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-weak {
    background-color: #dc2626;
}

.password-strength-medium {
    background-color: #f59e0b;
}

.password-strength-strong {
    background-color: #059669;
}