/* ============================================
   ArgessBPMS - Language switch + LTR (English) overrides (Phase 25.09)
   Loaded on every shared layout. RTL (Persian) is the design baseline: rules below
   either style the switch or apply only under [dir="ltr"], so Persian is unchanged.
   ============================================ */

.bp-lang-switch {
    min-width: 42px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease;
}

.bp-lang-switch:hover,
.bp-lang-switch:focus-visible {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .4);
}

.bp-login-lang {
    position: fixed;
    top: 18px;
    inset-inline-end: 18px;
    z-index: 5;
    color: #fff;
}

/* English: Latin text first, the Persian font remains the fallback for user content. */
html[dir="ltr"] {
    --bp-font-family: 'Segoe UI', 'Argess', 'Vazirmatn', Tahoma, sans-serif;
}

html[dir="ltr"] body {
    font-family: var(--bp-font-family);
}

/* User-entered Persian content inside the English (LTR) shell: each paragraph takes the
   direction of its own text, so Persian names/descriptions keep correct punctuation order. */
html[dir="ltr"] :is(p, li, td, th, h1, h2, h3, h4, h5, h6, dd, dt, blockquote, strong, small, .bp-user-name) {
    unicode-bidi: plaintext;
}

/* ---- Mirrored one-sided rules of the shared shell (RTL originals in the named sheets) ---- */

/* bp-ux-standard.css / bp-layout.css */
html[dir="ltr"] .bp-skip-link { right: auto; left: 12px; }
html[dir="ltr"] .bp-sidebar { border-left: 0; border-right: 1px solid var(--bp-glass-border); }

