/*
 * ملف الأنماط المتجاوبة
 * يحتوي على جميع أنماط التصميم المتجاوب لجميع أحجام الشاشات
 * نظام الحسابات المتكامل
 */

/* المتغيرات للشاشات المختلفة */
:root {
  --container-sm: 100%;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1536px;
}

/* الحاوي الرئيسي */
.container {
  width: 100%;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  margin-left: auto;
  margin-right: auto;
}

.container-fluid {
  width: 100%;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

/* نقاط التوقف */
@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }
  
  .container-md {
    max-width: var(--container-md);
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
  
  .container-lg {
    max-width: var(--container-lg);
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
  
  .container-xl {
    max-width: var(--container-xl);
  }
}

@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
  
  .container-2xl {
    max-width: var(--container-2xl);
  }
}

/* الشبكة المتجاوبة */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: calc(var(--space-2) * -1);
  margin-right: calc(var(--space-2) * -1);
}

.col,
.col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
.col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
  position: relative;
  width: 100%;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

/* الأعمدة التلقائية */
.col {
  flex: 1 0 0%;
}

.col-auto {
  flex: 0 0 auto;
  width: auto;
}

.col-1 { flex: 0 0 auto; width: 8.33333333%; }
.col-2 { flex: 0 0 auto; width: 16.66666667%; }
.col-3 { flex: 0 0 auto; width: 25%; }
.col-4 { flex: 0 0 auto; width: 33.33333333%; }
.col-5 { flex: 0 0 auto; width: 41.66666667%; }
.col-6 { flex: 0 0 auto; width: 50%; }
.col-7 { flex: 0 0 auto; width: 58.33333333%; }
.col-8 { flex: auto; width: 0 0 66.66666667%; }
.col-9 { flex: 0 0 auto; width: 75%; }
.col-10 { flex: 0 0 auto; width: 83.33333333%; }
.col-11 { flex: 0 0 auto; width: 91.66666667%; }
.col-12 { flex: 0 0 auto; width: 100%; }

/* فئات العرض */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }

/* فئات المرونة */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-row-reverse { flex-direction: row-reverse !important; }
.flex-column-reverse { flex-direction: column-reverse !important; }

.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-wrap-reverse { flex-wrap: wrap-reverse !important; }

.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }
.justify-content-evenly { justify-content: space-evenly !important; }

.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-baseline { align-items: baseline !important; }
.align-items-stretch { align-items: stretch !important; }

.align-content-start { align-content: flex-start !important; }
.align-content-end { align-content: flex-end !important; }
.align-content-center { align-content: center !important; }
.align-content-between { align-content: space-between !important; }
.align-content-around { align-content: space-around !important; }
.align-content-evenly { align-content: space-evenly !important; }
.align-content-stretch { align-content: stretch !important; }

.align-self-auto { align-self: auto !important; }
.align-self-start { align-self: flex-start !important; }
.align-self-end { align-self: flex-end !important; }
.align-self-center { align-self: center !important; }
.align-self-baseline { align-self: baseline !important; }
.align-self-stretch { align-self: stretch !important; }

