/* ════════════════════════════════════════════════════════════════
   Mobile UI Pack — تحسينات شاملة لتجربة الموبايل
   ─────────────────────────────────────────────
   • touch targets أكبر (44px minimum per Apple HIG)
   • Popups (Radzen + DevExpress) تنبثق من الأسفل
   • Form inputs أوضح و أسهل للضغط
   • أزرار أكبر و أوضح
   • تطبيق آلى على كل التطبيق على الموبايل (≤768px)
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    /* ═══ 1) Form Inputs — حجم touch-friendly ═══ */
    body .form-control,
    body input.lgn-input,
    body .lgn-drop,
    body .form-select,
    body input[type="text"]:not(.dxbl-text-edit-input):not(.fs-cell-expanded),
    body input[type="password"],
    body input[type="email"],
    body input[type="tel"],
    body input[type="number"],
    body select:not(.dxbl-spin-edit-buttons select),
    body textarea {
        min-height: 44px !important;
        font-size: 16px !important;          /* 16px يمنع iOS auto-zoom */
        padding: 10px 12px !important;
    }

    /* ═══ 2) Buttons — touch targets كبيرة ═══ */
    body .btn,
    body button:not(.dxbl-btn):not(.fs-mqm-btn):not(.fs-mbb-icon):not(.fs-btmnav-item):not(.ai-fp-icon-btn):not(.ai-fp-close):not(.ai-msg-speak),
    body .rz-button {
        min-height: 42px !important;
        font-size: 14px !important;
        padding: 10px 16px !important;
    }
    /* أزرار صغيرة عمداً (icon-only) — استثنى */
    body .btn.btn-icon,
    body .btn-sm.btn-icon {
        min-width: 36px !important;
        min-height: 36px !important;
        padding: 6px !important;
    }

    /* ═══ 3) Radzen Dialog/Popup — يفتح من الأسفل (bottom sheet) ═══ */
    body .rz-dialog,
    body .rz-dialog-wrapper > .rz-dialog {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        max-height: 90dvh !important;
        margin: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -8px 32px rgba(0,0,0,.2) !important;
        animation: fs-bottom-sheet-up .25s cubic-bezier(0.22,1,0.36,1) both !important;
    }
    @keyframes fs-bottom-sheet-up {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    body .rz-dialog-titlebar {
        position: relative;
        padding: 14px 16px 12px !important;
    }
    /* خط handle فى الأعلى (تأكيد بصرى للـ bottom sheet) */
    body .rz-dialog-titlebar::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 38px;
        height: 4px;
        background: rgba(0,0,0,.15);
        border-radius: 2px;
    }

    body .rz-dialog-content {
        max-height: calc(90vh - 60px) !important;
        max-height: calc(90dvh - 60px) !important;
        overflow-y: auto !important;
        padding: 12px !important;
    }

    /* ═══ 4) DevExpress Popup — bottom sheet style أيضاً ═══ */
    body .dxbl-popup:not(.fs-print-popup .dxbl-popup),
    body .dxbl-popup-content-wrapper:not(.fs-print-popup *) {
        max-width: 100vw !important;
    }

    /* ═══ 5) Dropdown menus — touch-friendly ═══ */
    body .dropdown-menu {
        min-width: 240px !important;
        padding: 8px !important;
        border-radius: 12px !important;
    }
    body .dropdown-item {
        padding: 11px 14px !important;
        font-size: 14px !important;
        border-radius: 8px !important;
    }
    body .dropdown-item + .dropdown-item {
        margin-top: 2px;
    }

    /* ═══ 6) Sidebar items — touch-friendly ═══ */
    body .sidebar .sidebar-menu li a {
        padding: 12px 14px !important;
        font-size: 14px !important;
        min-height: 44px !important;
    }
    body .sidebar .sidebar-menu .submenu ul li a {
        padding: 11px 14px 11px 36px !important;
        font-size: 13.5px !important;
    }

    /* ═══ 7) Tables (غير DxGrid) — أوضح ═══ */
    body .table:not(.dxbl-grid):not(.db-tbl) th,
    body .table:not(.dxbl-grid):not(.db-tbl) td {
        padding: 10px 8px !important;
        font-size: 13px !important;
    }

    /* ═══ 8) Cards — spacing أحسن ═══ */
    body .card {
        border-radius: 12px !important;
    }
    body .card-body {
        padding: 14px !important;
    }
    body .card-header {
        padding: 12px 14px !important;
    }

    /* ═══ 9) Notifications — أكبر وأوضح ═══ */
    body .rz-notification {
        font-size: 14px !important;
        padding: 12px 14px !important;
        border-radius: 12px !important;
    }

    /* ═══ 10) Modal/Dialog backdrop — أوضح ═══ */
    body .rz-dialog-mask,
    body .modal-backdrop {
        background: rgba(0,0,0,.55) !important;
        backdrop-filter: blur(2px) !important;
    }

    /* ═══ 11) Active touch feedback ═══ */
    body .btn:active,
    body button:active,
    body a.btn:active {
        transform: scale(0.97);
        transition: transform .08s;
    }

    /* ═══ 12) Larger checkboxes & radios ═══ */
    body input[type="checkbox"],
    body input[type="radio"] {
        width: 20px !important;
        height: 20px !important;
        cursor: pointer;
    }

    /* ═══ 13) Disable iOS tap highlight (نستخدم active state بدلها) ═══ */
    body * {
        -webkit-tap-highlight-color: rgba(var(--fs-primary-rgb),.15);
    }

    /* ═══ 14) Improve readability of values ═══ */
    body .text-muted,
    body .small {
        font-size: 12.5px !important;
    }
}

