/* اتجاه الواجهة يتبع لغة البرنامج (html[dir]) — يُحمَّل آخراً بعد قشور الستايل */
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}
html[dir="ltr"] {
    direction: ltr;
}
html[dir="ltr"] body {
    direction: ltr;
    text-align: left;
}

html[dir="ltr"] .main-header,
html[dir="ltr"] .main-content {
    margin-right: 0;
    margin-left: var(--fx-sidebar-w);
}
html[dir="ltr"] .sidebar-container {
    right: auto !important;
    left: 0 !important;
    border-left-width: 0 !important;
    border-right: 1px solid var(--fx-border);
}
html[dir="ltr"] .sidebar .nav-link {
    text-align: left;
}
html[dir="ltr"] .fx-quick-menu {
    right: auto;
    left: calc(var(--fx-sidebar-w) + 0.75rem);
}

html[dir="ltr"][data-fx-shell="glass"] .sidebar-container {
    right: auto !important;
    left: 0 !important;
    border-left-width: 0 !important;
    border-right: 1px solid var(--fx-glass-border, var(--fx-border)) !important;
}
html[dir="ltr"][data-fx-shell="glass"] .main-header,
html[dir="ltr"][data-fx-shell="glass"] .main-content {
    margin-right: 0 !important;
    margin-left: var(--fx-sidebar-w) !important;
}

html[dir="ltr"] body.fx-cashier-shell .main-header,
html[dir="ltr"] body.fx-cashier-shell .main-content {
    margin-left: 0;
    margin-right: 0;
}

html[dir="ltr"][data-fx-shell="windows7"] .sidebar-container {
    border-right-color: var(--fx-w7-border, var(--fx-border));
}
html[dir="ltr"][data-fx-shell="windows7"] .main-header,
html[dir="ltr"][data-fx-runtime="desktop"] .main-header {
    right: 0 !important;
    left: var(--fx-sidebar-w) !important;
    margin-left: 0;
    margin-right: 0;
}
html[dir="ltr"][data-fx-shell="windows7"] .main-content,
html[dir="ltr"][data-fx-runtime="desktop"] .main-content {
    right: 0 !important;
    left: var(--fx-sidebar-w) !important;
    margin-left: 0;
    margin-right: 0;
}
html[dir="ltr"][data-fx-runtime="desktop"] body.fx-cashier-shell .main-header,
html[dir="ltr"][data-fx-runtime="desktop"] body.fx-cashier-shell .main-content,
html[dir="ltr"][data-fx-shell="windows7"] body.fx-cashier-shell .main-header,
html[dir="ltr"][data-fx-shell="windows7"] body.fx-cashier-shell .main-content {
    left: 0 !important;
    right: 0 !important;
}

