/**
 * تحسينات الأداء الشاملة
 * Performance Boost CSS
 */

/* تحسين العناصر الحرجة */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

/* تحسين الصور */
img {
    max-width: 100%;
    height: auto;
    display: block;
    border: 0;
    font-style: italic;
    background-repeat: no-repeat;
    background-size: cover;
    shape-margin: 1rem;
}

/* تحسين الأزرار */
button, .btn {
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    outline: inherit;
    transition: all 0.2s ease;
    will-change: transform;
}

.btn-orange {
    background: #ff6b35;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    border: none;
}

.btn-orange:hover {
    background: #e55a2b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    color: white;
    text-decoration: none;
}

/* تحسين النماذج */
.form-control, input, textarea, select {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

/* تحسين التخطيط */
.container-fluid {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

.d-flex {
    display: flex !important;
}

.justify-content-center {
    justify-content: center !important;
}

.align-items-center {
    align-items: center !important;
}

.text-center {
    text-align: center !important;
}

/* تحسين الـ Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.preloader__img {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* تحسين صفحة تسجيل الدخول */
.account-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.account-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-width: 1000px;
    width: 100%;
    display: flex;
    min-height: 600px;
}

.account-left {
    flex: 1;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: white;
}

.account-right {
    flex: 1;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-wrapper {
    width: 100%;
    max-width: 400px;
}

/* تحسينات متجاوبة */
@media (max-width: 768px) {
    .account-wrapper {
        flex-direction: column;
        margin: 10px;
    }
    
    .account-left {
        display: none; /* إخفاء الجانب الأيسر على الهواتف */
    }
    
    .account-right {
        padding: 30px 20px;
    }
    
    .account-section {
        padding: 10px;
        min-height: 100vh;
    }
}

@media (max-width: 480px) {
    .account-right {
        padding: 20px 15px;
    }
    
    .btn-orange {
        width: 100%;
        padding: 15px;
        font-size: 16px;
    }
    
    .form-control {
        padding: 15px 12px;
        font-size: 16px; /* منع التكبير في iOS */
    }
}

/* تحسينات الأداء */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* تحسين التمرير */
.scroll-smooth {
    scroll-behavior: smooth;
}

/* تحسين النصوص */
.text-rendering-optimized {
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* إخفاء العناصر غير المرئية */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* تحسين التحميل */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* تحسين الطباعة */
@media print {
    .preloader,
    .account-section__close,
    button,
    .btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* تحسينات الوصولية */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* تحسين التباين */
@media (prefers-contrast: high) {
    .btn-orange {
        background: #000;
        border: 2px solid #fff;
    }
    
    .form-control {
        border: 2px solid #000;
    }
}
