/* Shared locale selector */
.language-dropdown { position: relative; }.language-toggle-btn{min-height:38px;display:inline-flex;align-items:center;gap:7px;padding:0 11px;border:1px solid var(--border-color,#d8e0ea);border-radius:10px;background:var(--surface-color,#fff);color:var(--text-color,#172033);font:inherit;font-size:13px;font-weight:700;cursor:pointer}
.language-toggle-btn:hover,.language-dropdown.is-open .language-toggle-btn{border-color:var(--primary-color,#00875a)}
.language-dropdown.is-open .bi-chevron-down { transform: rotate(180deg); }
.language-menu {
    position: absolute;
    z-index: 120;
    top: calc(100% + 8px);
    right: 0;
    min-width: 142px;
    padding: 6px;
    display: none;
    border: 1px solid var(--border-color, #d8e0ea);
    border-radius: 10px;
    background: var(--surface-color, #fff);
    box-shadow: 0 14px 32px rgba(15, 23, 42, .16);
}
.language-dropdown.is-open .language-menu { display: grid; gap: 2px; }
.language-menu a {
    padding: 9px 10px;
    border-radius: 7px;
    color: var(--text-color, #172033);
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}
.language-menu a:hover,
.language-menu a.is-active { background: color-mix(in srgb, var(--primary-color, #00875a) 12%, transparent); color: var(--primary-color, #00875a); }

/* Global RTL behavior: layout, menus, tables, and content alignment. */
html[dir="rtl"] body { direction: rtl; text-align: right; }html[dir="rtl"] .global-header,html[dir="rtl"] .header-left,html[dir="rtl"] .header-right,html[dir="rtl"] .sidebar-logo,html[dir="rtl"] .sidebar-nav a,html[dir="rtl"] .app-breadcrumb{ text-align: right; }html[dir="rtl"] .language-toggle-btn{text-align: right}
html[dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid var(--border-color, #d8e0ea); }
html[dir="rtl"] .dashboard-wrapper { direction: rtl; }
html[dir="rtl"] .sidebar { box-shadow: -8px 0 35px rgba(0,0,0,.18); }
@media (max-width: 768px) {
    html[dir="rtl"] .sidebar { right: -280px; left: auto; transition: right .3s ease; }
    html[dir="rtl"] .sidebar.show { right: 0; left: auto; }
}
html[dir="rtl"] .sidebar-nav a.active { box-shadow: inset -3px 0 0 var(--primary-color, #00875a); }
html[dir="rtl"] .global-sidebar-children { padding-left: 0; padding-right: 38px; }
html[dir="rtl"] .global-sidebar-children a.active { box-shadow: inset -2px 0 0 var(--primary-color, #00875a); }
html[dir="rtl"] .global-sidebar-chevron { transform: rotate(180deg); }
html[dir="rtl"] details[open] .global-sidebar-chevron { transform: rotate(-90deg); }
html[dir="rtl"] .language-menu { right: auto; left: 0; }
html[dir="rtl"] .app-breadcrumb-separator { direction: ltr; }
html[dir="rtl"] table { direction: rtl; }
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="date"],
html[dir="rtl"] input[type="datetime-local"] { direction: ltr; text-align: left; }
html[dir="rtl"] .modal-close,
html[dir="rtl"] .notification-count,
html[dir="rtl"] .messages-count { direction: ltr; }

@media (max-width: 760px) {.language-toggle-btn{min-width: 38px}
}
.auth-page { position: relative; }
.auth-language-switcher {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 2;
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border-color, #d8e0ea);
    border-radius: 10px;
    background: var(--surface-color, #fff);
}
.auth-language-switcher a { padding: 6px 9px; border-radius: 6px; color: var(--text-color, #172033); font-size: 13px; font-weight: 700; text-decoration: none; }
.auth-language-switcher a.is-active { background: var(--primary-color, #00875a); color: #fff; }
html[dir="rtl"] .auth-language-switcher { right: auto; left: 18px; }

/* Application launcher mirrors its desktop anchor and controls in Arabic. */
html[dir="rtl"] .module-switcher-menu,
html[dir="rtl"] .app-launcher-header,
html[dir="rtl"] .app-launcher-search,
html[dir="rtl"] .app-launcher-scroll,
html[dir="rtl"] .app-launcher-card-link { direction: rtl; text-align: right; }
html[dir="rtl"] .app-launcher-search > i { left: auto; right: 14px; }
html[dir="rtl"] .app-launcher-search-input { padding: 0 40px 0 58px; text-align: right; }
html[dir="rtl"] .app-launcher-search kbd { right: auto; left: 10px; }
html[dir="rtl"] .module-switcher-menu .app-launcher-card-link { padding: 11px 11px 11px 38px; }
html[dir="rtl"] .app-launcher-active { right: auto; left: 9px; }
html[dir="rtl"] .app-launcher-favorite { right: auto; left: 6px; }

@media (min-width: 769px) {
    html[dir="rtl"] .module-switcher .module-switcher-menu {
        left: auto;
        right: 0;
        transform-origin: top right;
    }
}
/* Language flags */
.language-menu a { display: flex; align-items: center; gap: 9px; }
.language-flag { display: inline-grid; place-items: center; width: 20px; flex: 0 0 20px; font-size: 16px; line-height: 1; }
.auth-language-switcher a { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 760px) {
}
/* CSS flags avoid operating-system emoji fallback glyphs. */
.language-flag {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 15px;
    flex: 0 0 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .24);
    vertical-align: middle;
}
.language-flag-us {
    background: repeating-linear-gradient(to bottom, #b22234 0 1.15px, #fff 1.15px 2.3px);
}
.language-flag-us::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 10px;
    height: 8px;
    background: #3c3b6e;
}
.language-flag-us::after {
    content: '✦';
    position: absolute;
    top: -2px;
    left: 2px;
    color: #fff;
    font-size: 8px;
    line-height: 1;
}
.language-flag-jo {
    background: linear-gradient(to bottom, #151515 0 33.33%, #fff 33.33% 66.66%, #007a3d 66.66% 100%);
}
.language-flag-jo::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 11px;
    background: #ce1126;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.language-flag-jo::after {
    content: '✦';
    position: absolute;
    top: 4px;
    left: 2px;
    color: #fff;
    font-size: 6px;
    line-height: 1;
}
/* Notification dropdown: retain readable icon and copy alignment in RTL. */
html[dir="rtl"] .notification-menu { right: auto; left: 0; direction: rtl; text-align: right; transform-origin: top left; }
html[dir="rtl"] .user-dropdown.open .user-dropdown-menu { right: auto; left: 0; direction: rtl; text-align: right; transform-origin: top left; }
html[dir="rtl"] .notification-menu .notification-header,
html[dir="rtl"] .notification-menu .notification-footer { text-align: right; }
html[dir="rtl"] .notification-menu .notification-item { flex-direction: row; text-align: right; }
html[dir="rtl"] .notification-menu .notification-item-icon { flex: 0 0 36px; margin: 0; }
html[dir="rtl"] .notification-menu .notification-item-content,
html[dir="rtl"] .notification-menu .notification-item-content strong,
html[dir="rtl"] .notification-menu .notification-item-content small { direction: rtl; text-align: right; unicode-bidi: plaintext; }

/* Mixed-language content: Arabic copy remains readable even while the UI is English. */
.is-arabic-text {
    direction: rtl;
    text-align: right !important;
    unicode-bidi: plaintext;
    font-weight: 600;
}

input.is-arabic-text,
textarea.is-arabic-text {
    font-weight: 600;
}
