/* Experimental global visual RTL for Superset 6.0.0, not native AntD RTL.
   Loaded using CUSTOM_FONT_URLS' existing runtime stylesheet mechanism.
   CSS does not change keyboard navigation or popup positioning logic. */
html, body, #app { direction: rtl; }
body { text-align: start; }

/* Typography & Line-height breathing room for Persian (Vazirmatn) */
html[lang='fa'], body, #app {
  font-family: 'Vazirmatn FD', Vazirmatn, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent horizontal overflow on dashboard and layout wrappers */
.dashboard-content, .dashboard, #app {
  overflow-x: clip;
}

/* Off-screen measurement elements: prevent negative scroll ranges in RTL */
.input-sizer,
[style*="left: -9999px"],
[style*="left:-9999px"] {
  left: auto !important;
  right: -9999px !important;
}

/* Global Button & Tab typography breathing room */
html[lang='fa'] .ant-btn {
  font-family: inherit;
  line-height: 1.5;
}
html[lang='fa'] .ant-tabs-tab {
  font-family: inherit;
  line-height: 1.6;
}
html[lang='fa'] h1, html[lang='fa'] h2, html[lang='fa'] h3,
html[lang='fa'] h4, html[lang='fa'] h5, html[lang='fa'] h6,
html[lang='fa'] .ant-typography {
  line-height: 1.6;
}

/* Global AntD dropdown submenu arrows mirroring */
html[lang='fa'] .ant-dropdown-menu-submenu-title,
[dir='rtl'] .ant-dropdown-menu-submenu-title {
  padding-inline-start: 12px !important;
  padding-inline-end: 28px !important;
}
html[lang='fa'] .ant-dropdown-menu-submenu-arrow,
[dir='rtl'] .ant-dropdown-menu-submenu-arrow {
  left: auto !important;
  right: 10px !important;
  transform: scaleX(-1);
}

/* Ant Design Tooltips & Popovers RTL & Vazirmatn font */
body .ant-tooltip,
body .ant-tooltip-inner,
body .ant-tooltip-content,
body .ant-tooltip-inner *,
body .ant-tooltip div,
body .ant-tooltip span,
body .ant-tooltip p,
body .ant-popover,
body .ant-popover-inner,
body .ant-popover-inner-content,
body .ant-popover-inner-content * {
  direction: rtl !important;
  text-align: right !important;
  font-family: 'Vazirmatn FD', Vazirmatn, sans-serif !important;
  line-height: 1.65 !important;
}

body .ant-tooltip-inner {
  max-width: 380px !important;
  padding: 8px 12px !important;
}

body .ant-tooltip [style*="text-align"],
body .ant-tooltip-inner [style*="text-align"],
body .ant-tooltip-inner div[style],
body .ant-tooltip div[style],
body .ant-tooltip [style*="textAlign"],
body .ant-tooltip-inner [style*="textAlign"] {
  text-align: right !important;
  direction: rtl !important;
}

body .ant-tooltip-inner strong,
body .ant-tooltip-inner span {
  display: inline !important;
  direction: rtl !important;
  unicode-bidi: isolate !important;
}
.ant-popover, .ant-popover-inner, .ant-popover-content {
  direction: rtl !important;
  text-align: right !important;
  font-family: 'Vazirmatn FD', Vazirmatn, sans-serif !important;
}
.ant-popover-title {
  direction: rtl !important;
  text-align: right !important;
  font-weight: 600;
}
.ant-popover-inner-content {
  direction: rtl !important;
  text-align: right !important;
}



/* Header brand logo and navigation item spacing */
#main-menu .navbar-brand,
#main-menu a[data-test="navbar-brand"] {
  margin-inline-end: 20px !important;
  margin-inline-start: 0 !important;
}
#main-menu .main-nav {
  display: flex;
  align-items: center;
}
#main-menu .main-nav > li:first-child {
  margin-inline-start: 8px;
}

/* The collapsed filter rail is 32px wide. Superset offsets this header with
   an inline LTR margin; mirror only that offset, keeping the trigger in view. */