/* سايدبار: سكة أيقونات 72px، تنبسط فوق الصفحة عند المرور دون قفز النص */
@media (min-width: 992px) {
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) {
        --fx-sidebar-rail: 72px;
        --fx-sidebar-open: 260px;
        --fx-sidebar-w: var(--fx-sidebar-rail);
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container {
        width: var(--fx-sidebar-rail);
        overflow: hidden;
        z-index: 1400;
        transition: width .3s ease-in-out, box-shadow .3s ease-in-out;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container:hover,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container:focus-within {
        width: var(--fx-sidebar-open);
        box-shadow: 0 8px 28px rgba(16, 24, 40, .18);
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-project-head,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-sidebar-hr {
        width: var(--fx-sidebar-open);
        min-width: var(--fx-sidebar-open);
        max-width: var(--fx-sidebar-open);
        align-self: flex-start;
        flex-shrink: 0;
        box-sizing: border-box;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .sidebar {
        width: var(--fx-sidebar-open);
        min-width: var(--fx-sidebar-open);
        max-width: var(--fx-sidebar-open);
        align-self: flex-start;
        flex: 1 1 auto;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-project-head {
        padding: 0.7rem 0 0.35rem;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-project-brand,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-project-brand-home {
        width: var(--fx-sidebar-open);
        gap: 0;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-project-logo-wrap {
        width: var(--fx-sidebar-rail);
        flex: 0 0 var(--fx-sidebar-rail);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-project-logo {
        width: 40px;
        height: 40px;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-nav-group-label {
        max-height: 2.4rem;
        overflow: hidden;
        transition: opacity .22s ease, max-height .25s ease, margin .25s ease, padding .25s ease;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-project-name,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-project-logo-edit,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-page-search-trigger-label,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-page-search-trigger-kbd {
        transition: opacity .22s ease;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-project-name {
        white-space: nowrap;
        -webkit-line-clamp: 1;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .sidebar {
        padding: 0.15rem 0 0.75rem;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-page-search-trigger,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .sidebar .nav-link {
        width: var(--fx-sidebar-open);
        justify-content: flex-start;
        gap: 0;
        padding-inline: 0;
        margin-inline: 0;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .sidebar .nav-link > span {
        display: flex;
        align-items: center;
        gap: 0;
        width: var(--fx-sidebar-open);
        white-space: nowrap;
        font-size: 1.02rem;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .sidebar .nav-link .fx-ico,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container .fx-page-search-trigger-ico {
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
        margin-inline-start: 25px;
        margin-inline-end: 25px;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container:not(:hover):not(:focus-within):not(.is-pinned) .fx-project-name,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container:not(:hover):not(:focus-within):not(.is-pinned) .fx-project-logo-edit,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container:not(:hover):not(:focus-within):not(.is-pinned) .fx-page-search-trigger-label,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container:not(:hover):not(:focus-within):not(.is-pinned) .fx-page-search-trigger-kbd,
    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container:not(:hover):not(:focus-within):not(.is-pinned) .brand-text {
        opacity: 0;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container:not(:hover):not(:focus-within) .fx-page-search-trigger {
        border-color: transparent;
        background: transparent;
        box-shadow: none;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container:not(:hover):not(:focus-within):not(.is-pinned) .fx-nav-group-label {
        opacity: 0;
        max-height: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
        border: 0;
        pointer-events: none;
    }

    html body:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container:not(:hover):not(:focus-within):not(.is-pinned) #fxShortcutPicker {
        display: none !important;
    }

    html body.fx-sidebar-pinned:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) {
        --fx-sidebar-w: var(--fx-sidebar-open);
    }

    html body.fx-sidebar-pinned:not(.fx-cashier-shell):not(.fx-invoice-shell):not(.fx-assistant-shell) .sidebar-container {
        width: var(--fx-sidebar-open) !important;
        box-shadow: none;
    }

}

.fx-shell-bar > .fx-sidebar-pin {
    order: 8;
    flex: 0 0 2.2rem;
    width: 2.2rem;
    height: 2.2rem;
    margin-left: 1rem;
    margin-right: 1rem;
    box-shadow: -1px 0 0 #dee2e6;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: #343a40;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    z-index: 3;
}

html[dir="ltr"] .fx-shell-bar > .fx-sidebar-pin {
    order: -1;
    margin-left: 0;
    margin-right: 1rem;
    box-shadow: 1px 0 0 #dee2e6;
}

.fx-shell-bar > .fx-sidebar-pin:hover,
.fx-shell-bar > .fx-sidebar-pin.is-on {
    color: var(--fx-primary, #0f766e);
}

.fx-sidebar-pin-label {
    display: none;
}

/* مفاتيح وخيارات الإعدادات: الزر على طرف السطر والنص بجانبه */
.fx-settings-section .form-check,
.fx-settings-glass-card .form-check {
    display: flex !important;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0 !important;
    min-height: 0;
    text-align: start;
}

.fx-settings-section .form-check > .form-check-input,
.fx-settings-glass-card .form-check > .form-check-input {
    position: static !important;
    float: none !important;
    margin: 0.2rem 0 0 !important;
    flex: 0 0 auto;
}

.fx-settings-section .form-switch > .form-check-input,
.fx-settings-glass-card .form-switch > .form-check-input {
    width: 2.6rem !important;
    height: 1.35rem !important;
    border-radius: 2rem;
}

.fx-settings-section .form-check > .form-check-label,
.fx-settings-glass-card .form-check > .form-check-label {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

.fx-side-chevs {
    display: inline-flex;
    align-items: center;
    width: 0.95rem;
    height: 0.85rem;
    transition: transform .15s ease;
}

.fx-side-chevs span {
    display: block;
    width: 0.38rem;
    height: 0.38rem;
    border-top: 2.5px solid currentColor;
    border-right: 2.5px solid currentColor;
    transform: rotate(45deg);
    margin-left: -0.2rem;
}

.fx-side-chevs span:first-child {
    margin-left: 0.08rem;
}

html[dir="rtl"] .fx-sidebar-pin:not(.is-on) .fx-side-chevs {
    transform: scaleX(-1);
}

html[dir="rtl"] .fx-sidebar-pin.is-on .fx-side-chevs,
html[dir="rtl"] .sidebar-container:hover ~ .fx-shell-bar .fx-sidebar-pin .fx-side-chevs,
html[dir="rtl"] .sidebar-container:hover > .fx-sidebar-pin .fx-side-chevs {
    transform: none;
}

html[dir="ltr"] .fx-sidebar-pin.is-on .fx-side-chevs,
html[dir="ltr"] .sidebar-container:hover ~ .fx-shell-bar .fx-sidebar-pin .fx-side-chevs,
html[dir="ltr"] .sidebar-container:hover > .fx-sidebar-pin .fx-side-chevs {
    transform: scaleX(-1);
}

.sidebar-container > .fx-sidebar-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    flex: 0 0 auto;
    width: 2.2rem;
    height: 2.2rem;
    margin: 0.55rem 0.75rem 0.95rem;
    padding: 0;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: inherit;
    cursor: pointer;
    position: relative;
    z-index: 3;
}

.sidebar-container .fx-nav-group-label {
    margin-top: 0.85rem;
}

#fxShortcutPicker [data-fx-shortcut-row] {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.2rem 0.15rem;
}

#fxShortcutPicker [data-fx-shortcut-row] input[type="checkbox"] {
    position: static;
    float: none;
    flex: 0 0 1.05rem;
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    margin-inline-end: 0.65rem;
}

#fxShortcutPicker [data-fx-shortcut-row] span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-inline-start: 0.15rem;
}

html[data-fx-shell="adminlte"] #fxShortcutPicker,
html[data-fx-shell="t2027"] #fxShortcutPicker {
    color: #f8f9fa;
}

html[data-fx-shell="adminlte"] #fxShortcutPicker .text-muted,
html[data-fx-shell="adminlte"] #fxShortcutPicker [data-fx-shortcut-sec],
html[data-fx-shell="adminlte"] #fxShortcutPicker [data-fx-shortcut-row],
html[data-fx-shell="adminlte"] #fxShortcutPicker [data-fx-shortcut-row] span,
html[data-fx-shell="t2027"] #fxShortcutPicker .text-muted,
html[data-fx-shell="t2027"] #fxShortcutPicker [data-fx-shortcut-sec],
html[data-fx-shell="t2027"] #fxShortcutPicker [data-fx-shortcut-row],
html[data-fx-shell="t2027"] #fxShortcutPicker [data-fx-shortcut-row] span {
    color: #f8f9fa !important;
}

html[data-fx-shell="adminlte"] #fxShortcutPicker [data-fx-shortcut-sec],
html[data-fx-shell="t2027"] #fxShortcutPicker [data-fx-shortcut-sec] {
    color: #ffffff !important;
    font-weight: 700;
}

html[data-fx-shell="adminlte"] #fxShortcutPicker .form-control,
html[data-fx-shell="t2027"] #fxShortcutPicker .form-control {
    background: #fff !important;
    color: #212529 !important;
    border-color: #ced4da !important;
}

html[data-fx-shell="adminlte"] #fxShortcutPicker input[type="checkbox"],
html[data-fx-shell="t2027"] #fxShortcutPicker input[type="checkbox"] {
    accent-color: var(--fx-primary, #0f766e);
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

@media (max-width: 991.98px) {
    html[dir="ltr"] .main-header,
    html[dir="ltr"] .main-content {
        margin-left: 0;
        margin-right: 0;
    }
    html[dir="ltr"][data-fx-shell="windows7"] .main-header,
    html[dir="ltr"][data-fx-shell="windows7"] .main-content,
    html[dir="ltr"][data-fx-runtime="desktop"] .main-header,
    html[dir="ltr"][data-fx-runtime="desktop"] .main-content {
        left: 0 !important;
        right: 0 !important;
    }
}
