/* Premium Sleek Authentication Popup */

.auth-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    visibility: hidden;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-popup-overlay.show {
    display: flex;
    opacity: 1;
    visibility: visible;
    animation: popupFadeIn 0.3s ease-out;
}

.auth-popup-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.auth-popup-content {
    position: relative;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 32px;
    border: 1px solid rgba(226, 232, 240, 0.4);
    box-shadow: 
        0 32px 64px rgba(15, 23, 42, 0.15),
        0 16px 32px rgba(15, 23, 42, 0.1),
        0 0 0 1px rgba(226, 232, 240, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(30px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.auth-popup-overlay.show .auth-popup-content {
    transform: scale(1) translateY(0);
    animation: popupSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-popup-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(71, 85, 105, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(71, 85, 105, 0.15);
    color: #475569;
    font-size: 16px;
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-popup-close:hover {
    background: rgba(71, 85, 105, 0.2);
    color: #334155;
    transform: scale(1.05);
    border-color: rgba(71, 85, 105, 0.25);
}

.auth-form-container {
    padding: 32px 40px 32px;
    position: relative;
}

.auth-form-container.hidden {
    display: none;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 700;
    color: #d4af37;
    font-family: 'Playfair Display', serif;
    letter-spacing: -0.5px;
}

.auth-logo i {
    font-size: 30px;
    background: linear-gradient(135deg, #d4af37 0%, #f4d03f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    color: #ffffff;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.auth-header p {
    color: #e2e8f0;
    font-size: 16px;
    margin: 0;
    font-weight: 400;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.form-group label {
    font-weight: 600;
    color: #f1f5f9;
    font-size: 14px;
    letter-spacing: 0.025em;
    margin-bottom: 2px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group i {
    position: absolute;
    left: 16px;
    color: #64748b;
    z-index: 2;
    font-size: 15px;
    transition: color 0.3s ease;
}

.input-group input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    color: #1e293b;
    font-weight: 400;
    letter-spacing: 0.025em;
}

.input-group input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
    background: rgba(255, 255, 255, 0.98);
    transform: translateY(-1px);
}

.input-group input:focus + i {
    color: #d4af37;
}

.input-group input::placeholder {
    color: #64748b;
    opacity: 0.8;
    font-weight: 400;
}

.password-toggle {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    z-index: 2;
    padding: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle i {
    font-size: 16px;
}

/* Special states for password visibility */
.password-toggle.showing-password {
    color: #d4af37;
}

.password-toggle.showing-password i {
    color: #d4af37;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    position: relative;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.8);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #1e40af;
    border-color: #1e40af;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-password {
    color: #d4af37;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.forgot-password:hover {
    color: #b8941f;
}

.auth-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #d4af37 0%, #f4d03f 100%);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.025em;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.auth-btn:hover {
    background: linear-gradient(135deg, #b8941f 0%, #d4af37 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.auth-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e5e7eb 50%, transparent 100%);
}

.auth-divider span {
    background: rgba(248, 250, 252, 0.95);
    padding: 0 20px;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.025em;
}

.social-auth {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    color: #334155;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    letter-spacing: 0.025em;
}

.social-btn:hover {
    border-color: #d4af37;
    color: #d4af37;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.98);
}

.google-btn:hover {
    border-color: #db4437;
    color: #db4437;
    box-shadow: 0 8px 25px rgba(219, 68, 55, 0.2);
}

.facebook-btn:hover {
    border-color: #4267B2;
    color: #4267B2;
    box-shadow: 0 8px 25px rgba(66, 103, 178, 0.2);
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.auth-switch p {
    color: #e2e8f0;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 400;
}

.switch-btn {
    background: none;
    border: none;
    color: #d4af37;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-size: 15px;
    padding: 10px 16px;
    border-radius: 12px;
    letter-spacing: 0.025em;
}

.switch-btn:hover {
    color: #b8941f;
    background: rgba(212, 175, 55, 0.1);
    transform: translateY(-1px);
}

.password-strength {
    margin-top: 8px;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.strength-fill {
    height: 100%;
    width: 0%;
    background: #e74c3c;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-fill.weak {
    width: 25%;
    background: #e74c3c;
}

.strength-fill.fair {
    width: 50%;
    background: #f39c12;
}

.strength-fill.good {
    width: 75%;
    background: #f1c40f;
}

.strength-fill.strong {
    width: 100%;
    background: #27ae60;
}

.strength-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Loading States */
.auth-btn.loading {
    position: relative;
    pointer-events: none;
}

.auth-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error States */
.input-group input.error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1) !important;
}

.error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
}

.success-message {
    color: #27ae60;
    font-size: 12px;
    margin-top: 4px;
}

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

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

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .auth-popup-overlay {
        padding: 16px;
    }
    
    .auth-popup-content {
        border-radius: 24px;
        max-height: 95vh;
    }
    
    .auth-form-container {
        padding: 24px 20px 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .auth-header h1 {
        font-size: 28px;
    }
    
    .auth-header {
        margin-bottom: 24px;
    }
    
    .auth-logo {
        margin-bottom: 16px;
        font-size: 22px;
    }
    
    .form-options {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .auth-popup-close {
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .input-group input {
        padding: 16px 16px 16px 48px;
    }
    
    .password-toggle {
        right: 20px;
        width: 24px;
        height: 24px;
        padding: 4px;
    }
    
    .password-toggle i {
        font-size: 15px;
    }
    
    .auth-btn {
        padding: 16px 20px;
    }
}

@media (max-width: 480px) {
    .auth-popup-content {
        border-radius: 16px;
    }
    
    .auth-form-container {
        padding: 20px;
    }
    
    .auth-header h1 {
        font-size: 22px;
    }
    
    .input-group input {
        padding: 14px 14px 14px 44px;
        font-size: 16px;
    }
    
    .auth-btn {
        padding: 14px 20px;
        font-size: 16px;
    }
}

/* Arabic Language Support */
[dir="rtl"] .input-group i {
    left: auto;
    right: 16px;
}

[dir="rtl"] .input-group input {
    padding: 16px 48px 16px 16px;
}

[dir="rtl"] .password-toggle {
    right: auto;
    left: 16px;
}

[dir="rtl"] .form-row {
    direction: rtl;
}

[dir="rtl"] .auth-switch {
    direction: rtl;
}

[dir="rtl"] .social-btn {
    direction: rtl;
}

[dir="rtl"] .social-btn i {
    order: 2;
}

[dir="rtl"] .social-btn span {
    order: 1;
}

[dir="rtl"] .auth-popup-close {
    right: auto;
    left: 20px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .auth-popup-content {
        background: rgba(30, 30, 30, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .input-group input {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        color: var(--white);
    }
    
    .input-group input:focus {
        background: rgba(255, 255, 255, 0.15);
    }
    
    .social-btn {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        color: var(--white);
    }
    
    .checkmark {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
    }
}
