
/* Persian Screener only: English geometry, Persian typography. */

html[lang="fa-IR"] {
    direction: ltr !important;
}

html[lang="fa-IR"] body:has(.screener-hero-v2) {
    direction: ltr !important;
    text-align: left !important;
    padding-top: 0 !important;
    min-width: 0;
}

/* Keep the navigation in normal document flow. */
html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 72px !important;
    direction: ltr !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    box-sizing: border-box;
    z-index: 100 !important;
}

html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav nav {
    direction: ltr !important;
    flex-direction: row !important;
    min-width: 0;
}

html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav nav a {
    direction: rtl;
    unicode-bidi: isolate;
    text-align: center;
}

html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav .brand {
    direction: ltr !important;
    flex-direction: row !important;
}

html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav .actions,
html[lang="fa-IR"] body:has(.screener-hero-v2) .language-switcher {
    direction: ltr !important;
}

/* Preserve English hero geometry. */
html[lang="fa-IR"] .screener-hero-v2 {
    direction: ltr !important;
    text-align: left !important;
}

html[lang="fa-IR"] .screener-hero-v2 .screener-hero-copy {
    direction: rtl !important;
    text-align: right !important;
    min-width: 0;
}

html[lang="fa-IR"] .screener-hero-v2 .screener-hero-copy h1,
html[lang="fa-IR"] .screener-hero-v2 .screener-hero-copy p {
    text-align: right !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

html[lang="fa-IR"] .screener-hero-v2 .screener-hero-stats {
    direction: ltr !important;
    flex-direction: row !important;
    text-align: center !important;
}

/* English toolbar positions and market-table column order. */
html[lang="fa-IR"] .toolbar,
html[lang="fa-IR"] .active-filters,
html[lang="fa-IR"] .results-card,
html[lang="fa-IR"] .results-header,
html[lang="fa-IR"] .table-wrap,
html[lang="fa-IR"] #screenerTable {
    direction: ltr !important;
}

html[lang="fa-IR"] #screenerTable th,
html[lang="fa-IR"] #screenerTable td {
    direction: ltr !important;
    unicode-bidi: isolate;
}

html[lang="fa-IR"] #screenerTable {
    text-align: left !important;
}

html[lang="fa-IR"] .search-box input {
    direction: rtl !important;
    text-align: right !important;
}

html[lang="fa-IR"] .filter-label,
html[lang="fa-IR"] .empty-filter-state,
html[lang="fa-IR"] .results-header strong {
    direction: rtl;
    unicode-bidi: isolate;
}

/* Keep the drawer geometry while preserving Persian reading direction. */
html[lang="fa-IR"] #filterDrawer {
    direction: ltr !important;
}

html[lang="fa-IR"] #filterDrawer .drawer-header,
html[lang="fa-IR"] #filterDrawer .filter-config,
html[lang="fa-IR"] #filterDrawer .catalog-filter {
    text-align: right;
}

html[lang="fa-IR"] #filterDrawer label,
html[lang="fa-IR"] #filterDrawer .catalog-filter {
    direction: rtl;
}

html[lang="fa-IR"] #filterDrawer input[type="number"] {
    direction: ltr;
    text-align: left;
}

/* Mobile: keep the existing menu interaction and prevent overflow. */
@media (max-width: 1100px) {
    html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav {
        min-height: 64px !important;
        flex-wrap: wrap !important;
    }

    html[lang="fa-IR"] body:has(.screener-hero-v2)
    header.nav:not(.mobile-open) nav {
        display: none !important;
    }

    html[lang="fa-IR"] body:has(.screener-hero-v2)
    header.nav.mobile-open nav {
        display: flex !important;
        flex-direction: column !important;
        direction: rtl !important;
        width: 100% !important;
        flex: 0 0 100% !important;
    }

    html[lang="fa-IR"] .screener-hero-v2 {
        max-width: 100%;
    }

    html[lang="fa-IR"] .table-wrap {
        overflow-x: auto;
    }
}


/* STEP543_PERSIAN_DRAWER_PARITY */
/* Preserve English drawer geometry and Persian text readability. */

html[lang="fa-IR"] #filterDrawer {
    direction: ltr !important;
    text-align: left !important;
}

html[lang="fa-IR"] #filterDrawer .drawer-header {
    direction: ltr !important;
    text-align: left !important;
    flex-direction: row !important;
    align-items: center !important;
}

html[lang="fa-IR"] #filterDrawer .drawer-header > div {
    min-width: 0;
    direction: rtl !important;
    text-align: left !important;
}

html[lang="fa-IR"] #filterDrawer .drawer-header h2,
html[lang="fa-IR"] #filterDrawer .drawer-header p {
    direction: rtl !important;
    text-align: left !important;
}

html[lang="fa-IR"] #filterDrawer .drawer-close {
    margin-left: auto !important;
    flex-shrink: 0;
}

html[lang="fa-IR"] #filterDrawer .filter-search {
    direction: ltr !important;
    flex-direction: row !important;
}

html[lang="fa-IR"] #filterDrawer #filterSearch {
    direction: rtl !important;
    text-align: left !important;
}

html[lang="fa-IR"] #filterDrawer .filter-categories,
html[lang="fa-IR"] #filterDrawer .filter-category,
html[lang="fa-IR"] #filterDrawer .category-items {
    direction: ltr !important;
}

