/* ================================
   MODERN AUTHENTICATION SYSTEM
   ================================ */

/* Modal Animation System */
.auth-modal {
    animation: modalFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    background: rgba(0, 0, 0, 0.65);
}

.auth-modal > div {
    animation: modalSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

@keyframes modalFadeIn {
    from { 
        opacity: 0; 
        backdrop-filter: blur(0px);
    }
    to { 
        opacity: 1; 
        backdrop-filter: blur(12px);
    }
}

@keyframes modalSlideIn {
    from { 
        opacity: 0;
        transform: translateY(40px) scale(0.92) rotateX(10deg);
        filter: blur(4px);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0deg);
        filter: blur(0px);
    }
}

/* Enhanced Input Field System */
.auth-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.auth-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
    color: #1f2937;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.auth-input:focus {
    border-color: #3b82f6;
    background: #fefefe;
    transform: translateY(-1px);
    box-shadow: 
        0 4px 20px rgba(59, 130, 246, 0.15),
        0 0 0 4px rgba(59, 130, 246, 0.08),
        0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-input:hover:not(:focus) {
    border-color: #9ca3af;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Input States */
.auth-input.error {
    border-color: #ef4444;
    background: #fef2f2;
    box-shadow: 
        0 0 0 4px rgba(239, 68, 68, 0.1),
        0 2px 10px rgba(239, 68, 68, 0.15);
    animation: inputShake 0.5s ease-in-out;
}

.auth-input.success {
    border-color: #10b981;
    background: #f0fdf4;
    box-shadow: 
        0 0 0 4px rgba(16, 185, 129, 0.1),
        0 2px 10px rgba(16, 185, 129, 0.15);
}

@keyframes inputShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Enhanced Password Strength System */
.password-strength-container {
    margin-top: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.password-strength-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.strength-indicator {
    height: 100%;
    border-radius: 3px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.strength-indicator::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 25%, rgba(255,255,255,0.3) 25%, rgba(255,255,255,0.3) 50%, transparent 50%, transparent 75%, rgba(255,255,255,0.3) 75%);
    background-size: 8px 8px;
    animation: strengthShimmer 1s linear infinite;
}

@keyframes strengthShimmer {
    0% { background-position: 0 0; }
    100% { background-position: 8px 0; }
}

/* Strength Levels */
.strength-very-weak { 
    background: linear-gradient(90deg, #ef4444, #dc2626); 
    width: 20%; 
}

.strength-weak { 
    background: linear-gradient(90deg, #f97316, #ea580c); 
    width: 40%; 
}

.strength-fair { 
    background: linear-gradient(90deg, #eab308, #ca8a04); 
    width: 60%; 
}

.strength-good { 
    background: linear-gradient(90deg, #3b82f6, #2563eb); 
    width: 80%; 
}

.strength-strong { 
    background: linear-gradient(90deg, #10b981, #059669); 
    width: 100%; 
}

/* Enhanced Button System */
.auth-btn {
    position: relative;
    overflow: hidden;
    font-weight: 600;
    font-size: 15px;
    padding: 14px 24px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: none;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    filter: brightness(1.05);
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.auth-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-btn:hover::before {
    left: 100%;
}

/* Primary Auth Button */
.auth-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.auth-btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

/* Success Auth Button */
.auth-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.auth-btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

/* Warning Auth Button */
.auth-btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.auth-btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

/* Enhanced Social Login System */
.social-login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid transparent;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.social-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.social-btn:active {
    transform: translateY(0);
}

/* Google Button Enhanced */
.google-btn {
    background: linear-gradient(135deg, #db4437 0%, #c23321 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(219, 68, 55, 0.3);
}

.google-btn:hover {
    background: linear-gradient(135deg, #c23321 0%, #a52714 100%);
    box-shadow: 0 6px 20px rgba(219, 68, 55, 0.5);
}

.google-btn i {
    margin-right: 8px;
    font-size: 16px;
}

/* Facebook Button Enhanced */
.facebook-btn {
    background: linear-gradient(135deg, #4267b2 0%, #365899 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(66, 103, 178, 0.3);
}

.facebook-btn:hover {
    background: linear-gradient(135deg, #365899 0%, #2d4373 100%);
    box-shadow: 0 6px 20px rgba(66, 103, 178, 0.5);
}

.facebook-btn i {
    margin-right: 8px;
    font-size: 16px;
}

/* Enhanced Form Labels */
.auth-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.auth-label i {
    margin-right: 8px;
    font-size: 13px;
    opacity: 0.8;
}

.auth-input:focus + .auth-label,
.auth-input-group:focus-within .auth-label {
    color: #3b82f6;
}

/* Enhanced Validation System */
.validation-message {
    font-size: 13px;
    font-weight: 500;
    margin-top: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
}

.validation-error {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    animation: validationSlideIn 0.3s ease-out;
}

.validation-success {
    color: #059669;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    animation: validationSlideIn 0.3s ease-out;
}

.validation-message i {
    margin-right: 6px;
    font-size: 12px;
}

@keyframes validationSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Password Match Indicator */
.password-match-container {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.password-match-success {
    color: #059669;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.password-match-error {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

/* Enhanced Checkbox Styling */
.auth-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    margin: 16px 0;
}

.auth-checkbox input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background: white;
    margin-right: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.auth-checkbox input[type="checkbox"]:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.auth-checkbox input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-color: #3b82f6;
    transform: scale(1.05);
}

.auth-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    animation: checkmarkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkmarkPop {
    0% { transform: translate(-50%, -50%) scale(0); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* Enhanced Loading States */
.auth-btn.loading {
    pointer-events: none;
    position: relative;
    color: transparent;
}

.auth-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: authButtonSpin 1s linear infinite;
}

@keyframes authButtonSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification System */
.auth-notification {
    position: fixed;
    top: 24px;
    right: 24px;
    max-width: 420px;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 1000;
    backdrop-filter: blur(8px);
    animation: notificationSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.auth-notification.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95));
    color: white;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.auth-notification.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.auth-notification.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.95));
    color: white;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

@keyframes notificationSlideIn {
    from {
        transform: translateX(100%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

/* Modal Header Enhancements */
.auth-modal-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    position: relative;
    overflow: hidden;
}

.auth-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: headerShimmer 3s ease-in-out infinite;
}

@keyframes headerShimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .auth-modal > div {
        margin: 12px;
        max-width: calc(100% - 24px);
        max-height: calc(100vh - 24px);
        overflow-y: auto;
    }
    
    .auth-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 16px;
    }
    
    .auth-btn {
        padding: 14px 20px;
        font-size: 15px;
        width: 100%;
    }
    
    .social-login-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .social-btn {
        padding: 12px 16px;
        font-size: 14px;
        width: 100%;
    }
    
    .auth-notification {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
    }
    
    .password-strength-container {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .auth-modal > div {
        margin: 8px;
        max-width: calc(100% - 16px);
        border-radius: 16px;
    }
    
    .auth-input {
        padding: 12px 14px;
        font-size: 16px;
    }
    
    .auth-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    .auth-modal > div {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        color: #f9fafb;
        border: 1px solid rgba(75, 85, 99, 0.3);
    }
    
    .auth-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .auth-input:focus {
        background: #4b5563;
        border-color: #60a5fa;
        box-shadow: 
            0 4px 20px rgba(96, 165, 250, 0.15),
            0 0 0 4px rgba(96, 165, 250, 0.08);
    }
    
    .auth-input.error {
        background: #2d1b1b;
        border-color: #ef4444;
    }
    
    .auth-input.success {
        background: #1a2e1a;
        border-color: #10b981;
    }
    
    .auth-label {
        color: #e5e7eb;
    }
    
    .password-strength-container {
        background: #374151;
        border-color: #4b5563;
    }
    
    .validation-error {
        background: #2d1b1b;
        border-color: #ef4444;
        color: #fca5a5;
    }
    
    .validation-success {
        background: #1a2e1a;
        border-color: #10b981;
        color: #86efac;
    }
}

/* Accessibility Enhancements */
.auth-input:focus-visible,
.auth-btn:focus-visible,
.social-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .auth-modal,
    .auth-modal > div,
    .auth-input,
    .auth-btn,
    .social-btn,
    .validation-message,
    .auth-notification {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus Management */
.auth-modal:focus-within .auth-input:focus {
    box-shadow: 
        0 4px 20px rgba(59, 130, 246, 0.2),
        0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Utility Classes for Auth System */
.auth-divider {
    position: relative;
    text-align: center;
    margin: 24px 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #e5e7eb, transparent);
}

.auth-divider span {
    background: white;
    padding: 0 16px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

.auth-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.auth-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Animation Performance Optimization */
.auth-modal,
.auth-modal > div,
.auth-input,
.auth-btn,
.social-btn {
    will-change: transform;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}