/* استيراد الخطوط العربية */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;600;700&display=swap');

/* متغيرات CSS مستوحاة من ملف الأنماط */
:root {
    /* الألوان الأساسية */
    --primary: #1E88E5;
    --primary-dark: #1565C0;
    --primary-light: #42A5F5;
    --secondary: #FF9800;
    --secondary-dark: #F57C00;
    
    /* ألوان الخلفية */
    --background-primary: #F5F7FA;
    --background-secondary: #FFFFFF;
    --surface: #FFFFFF;
    --surface-elevated: #FAFBFC;
    
    /* ألوان النص */
    --text-primary: #212121;
    --text-secondary: #757575;
    --text-disabled: #BDBDBD;
    
    /* ألوان الحدود */
    --border: #E0E0E0;
    --border-light: #F5F5F5;
    --border-dark: #BDBDBD;
    
    /* ألوان الحالة */
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #F44336;
    --info: #2196F3;
    
    /* المسافات */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* نصف أقطار الزوايا */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* الظلال */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow: 0 2px 6px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --shadow-xl: 0 8px 25px rgba(0,0,0,0.15);
    
    /* الانتقالات */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
    
    /* ألوان التدرج */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(45deg, #ff6b6b 0%, #4ecdc4 100%);
}

/* إعادة تعيين الأنماط */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* الجسم الرئيسي */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Arial', sans-serif;
    direction: rtl;
    text-align: right;
    background: var(--gradient-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
    line-height: 1.6;
}

/* عناصر الخلفية المتحركة */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
    backdrop-filter: blur(10px);
}

.shape-1 {
    width: 80px;
    height: 80px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 120px;
    height: 120px;
    top: 20%;
    right: 15%;
    animation-delay: 1s;
}

.shape-3 {
    width: 60px;
    height: 60px;
    bottom: 30%;
    left: 20%;
    animation-delay: 2s;
}

.shape-4 {
    width: 100px;
    height: 100px;
    bottom: 20%;
    right: 10%;
    animation-delay: 3s;
}

.shape-5 {
    width: 140px;
    height: 140px;
    top: 50%;
    left: 5%;
    animation-delay: 4s;
}

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

/* الحاوية الرئيسية */
.main-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--spacing-lg);
}

/* بطاقة تسجيل الدخول */
.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    position: relative;
    overflow: hidden;
    animation: slideInRight 0.8s ease-out;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

/* رأس تسجيل الدخول */
.login-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.logo-container {
    margin-bottom: var(--spacing-lg);
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.logo-circle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.logo {
    width: 40px;
    height: 40px;
    z-index: 1;
    position: relative;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

/* نموذج تسجيل الدخول */
.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* رسالة التنبيه */
.alert-message {
    background: rgba(244, 67, 54, 0.1);
    color: var(--error);
    padding: var(--spacing-md);
    border-radius: var(--radius);
    border: 1px solid rgba(244, 67, 54, 0.2);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.9rem;
    animation: shake 0.5s ease-in-out;
}

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

.alert-icon {
    font-size: 1.1rem;
}

/* مجموعات النموذج */
.form-group {
    position: relative;
}

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

.input-icon {
    position: absolute;
    right: var(--spacing-md);
    font-size: 1.2rem;
    color: var(--text-secondary);
    z-index: 2;
}

.form-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-2xl) var(--spacing-md) var(--spacing-md);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text-primary);
    transition: all var(--transition-normal);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
    transform: translateY(-1px);
}

.form-input::placeholder {
    color: var(--text-disabled);
}

/* زر إظهار/إخفاء كلمة المرور */
.toggle-password {
    position: absolute;
    left: var(--spacing-md);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    z-index: 2;
}

.toggle-password:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* خيارات النموذج */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: var(--spacing-sm) 0;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: transparent;
    transition: all var(--transition-normal);
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.forgot-password {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.forgot-password:hover {
    color: var(--primary-dark);
}

/* زر تسجيل الدخول */
.login-button {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    min-height: 50px;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.button-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.loader-spinner {
    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;
}

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

/* تذييل تسجيل الدخول */
.login-footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.version {
    font-weight: 600;
    color: var(--primary);
}

/* الحركات */
@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* التصميم المتجاوب */
@media (max-width: 768px) {
    .main-container {
        padding: var(--spacing-md);
    }
    
    .login-card {
        max-width: 100%;
        padding: var(--spacing-lg);
        margin: 0 auto;
    }
    
    .login-title {
        font-size: 1.7rem;
    }
    
    .floating-shape {
        display: none;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: var(--spacing-sm);
    }
    
    .login-card {
        padding: var(--spacing-md);
        margin: var(--spacing-sm);
        width: calc(100% - 2 * var(--spacing-sm));
    }
    
    .logo-circle {
        width: 60px;
        height: 60px;
    }
    
    .logo {
        width: 30px;
        height: 30px;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .form-input {
        padding: var(--spacing-sm) var(--spacing-xl) var(--spacing-sm) var(--spacing-sm);
    }
}

/* دعم الوضع المظلم */
@media (prefers-color-scheme: dark) {
    :root {
        --background-primary: #2C3E50;
        --background-secondary: #34495E;
        --surface: #3A4A5C;
        --text-primary: #ECF0F1;
        --text-secondary: #BDC3C7;
        --border: #4A5568;
    }
    
    .login-card {
        background: rgba(58, 74, 92, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
}

/* تحسينات إمكانية الوصول */
.form-input:focus,
.login-button:focus,
.toggle-password:focus,
.checkbox-container:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* تقليل الحركة للمستخدمين الذين يفضلون ذلك */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}