html[lang="fa-IR"] #filterDrawer .category-title {
    direction: ltr !important;
    text-align: left !important;
}

html[lang="fa-IR"] #filterDrawer .catalog-filter {
    direction: ltr !important;
    text-align: left !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
}

html[lang="fa-IR"] #filterDrawer .catalog-filter > span {
    direction: ltr !important;
    text-align: left !important;
    min-width: 0;
}

html[lang="fa-IR"] #filterDrawer .catalog-filter > b {
    direction: ltr !important;
    margin-left: auto !important;
    flex-shrink: 0;
}

/* Prevent the underlying page from scrolling behind an open drawer. */
html[lang="fa-IR"] body:has(#filterDrawer.open) {
    overflow: hidden !important;
}

/* Keep the drawer body as the primary scrolling area. */
html[lang="fa-IR"] #filterDrawer .drawer-body {
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

html[lang="fa-IR"] #filterDrawer .filter-browser {
    overflow: visible !important;
}


/* STEP544_FILTER_CONFIG_ENGLISH_PARITY */

/* Keep the original English configuration geometry. */
html[lang="fa-IR"] #filterDrawer .filter-config {
    direction: ltr !important;
    text-align: left !important;
}

html[lang="fa-IR"] #filterDrawer .config-back {
    direction: ltr !important;
    text-align: left !important;
    display: inline-flex;
    flex-direction: row !important;
    align-items: center;
}

html[lang="fa-IR"] #filterDrawer .config-heading {
    direction: ltr !important;
    text-align: left !important;
}

html[lang="fa-IR"] #filterDrawer .config-heading > * {
    direction: ltr !important;
    text-align: left !important;
}

/* Match English labels and form controls. */
html[lang="fa-IR"] #filterDrawer .filter-config label {
    direction: ltr !important;
    text-align: left !important;
}

html[lang="fa-IR"] #filterDrawer .filter-config select,
html[lang="fa-IR"] #filterDrawer .filter-config input {
    direction: ltr !important;
    text-align: left !important;
}

html[lang="fa-IR"] #filterDrawer .filter-config input[type="checkbox"] {
    direction: ltr !important;
    margin-left: 0 !important;
}

/* Restore checkbox and label ordering. */
html[lang="fa-IR"] #filterDrawer .filter-config label:has(input[type="checkbox"]) {
    direction: ltr !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    text-align: left !important;
}

/* Match English results card alignment. */
html[lang="fa-IR"] #filterDrawer .filter-config .config-results,
html[lang="fa-IR"] #filterDrawer .filter-config .filter-preview,
html[lang="fa-IR"] #filterDrawer .filter-config .preview-results {
    direction: ltr !important;
    text-align: left !important;
}

/* Preserve the English footer button positions. */
html[lang="fa-IR"] #filterDrawer .drawer-footer {
    direction: ltr !important;
    flex-direction: row !important;
    justify-content: flex-end !important;
    align-items: center !important;
}

html[lang="fa-IR"] #filterDrawer .drawer-footer button {
    direction: ltr !important;
    text-align: center !important;
}


/* STEP545_PERSIAN_HEADER_RTL_PARITY */

/*
   Keep the Persian navigation in its original RTL order.
   Do not change the LTR Screener content.
*/

html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav {
    direction: rtl !important;
    flex-direction: row !important;
}

/* Logo stays on the right, with its English wordmark intact. */
html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav .brand {
    direction: ltr !important;
    flex-direction: row !important;
    flex-shrink: 0;
}

/* Match the Persian homepage navigation order. */
html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav nav {
    direction: rtl !important;
    flex-direction: row !important;
}

/* Persian navigation labels retain RTL text. */
html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav nav a {
    direction: rtl !important;
    unicode-bidi: isolate;
}

/* Account and language controls remain on the left. */
html[lang="fa-IR"] body:has(.screener-hero-v2) header.nav .actions {
    direction: rtl !important;
    flex-direction: row !important;
}

/* Preserve mobile navigation behavior. */
@media (max-width: 900px) {
    html[lang="fa-IR"] body:has(.screener-hero-v2)
    header.nav.mobile-open nav {
        direction: rtl !important;
        flex-direction: column !important;
    }
}


/* STEP1108_PERSIAN_MOBILE_DRAWER_HEIGHT */
@media (max-width: 600px) {
  html[lang="fa-IR"] #filterDrawer {
    box-sizing: border-box !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html[lang="fa-IR"] #filterDrawer .drawer-header,
  html[lang="fa-IR"] #filterDrawer .drawer-footer {
    flex-shrink: 0 !important;
  }
  html[lang="fa-IR"] #filterDrawer .drawer-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
}

/* STEP1122_PERSIAN_VISUAL_POLISH */

/* Align the desktop Persian hero with the main Screener content. */
@media (min-width: 1101px) {
  html[lang="fa-IR"] .screener-hero-v2 {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }
}

/* Show the horizontal-scroll hint only on mobile. */
html[lang="fa-IR"] .fa-table-swipe-hint-1122 {
  display: none;
}

@media (max-width: 600px) {
  html[lang="fa-IR"] .fa-table-swipe-hint-1122 {
    display: block;
    direction: rtl;
    text-align: right;
    color: #9cb8ad;
    font-size: 12px;
    line-height: 1.7;
    padding: 8px 12px;
  }
}
