/**
 * تصميم صفحات المصادقة الاحترافي
 * Professional Authentication Pages Design
 */

/* ========== Auth Container ========== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    padding: 2rem;
}

/* خلفية متحركة */
.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
}

@keyframes moveBackground {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* دوائر ديكور */
.auth-decoration {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.auth-decoration:nth-child(1) {
    width: 300px;
    height: 300px;
    top: -150px;
    right: -150px;
    animation: float 6s ease-in-out infinite;
}

.auth-decoration:nth-child(2) {
    width: 200px;
    height: 200px;
    bottom: -100px;
    left: -100px;
    animation: float 8s ease-in-out infinite reverse;
}

.auth-decoration:nth-child(3) {
    width: 150px;
    height: 150px;
    top: 50%;
    left: 10%;
    animation: float 7s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* ========== Auth Box ========== */
.auth-box {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.6s ease-out;
}

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

/* ========== Auth Header ========== */
.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.auth-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ========== Form Styles ========== */
.auth-form {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 1.1rem;
    transition: color 0.3s;
    pointer-events: none;
    z-index: 1;
}

.form-control {
    width: 100%;
    padding: 1rem 1rem 1rem 3.5rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-control:focus + .input-icon {
    color: #667eea;
}

/* زر إظهار/إخفاء كلمة المرور */
.password-toggle {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.5rem;
    transition: color 0.3s;
    z-index: 2;
}

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

/* ========== Remember & Forgot ========== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.remember-me label {
    margin: 0;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.forgot-password {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.forgot-password:hover {
    color: #764ba2;
}

/* ========== Submit Button ========== */
.btn-auth {
    width: 100%;
    padding: 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-auth::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-auth:hover::before {
    left: 100%;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

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

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

/* Loading State */
.btn-auth.loading {
    pointer-events: none;
}

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

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

/* ========== Divider ========== */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 2rem 0;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

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

.auth-divider span {
    padding: 0 1rem;
}

/* ========== Social Login ========== */
.social-login {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.social-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.social-btn i {
    font-size: 1.25rem;
}

.social-btn.google:hover {
    border-color: #ea4335;
}

.social-btn.facebook:hover {
    border-color: #1877f2;
}

/* ========== Footer Links ========== */
.auth-footer {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s;
}

.auth-footer a:hover {
    color: #764ba2;
}

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    margin-top: 1rem;
    transition: color 0.3s;
}

.back-home:hover {
    color: var(--text-primary);
}

/* ========== Alert Messages ========== */
.auth-alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-alert.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.auth-alert.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.auth-alert.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.auth-alert i {
    font-size: 1.25rem;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .auth-wrapper {
        padding: 1rem;
    }
    
    .auth-box {
        padding: 2rem 1.5rem;
    }
    
    .auth-title {
        font-size: 1.75rem;
    }
    
    .auth-logo {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }
    
    .form-options {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .social-login {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .auth-box {
        padding: 1.5rem 1rem;
    }
    
    .auth-title {
        font-size: 1.5rem;
    }
    
    .form-control {
        padding: 0.875rem 2.5rem 0.875rem 0.875rem;
    }
}

/* ========== Dark Mode Enhancements ========== */
body.dark-mode .auth-wrapper,
[data-theme="dark"] .auth-wrapper {
    background: linear-gradient(135deg, #1a1f2e 0%, #0f1419 100%);
}

body.dark-mode .auth-wrapper::before,
[data-theme="dark"] .auth-wrapper::before {
    background: radial-gradient(circle, rgba(102, 126, 234, 0.05) 1px, transparent 1px);
}

body.dark-mode .auth-decoration,
[data-theme="dark"] .auth-decoration {
    background: rgba(102, 126, 234, 0.08);
}

body.dark-mode .auth-box,
[data-theme="dark"] .auth-box {
    background: rgba(31, 41, 55, 0.98);
    border: 1px solid rgba(102, 126, 234, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

body.dark-mode .auth-logo,
[data-theme="dark"] .auth-logo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

body.dark-mode .auth-title,
[data-theme="dark"] .auth-title {
    color: #f9fafb;
}

body.dark-mode .auth-subtitle,
[data-theme="dark"] .auth-subtitle {
    color: #9ca3af;
}

body.dark-mode .form-group label,
[data-theme="dark"] .form-group label {
    color: #e5e7eb;
}

body.dark-mode .form-control,
[data-theme="dark"] .form-control {
    background: rgba(17, 24, 39, 0.8);
    border-color: rgba(75, 85, 99, 0.5);
    color: #f9fafb;
}

body.dark-mode .form-control:focus,
[data-theme="dark"] .form-control:focus {
    border-color: #667eea;
    background: rgba(17, 24, 39, 0.95);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

body.dark-mode .form-control::placeholder,
[data-theme="dark"] .form-control::placeholder {
    color: #6b7280;
}

body.dark-mode .input-icon,
[data-theme="dark"] .input-icon {
    color: #9ca3af;
}

body.dark-mode .password-toggle,
[data-theme="dark"] .password-toggle {
    color: #9ca3af;
}

body.dark-mode .password-toggle:hover,
[data-theme="dark"] .password-toggle:hover {
    color: #e5e7eb;
}

body.dark-mode .remember-me label,
[data-theme="dark"] .remember-me label {
    color: #d1d5db;
}

body.dark-mode .forgot-password,
[data-theme="dark"] .forgot-password {
    color: #818cf8;
}

body.dark-mode .forgot-password:hover,
[data-theme="dark"] .forgot-password:hover {
    color: #a78bfa;
}

body.dark-mode .btn-auth,
[data-theme="dark"] .btn-auth {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

body.dark-mode .btn-auth:hover,
[data-theme="dark"] .btn-auth:hover {
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

body.dark-mode .auth-divider::before,
body.dark-mode .auth-divider::after,
[data-theme="dark"] .auth-divider::before,
[data-theme="dark"] .auth-divider::after {
    background: rgba(75, 85, 99, 0.5);
}

body.dark-mode .auth-divider,
[data-theme="dark"] .auth-divider {
    color: #9ca3af;
}

body.dark-mode .social-btn,
[data-theme="dark"] .social-btn {
    background: rgba(17, 24, 39, 0.8);
    border-color: rgba(75, 85, 99, 0.5);
    color: #e5e7eb;
}

body.dark-mode .social-btn:hover,
[data-theme="dark"] .social-btn:hover {
    background: rgba(31, 41, 55, 0.9);
    border-color: #667eea;
}

body.dark-mode .auth-footer,
[data-theme="dark"] .auth-footer {
    border-top-color: rgba(75, 85, 99, 0.3);
}

body.dark-mode .auth-footer p,
[data-theme="dark"] .auth-footer p {
    color: #9ca3af;
}

body.dark-mode .auth-footer a,
[data-theme="dark"] .auth-footer a {
    color: #818cf8;
}

body.dark-mode .auth-footer a:hover,
[data-theme="dark"] .auth-footer a:hover {
    color: #a78bfa;
}

body.dark-mode .back-home,
[data-theme="dark"] .back-home {
    color: #9ca3af;
}

body.dark-mode .back-home:hover,
[data-theme="dark"] .back-home:hover {
    color: #e5e7eb;
}

body.dark-mode .auth-alert.error,
[data-theme="dark"] .auth-alert.error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

body.dark-mode .auth-alert.success,
[data-theme="dark"] .auth-alert.success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

body.dark-mode .auth-alert.warning,
[data-theme="dark"] .auth-alert.warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fcd34d;
}

/* ========== Animations ========== */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

.shake {
    animation: shake 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}
