/* Custom CSS to support Tailwind-like utility classes used by Heroicons */
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-7 { width: 1.75rem; }
.h-7 { height: 1.75rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }

/* Ensure SVGs respect these dimensions */
svg.w-4 { width: 1rem; }
svg.h-4 { height: 1rem; }
svg.w-5 { width: 1.25rem; }
svg.h-5 { height: 1.25rem; }
svg.w-6 { width: 1.5rem; }
svg.h-6 { height: 1.5rem; }

/* =====================================================
   MOBILE FIRST GLOBAL OVERRIDES
   ===================================================== */

/* --- Prevent Zoom / Pinch / Double-Tap Zoom --- */
html, body {
    /* إزالة touch-action: manipulation للسماح بالتمرير الطبيعي داخل المحتوى */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

* {
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    /* إزالة overscroll-behavior: none للسماح بالتمرير الطبيعي داخل المحتوى */
}

/* =====================================================
   🔁 GLOBAL SCROLL FIX (Enable vertical scroll + hide scrollbars)
   ===================================================== */

/* تفعيل السكرول العمودي بشكل حتمي على مستوى html و body */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: 100%;
    /* إخفاء السكرول في Firefox و Edge الجديد */
    scrollbar-width: none !important;
    /* إخفاء سكرول في IE و Edge القديم */
    -ms-overflow-style: none !important;
    /* إصلاح مشكلة السكرول على مستوى الصفحة */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

/* إخفاء السكرول بصرياً في Chrome / Safari / Opera (webkit) */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
::-webkit-scrollbar {
    width: 0px !important;
    height: 0px !important;
    display: none !important;
    background: transparent !important;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb:hover {
    background: transparent !important;
    display: none !important;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-size: 15px;
    line-height: 1.55;
    /* تفعيل السكرول العمودي + إخفاء الأفقي فقط */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    /* إخفاء السكرول في باقي المتصفحات */
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    height: auto !important;
    /* إصلاح مشكلة السكرول على مستوى الـ body */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

/* ضمان عمل السكرول حتى في الـ wrapper و container العامة */
.wrapper {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    height: 100%;
    /* إصلاح مشكلة السكرول داخل الـ wrapper */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}
.wrapper::-webkit-scrollbar { display: none !important; }

/* --- Safe-area aware containers --- */
.safe-top { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
.safe-left { padding-left: env(safe-area-inset-left); }
.safe-right { padding-right: env(safe-area-inset-right); }
.safe-x { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.safe-y { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.safe-all {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* --- Layout: Sidebar & Navbar Mobile-First --- */
.iq-sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1040;
    will-change: transform;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.iq-top-navbar {
    z-index: 1030;
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    background-color: rgba(255, 255, 255, 0.92);
    position: sticky;
    top: 0;
}

.content-page {
    min-height: calc(100vh - 60px);
    min-height: calc(100dvh - 60px);
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
    overflow-y: auto !important;
    overflow-x: hidden !important;
    /* إصلاح مشكلة السكرول داخل المحتوى */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

/* --- Touch-friendly Buttons & Links (44x44px minimum) --- */
button,
.btn,
a.btn,
input[type="button"],
input[type="submit"],
input[type="reset"],
.dropdown-item,
.nav-link,
.page-link,
.close,
.navbar-toggler,
.sidebar-toggle,
.iq-menu a,
.product-card,
.btn-icon {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s ease-out;
    -webkit-user-select: none;
    user-select: none;
    /* إصلاح مشكلة السكرول داخل الأزرار */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

button:active,
.btn:active,
a.btn:active,
.nav-link:active,
.dropdown-item:active,
.page-link:active,
.iq-menu a:active {
    transform: scale(0.96);
    opacity: 0.9;
}

/* Larger touch targets on mobile */
@media (max-width: 768px) {
    button,
    .btn,
    a.btn,
    input[type="button"],
    input[type="submit"],
    input[type="reset"],
    .dropdown-item,
    .nav-link,
    .page-link,
    .navbar-toggler,
    .sidebar-toggle,
    .btn-icon {
        min-height: 48px;
        min-width: 48px;
        font-size: 15px;
    }
}

/* --- Form Controls Touch-Friendly --- */
.form-control,
.form-select,
.custom-select,
input,
select,
textarea,
.select2-container .select2-selection {
    min-height: 44px;
    font-size: 16px !important;
    padding: 10px 14px;
    border-radius: 10px;
    border-width: 1.5px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    /* إصلاح مشكلة السكرول داخل عناصر النموذج */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

.form-control:focus,
.form-select:focus,
.custom-select:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--iq-primary, #32BDEA);
    box-shadow: 0 0 0 3px rgba(50, 189, 234, 0.15);
    outline: none;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* Prevent iOS auto-zoom on focus (inputs <16px font cause auto-zoom) */
@media (max-width: 768px) {
    .form-control,
    .form-select,
    .custom-select,
    input,
    select,
    textarea,
    .select2-container .select2-selection {
        min-height: 48px;
        font-size: 16px !important;
    }

    input[type="checkbox"],
    input[type="radio"] {
        width: 22px;
        height: 22px;
    }
}

/* --- Card Styling: Elevated, Rounded, Mobile-optimized --- */
.card {
    border-radius: 16px;
    border: none;
    box-shadow: 0 2px 10px rgba(1, 4, 27, 0.06),
                0 4px 20px rgba(1, 4, 27, 0.04);
    transition: box-shadow 0.25s ease, transform 0.2s ease;
    margin-bottom: 16px;
    overflow: hidden;
    /* إصلاح مشكلة السكرول داخل الـ card */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

.card:active {
    transform: translateY(1px);
    box-shadow: 0 1px 6px rgba(1, 4, 27, 0.08);
}

.card-header {
    border-radius: 16px 16px 0 0 !important;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    background: linear-gradient(135deg, #fafbff 0%, #f4f8ff 100%);
}

.card-body {
    padding: 20px;
}

@media (max-width: 768px) {
    .card {
        border-radius: 14px;
        margin-bottom: 12px;
    }
    .card-header { padding: 14px 16px; }
    .card-body { padding: 16px; }
}

/* --- Tables: Horizontal scroll + mobile friendly --- */
.table-responsive,
.dataTables_wrapper .dataTables_scroll {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-radius: 12px;
    /* إصلاح مشكلة السكرول داخل الجداول */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #f8f9fc;
    backdrop-filter: blur(8px);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    padding: 14px 12px;
    /* إصلاح مشكلة السكرول داخل الجدول */
    touch-action: auto !important;
}

.table tbody tr {
    transition: background-color 0.2s ease;
    /* إصلاح مشكلة السكرول داخل صفوف الجدول */
    touch-action: auto !important;
}

.table tbody tr:active {
    background-color: rgba(50, 189, 234, 0.06);
}

.table td {
    padding: 14px 12px;
    vertical-align: middle;
    white-space: nowrap;
    /* إصلاح مشكلة السكرول داخل خلايا الجدول */
    touch-action: auto !important;
}

@media (max-width: 768px) {
    .table thead th,
    .table td {
        padding: 12px 10px;
        font-size: 14px;
    }
}

/* --- Container Spacing Mobile-First --- */
.container,
.container-fluid {
    padding-left: max(15px, env(safe-area-inset-left));
    padding-right: max(15px, env(safe-area-inset-right));
    /* إصلاح مشكلة السكرول داخل الـ container */
    touch-action: auto !important;
    -webkit-touch-callout: auto !important;
    overscroll-behavior: auto !important;
}

.row {
    margin-left: -8px;
    margin-right: -8px;
    /* إصلاح مشكلة السكرول داخل الصفوف */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

.row > [class*="col-"] {
    padding-left: 8px;
    padding-right: 8px;
    /* إصلاح مشكلة السكرول داخل الأعمدة */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

@media (min-width: 768px) {
    .row { margin-left: -15px; margin-right: -15px; }
    .row > [class*="col-"] { padding-left: 15px; padding-right: 15px; }
}

/* --- Dropdown Menus: Full-width on mobile --- */
.dropdown-menu {
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 8px;
}

.dropdown-item {
    border-radius: 10px;
    padding: 12px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-item:active {
    background-color: rgba(50, 189, 234, 0.1) !important;
    color: var(--iq-primary, #32BDEA) !important;
}

@media (max-width: 576px) {
    .dropdown-menu {
        position: fixed !important;
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        transform: none !important;
        top: auto !important;
        bottom: 16px;
        border-radius: 18px;
        padding: 12px;
    }
}

/* --- Modals: Mobile sheet style --- */
.modal {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.modal-dialog {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: stretch;
}

.modal-content {
    border-radius: 0;
    border: none;
    margin: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

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

@media (min-width: 576px) {
    .modal-dialog {
        margin: 1.75rem auto;
        min-height: auto;
        align-items: center;
    }
    .modal-content {
        border-radius: 18px;
        box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    }
    .modal-lg { max-width: 900px; }
    .modal-xl { max-width: 1140px; }
}

.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header .btn-close,
.modal-header .close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f1f3f8;
    border: none;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-footer {
    border-top: 1px solid rgba(0,0,0,0.06);
    padding: 16px 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    background-color: rgba(244, 245, 250, 0.5);
}

@media (max-width: 576px) {
    .modal-footer { justify-content: stretch; }
    .modal-footer .btn { flex: 1; min-width: 0; }
}

/* --- Input Group: consistent height --- */
.input-group {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: none;
    /* إصلاح مشكلة السكرول داخل مجموعات الإدخال */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

.input-group .form-control,
.input-group .form-select,
.input-group .btn {
    border-radius: 0;
}

.input-group > :first-child { border-radius: 10px 0 0 10px; }
.input-group > :last-child { border-radius: 0 10px 10px 0; }
[dir="rtl"] .input-group > :first-child { border-radius: 0 10px 10px 0; }
[dir="rtl"] .input-group > :last-child { border-radius: 10px 0 0 10px; }

/* --- DataTables Responsive Tune-up --- */
.dataTables_wrapper .row {
    align-items: center;
    gap: 10px;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    padding: 10px 4px;
}

.dataTables_wrapper .dataTables_filter input {
    min-width: 200px;
}

.dataTables_wrapper .paginate_button.page-item {
    margin: 2px;
}

.dataTables_wrapper .paginate_button.page-item .page-link {
    min-width: 40px;
    min-height: 40px;
    border-radius: 10px;
    margin: 0;
}

@media (max-width: 768px) {
    .dataTables_wrapper .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left;
        width: 100%;
    }
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
    }
}

/* --- Select2 Dropdown Mobile --- */
.select2-container {
    width: 100% !important;
}

.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
    min-height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-width: 1.5px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px;
}

.select2-dropdown {
    border-radius: 12px;
    border: 1.5px solid #ced4da;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    overflow: hidden;
}

.select2-results__option {
    padding: 12px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* --- Alert / Toast: Slide in from bottom on mobile --- */
.alert {
    border-radius: 12px;
    border: none;
    padding: 14px 18px;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.alert-dismissible .btn-close {
    padding: 14px 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Sidebar Overlay on mobile --- */
.iq-sidebar-bg {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1039;
    animation: fadeIn 0.25s ease;
}

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

/* --- Pagination: big tap targets --- */
.pagination {
    gap: 6px;
    flex-wrap: wrap;
}

.pagination .page-link {
    border-radius: 10px !important;
    border: 1px solid #e2e6ee;
    margin: 0;
    padding: 8px 14px;
    font-weight: 600;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination .page-item.active .page-link {
    border-color: var(--iq-primary, #32BDEA);
    box-shadow: 0 4px 12px rgba(50, 189, 234, 0.25);
}

/* =====================================================
   SIMPLE LANGUAGE SWITCHER
   ===================================================== */

.language-switcher {
    margin-right: 8px;
}

.language-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.language-btn:hover {
    background: rgba(50, 189, 234, 0.1);
    border-color: rgba(50, 189, 234, 0.3);
}

.lang-text {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
}

.language-btn:hover .lang-text {
    color: #32BDEA;
}

/* RTL Support */
[dir="rtl"] .language-switcher {
    margin-right: 0;
    margin-left: 8px;
}

/* =====================================================
   AUTH PAGE STYLING
   ===================================================== */

.auth-logo {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-logo-large {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.auth-subtitle {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 0;
}

/* RTL Support for Auth Page */
[dir="rtl"] .auth-content {
    flex-direction: row-reverse;
}

/* إصلاح عام لمشكلة السكرول في جميع عناصر النموذج والتفاعلية */
.form-group,
.form-check,
.custom-control,
.select2-container,
.input-group-prepend,
.input-group-append,
.btn-group,
.dropdown {
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

/* إصلاح خاص لصفحات CRUD (المنتجات، الفئات، الموظفين، إلخ) */
.col-lg-12,
.col-md-12,
.col-sm-12,
.d-flex,
.justify-content-between,
.align-items-center {
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

/* إصلاح إضافي للجداول والنماذج في صفحات CRUD */
table,
thead,
tbody,
tr,
td,
th,
.form-control,
select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
input[type="search"] {
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

[dir="rtl"] .auth-title,
[dir="rtl"] .auth-subtitle {
    text-align: right;
}

[dir="rtl"] .text-center {
    text-align: center;
}

[dir="rtl"] .auth-footer .col-lg-8,
[dir="rtl"] .auth-footer .col-lg-4 {
    text-align: center;
}

[dir="rtl"] .auth-footer .d-flex {
    justify-content: center;
}

[dir="rtl"] .auth-footer .text-right {
    text-align: center;
}

[dir="rtl"] .auth-footer .mr-3 {
    margin-right: 0;
    margin-left: 12px;
}

/* Arabic form styling */
[dir="rtl"] .floating-label form-group {
    text-align: right;
}

[dir="rtl"] .floating-input {
    text-align: right;
}

[dir="rtl"] .floating-label label {
    right: 12px;
    left: auto;
}

[dir="rtl"] .position-absolute {
    left: 15px;
    right: auto;
}

/* =====================================================
   DASHBOARD FOOTER STYLING
   ===================================================== */

.iq-footer .card {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
}

.iq-footer .card-body {
    padding: 12px 20px;
}

.iq-footer h6 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
}

.iq-footer .footer-logo {
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.iq-footer a {
    text-decoration: none;
    transition: color 0.2s ease;
}

.iq-footer a:hover {
    color: #32BDEA !important;
}

.iq-footer .text-muted {
    color: #64748b !important;
}

.iq-footer .small {
    font-size: 12px;
}

[dir="rtl"] .iq-footer .mr-3 {
    margin-right: 0;
    margin-left: 12px;
}

[dir="rtl"] .iq-footer .text-right {
    text-align: left;
}

/* =====================================================
   AUTH FOOTER STYLING
   ===================================================== */

.auth-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 15px 0;
    margin-top: auto;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.auth-footer .footer-logo {
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-footer h6 {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
}

.auth-footer a {
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: #32BDEA !important;
}

.auth-footer .text-muted {
    color: #64748b !important;
}

.auth-footer .small {
    font-size: 11px;
}

@media (max-width: 768px) {
    .auth-footer {
        padding: 12px 0;
    }

    .auth-footer .row {
        flex-direction: column;
        text-align: center;
    }

    .auth-footer .col-lg-7,
    .auth-footer .col-lg-5 {
        text-align: center;
        margin-bottom: 8px;
    }

    .auth-footer .d-flex {
        justify-content: center;
    }
}

[dir="rtl"] .auth-footer .mr-3 {
    margin-right: 0;
    margin-left: 10px;
}

[dir="rtl"] .auth-footer .text-right {
    text-align: left;
}

.metric-value .currency {
    font-size: 0.6em;
    color: #6c757d;
    margin-left: 4px;
}

[dir="rtl"] .metric-value .currency {
    margin-left: 0;
    margin-right: 4px;
}

/* =====================================================
   DASHBOARD METRIC CARDS PROFESSIONAL DESIGN
   ===================================================== */

.metric-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    border-color: rgba(50, 189, 234, 0.3);
}

.icon-box {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.icon-box-info {
    background: linear-gradient(135deg, rgba(50, 189, 234, 0.15) 0%, rgba(50, 189, 234, 0.05) 100%);
    color: #32BDEA;
}

.icon-box-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
    color: #ef4444;
}

.icon-box-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
    color: #22c55e;
}

.icon-box-warning {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(234, 179, 8, 0.05) 100%);
    color: #eab308;
}

.metric-card:hover .icon-box {
    transform: scale(1.1);
}

.trend-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.trend-up {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.trend-down {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.trend-neutral {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
}

.metric-content {
    margin-bottom: 12px;
}

.metric-label {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.2;
}

.currency {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    margin-left: 4px;
}

.progress-wrapper {
    margin-top: 8px;
}

.progress {
    height: 6px;
    border-radius: 3px;
    background-color: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.progress-bar {
    transition: width 0.6s ease;
    border-radius: 3px;
}

/* Mobile responsive for metric cards */
@media (max-width: 768px) {
    .metric-card {
        margin-bottom: 12px;
    }

    .icon-box {
        width: 45px;
        height: 45px;
    }

    .metric-value {
        font-size: 20px;
    }

    .currency {
        font-size: 12px;
    }
}

/* =====================================================
   POS PAGE SPECIFIC MOBILE ENHANCEMENTS
   ===================================================== */

/* Product grid responsive */
.product-card {
    position: relative;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    padding: 12px;
    border-radius: 14px;
    background: #fff;
    border: 1.5px solid transparent;
    transition: all 0.2s ease-out;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    box-shadow: 0 2px 8px rgba(1, 4, 27, 0.05);
}

.product-card:active {
    transform: scale(0.97);
    border-color: var(--iq-primary, #32BDEA);
    background-color: rgba(50, 189, 234, 0.04);
    box-shadow: 0 6px 18px rgba(50, 189, 234, 0.15);
}

.product-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
    background-color: #f4f5fa;
}

.product-card .product-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.product-card .product-name {
    font-size: 13px;
    font-weight: 700;
    color: #01041b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .product-price {
    font-size: 15px;
    font-weight: 800;
    color: var(--iq-primary, #32BDEA);
}

.product-card .stock-chip {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 999px;
    z-index: 2;
}

[dir="rtl"] .product-card .stock-chip {
    right: auto;
    left: 8px;
}

/* Responsive product grid */
@media (max-width: 479px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 12px !important;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 14px !important;
    }
}

/* Category chips horizontal scroll on mobile */
.categories-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 6px;
    scrollbar-width: none;
}

.categories-chips::-webkit-scrollbar { display: none; }

.categories-chips .chip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 18px;
    border-radius: 999px;
    background: #f4f5fa;
    color: #676E8A;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
    border: 1.5px solid transparent;
}

.categories-chips .chip.active {
    background: var(--iq-primary, #32BDEA);
    color: #fff;
    border-color: var(--iq-primary, #32BDEA);
    box-shadow: 0 4px 12px rgba(50, 189, 234, 0.3);
}

.categories-chips .chip:active { transform: scale(0.96); }

/* Cart sidebar: Full-width sheet on mobile */
.cart-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    z-index: 1050;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0,0,0,0.12);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1),
                -webkit-transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

[dir="rtl"] .cart-sidebar {
    box-shadow: 8px 0 30px rgba(0,0,0,0.12);
}

@media (max-width: 575px) {
    .cart-sidebar {
        max-width: 100%;
        width: 100%;
    }
}

.cart-sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: linear-gradient(135deg, #32BDEA 0%, #158df7 100%);
    color: #fff;
}

.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 12px 16px;
}

.cart-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0,0,0,0.06);
    background-color: #fafbfc;
}

/* Cart item row */
.cart-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 10px;
}

.cart-item img {
    width: 54px;
    height: 54px;
    border-radius: 10px;
    object-fit: cover;
    background: #f4f5fa;
}

.cart-item-qty {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #f1f3f8;
    border-radius: 10px;
    padding: 3px;
}

.cart-item-qty button {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 8px;
    border: none;
    background: #fff;
    color: #32BDEA;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.15s ease;
}

.cart-item-qty button:active { transform: scale(0.9); }

.cart-item-qty .qty-val {
    min-width: 30px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
}

/* POS action buttons: stacked nicely */
.pos-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 400px) {
    .pos-actions { grid-template-columns: 1fr; }
}

.pos-actions .btn {
    min-height: 54px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pos-checkout-btn {
    background: linear-gradient(135deg, #32BDEA 0%, #158df7 100%);
    color: #fff;
    border: none;
    box-shadow: 0 6px 18px rgba(50, 189, 234, 0.35);
}

.pos-checkout-btn:active { box-shadow: 0 3px 10px rgba(50, 189, 234, 0.3); }

.pos-hold-btn {
    background: linear-gradient(135deg, #FF7E41 0%, #FF9770 100%);
    color: #fff;
    border: none;
    box-shadow: 0 6px 18px rgba(255, 126, 65, 0.3);
}

/* =====================================================
   TYPOGRAPHY SCALING
   ===================================================== */

h1 { font-size: clamp(1.8rem, 4vw + 1rem, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw + 0.5rem, 2.1rem); }
h3 { font-size: clamp(1.3rem, 3vw + 0.3rem, 1.75rem); }
h4 { font-size: clamp(1.15rem, 2.5vw + 0.2rem, 1.45rem); }
h5 { font-size: clamp(1.05rem, 2vw + 0.1rem, 1.25rem); }
h6 { font-size: clamp(1rem, 1.5vw + 0.05rem, 1.1rem); }

.lead { font-size: clamp(1rem, 1.5vw + 0.2rem, 1.25rem); }

/* =====================================================
   UTILITY: HAPTIC FEEL (micro-interactions)
   ===================================================== */
.haptic {
    transition: transform 0.1s ease-out;
}

.haptic:active {
    transform: scale(0.95);
}

/* Hide scrollbar for chip rows */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* =====================================================
   RTL FINE-TUNES FOR MOBILE
   ===================================================== */
[dir="rtl"] .text-left { text-align: right !important; }
[dir="rtl"] .text-right { text-align: left !important; }
[dir="rtl"] .mr-0 { margin-right: 0 !important; margin-left: auto !important; }
[dir="rtl"] .ml-0 { margin-left: 0 !important; margin-right: auto !important; }

/* =====================================================
   POS FULL-PAGE RESPONSIVE OVERRIDES
   Mobile: bottom-tabs navigation (Products ↔ Cart)
   ===================================================== */

#pos-app {
    width: 100vw !important;
    width: 100dvw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    touch-action: none;
}

/* Mobile: Add a bottom tab bar when POS active */
@media (max-width: 991px) {

    #pos-title-bar {
        height: auto !important;
        min-height: 52px;
        padding: 8px 12px !important;
        flex-wrap: wrap;
        gap: 6px;
    }

    #pos-title-bar > div:first-child {
        order: 2;
    }
    #pos-title-bar > div:nth-child(2) {
        order: 1;
        width: 100%;
        justify-content: center;
    }
    #pos-title-bar > div:nth-child(3) {
        order: 3;
        margin-left: auto;
    }

    /* Stack panels vertically on tablet/mobile */
    #pos-app > div:nth-child(2) {
        flex-direction: column !important;
        position: relative;
    }

    #left-panel,
    #right-panel {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border: none !important;
    }

    #left-panel {
        border-bottom: 1px solid #E5E7EB;
    }

    #right-panel {
        flex: 1 1 auto !important;
    }

    /* Product grid adapts per breakpoint */
    #pos-products-row > div[id="pos-product-col"] {
        padding: 6px !important;
    }
    #pos-products-row {
        margin: 0 -6px !important;
    }
}

@media (max-width: 767px) {
    #pos-products-row > div[id="pos-product-col"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    #pos-products-row > div[id="pos-product-col"] {
        flex: 0 0 33.3333% !important;
        max-width: 33.3333% !important;
    }
}

@media (min-width: 1024px) and (max-width: 1365px) {
    #pos-products-row > div[id="pos-product-col"] {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
}

@media (min-width: 1366px) {
    #pos-products-row > div[id="pos-product-col"] {
        flex: 0 0 20% !important;
        max-width: 20% !important;
    }
}

/* POS product card: match actual class used in HTML */
.product-card-new {
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.product-card-new:active {
    transform: scale(0.97) !important;
    border-color: #2563EB !important;
    background-color: #F8FAFC !important;
    box-shadow: 0 6px 18px rgba(30, 42, 68, 0.1) !important;
}

/* Spacing tune for mobile in POS areas */
#categories-row { padding: 10px 14px !important; }
#search-row { padding: 12px 14px !important; }
#products-grid-area { padding: 14px !important; }

#category-scroll {
    padding-bottom: 4px;
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent);
    mask-image: linear-gradient(to right, black calc(100% - 24px), transparent);
}

/* Category pills tap feel */
.cat-pill {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* إزالة الانميشن كما طلب المستخدم */
    transition: none !important;
}
.cat-pill:active { transform: none !important; }

/* إضافة تأثيرات خاصة لأزرار التصنيفات */
#category-scroll .cat-pill {
    transition: all 0.15s ease !important;
}

#category-scroll .cat-pill:active {
    transform: scale(0.97) !important;
}

/* Payment methods: touch targets */
.pay-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.pay-btn:active { transform: scale(0.95) !important; }

.qty-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-width: 28px;
    min-height: 28px;
}
.qty-btn:active { transform: scale(0.88); }

.cart-item-row {
    touch-action: manipulation;
    transition: background-color 0.12s ease;
}
.cart-item-row:active {
    background-color: #F8FAFC !important;
}

/* =====================================================
   PWA LIKE FULLSCREEN
   ===================================================== */
.wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

@media (display-mode: standalone), (display-mode: fullscreen) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* =====================================================
   SAFE AREA FOR IPHONE NOTCH / HOME INDICATOR
   Use .safe-all / .safe-top ... classes in templates
   ===================================================== */
@supports (padding: max(0px)) {
    .content-page {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
}

/* =====================================================
   IOS SPECIFIC FIXES
   ===================================================== */
@supports (-webkit-touch-callout: none) {
    body {
        cursor: pointer;
    }
    .wrapper, #pos-app {
        min-height: -webkit-fill-available;
    }
    #pos-app {
        height: -webkit-fill-available !important;
    }
}

/* =====================================================
   BUG FIXES: Sidebar + Navbar + Content Container
   (Solve 3 issues reported by user)
   ===================================================== */

/* ---- ISSUE #1: إزالة الخط الأسود الطولي بجانب السيدبار ---- */
.iq-sidebar,
.sidebar-default {
    border: none !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: none !important;
    outline: none !important;
    box-shadow: 1px 0 0 rgba(0, 0, 0, 0.05) !important;
    background-color: #fff;
}

[dir="rtl"] .iq-sidebar,
[dir="rtl"] .sidebar-default {
    box-shadow: -1px 0 0 rgba(0, 0, 0, 0.05) !important;
}

/* ضمان عدم وجود borders من أي نوع على السيدبار حتى لو كان مطوي */
.sidebar-main .iq-sidebar {
    border: none !important;
    box-shadow: 1px 0 0 rgba(0, 0, 0, 0.05) !important;
}

[dir="rtl"] .sidebar-main .iq-sidebar {
    box-shadow: -1px 0 0 rgba(0, 0, 0, 0.05) !important;
}

/* نزع أي border/خط على مستوى الـ wrapper كله */
.wrapper {
    border: none !important;
    outline: none !important;
}

/* ---- ISSUE #2: إصلاح طي السيدبار (ثبات البرغر + منع سكرول أفقي) ---- */

/* منع سكرول أفقي خالص على مستوى الصفحة كلها + السيدبار */
html,
body,
.wrapper,
.iq-sidebar,
.iq-sidebar .data-scrollbar,
.iq-sidebar-menu,
#iq-sidebar-toggle {
    overflow-x: hidden !important;
    max-width: 100%;
}

/* ضمان أن السيدبار نفسه مش هيعمل overflow حتى لو المحتوى أكبر */
.iq-sidebar {
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    top: 0;
    /* إصلاح مشكلة السكرول داخل السيدبار */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

/* الـ data-scrollbar اللي جوه السيدبار (ال scrollbar plugin) */
.iq-sidebar .data-scrollbar {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* إصلاح مشكلة السكرول داخل السيدبار */
    touch-action: auto !important;
}

/* ************************
   الأهم: إصلاح زرار البرغر اللي داخل السيدبار لما السيدبار يتقفل!
   المشكلة القديمة: body.sidebar-main .iq-sidebar-logo بيتعملله translateX(-100px)
   فالبرغر اللي جواه بيختفي تماماً.
   الحل: نشيل الـ transform عن الـ logo كله، ونعمل opacity للـ logo-text والـ image بس،
   ونخلي الـ iq-menu-bt-sidebar (البرغر) ثابت مكانه ومظهر واضح حتى في وضعية الطي.
   ************************ */
.iq-sidebar-logo {
    min-height: 70px;
    height: 70px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: visible !important;
}

/* إلغاء transform القديم اللي كان بيخفي البرغر */
body.sidebar-main .iq-sidebar-logo {
    transform: none !important;
}

/* إخفاء صورة اللوجو + العنوان النصي + spacer بس عند الطي (مش البرغر) */
body.sidebar-main .iq-sidebar-logo .header-logo,
body.sidebar-main .iq-sidebar-logo .header-logo img,
body.sidebar-main .iq-sidebar-logo .header-logo .logo-title,
body.sidebar-main .iq-sidebar-logo .header-logo h5 {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: all 0.4s ease-in-out;
}

/* ================================================================
   زرار البرغر (wrapper-menu):
   - زرار واحد في قمة السيدبار (iq-sidebar-logo).
   - زرار تاني في النافبار (iq-navbar-custom).
   نكيد إن الاثنين دائماً موجودين، قابليين للنقر، وبيظهروا حتى في وضعية الطي.
   ================================================================ */
.iq-menu-bt-sidebar,
.iq-navbar-logo .iq-menu-bt-sidebar,
.iq-top-navbar .wrapper-menu {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: all !important;
    position: relative !important;
    z-index: 10 !important;
    flex-shrink: 0 !important;
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 10px !important;
    transition: background-color 0.2s ease;
}

.iq-menu-bt-sidebar:hover,
.iq-navbar-logo .iq-menu-bt-sidebar:hover,
.iq-top-navbar .wrapper-menu:hover {
    background-color: rgba(50, 189, 234, 0.1) !important;
}

/* تأكيد ظهور الأيقونة نفسها داخل البرغر (Heroicon SVG) */
.iq-menu-bt-sidebar svg,
.wrapper-menu svg {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #01041b !important;
    flex-shrink: 0;
}

/* ================================================================
   وضعية طي السيدبار (sidebar-main) عند عرض >= 1300px:
   نضمن بقاء برغر السيدبار ظاهرًا ومركزًا في عرض السيدبار اللي بيبقى 60px فقط.
   ================================================================ */
@media (min-width: 1300px) {

    /* لما السيدبار بيتقفل، نضبط الـ logo container عشان البرغر يبقى في النص */
    body.sidebar-main .iq-sidebar-logo {
        padding: 0 !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* البرغر نفسه يبقى في المنتصف تمامًا في عرض الـ 60px */
    body.sidebar-main .iq-sidebar-logo .iq-menu-bt-sidebar {
        margin: 0 auto !important;
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
    }

    [dir="rtl"] body.sidebar-main .iq-sidebar-logo .iq-menu-bt-sidebar {
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
    }
}

/* إخفاء برغر النافبار على الشاشات الكبيرة (السيدبار مفتوح) — زي ما كان متوقع أصلاً */
@media (min-width: 1300px) {
    body:not(.sidebar-main) .iq-top-navbar .iq-navbar-custom .wrapper-menu {
        display: none !important;
    }
    body.sidebar-main .iq-top-navbar .iq-navbar-custom .wrapper-menu {
        display: inline-flex !important;
    }
}

/* ---- ISSUE #3: ثبات محتوى الصفحات داخل Container ثابت (عدم التمدد) + إصلاح LTR/RTL sidebar offset ---- */

/*
  ============================================================
  ⚠️  CORRECT APPROACH: Never put margin: 0 auto on .content-page
  because backend.css uses margin-left: 260px as sidebar offset!
  Instead:
  1. Keep the sidebar offset on content-page (margin-left for LTR,
     margin-right for RTL) exactly as template expects.
  2. Apply max-width + center-align ONLY TO THE DIRECT INNER CHILD
     (the .container or .container-fluid inside content-page).
  ============================================================
*/

/* ===== LTR DEFAULT ===== */
[dir="ltr"] .iq-sidebar,
html:not([dir="rtl"]) .iq-sidebar {
    left: 0 !important;
    right: auto !important;
}

[dir="ltr"] .content-page,
html:not([dir="rtl"]) .content-page {
    margin-left: 260px !important;   /* Original template value */
    margin-right: 0 !important;
}

/* LTR collapsed sidebar (>=1300px) */
@media (min-width: 1300px) {
    [dir="ltr"] body.sidebar-main .content-page,
    html:not([dir="rtl"]) body.sidebar-main .content-page {
        margin-left: 70px !important;
        margin-right: 0 !important;
    }
}

/* LTR mobile (<=1299px): sidebar becomes overlay, so NO offset */
@media (max-width: 1299px) {
    [dir="ltr"] .content-page,
    html:not([dir="rtl"]) .content-page {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ===== RTL ===== */
[dir="rtl"] .iq-sidebar {
    left: auto !important;
    right: 0 !important;
}

[dir="rtl"] .content-page {
    margin-right: 260px !important;  /* Mirror of LTR */
    margin-left: 0 !important;
}

/* RTL collapsed sidebar (>=1300px) */
@media (min-width: 1300px) {
    [dir="rtl"] body.sidebar-main .content-page {
        margin-right: 70px !important;
        margin-left: 0 !important;
    }
}

/* RTL mobile (<=1299px): sidebar overlay, NO offset */
@media (max-width: 1299px) {
    [dir="rtl"] .content-page {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

/* ===== MAX-WIDTH (readability on large screens) =====
   Applied ONLY to inner container (not the page wrapper that
   carries sidebar offset!) */
.content-page > .container,
.content-page > .container-fluid {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    transition: max-width 0.3s ease;
}

@media (min-width: 1024px) {
    .content-page > .container,
    .content-page > .container-fluid {
        max-width: 980px;
    }
}
@media (min-width: 1280px) {
    .content-page > .container,
    .content-page > .container-fluid {
        max-width: 1200px;
    }
}
@media (min-width: 1440px) {
    .content-page > .container,
    .content-page > .container-fluid {
        max-width: 1360px;
    }
}
@media (min-width: 1680px) {
    .content-page > .container,
    .content-page > .container-fluid {
        max-width: 1560px;
    }
}
@media (min-width: 1920px) {
    .content-page > .container,
    .content-page > .container-fluid {
        max-width: 1720px;
    }
}

/* POS page exception: always full-width! (we also exempt it from sidebar-offset override safety) */
body:has(#pos-app) .content-page {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
body:has(#pos-app) .content-page > .container,
body:has(#pos-app) .content-page > .container-fluid {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Uniform vertical padding for content */
.content-page > .container-fluid,
.content-page > .container {
    padding-top: 24px;
    padding-bottom: 32px;
    /* إصلاح مشكلة السكرول داخل الحاويات الرئيسية */
    touch-action: auto !important;
    overscroll-behavior: auto !important;
}

@media (max-width: 768px) {
    .content-page > .container-fluid,
    .content-page > .container {
        padding-top: 16px;
        padding-bottom: 24px;
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* ---- الموبايل: إظهار/إخفاء السيدبار كـ Overlay Slide ----
   LTR: sidebar lives on LEFT → translateX(-100%) to hide
   RTL: sidebar lives on RIGHT → translateX(100%) to hide
   (this was previously inverted — causing full layout breakage!) */
@media (max-width: 1299px) {
    /* LTR default */
    [dir="ltr"] .iq-top-navbar,
    html:not([dir="rtl"]) .iq-top-navbar {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
    }
    [dir="ltr"] .iq-sidebar,
    html:not([dir="rtl"]) .iq-sidebar {
        transform: translateX(-100%);
        -webkit-transform: translateX(-100%);
    }
    /* RTL */
    [dir="rtl"] .iq-sidebar {
        transform: translateX(100%);
        -webkit-transform: translateX(100%);
    }
    /* OPEN state (sidebar-main class toggled by JS) */
    body.sidebar-main .iq-sidebar {
        transform: translateX(0) !important;
        -webkit-transform: translateX(0) !important;
    }
}

/* =====================================================
   🧭  FIXED NAVBAR (STICKY TOP, سلوك زي السيدبار تماماً)
   ===================================================== */

/* ---- خصائص الثبات العامة للنافبار (جميع الأوضاع) ---- */
.iq-top-navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;           /* ✅ حتمي: لا فراغ على اليسار أبداً */
    right: 0 !important;          /* ✅ حتمي: لا فراغ على اليمين أبداً  */
    width: 100% !important;       /* ✅ حتمي: ملء عرض الشاشة 100% (بدون أي حساب) */
    margin: 0 !important;
    z-index: 1020 !important;     /* فوق المحتوى + تحت Overlay للسيدبار (1040) */
    height: 70px;                 /* ارتفاع ثابت لسهولة الحساب في padding-top */
    min-height: 70px;
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
    transition:
        background-color 0.3s ease,
        box-shadow 0.3s ease !important;
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    background-color: rgba(255, 255, 255, 0.96);
    /* ✅ الأهم: overflow:visible عشان الـ dropdown الخاص بالحساب يطلع برة النافبار ويتظهر كله من غير ما يتقطع! */
    overflow: visible !important;
    /* إخفاء أي سكرول ممكن يظهر في النافبار */
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.iq-top-navbar::-webkit-scrollbar { display: none !important; }

/* ⚠️ مهم جداً: عدم وضع أي overflow على النافبار أو الـ iq-navbar-custom عشان الـ dropdown يطلع.
   بدل كده، نضع overflow-x:hidden على الـ .navbar الداخلي بس عشان يحمي من السكرول الأفقي بدون ما يقطع الـ dropdown العمودي */
.iq-top-navbar,
.iq-navbar-custom {
    overflow: visible !important;
    width: 100%;
    max-width: none !important;
    height: 70px;
    min-height: 70px;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.iq-navbar-custom::-webkit-scrollbar { display: none !important; }

/* هنا فقط: الـ navbar الداخلي بيمنع السكرول الأفقي بس، ويخلي العمودي visible */
.iq-navbar-custom > .navbar,
.iq-top-navbar > * > .navbar {
    width: 100%;
    max-width: none !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    height: 70px;
    min-height: 70px;
    position: relative;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.iq-navbar-custom > .navbar::-webkit-scrollbar { display: none !important; }

/* ✅ حماية خاصة للـ dropdown: لازم يكون فوق كل حاجة ومش بيتقطع بواسطة أي overflow parent */
.iq-top-navbar .dropdown-menu,
.iq-top-navbar .iq-sub-dropdown,
.iq-top-navbar .caption-content .dropdown-menu,
.navbar-nav > li > .dropdown-menu {
    position: absolute !important;
    z-index: 99999 !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    transform: translateY(12px) !important;
    overflow: visible !important;
}
[dir="ltr"] .iq-top-navbar .dropdown-menu,
[dir="ltr"] .iq-top-navbar .iq-sub-dropdown {
    right: 0 !important;
    left: auto !important;
}
[dir="rtl"] .iq-top-navbar .dropdown-menu,
[dir="rtl"] .iq-top-navbar .iq-sub-dropdown {
    right: auto !important;
    left: 0 !important;
}

/* ضمان أن العناصر الداخلية في النافبار متباعدة بشكل صحيح */
.iq-navbar-custom .navbar {
    padding: 0 24px;
}

/* ---- ⬅️ LTR: النافبار يبدأ بعد السيدبار من اليسار ----
   💡 نستخدم PADDING-LEFT عوض عن LEFT: 260px عشان ما نكسرش right:0(width:100% اللي فوق مع right:0 + left:0 بيخللي كامل العرض)
   وبهذا النهج، النافبار دائماً right:0 بلا فراغ على اليمين!  */
[dir="ltr"] .iq-top-navbar,
html:not([dir="rtl"]) .iq-top-navbar {
    padding-left: 260px !important;   /* ✅ مكان السيدبار 260px على اليسار، النافبار يبتعد عن اليسار بقدمه */
    padding-right: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    margin: 0 !important;
}

/* LTR: طي السيدزار (≥ 1300px) → padding-left=70px يعوض عرض السيدبار المطوي */
@media (min-width: 1300px) {
    [dir="ltr"] body.sidebar-main .iq-top-navbar,
    html:not([dir="rtl"]) body.sidebar-main .iq-top-navbar {
        padding-left: 70px !important;
        padding-right: 0 !important;
    }
}

/* LTR: شاشات صغيرة ≤ 1299px → النافبار كامل عرض الشاشة (overlay) → no padding */
@media (max-width: 1299px) {
    [dir="ltr"] .iq-top-navbar,
    html:not([dir="rtl"]) .iq-top-navbar {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ---- ➡️ RTL: النافبار يبدأ بعد السيدبار من اليمين ----
   نفس الفكرة: نستخدم padding-right عوض right:260px عشان نحافظ على right:0،left:0،width:100% بدون فراغات */
[dir="rtl"] .iq-top-navbar {
    padding-right: 260px !important;  /* ✅ مكان السيدبار على اليمين في RTL */
    padding-left: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    margin: 0 !important;
}

/* RTL: طي السيدزار (≥ 1300px) → padding-right=70px */
@media (min-width: 1300px) {
    [dir="rtl"] body.sidebar-main .iq-top-navbar {
        padding-right: 70px !important;
        padding-left: 0 !important;
    }
}

/* RTL: شاشات صغيرة ≤ 1299px → كامل عرض الشاشة بدون padding */
@media (max-width: 1299px) {
    [dir="rtl"] .iq-top-navbar {
        padding-right: 0 !important;
        padding-left: 0 !important;
    }
}

/* ---- 🚫 استثناء صفحة POS: النافبار لازم كامل عرض الشاشة 0 padding ---- */
body:has(#pos-app) .iq-top-navbar {
    padding-left: 0 !important;
    padding-right: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
}

/* ---- 🛡️ تعويض ارتفاع النافبار الـ Fixed عشان أول المحتوى ما يختفي خلفه ----
   الـ Template الأصلي بيحط padding: 105px 15px 0 للـ content-page اللي تقريباً كفاية،
   لكن هنا نعمل إعادة تأكيد مع ضمان دقة أعلى في جميع breakpoints +
   نضمن عدم التداخل مع الـ sidebar margins. */
.content-page {
    padding-top: 105px !important;   /* 70px (Navbar) + 35px Spacing */
}

/* Tablet / Mobile */
@media (max-width: 1299px) {
    .content-page {
        padding-top: 100px !important;
    }
}
@media (max-width: 991px) {
    .content-page {
        padding-top: 90px !important;
    }
}
@media (max-width: 768px) {
    .content-page {
        padding-top: 85px !important;
    }
}

/* استثناء POS: padding-top = ارتفاع النافبار فقط (لان الـ POS ملء الشاشة) */
body:has(#pos-app) .content-page {
    padding-top: 70px !important;
    padding-bottom: 0 !important;
}
@media (max-width: 991px) {
    body:has(#pos-app) .content-page {
        padding-top: 70px !important;
    }
}

/* ---- تحسينات خاصة للنافبار: الموبايل (Touch-Friendly) ---- */
@media (max-width: 768px) {
    .iq-navbar-custom .navbar {
        padding: 0 12px;
    }
    .iq-search-bar.device-search {
        display: none !important;
    }
    .iq-navbar-logo h5.logo-title {
        font-size: 16px;
    }
}

/* ---- إزالة الـ fixed class القديم اللي كان بيتحط عند السكرول (مش محتاجينه دلوقتي النافبار fixed دائماً) ---- */
.iq-top-navbar.fixed {
    top: 0 !important;
    /* أي قيمة هنا لن تغلب على الـ !important اللي فوقها — بس نكتبها للتوضيح */
}

/* =====================================================
   📜 FINAL SCROLLBAR HIDE & SCROLL ENABLE (جميع مناطق السيستم)
   ===================================================== */

/* ✅ السيدبار: إخفاء سكروله (الأسود) مع بقاء القدرة على السكرول شغالة */
.iq-sidebar,
.iq-sidebar .data-scrollbar,
.iq-sidebar-menu,
#iq-sidebar-toggle,
.data-scrollbar {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
.iq-sidebar::-webkit-scrollbar,
.iq-sidebar .data-scrollbar::-webkit-scrollbar,
.data-scrollbar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* ✅ جميع مناطق المحتوى اللي فيها سكرول: إخفاء السكرول مع بقائه شغال */
.content-page,
.content-inner,
.card-body,
.table-responsive,
.dataTables_wrapper,
.dataTables_scroll,
.dataTables_scrollBody,
.modal-body,
.offcanvas-body,
.dropdown-menu,
.select2-results,
.tab-content {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.content-page::-webkit-scrollbar,
.content-inner::-webkit-scrollbar,
.card-body::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
.dataTables_wrapper::-webkit-scrollbar,
.dataTables_scrollBody::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.offcanvas-body::-webkit-scrollbar,
.dropdown-menu::-webkit-scrollbar,
.select2-results::-webkit-scrollbar,
.tab-content::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* ✅ تفعيل السكرول للجسم بشكل حتمي حتى لو فيه أي قاعدة تانية كانت منعته */
html,
body,
.wrapper {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: auto !important;
    overscroll-behavior-x: none !important;
    -webkit-overflow-scrolling: touch !important;
}

/* ✅ إصلاح المشكلة العامة للسكرول - content-page */
.content-page {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    min-height: 100vh;
    padding-bottom: 50px;
    position: relative !important;
}

/* ضمان أن body و html ليست fixed أو sticky */
html, body {
    position: relative !important;
    height: auto !important;
    max-height: none !important;
}

/* إزالة أي overflow مخفي على الـ wrapper */
.wrapper {
    position: relative !important;
    height: auto !important;
    min-height: 100vh;
}

/* ضمان أن body و html ليست fixed أو sticky */
html, body {
    position: relative !important;
    height: auto !important;
    max-height: none !important;
}

/* ✅ صفحة الـ POS: تفعيل السكرول للمناطق المحددة داخل الـ POS فقط */
#pos-app {
    overflow: hidden !important;
    height: calc(100dvh - 70px);
    min-height: calc(100dvh - 70px);
    max-height: calc(100dvh - 70px);
    /* إزالة أي انميشن من صفحة POS */
    scroll-behavior: auto !important;
}

/* إزالة الانميشن الكامل من صفحة POS */
#pos-app, #pos-app *, #pos-app *::before, #pos-app *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
}

/* ✅ منع أي padding أو margin يسبب ظهور سكرول أفقي غير مرغوب فيه */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
*::before,
*::after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* ✅ أخيراً: ضمان أن السكرول الشفاف شغال جيد في Chrome حتى بعد إخفائه */
::-webkit-scrollbar {
    -webkit-appearance: none !important;
}

/* =====================================================
   🦶 FIXED FOOTER (الفوتر الثابت في أسفل الشاشة)
   نفس نهج النافبار تماماً:
   - دائماً left:0 / right:0 / width:100% (بدون فراغات على اليمين)
   - استخدام padding-left/right عشان نعمل مكان للسيدبار
   - z-index أقل من النافبار (1010 < 1020) عشان النافبار تفضل فوق الفوتر لو تداخلوا
   ===================================================== */
.iq-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 1010 !important;
    background-color: #ffffff;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06) !important;
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    background-color: rgba(255, 255, 255, 0.97);
    border: none !important;
    /* الفوتر لازم overflow visible عشان لو فيه أي dropdown ما يتقطعش */
    overflow: visible !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.iq-footer::-webkit-scrollbar { display: none !important; }

/* تنعيم للـ padding وtransition في الفوتر مع طي/فتح السيدبار */
.iq-footer .card {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
}
.iq-footer .card-body {
    padding: 14px 24px !important;
}

/* ---- LTR: padding-left يعوض السيدبار ---- */
[dir="ltr"] .iq-footer,
html:not([dir="rtl"]) .iq-footer {
    padding-left: 260px !important;
    padding-right: 0 !important;
}
@media (min-width: 1300px) {
    [dir="ltr"] body.sidebar-main .iq-footer,
    html:not([dir="rtl"]) body.sidebar-main .iq-footer {
        padding-left: 70px !important;
    }
}
@media (max-width: 1299px) {
    [dir="ltr"] .iq-footer,
    html:not([dir="rtl"]) .iq-footer {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ---- RTL: padding-right يعوض السيدبار ---- */
[dir="rtl"] .iq-footer {
    padding-right: 260px !important;
    padding-left: 0 !important;
}
@media (min-width: 1300px) {
    [dir="rtl"] body.sidebar-main .iq-footer {
        padding-right: 70px !important;
    }
}
@media (max-width: 1299px) {
    [dir="rtl"] .iq-footer {
        padding-right: 0 !important;
        padding-left: 0 !important;
    }
}

/* ---- استثناء صفحة الـ POS: الفوتر كامل الشاشة بدون أي padding ---- */
body:has(#pos-app) .iq-footer {
    padding-left: 0 !important;
    padding-right: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
}

/* ---- ⚠️ الأهم جداً: تعويض ارتفاع الفوتر في الـ content-page عشان أول شيء ما يختفي خلف الفوتر ----
   متوسط ارتفاع الفوتر حوالي 70px، بنحط padding-bottom 120px عشان يبقى فيه هوامش جميلة.
   ونعدل على جميع الـ breakpoints اللي كتبناها فوق للنافبار عشان نضيف الفوتر. */
.content-page {
    padding-bottom: 130px !important; /* 70px (Footer) + 60px Spacing */
}

/* تحديث جميع الـ breakpoints عشان نضيف تعويض الفوتر للـ padding-bottom */
@media (max-width: 1299px) {
    .content-page { padding-bottom: 130px !important; }
}
@media (max-width: 991px) {
    .content-page { padding-bottom: 120px !important; }
}
@media (max-width: 768px) {
    .content-page { padding-bottom: 150px !important; } /* الفوتر على الموبايل بياخد مساحة أكتر */
    .iq-footer .card-body { padding: 12px 14px !important; }
    .iq-footer .text-right { text-align: center !important; }
    .iq-footer .col-lg-6:last-child { margin-top: 8px; }
}
@media (max-width: 576px) {
    .content-page { padding-bottom: 170px !important; }
}

/* استثناء POS: الفوتر في الـ POS بيتراكب مع النافبار أحياناً → مخفي أو شفاف شوية */
body:has(#pos-app) .content-page {
    padding-bottom: 0 !important;
}

/* =====================================================
   👤 FIX: فورم الحساب (User Dropdown) يظهر فوق كل الطبقات!
   المشكلة القديمة: كان بيظهر وده مختفي أسفل طبقات النافبار أو السيدبار بسبب
   - position: absolute كان بيتأثر ب parent overflow.
   - z-index غليظ شوية فكان عالـ 99999 بس مش كفاية مع stack context مشاكل.
   الحل النهائي: position: fixed (عشان يطلع برا كل الـ stack contexts) + z-index خيالي عالي.
   ===================================================== */

/* الـ Dropdown الخاص بصورة الحساب: caption-content → li -> a -> dropdown-menu */
.navbar-list .caption-content > .iq-sub-dropdown.dropdown-menu,
.navbar-list .nav-item.caption-content > .dropdown-menu,
.navbar-nav > li.caption-content > .dropdown-menu,
.navbar-list li.caption-content > .iq-sub-dropdown.dropdown-menu {
    /* ✅ position: fixed بدلاً من absolute ده هو حسم المشكلة 100%!
       fixed بيخلي الـ dropdown بيتحسب بالنسبة للـ Window نفسها
       مش لأي parent → فما فيش أي overflow يقطعه مهما كان! */
    position: fixed !important;
    top: 82px !important;         /* تحت النافبار مباشرة (Navbar height = 70px + 12px spacing) */
    right: 24px !important;       /* LTR: من اليمين مسافة 24px */
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    min-width: 320px !important;
    max-width: 94vw !important;   /* على الموبايل مايعدلش 94% من عرض الشاشة */
    z-index: 999999 !important;   /* فوق كل حاجة — حتى فوق مودالات Bootstrap */
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 14px !important;
    overflow: visible !important;
    /* زيادة shadow عشان يبان بوضوح أنه فاتح فوق كل شيء */
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.18),
        0 8px 20px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(0, 0, 0, 0.06);
    /* إزالة transform القديم اللي كان بيخليه يبان فوق بعض */
    transform: none !important;
    -webkit-transform: none !important;
}

/* RTL: نفس الفكرة بس يعتمد على اليسار 24px بدلاً من اليمين */
[dir="rtl"] .navbar-list .caption-content > .iq-sub-dropdown.dropdown-menu,
[dir="rtl"] .navbar-list .nav-item.caption-content > .dropdown-menu,
[dir="rtl"] .navbar-nav > li.caption-content > .dropdown-menu,
[dir="rtl"] .navbar-list li.caption-content > .iq-sub-dropdown.dropdown-menu {
    right: auto !important;
    left: 24px !important;
}

/* على الموبايل: الـ dropdown يبقى عرض كامل تقريباً ووسطّع شوية */
@media (max-width: 768px) {
    .navbar-list .caption-content > .iq-sub-dropdown.dropdown-menu,
    .navbar-list .nav-item.caption-content > .dropdown-menu {
        right: 12px !important;
        left: 12px !important;
        margin: 0 auto !important;
        min-width: auto !important;
        width: auto !important;
        max-width: none !important;
    }
    [dir="rtl"] .navbar-list .caption-content > .iq-sub-dropdown.dropdown-menu,
    [dir="rtl"] .navbar-list .nav-item.caption-content > .dropdown-menu {
        right: 12px !important;
        left: 12px !important;
    }
}

/* نفس الحل على الـ dropdown بتاع البحث الصغير اللي جنب الحساب (عشان يطلع برا كمان!) */
.navbar-list .search-content > .iq-sub-dropdown.dropdown-menu,
.navbar-list .nav-item.search-content > .dropdown-menu,
.navbar-list > li.nav-item.search-content > .iq-sub-dropdown.dropdown-menu {
    position: fixed !important;
    top: 82px !important;
    /* بعيد عن اليمين بمقدار 140px عشان يجي تحت زرار البحث */
    right: 140px !important;
    left: auto !important;
    bottom: auto !important;
    min-width: 320px !important;
    max-width: 90vw !important;
    z-index: 999999 !important;
    margin: 0 !important;
    border-radius: 12px !important;
    overflow: visible !important;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.18),
        0 8px 20px rgba(0, 0, 0, 0.1) !important;
    transform: none !important;
    -webkit-transform: none !important;
}

/* RTL: dropdown البحث يكون بعيد عن اليسار 140px */
[dir="rtl"] .navbar-list .search-content > .iq-sub-dropdown.dropdown-menu,
[dir="rtl"] .navbar-list .nav-item.search-content > .dropdown-menu {
    right: auto !important;
    left: 140px !important;
}
@media (max-width: 768px) {
    .navbar-list .search-content > .iq-sub-dropdown.dropdown-menu,
    .navbar-list .nav-item.search-content > .dropdown-menu,
    [dir="rtl"] .navbar-list .search-content > .iq-sub-dropdown.dropdown-menu {
        right: 12px !important;
        left: 12px !important;
        min-width: auto !important;
    }
}

/* ضمان أن الـ nav-item نفسه وذرياته (الـ dropdown) مفيهوش أي overflow يقطع الفورم */
.navbar-list,
.navbar-list > li,
.navbar-list > li.nav-item,
.navbar-list > li.caption-content,
.navbar-list > li > a,
.caption-content {
    overflow: visible !important;
}

/* في حال استخدم الـ Nav Toggle (الموبايل): الـ collapse لازم overflow:visible كمان عشان الـ dropdown يطلع برا */
.navbar-collapse.collapse,
.navbar-collapse.collapsing,
.navbar-collapse.collapse.show {
    overflow: visible !important;
}

/* الـ navbar اللي جوه النافبار نفسها: لازم overflow:visible عشان الـ dropdown يخرج برا */
.iq-navbar-custom > nav.navbar,
.iq-top-navbar nav.navbar,
#navbarSupportedContent {
    overflow: visible !important;
}