.dragdroppable-column[style*="margin-left: -32px"]:has(> div > .dashboard-header-container) {
  margin-left: 0 !important;
  margin-right: -32px;
}
#main-menu, #main-menu .main-nav,
.ant-menu, .ant-dropdown, .ant-dropdown-menu,
.ant-modal, .ant-drawer, .ant-popover,
.ant-form, .ant-select-dropdown, .ant-notification,
.ant-tabs-nav, .ant-breadcrumb, .ant-pagination {
  direction: rtl;
  text-align: start;
}
.ant-menu-title-content, .ant-dropdown-menu-title-content,
.ant-modal-title, .ant-form-item-label { text-align: start; }
/* Superset's home submenu pins actions to physical right; mirror that rule. */
.menu[role='navigation'] > .nav-right {
  right: auto !important;
  left: 16px !important;
  float: left !important;
}
.menu[role='navigation'] > .header {
  text-align: start !important;
  margin-right: 0 !important;
  margin-left: 12px;
}
@media (max-width: 767px) {
  .menu[role='navigation'] > .nav-right { left: auto !important; }
}

/* Never inherit RTL in SQL/code editors, gutter, selections or completions. */
.ace_editor, .ace_editor *, .ace_autocomplete, .ace_autocomplete *,
.monaco-editor, .monaco-editor *, .CodeMirror, .CodeMirror *,
pre, pre *, code, code *, kbd, samp,
input[type='url'], input[type='email'], input[type='number'],
input[type='password'], [dir='ltr'], [dir='ltr'] * {
  direction: ltr !important;
  text-align: left !important;
}
.ace_editor, .ace_autocomplete, .monaco-editor, .CodeMirror, pre, code {
  unicode-bidi: isolate;
}
/* Keep visualization geometry/grid coordinates and SQL result column order. */
.react-grid-layout, .grid-container, .chart-container,
.SqlEditor .queryPane table { direction: ltr; }
/* Text blocks inside dashboard layout remain Persian. */
.dashboard-markdown, .dashboard-component-header,
.dashboard-markdown p, .dashboard-markdown h1,
.dashboard-markdown h2, .dashboard-markdown h3 {
  direction: rtl;
  text-align: start;
}


/* BEGIN CHART TEXT RTL
   Keep canvas/grid coordinate systems LTR; explicitly localize HTML chrome. */
.chart-slice div:has(> .header-title):has(> .header-controls) {
  direction: rtl;
}
.chart-slice .header-title,
.chart-slice .header-title .editable-title,
.chart-slice .header-title a {
  direction: rtl;
  text-align: right !important;
}
.chart-slice .header-title { flex: 1; min-width: 0; }
.chart-slice .header-title .editable-title { display: block; width: 100%; }
/* Big Number KPI Cards (Legacy, ECharts Plugin & Trendline) */
.superset-legacy-chart-big-number,
.superset-plugin-chart-big-number-total,
.superset-plugin-chart-big-number-trendline {
  direction: rtl !important;
  text-align: right !important;
}
.superset-legacy-chart-big-number .text-container,
.superset-plugin-chart-big-number-total .text-container,
.superset-plugin-chart-big-number-trendline .text-container {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  text-align: right !important;
  width: 100%;
}
.superset-legacy-chart-big-number .header-line,
.superset-plugin-chart-big-number-total .header-line,
.superset-plugin-chart-big-number-trendline .header-line {
  direction: rtl !important;
  display: flex !important;
  align-items: baseline !important;
  justify-content: flex-start !important;
  text-align: right !important;
  width: 100%;
}
/* Isolate numerical digits & symbols with Vazirmatn FD */
.superset-legacy-chart-big-number .header-line > span,
.superset-plugin-chart-big-number-total .header-line > span,
.superset-plugin-chart-big-number-trendline .header-line > span,
.superset-legacy-chart-big-number .metric-name,
.superset-plugin-chart-big-number-total .metric-name {
  unicode-bidi: isolate;
  direction: ltr;
  display: inline-block;
  font-family: 'Vazirmatn FD', Vazirmatn, sans-serif !important;
  font-weight: 700;
  letter-spacing: -0.02em;
}
/* Subheader line (comparison, percentage changes, time ranges) */
.superset-legacy-chart-big-number .subheader-line,
.superset-plugin-chart-big-number-total .subheader-line,
.superset-plugin-chart-big-number-trendline .subheader-line {
  direction: rtl !important;
  text-align: right !important;
  margin-top: 4px;
  line-height: 1.6;
}
.superset-legacy-chart-big-number .subheader-line span,
.superset-plugin-chart-big-number-total .subheader-line span,
.superset-plugin-chart-big-number-trendline .subheader-line span {
  unicode-bidi: plaintext;
  text-align: right;
}
.echarts-tooltip, .echarts-tooltip table, .echarts-tooltip th, .echarts-tooltip td {
  direction: rtl;
  text-align: right;
}
/* END CHART TEXT RTL */

