/* Persian forms/lists: rc-tabs has LTR physical margins even in RTL documents.
   Keep its physical offset/ink-bar model; fix the gap, not transforms. */
html[lang='fa'] .ant-tabs-top > .ant-tabs-nav .ant-tabs-tab + .ant-tabs-tab,
html[lang='fa'] .ant-tabs-bottom > .ant-tabs-nav .ant-tabs-tab + .ant-tabs-tab {
  margin-left: 0 !important;
  margin-right: 32px !important;
}
html[lang='fa'] .ant-modal .ant-form-item-label { text-align: right; }
html[lang='fa'] .ant-modal .ant-form-item-required::before {
  margin-right: 0 !important;
  margin-left: 4px;
}
html[lang='fa'] .ant-select-multiple .ant-select-selection-item {
  direction: rtl;
  gap: 4px;
  margin-left: 4px;
  margin-right: 0;
}
html[lang='fa'] .ant-select-multiple .ant-select-selection-item-content {
  margin-left: 4px;
  margin-right: 0;
  unicode-bidi: plaintext;
}
html[lang='fa'] .ant-pagination-total-text { margin-right: 0; margin-left: 8px; }
html[lang='fa'] .ant-table-thead th { text-align: right; }

/* Shared popup headings: ModalTitleWithIcon uses a physical LTR right margin.
   In RTL the adjacent title text is on the icon's left. Keep inline layout so
   long titles wrap naturally; do not change the separate close button. */
html[lang='fa'] .ant-modal-title .anticon,
html[lang='fa'] .ant-drawer-title .anticon {
  margin-right: 0 !important;
  margin-left: 8px !important;
}
/* AntD confirmation dialogs place their leading icon beside, not inside, title. */
html[lang='fa'] .ant-modal-confirm-body > .anticon {
  margin-right: 0 !important;
  margin-left: 12px !important;
}
/* Same ListView control serves dashboard and chart lists. Mirror both offsets;
   keep the selected-state background and hit targets unchanged. */
html[lang='fa'] .superset-list-view > .header > div:has(> .toggle-button) {
  padding-right: 0;
  padding-left: 16px;
  flex-shrink: 0;
}
html[lang='fa'] .superset-list-view .toggle-button:first-of-type {
  margin-right: 0;
  margin-left: 8px;
}

/* Shared modal footer actions: physical LTR margins leave RTL neighbors touching.
   Apply to nested custom footers as well as native AntD footer buttons. */
html[lang='fa'] .ant-modal-footer button + button {
  margin-left: 0 !important;
  margin-right: 8px !important;
}
/* Native-filter sidebar action row has space-around but no minimum separation.
   Match its semantic icon pair, independent of Emotion-generated class names. */
html[lang='fa'] .ant-modal-body div:has(> button .anticon-filter):has(> button .anticon-pic-center) {
  gap: 8px;
  flex-wrap: wrap;
}

/* Shared RTL action spacing. The classifier distinguishes rows, columns and
   inline action footers, including tooltip-wrapped and dynamically added buttons.
   Reset physical LTR margins once; never add margins on top of flex/grid gaps. */
html[lang='fa'] [data-farano-action-layout] > [data-farano-action-unit],
html[lang='fa'] [data-farano-action-layout] > [data-farano-action-unit] > :is(.ant-btn, .superset-button, .btn) {
  margin-left: 0 !important;
  margin-right: 0 !important;
}
html[lang='fa'] [data-farano-action-layout='row'] {
  column-gap: 8px !important;
  row-gap: 8px !important;
}
html[lang='fa'] [data-farano-action-layout='column'] {
  row-gap: 8px !important;
}
html[lang='fa'] [data-farano-action-layout='inline'] > [data-farano-action-unit] ~ [data-farano-action-unit] {
  margin-inline-start: 8px !important;
}

/* Ant Design Compact & Button Groups RTL mirroring */
html[lang='fa'] .ant-space-compact > .ant-btn:first-child:not(:last-child),
html[lang='fa'] .ant-btn-group > .ant-btn:first-child:not(:last-child) {
  border-start-start-radius: var(--ant-border-radius, 6px) !important;
  border-end-start-radius: var(--ant-border-radius, 6px) !important;
  border-start-end-radius: 0 !important;
  border-end-end-radius: 0 !important;
}
html[lang='fa'] .ant-space-compact > .ant-btn:last-child:not(:first-child),
html[lang='fa'] .ant-btn-group > .ant-btn:last-child:not(:first-child) {
  border-start-start-radius: 0 !important;
  border-end-start-radius: 0 !important;
  border-start-end-radius: var(--ant-border-radius, 6px) !important;
  border-end-end-radius: var(--ant-border-radius, 6px) !important;
}
html[lang='fa'] .ant-space-compact > .ant-btn:not(:first-child):not(:last-child),
html[lang='fa'] .ant-btn-group > .ant-btn:not(:first-child):not(:last-child) {
  border-radius: 0 !important;
}