/* bp-core-components.css: toasts, modal footer, grid, helpers */
html[dir="ltr"] .bp-toast-region,
html[dir="ltr"] dialog[open] > .bp-toast-region { left: auto; right: 18px; }
html[dir="ltr"] .bp-modal-footer .bp-btn:first-child { margin-left: 0; margin-right: auto; }
html[dir="ltr"] .bp-grid-table tbody tr.bp-grid-row-selected { border-right: 0; border-left: 3px solid #6366f1; }
html[dir="ltr"] .bp-vars-table th,
html[dir="ltr"] .bp-vars-mini-table th,
html[dir="ltr"] .bp-vars-mini-table td { text-align: left; }
html[dir="ltr"] .bp-vars-footer-meta,
html[dir="ltr"] .bp-org-picker__footer > span,
html[dir="ltr"] .bp-expression-footer > span { margin-left: 0; margin-right: auto; }
html[dir="ltr"] .bp-help-popover li::before { right: auto; left: 2px; }

/* bp-notifications.css / bp-layout-user.css */
html[dir="ltr"] .bp-notification-badge { left: auto; right: -3px; }
html[dir="ltr"] .bp-notification-dropdown { left: auto; right: 24px; }
html[dir="ltr"] .bp-notification-item { text-align: left; }
html[dir="ltr"] .bp-notification-item.unread { border-right: 0; border-left: 3px solid var(--bp-primary); }
html[dir="ltr"] .bp-notification-list .bp-notification-item::before { right: auto; left: 0; }
html[dir="ltr"] .bp-notification-open { text-align: left; }

/* bp-help-center.css */
html[dir="ltr"] .bp-global-help-search > i { right: auto; left: 15px; }
html[dir="ltr"] .bp-global-help-search kbd { left: auto; right: 13px; }
html[dir="ltr"] .bp-global-help-result,
html[dir="ltr"] .hc-featured-card { text-align: left; }
html[dir="ltr"] .bp-help-error-ribbon { right: auto; left: 18px; }

/* bp-inbox.css */
html[dir="ltr"] .bp-inbox-stat,
html[dir="ltr"] .bp-inbox-task-card,
html[dir="ltr"] .bp-inbox-process-card { text-align: left; }
html[dir="ltr"] .bp-inbox-divider::after { left: auto; right: 1px; }
html[dir="ltr"] .bp-inbox-process-search::before { right: auto; left: 13px; }
html[dir="ltr"] .bp-inbox-inspector { border-left: 0; border-right: 1px solid #e3e8f0; }
html[dir="ltr"] .bp-inbox-process-categories button span { margin-right: 0; margin-left: 4px; }

/* bp-workspace.css: collapsible panel toggle */
html[dir="ltr"] .bp-workspace-region[data-workspace-kind="panel"] > .bp-workspace-toggle { left: auto; right: 7px; }

html[dir="ltr"] .bp-global-help-search input { padding: 0 48px 0 42px; }
html[dir="ltr"] .bp-inbox-process-search input { padding: 0 12px 0 38px; }

@media (max-width: 1200px) {
    html[dir="ltr"] .bp-help-error-ribbon { right: auto; left: 10px; }
}

@media (max-width: 640px) {
    html[dir="ltr"] .bp-notification-dropdown { left: auto; right: 14px; }
}

/* Directional icons were chosen for RTL ("back" = arrow-right); mirror them in English. */
html[dir="ltr"] :is(.fa-arrow-right, .fa-arrow-left, .fa-chevron-right, .fa-chevron-left,
    .fa-angle-right, .fa-angle-left, .fa-angles-right, .fa-angles-left, .fa-arrow-right-from-bracket,
    .fa-right-from-bracket, .bp-inbox-process-card__start b) {
    transform: scaleX(-1);
}

/* ---- Phase 25.10: end-user screens (my requests, reports, task form) ---- */

/* bp-my-requests.css: summary cards and request timeline */
html[dir="ltr"] .bp-request-stat { text-align: left; }
html[dir="ltr"] .bp-request-timeline-item { padding: 0 0 20px 42px; }
html[dir="ltr"] .bp-request-timeline-item::before { right: auto; left: 15px; }
html[dir="ltr"] .bp-request-timeline-item__dot { right: auto; left: 6px; }

/* bp-report.css */
html[dir="ltr"] .bp-report-table th,
html[dir="ltr"] .bp-report-table td { text-align: left; }

/* bp-form-renderer.css: task form, grids and smart lookup */
html[dir="ltr"] .bp-rf-required { margin-left: 0; margin-right: 2px; }
html[dir="ltr"] .bp-rf-select { padding-left: 10px; padding-right: 32px; background-position: right 10px center; }
html[dir="ltr"] .bp-rf-grid-table th,
html[dir="ltr"] .bp-smart-table th,
html[dir="ltr"] .bp-smart-table td,
html[dir="ltr"] .bp-rf-smart-lookup-button { text-align: left; }

@media (max-width: 480px) {
    html[dir="ltr"] .bp-request-timeline-item { padding-right: 0; padding-left: 34px; }
    html[dir="ltr"] .bp-request-timeline-item__dot { right: auto; left: 2px; }
    html[dir="ltr"] .bp-request-timeline-item::before { right: auto; left: 11px; }
}

/* ---- Phase 25.12: administration screens ---- */

/* workflow-operations.css */
html[dir="ltr"] .wo-stat,
html[dir="ltr"] .wo-instance-row,
html[dir="ltr"] .wo-incident,
html[dir="ltr"] .wo-table th,
html[dir="ltr"] .wo-table td { text-align: left; }
html[dir="ltr"] .wo-search-wrap::before { right: auto; left: 14px; }
html[dir="ltr"] .wo-search-wrap .bp-input { padding-right: 12px; padding-left: 42px; }
html[dir="ltr"] .wo-badge-muted { margin-right: 0; margin-left: 6px; }
html[dir="ltr"] .wo-outcome-reason { border-right: 0; border-left: 3px solid #f59e0b; }
html[dir="ltr"] .wo-instance-timeline { padding-right: 0; padding-left: 4px; }
/* The detail drawer opens from the reading side: left in Persian, right in English. */
html[dir="ltr"] .wo-drawer-panel { left: auto; right: 0; box-shadow: -20px 0 60px rgba(15, 23, 42, .22); transform: translateX(100%); }
html[dir="ltr"] .wo-drawer.is-open .wo-drawer-panel { transform: translateX(0); }

/* bp-special-participants.css */
html[dir="ltr"] .sp-table th,
html[dir="ltr"] .sp-modal-table th,
html[dir="ltr"] .sp-modal-table td { text-align: left; }

/* bp-administration.css: section menu, tables, organization tree, move dialog */
html[dir="ltr"] .adm-summary-card::after { left: auto; right: -34px; }
html[dir="ltr"] .adm-navigation { border-left: 0; border-right: 1px solid var(--adm-border); }
html[dir="ltr"] .adm-nav-item,
html[dir="ltr"] .adm-move-preview-empty { text-align: left; }
html[dir="ltr"] .adm-table td:first-child { border-right: 0; border-left: 1px solid #edf1f7; }
html[dir="ltr"] .adm-table td:last-child { border-left: 0; border-right: 1px solid #edf1f7; }
html[dir="ltr"] .adm-tree-list ul { padding-right: 0; padding-left: 24px; border-right: 0; border-left: 1px dashed #cbd5e1; }
html[dir="ltr"] .adm-permission-legend small { margin-right: 0; margin-left: auto; }
html[dir="ltr"] .adm-tree-node.is-position > .adm-tree-button { border-right: 0; border-left: 3px solid rgba(99,102,241,.18); }
html[dir="ltr"] .adm-tree-node.is-unit > .adm-tree-button { border-right: 0; border-left: 3px solid rgba(245,158,11,.22); }
html[dir="ltr"] .adm-move-parent-tree ul { padding: 0 0 0 18px; }
html[dir="ltr"] .adm-move-parent-tree > ul { padding-left: 0; }
html[dir="ltr"] .adm-move-tree-node > ul { border-right: 0; border-left: 1px dashed #dbe3ef; }
html[dir="ltr"] .adm-link-button i { margin-left: 0; margin-right: 4px; }

/* Phase 25.13 — process list (bp-lifecycle.css) and process designer */
html[dir="ltr"] .bp-validation-list { padding-left: 0; padding-right: 4px; }
html[dir="ltr"] .bp-validation-item.is-error { border-right: 0; border-left: 4px solid #e11d48; }
html[dir="ltr"] .bp-validation-item.is-warning { border-right: 0; border-left: 4px solid #f59e0b; }
html[dir="ltr"] .bp-validation-item.is-info { border-right: 0; border-left: 4px solid #3b82f6; }
html[dir="ltr"] .bp-validation-item-suggestion { border-right: 0; border-left: 3px solid #94a3b8; }
html[dir="ltr"] .bp-integration-test-card.is-ready { border-right: 0; border-left: 4px solid #10b981; }
html[dir="ltr"] .bp-integration-test-card.is-blocked { border-right: 0; border-left: 4px solid #ef4444; }
html[dir="ltr"] .bp-status-pill { text-align: left; }
html[dir="ltr"] .bp-org-picker { border-left: 0; border-right: 1px solid rgba(255,255,255,.8); }
html[dir="ltr"] .bp-designer-contextbar.bp-workspace-region[data-workspace-kind="header"] > .bp-workspace-toggle,
html[dir="ltr"] .bp-designer-contextbar.bp-workspace-region.is-collapsed > .bp-workspace-toggle { left: auto; right: 12px; }
html[dir="ltr"] .bp-designer-contextbar.bp-workspace-region:not(.is-collapsed) { padding-left: 0; padding-right: 52px; }

/* Phase 25.13 — form builder (bp-form-builder.css) */
html[dir="ltr"] .bp-fb-field-type-badge { right: auto; left: 12px; max-width: 32%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[dir="ltr"] .bp-fb-field-label .required-star { margin-right: 0; margin-left: 2px; }
html[dir="ltr"] .bp-fb-field { padding-left: 14px; padding-right: 58px; }
html[dir="ltr"] .bp-fb-field-drag-handle { left: auto; right: 7px; }
html[dir="ltr"] .bp-fb-field-actions { left: auto; right: 5px; }
html[dir="ltr"] .bp-fb-binding-badge { left: auto; right: 48px; }
html[dir="ltr"] .bp-variables-table th,
html[dir="ltr"] .bp-preview-grid-table th,
html[dir="ltr"] .bp-tree-category-header,
html[dir="ltr"] .bp-lookup-preview-table th,
html[dir="ltr"] .bp-lookup-preview-table td,
html[dir="ltr"] .bp-grid-column-header code,
html[dir="ltr"] .bp-event-action-assistant-main > span,
html[dir="ltr"] .bp-event-action-safety-main > span { text-align: left; }
html[dir="ltr"] .bp-tree-count,
html[dir="ltr"] .bp-fv-card-actions .bp-fv-delete { margin-right: 0; margin-left: auto; }
html[dir="ltr"] .bp-fb-diagnostics-list { padding-left: 0; padding-right: 3px; }
html[dir="ltr"] .bp-fb-diagnostic-item.is-error { border-right: 0; border-left: 4px solid #dc2626; }
html[dir="ltr"] .bp-fb-diagnostic-item.is-warning { border-right: 0; border-left: 4px solid #f59e0b; }
html[dir="ltr"] .bp-fb-diagnostic-item.is-info { border-right: 0; border-left: 4px solid #0284c7; }
html[dir="ltr"] .bp-grid-table tbody tr.bp-grid-row-selected { border-right: 0; border-left: 3px solid #6366f1; }

/* Phase 25.13 — report designer (bp-report-designer.css) */
html[dir="ltr"] .bp-rd-panel + .bp-rd-panel { border-right: 0; border-left: 1px solid #dbe3f0; }
@media (max-width: 980px) {
    html[dir="ltr"] .bp-rd-panel + .bp-rd-panel { border-left: 0; }
}

/* Phase 25.13 — dashboard designer and runtime (bp-dashboard-designer.css, bp-dashboard.css) */
html[dir="ltr"] .bp-dashboard-designer-meta span + span::before { margin-left: 0; margin-right: 11px; }
html[dir="ltr"] .bp-dashboard-palette { border-left: 0; border-right: 1px solid #e5eaf2; }
html[dir="ltr"] .bp-dashboard-properties { border-right: 0; border-left: 1px solid #e5eaf2; }
html[dir="ltr"] .bp-dashboard-canvas-toolbar span { margin-right: 0; margin-left: 8px; }
html[dir="ltr"] .bp-dashboard-device-switch button { border-left: 0; border-right: 1px solid #edf0f5; }
html[dir="ltr"] .bp-dashboard-device-switch button:last-child { border-right: 0; }
html[dir="ltr"] .bp-dashboard-widget-editor-actions { left: auto; right: 9px; }
html[dir="ltr"] .bp-dashboard-diagnostics { right: 310px; left: 270px; }
html[dir="ltr"] .bp-dashboard-kpi-value,
html[dir="ltr"] .bp-dashboard-table th:first-child,
html[dir="ltr"] .bp-dashboard-table td:first-child { text-align: left; }
@media (max-width: 1250px) {
    html[dir="ltr"] .bp-dashboard-diagnostics { right: 280px; left: 240px; }
}
@media (max-width: 980px) {
    html[dir="ltr"] .bp-dashboard-diagnostics { right: 15px; left: 205px; }
}

/* Phase 25.13 — designer toolbar: English labels are longer than the fixed RTL widths */
html[dir="ltr"] .bp-designer-toolbar-h .bp-toolbar-item.bp-toolbar-item-labeled { width: auto; min-width: 36px; padding-left: 1px; padding-right: 1px; }
html[dir="ltr"] .bp-designer-toolbar-h .bp-authoring-group { gap: 2px; }
html[dir="ltr"] .bp-designer-toolbar-h .bp-toolbar-item-labeled small { font-size: 10px !important; letter-spacing: -0.1px; white-space: nowrap; }

/* Phase 25.14 — integration center (bp-integration.css) and runtime support (runtime-support.css) */
html[dir="ltr"] .int-external-reference { text-align: left; }
html[dir="ltr"] .int-mapping-dependencies span b { margin-left: 0; margin-right: .25rem; }
html[dir="ltr"] .rst-event { border-right: 0; border-left: 3px solid #2563eb; }

/* Phase 25.15 polish — English admin menu labels are longer than the Persian ones.
   Wide screens: compact items without the 118px clamp, so "Release readiness" and "Inbox" stay visible.
   Up to 1599px (e.g. 1360×768) the menu icons also give way (user name/RC badge: bp-ux-standard.css) so every label stays readable;
   below 1340px: icon-only items with tooltips (title), as in the Persian layout at narrow widths. */
html[dir="ltr"] body.bp-shell-admin .bp-admin-menu { gap: 2px; }
html[dir="ltr"] body.bp-shell-admin .bp-admin-menu-item { padding-inline: 8px; gap: 5px; font-weight: 600; max-width: none; }
@media (max-width: 1599px) {
    html[dir="ltr"] body.bp-shell-admin .bp-admin-menu-item > i { display: none; }
}
@media (max-width: 1339px) {
    html[dir="ltr"] body.bp-shell-admin .bp-admin-menu-item > span { display: none; }
    html[dir="ltr"] body.bp-shell-admin .bp-admin-menu-item > i { display: inline-block; }
    html[dir="ltr"] body.bp-shell-admin .bp-admin-menu-item { width: 36px; justify-content: center; padding-inline: 0; }
}