/* BEGIN DASHBOARD RTL AUDIT 20261026
   Superset 6.0.0 dashboard chrome only. Do not mirror chart/grid coordinates.
   Keep rc-tabs JS/ink-bar and rc-menu popup placement in their native model. */
.dashboard-header-container .title-panel {
  margin-right: 0;
  margin-left: 48px;
}
.dashboard-header-container .title-panel > div:has(.fave-unfave-icon) {
  padding-left: 0;
  padding-right: 8px;
}
.dashboard-header-container .right-button-panel > div:last-child {
  margin-left: 0;
  margin-right: 8px;
}
.dashboard-header-container .right-button-panel .button-container {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dashboard-header-container .undoRedo {
  direction: ltr;
  margin-right: 0;
  margin-left: 8px;
}
/* rc-tabs reads physical offsetLeft for its ink bar. Mirror the gap only. */
#tabs:has(#tabs-tab-CHARTS) .ant-tabs-tab + .ant-tabs-tab {
  margin-left: 0 !important;
  margin-right: 32px !important;
}
#tabs:has(#tabs-tab-CHARTS) > .ant-tabs-nav {
  padding-left: 0 !important;
  padding-right: 16px;
}
/* react-window owns inline LTR coordinates. Localize card content only. */
#tabs-panel-CHARTS [draggable='true'] > div {
  direction: rtl;
  text-align: right;
}
#tabs-panel-CHARTS [draggable='true'] div:has(> span + span) > span:first-child {
  margin-right: 0;
  margin-left: 16px;
}
#tabs-panel-CHARTS div:has(> .search-input) { gap: 8px; }
#tabs-panel-CHARTS .search-input { min-width: 0; }
#tabs-panel-CHARTS div:has(> .search-input) > div { margin-left: 0; }
#tabs-panel-CHARTS div:has(> button .anticon-plus) {
  justify-content: flex-start;
}
/* Native rc-menu still opens toward the physical right when space permits.
   Put its arrow at that same edge; retain RTL Persian text. */
body:has(.dashboard-header-container) .ant-dropdown-menu-submenu-title {
  padding-right: 24px !important;
  padding-left: 12px !important;
}
body:has(.dashboard-header-container) .ant-dropdown-menu-submenu-arrow {
  left: auto !important;
  right: 8px !important;
}
/* END DASHBOARD RTL AUDIT 20261026 */

/* Modal titles are RTL, but Superset's close button uses physical right:0.
   Reserve an explicit opposite-side close area, including for long titles. */
.ant-modal .ant-modal-close { right: auto !important; left: 0 !important; }
.ant-modal .ant-modal-header { padding-left: 56px !important; padding-right: 16px !important; }

/* In edit mode the chart header already leaves a left-side control gutter.
   Move the chart-only delete hover menu into that gutter, away from RTL title. */
.dashboard-component-chart-holder > .hover-menu-container > .hover-menu--top {
  left: 12px !important;
  right: auto !important;
}

/* Database connection modal: preserve physical rc-tabs ink-bar geometry,
   mirror only the gap between Basic and Advanced in the inherited RTL nav. */