.flex-fill { flex: 1 1 auto !important; }
.flex-grow-0 { flex-grow: 0 !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.flex-shrink-1 { flex-shrink: 1 !important; }

/* فئات الهوامش */
.gap-0 { gap: 0 !important; }
.gap-1 { gap: var(--space-1) !important; }
.gap-2 { gap: var(--space-2) !important; }
.gap-3 { gap: var(--space-3) !important; }
.gap-4 { gap: var(--space-4) !important; }
.gap-5 { gap: var(--space-5) !important; }

/* فئات الظلال المتجاوبة */
.shadow-none { box-shadow: none !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl { box-shadow: var(--shadow-xl) !important; }
.shadow-2xl { box-shadow: var(--shadow-2xl) !important; }

/* أحجام الشاشات الصغيرة (موبايل) */
@media (max-width: 767.98px) {
  /* إخفاء العناصر على الموبايل */
  .d-none-mobile {
    display: none !important;
  }
  
  /* إظهار العناصر فقط على الموبايل */
  .d-block-mobile {
    display: block !important;
  }
  
  /* الشبكة على الموبايل */
  .col-mobile-12 { width: 100% !important; }
  .col-mobile-6 { width: 50% !important; }
  .col-mobile-4 { width: 33.333% !important; }
  .col-mobile-3 { width: 25% !important; }
  
  /* الهوامش على الموبايل */
  .m-0-mobile { margin: 0 !important; }
  .m-2-mobile { margin: var(--space-2) !important; }
  .m-4-mobile { margin: var(--space-4) !important; }
  .mt-2-mobile { margin-top: var(--space-2) !important; }
  .mt-4-mobile { margin-top: var(--space-4) !important; }
  .mb-2-mobile { margin-bottom: var(--space-2) !important; }
  .mb-4-mobile { margin-bottom: var(--space-4) !important; }
  
  /* الحشو على الموبايل */
  .p-0-mobile { padding: 0 !important; }
  .p-2-mobile { padding: var(--space-2) !important; }
  .p-4-mobile { padding: var(--space-4) !important; }
  
  /* النص على الموبايل */
  .text-center-mobile { text-align: center !important; }
  .text-right-mobile { text-align: right !important; }
  .text-left-mobile { text-align: left !important; }
  
  /* الخط على الموبايل */
  .text-sm-mobile { font-size: var(--text-sm) !important; }
  .text-xs-mobile { font-size: var(--text-xs) !important; }
  
  /* المرونة على الموبايل */
  .flex-column-mobile { flex-direction: column !important; }
  .flex-row-mobile { flex-direction: row !important; }
  
  /* البطاقات على الموبايل */
  .card-mobile {
    margin-bottom: var(--space-4);
    border-radius: var(--radius-lg);
  }
  
  /* الأزرار على الموبايل */
  .btn-mobile {
    width: 100%;
    padding: var(--space-3) var(--space-4);
  }
  
  /* الجداول على الموبايل */
  .table-mobile {
    font-size: var(--text-sm);
  }
  
  .table-mobile th,
  .table-mobile td {
    padding: var(--space-2) var(--space-3);
  }
  
  /* الشريط الجانبي على الموبايل */
  .sidebar-mobile {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-primary);
    z-index: var(--z-modal);
    transition: var(--transition-normal);
  }
  
  .sidebar-mobile.open {
    right: 0;
  }
  
  /* التنقل على الموبايل */
  .navbar-mobile {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
  }
}

/* أحجام الشاشات المتوسطة (تابلت) */
@media (min-width: 768px) and (max-width: 991.98px) {
  /* إخفاء العناصر على التابلت */
  .d-none-tablet {
    display: none !important;
  }
  
  /* إظهار العناصر فقط على التابلت */
  .d-block-tablet {
    display: block !important;
  }
  
  /* الشبكة على التابلت */
  .col-tablet-6 { width: 50% !important; }
  .col-tablet-4 { width: 33.333% !important; }
  .col-tablet-3 { width: 25% !important; }
  
  /* الهوامش على التابلت */
  .m-4-tablet { margin: var(--space-4) !important; }
  
  /* النص على التابلت */
  .text-md-tablet { font-size: var(--text-base) !important; }
  
  /* المرونة على التابلت */
  .flex-wrap-tablet { flex-wrap: wrap !important; }
}

/* أحجام الشاشات الكبيرة (ديسكتوب) */
@media (min-width: 992px) {
  /* إخفاء العناصر على الديسكتوب */
  .d-none-desktop {
    display: none !important;
  }
  
  /* إظهار العناصر فقط على الديسكتوب */
  .d-block-desktop {
    display: block !important;
  }
  
  /* الشبكة على الديسكتوب */
  .col-desktop-3 { width: 25% !important; }
  .col-desktop-4 { width: 33.333% !important; }
  .col-desktop-6 { width: 50% !important; }
  .col-desktop-8 { width: 66.666% !important; }
  .col-desktop-9 { width: 75% !important; }
  
  /* الهوامش على الديسكتوب */
  .m-6-desktop { margin: var(--space-6) !important; }
  
  /* النص على الديسكتوب */
  .text-lg-desktop { font-size: var(--text-lg) !important; }
}

/* أحجام الشاشات الكبيرة جداً (شاشات عريضة) */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
  
  .d-none-large {
    display: none !important;
  }
  
  .d-block-large {
    display: block !important;
  }
}

/* شاشات 4K */
@media (min-width: 1920px) {
  .container {
    max-width: 1400px;
  }
  
  .text-4k { font-size: var(--text-2xl) !important; }
}

/* تحسينات للطباعة */
@media print {
  .container {
    max-width: none;
    padding: 0;
  }
  
  .d-print-none { display: none !important; }
  .d-print-block { display: block !important; }
  .d-print-inline { display: inline !important; }
  .d-print-inline-block { display: inline-block !important; }
}

/* تحسينات للشاشات عالية الدقة */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* تحسينات للخطوط */
  .text-hd {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* تحسينات للمس */
@media (hover: none) and (pointer: coarse) {
  /* تحسينات للأجهزة اللمسية */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  .form-control {
    min-height: 44px;
  }
  
  .table th,
  .table td {
    padding: var(--space-3) var(--space-4);
  }
}

/* تحسينات للوحة المفاتيح */
@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-color-scheme: dark) {
  [data-theme="auto"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
  }
}

/* أنماط خاصة بالشاشات العمودية والأفقية */
@media (orientation: portrait) {
  .portrait-only {
    display: block;
  }
  
  .landscape-only {
    display: none;
  }
}

@media (orientation: landscape) {
  .portrait-only {
    display: none;
  }
  
  .landscape-only {
    display: block;
  }
}

/* تحسينات خاصة للحسابات */
@media (max-width: 768px) {
  .account-table {
    font-size: var(--text-xs);
  }
  
  .chart-container {
    height: 200px;
  }
  
  .dashboard-cards {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

/* إخفاء شريط التمرير مع الحفاظ على الوظيفة */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* تحسينات للتمرير السلس */
.smooth-scroll {
  scroll-behavior: smooth;
}

/* تحسينات للوضع المريح */
@media (prefers-contrast: high) {
  .btn {
    border-width: 2px;
  }
  
  .card {
    border: 2px solid var(--border-color);
  }
}