/* ─── PHONES (≤480px) — اضغط شوية ─── */
@media (max-width: 480px) {
    body .form-control,
    body input.lgn-input,
    body input[type="text"]:not(.dxbl-text-edit-input):not(.fs-cell-expanded),
    body input[type="password"],
    body input[type="email"],
    body input[type="tel"],
    body input[type="number"],
    body textarea {
        font-size: 16px !important;          /* احتفاظ بـ 16px */
        padding: 9px 10px !important;
    }
    body .btn,
    body button:not(.dxbl-btn):not(.fs-mqm-btn):not(.fs-mbb-icon):not(.fs-btmnav-item):not(.ai-fp-icon-btn):not(.ai-fp-close):not(.ai-msg-speak) {
        font-size: 13.5px !important;
        padding: 9px 14px !important;
    }
}

/* ════════════════════════════════════════════════════════════════
   Skeleton Loader Utility Classes
   ─────────────────────────────────────────
   Usage: <div class="fs-skel fs-skel-text"></div>
          <div class="fs-skel fs-skel-card"></div>
          <div class="fs-skel fs-skel-avatar"></div>
   ════════════════════════════════════════════════════════════════ */
.fs-skel {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    border-radius: 8px;
    animation: fs-skel-shimmer 1.4s ease-in-out infinite;
    display: inline-block;
}
html.dark-mode .fs-skel {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
}
.fs-skel-text {
    height: 14px;
    width: 100%;
    margin: 4px 0;
    border-radius: 4px;
}
.fs-skel-text-sm { height: 11px; }
.fs-skel-text-lg { height: 18px; }
.fs-skel-card {
    height: 100px;
    width: 100%;
    border-radius: 12px;
}
.fs-skel-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}
.fs-skel-btn {
    height: 38px;
    width: 100px;
    border-radius: 8px;
}
@keyframes fs-skel-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ════════════════════════════════════════════════════════════════
   Floating Action helpers — للأزرار الـ floating
   ════════════════════════════════════════════════════════════════ */
.fs-fab {
    position: fixed;
    bottom: 80px;       /* فوق الـ Bottom Nav */
    inset-inline-end: 14px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--fs-primary), var(--fs-primary-deep));
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 990;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 6px 18px rgba(var(--fs-primary-rgb),.45);
    transition: transform .18s, box-shadow .18s;
}
.fs-fab:hover { box-shadow: 0 8px 22px rgba(var(--fs-primary-rgb),.6); transform: scale(1.05); }
.fs-fab:active { transform: scale(0.95); }
@media (min-width: 992px) {
    .fs-fab { bottom: 24px; }
}

/* ════════════════════════════════════════════════════════════════
   Sidebar — إزالة نقاط القائمة الافتراضية
   ─────────────────────────────────────────
   • بعض الإصدارات بتظهر نقطة (•) قبل اسم العنصر
   • نخفى الـ bullets ونضيف مسافة مناسبة
   ════════════════════════════════════════════════════════════════ */
body .sidebar ul,
body .sidebar-menu ul,
body .sidebar .sidebar-menu ul,
body .sidebar .submenu ul {
    list-style: none !important;
    list-style-type: none !important;
    padding-inline-start: 0 !important;
    margin: 0 !important;
}
body .sidebar li,
body .sidebar-menu li,
body .sidebar .sidebar-menu li,
body .sidebar .submenu li {
    list-style: none !important;
    list-style-type: none !important;
}
body .sidebar li::marker,
body .sidebar-menu li::marker {
    content: '' !important;
    display: none !important;
}

/* ضمان padding مناسب للـ submenu items (RTL) */
body .sidebar .sidebar-menu .submenu > ul > li > a {
    padding-inline-start: 36px !important;
    padding-inline-end: 14px !important;
}

/* ضمان padding للـ root items */
body .sidebar .sidebar-menu > ul > li > a {
    padding-inline-start: 14px !important;
    padding-inline-end: 14px !important;
}