.ant-modal .ant-tabs:has(> .ant-tabs-nav [data-node-key='basic']):has(> .ant-tabs-nav [data-node-key='advanced']) > .ant-tabs-nav .ant-tabs-tab + .ant-tabs-tab {
  margin-left: 0 !important;
  margin-right: 32px !important;
}
.ant-modal .ant-tabs:has(> .ant-tabs-nav [data-node-key='basic']):has(> .ant-tabs-nav [data-node-key='advanced']) > .ant-tabs-nav {
  padding-left: 16px !important;
  padding-right: 16px !important;
}

/* Chart creation and shared chart picker, Persian documents only. */
html[lang='fa'] .ant-steps:has(.viz-gallery) .ant-steps-item-container {
  display: grid !important;
  grid-template-columns: 20px minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
}
html[lang='fa'] .ant-steps:has(.viz-gallery) .ant-steps-item-icon {
  float: none !important;
  margin: 0 !important;
}
html[lang='fa'] .ant-steps:has(.viz-gallery) .ant-steps-item-content {
  display: block !important;
  min-width: 0;
}
html[lang='fa'] .ant-steps:has(.viz-gallery) .ant-steps-item-description > div {
  margin-left: 0;
  margin-right: 0;
}
html[lang='fa'] .ant-steps:has(.viz-gallery) .dataset {
  flex-wrap: wrap;
  gap: 12px 16px;
}
html[lang='fa'] .ant-steps:has(.viz-gallery) .dataset > span { margin: 0; }
html[lang='fa'] .ant-steps:has(.viz-gallery) .dataset .ant-select-selector {
  padding-right: 12px !important;
  padding-left: 30px !important;
}
html[lang='fa'] .ant-steps:has(.viz-gallery) .dataset .ant-select-arrow {
  right: auto;
  left: 11px;
}
html[lang='fa'] .ant-steps:has(.viz-gallery) .dataset .ant-select-selection-search {
  left: 30px;
  right: 12px;
}
html[lang='fa'] .viz-gallery [role='tablist'] {
  border-right: 0;
  border-left: 1px solid var(--ant-color-border, #d9d9d9);
}
html[lang='fa'] .viz-gallery [role='tab'] { gap: 8px; }
html[lang='fa'] .viz-gallery [role='tab'] > span[role='img'] { margin: 0; }
html[lang='fa'] .viz-gallery .ant-input-prefix { margin-right: 0; margin-left: 8px; }
html[lang='fa'] .viz-gallery .ant-collapse-header { flex-direction: row; }
html[lang='fa'] .viz-gallery .ant-collapse-expand-icon { padding-right: 8px; padding-left: 0; }
html[lang='fa'] .viz-gallery .viztype-label { line-height: 1.8; }

/* BEGIN PERSIAN ALERT LAYOUT FIX 20261027
   Ant Design alerts keep the icon in the flex row.  In RTL, older physical
   positioning rules can let the title run underneath that icon. */
html[lang="fa"] .ant-alert {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 12px !important;
  direction: rtl !important;
  text-align: right !important;
}
html[lang="fa"] .ant-alert-icon,
html[lang="fa"] .ant-alert-with-description .ant-alert-icon {
  position: static !important;
  flex: 0 0 auto !important;
  margin: 3px 0 0 0 !important;
}
html[lang="fa"] .ant-alert-content {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  text-align: right !important;
}
html[lang="fa"] .ant-alert-message,
html[lang="fa"] .ant-alert-description {
  display: block !important;
  direction: rtl !important;
  text-align: right !important;
  line-height: 1.8 !important;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}
/* Keep a close button outside the text flow when an alert is dismissible. */
html[lang="fa"] .ant-alert-close-icon {
  position: static !important;
  flex: 0 0 auto !important;
  margin: 3px 0 0 0 !important;
}
/* END PERSIAN ALERT LAYOUT FIX 20261027 */

/* BEGIN PERSIAN DATASET ALERT FIX 20261027-2
   The Dataset page renders the alert icon as a physical overlay in RTL.
   Reserve the icon lane explicitly so long Persian text cannot pass beneath it. */
html[lang="fa"] body:has(.ant-alert) {
  overflow-x: hidden !important;
}
html[lang="fa"] body:has(.ant-alert) .ant-alert,
html[lang="fa"] body:has(.ant-alert) .ant-alert.ant-alert-with-description {
  position: relative !important;
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: 72px !important;
  padding: 15px 64px 15px 18px !important;
  direction: rtl !important;
  text-align: right !important;
}
html[lang="fa"] body:has(.ant-alert) .ant-alert-icon,
html[lang="fa"] body:has(.ant-alert) .ant-alert-with-description .ant-alert-icon {
  position: absolute !important;
  top: 16px !important;
  right: 18px !important;
  left: auto !important;
  display: block !important;
  width: 22px !important;
  margin: 0 !important;
  line-height: 1 !important;
  transform: none !important;
}
html[lang="fa"] body:has(.ant-alert) .ant-alert-content {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: right !important;
}
html[lang="fa"] body:has(.ant-alert) .ant-alert-message,
html[lang="fa"] body:has(.ant-alert) .ant-alert-description {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  direction: rtl !important;
  text-align: right !important;
  line-height: 1.9 !important;
  unicode-bidi: plaintext !important;
}
html[lang="fa"] body:has(.ant-alert) .ant-alert-message {
  margin-bottom: 5px !important;
  font-weight: 600 !important;
}
html[lang="fa"] body:has(.ant-alert) .ant-alert-close-icon {
  position: absolute !important;
  top: 16px !important;
  left: 16px !important;
  right: auto !important;
  margin: 0 !important;
}
/* Keep the dataset page from creating a second horizontal scroll region. */
html[lang="fa"] #app,
html[lang="fa"] #app > div {
  min-width: 0 !important;
  max-width: 100vw !important;
}
/* END PERSIAN DATASET ALERT FIX 20261027-2 */

