﻿/* ---------- Arabic font + better rendering ---------- */
:root {
    --app-ar-font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
}

html[dir="rtl"], html[dir="rtl"] body {
    font-family: var(--app-ar-font) !important;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 0.95rem;
    line-height: 1.6;
}

    html[dir="rtl"] h1,
    html[dir="rtl"] h2,
    html[dir="rtl"] h3,
    html[dir="rtl"] h4,
    html[dir="rtl"] h5,
    html[dir="rtl"] h6,
    html[dir="rtl"] .btn,
    html[dir="rtl"] .form-control,
    html[dir="rtl"] .form-select,
    html[dir="rtl"] .menu-title,
    html[dir="rtl"] .table {
        font-family: var(--app-ar-font) !important;
    }

    /* أرقام وحقول التاريخ تكون واضحة */
    html[dir="rtl"] input,
    html[dir="rtl"] select,
    html[dir="rtl"] textarea {
        font-variant-numeric: tabular-nums;
    }

/* ---------- Global tables: nicer spacing ---------- */
@media (max-width: 1199.98px) {
    .table th,
    .table td {
        padding: .55rem .65rem;
        vertical-align: middle;
    }
}

/*
  Mobile stack mode (يخلي الجدول كروت في الشاشات الصغيرة)
  - يتم تفعيلها تلقائياً عبر JS بإضافة class: table-mobile
  - ويضيف data-label لكل خلية بناءً على عنوان العمود
*/
@media (max-width: 767.98px) {
    table.table.table-mobile {
        border: 0;

    }

        table.table.table-mobile thead {
            display: none;
        }

        table.table.table-mobile tbody,
        table.table.table-mobile tr,
        table.table.table-mobile td {
            display: block;
            width: 100%;
        }

            table.table.table-mobile tbody tr {
                border: 1px solid var(--bs-border-color);
                border-radius: .85rem;
                padding: .6rem .8rem;
                margin-bottom: .8rem;
                background: var(--bs-body-bg);
                box-shadow: 0 1px 2px rgba(0,0,0,.03);
            }

            table.table.table-mobile tbody td {
                display: flex;
                align-items: flex-start;
                justify-content: space-between;
                gap: .75rem;
                padding: .35rem 0 !important;
                border: 0 !important;
                border-bottom: 1px dashed rgba(0,0,0,.08) !important;
                white-space: normal !important;
            }

            table.table.table-mobile tbody tr td:last-child {
                border-bottom: 0 !important;
            }

            table.table.table-mobile tbody td::before {
                content: attr(data-label);
                font-weight: 600;
                color: var(--bs-gray-600);
                flex: 0 0 42%;
                max-width: 42%;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

            table.table.table-mobile tbody td > * {
                flex: 1 1 auto;
                max-width: 58%;
            }

            /* عمود الإجراءات: بدون عنوان + محاذاة يمين */
            table.table.table-mobile tbody td.cell-actions {
                justify-content: flex-end;
            }

                table.table.table-mobile tbody td.cell-actions::before {
                    display: none;
                    content: "";
                }

                table.table.table-mobile tbody td.cell-actions > * {
                    max-width: 100%;
                }
            table.table.table-mobile tbody td.cell-hide-mobile {
                display: none !important;
            }

}
