/* ============================================================
   RTL / LTR + Dubai Font Support
   ============================================================ */

/* خط Dubai - يُحمَّل عند توفّر الملفات */
@font-face {
    font-family: 'Dubai';
    src: local('Dubai'),
         url('../fonts/dubai/Dubai-Regular.ttf') format('truetype'),
         url('../fonts/dubai/Dubai-Regular.otf') format('opentype');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Dubai';
    src: local('Dubai-Medium'),
         url('../fonts/dubai/Dubai-Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'Dubai';
    src: local('Dubai-Bold'),
         url('../fonts/dubai/Dubai-Bold.ttf') format('truetype');
    font-weight: 700;
    font-display: swap;
}

/* خط احتياطي ممتاز من Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }

/* الافتراضي للعربية - Tahoma + Cairo */
html[dir="rtl"] body,
html[dir="rtl"] * {
    font-family: 'Cairo', Tahoma, Arial, sans-serif !important;
}

/* الإنجليزية - Dubai أولاً ثم احتياطي */
html[dir="ltr"] body,
html[dir="ltr"] * {
    font-family: 'Dubai', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
    direction: ltr;
}

/* عند LTR - اقلب الشريط الجانبي */
html[dir="ltr"] .sidebar {
    right: auto !important;
    left: 0 !important;
    border-right: none;
    border-left: 1px solid var(--border);
}

html[dir="ltr"] .main {
    margin-right: 0 !important;
    margin-left: 260px !important;
}

html[dir="ltr"] body { text-align: left; }
html[dir="ltr"] .page-header,
html[dir="ltr"] .card-header,
html[dir="ltr"] .stat-card,
html[dir="ltr"] .topbar { text-align: left; }

html[dir="ltr"] .nav-badge,
html[dir="ltr"] .badge { margin-right: 0; margin-left: auto; }

html[dir="ltr"] .breadcrumb { direction: ltr; }
html[dir="ltr"] .nav-link svg { margin-left: 0 !important; margin-right: 10px !important; }
html[dir="ltr"] .topbar-user .avatar { margin-right: 10px; margin-left: 0; }

/* Tables LTR */
html[dir="ltr"] .table th,
html[dir="ltr"] .table td { text-align: left; }
html[dir="ltr"] .table .num { text-align: right; }

/* Forms LTR */
html[dir="ltr"] .label,
html[dir="ltr"] .input,
html[dir="ltr"] .textarea,
html[dir="ltr"] .select {
    text-align: left;
    direction: ltr;
}

/* Right border accents (priority bars) → left */
html[dir="ltr"] .card[style*="border-right"] {
    border-right: none !important;
    border-left: 4px solid currentColor;
}

/* Active nav indicator */
html[dir="ltr"] .nav-link.active {
    border-right: none;
    border-left: 3px solid var(--primary);
}

/* Theme dropdown */
html[dir="ltr"] .theme-switcher-dropdown { right: auto; left: 0; }

/* Flash messages */
html[dir="ltr"] .flash { right: auto; left: 16px; }

/* Footer LTR */
html[dir="ltr"] .footer-grid { direction: ltr; }
html[dir="ltr"] .product-card { text-align: left; }

/* أرقام دائماً LTR */
.price, .num, .currency, code, time {
    direction: ltr;
    unicode-bidi: embed;
}

/* Smooth transitions */
body, .main, .sidebar { transition: margin 0.2s ease; }

/* الحجم الأفضل بالإنجليزي */
html[dir="ltr"] {
    font-size: 15px;
}

html[dir="ltr"] .page-title { letter-spacing: -0.02em; }
html[dir="ltr"] .nav-link { letter-spacing: 0; }