/* BEGIN DATASET PANEL RTL FIX 20261027-3
   DatasetPanel positions the "View Dataset" action absolutely in the alert.
   In RTL that action collides with the alert title, so keep it in normal flow. */
html[lang="fa"] body:has(.ant-alert) .ant-alert .view-dataset-button {
  position: static !important;
  display: block !important;
  width: max-content !important;
  max-width: 100% !important;
  margin: 8px 0 0 auto !important;
  padding: 3px 8px !important;
  line-height: 1.7 !important;
  white-space: normal !important;
  text-align: right !important;
}
html[lang="fa"] body:has(.ant-alert) .ant-alert-description {
  display: block !important;
  padding-left: 0 !important;
}
/* DatasetPanel's table title is a styled div with a physical nowrap rule.
   Let Latin table names render fully while keeping the heading right-aligned. */
html[lang="fa"] body:has(.ant-alert) .ant-alert ~ div[title] {
  direction: ltr !important;
  text-align: right !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere !important;
  max-width: 100% !important;
}
html[lang="fa"] body:has(.ant-alert) .ant-alert ~ div[title] .anticon:first-of-type {
  margin-right: 0 !important;
  margin-left: 8px !important;
}
/* END DATASET PANEL RTL FIX 20261027-3 */

/* BEGIN IMPECCABLE CRAFT FLOOR POLISH 20261116
   Themed browser surfaces: scrollbars, focus-visible and selection. */
html[lang='fa'] ::selection {
  background-color: rgba(33, 138, 164, 0.25);
  color: inherit;
}
html[lang='fa'] :focus-visible {
  outline: 2px solid var(--ant-color-primary, #218aa4);
  outline-offset: 2px;
}
html[lang='fa'] ::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
html[lang='fa'] ::-webkit-scrollbar-track {
  background: transparent;
}
html[lang='fa'] ::-webkit-scrollbar-thumb {
  background: var(--ant-color-border, rgba(0, 0, 0, 0.2));
  border-radius: 4px;
}
html[lang='fa'] ::-webkit-scrollbar-thumb:hover {
  background: var(--ant-color-text-secondary, rgba(0, 0, 0, 0.35));
}
/* END IMPECCABLE CRAFT FLOOR POLISH 20261116 */

