/*
 * L2 Teacher Search — mobile filter polish
 * Phone-only overrides. Desktop/tablet layouts are intentionally untouched.
 */
@media (max-width: 700px) {
  .l2-teacher-search[data-l2-teacher-search] .l2-ts-mobile-filter-layer {
    position: relative !important;
    z-index: 2147483000 !important;
    isolation: isolate !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-ts-filter-panel {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 14px !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-ts-filter-panel-head {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle.l2-ts-filter-dropdown-toggle,
  body > .l2-course-filters-toggle.l2-ts-filter-dropdown-toggle {
    position: fixed !important;
    inset-inline-end: max(14px, env(safe-area-inset-right)) !important;
    inset-inline-start: auto !important;
    bottom: calc(14px + env(safe-area-inset-bottom)) !important;
    top: auto !important;
    z-index: 2147483647 !important;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    width: auto !important;
    min-width: 138px !important;
    max-width: calc(100vw - 28px) !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    margin: 0 !important;
    padding: 0 15px !important;
    border: 1px solid #1d4f91 !important;
    border-radius: 16px !important;
    background: linear-gradient(135deg, #2457a6 0%, #1c4788 100%) !important;
    color: #fff !important;
    box-shadow: 0 9px 24px rgba(36, 87, 166, .28), 0 2px 6px rgba(15, 35, 65, .12) !important;
    font: 850 12px/1.2 Vazirmatn, sans-serif !important;
    white-space: nowrap !important;
    direction: rtl !important;
    cursor: pointer !important;
    transform: translateZ(0) !important;
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle.l2-ts-filter-dropdown-toggle.l2-ts-filter-trigger-preload-hidden {
    display: none !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle.l2-ts-filter-dropdown-toggle:hover,
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle.l2-ts-filter-dropdown-toggle[aria-expanded="true"],
  body > .l2-course-filters-toggle.l2-ts-filter-dropdown-toggle[aria-expanded="true"] {
    border-color: #173f7a !important;
    background: #173f7a !important;
    color: #fff !important;
    box-shadow: 0 10px 26px rgba(23, 63, 122, .32) !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-ts-filter-mobile-icon,
  body > .l2-course-filters-toggle .l2-ts-filter-mobile-icon {
    display: inline-flex !important;
    flex: 0 0 20px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #fff !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-ts-filter-mobile-icon svg,
  body > .l2-course-filters-toggle .l2-ts-filter-mobile-icon svg {
    display: block !important;
    width: 19px !important;
    height: 19px !important;
    stroke: currentColor !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle .l2-ts-filter-mobile-label,
  body > .l2-course-filters-toggle .l2-ts-filter-mobile-label {
    display: inline-block !important;
    color: #fff !important;
    font: 850 12px/1.2 Vazirmatn, sans-serif !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle .l2-ts-total-teacher-count,
  body > .l2-course-filters-toggle .l2-ts-total-teacher-count {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 0 0 8px !important;
    border: 0 !important;
    border-inline-start: 1px solid rgba(255, 255, 255, .32) !important;
    background: transparent !important;
    color: rgba(255, 255, 255, .88) !important;
    font: 700 9px/1.4 Vazirmatn, sans-serif !important;
    white-space: nowrap !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle .l2-ts-filter-dropdown-count,
  body > .l2-course-filters-toggle .l2-ts-filter-dropdown-count {
    display: none !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle .l2-ts-filter-dropdown-chevron,
  body > .l2-course-filters-toggle .l2-ts-filter-dropdown-chevron {
    display: inline-block !important;
    position: static !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    color: rgba(255, 255, 255, .9) !important;
    font-size: 16px !important;
    line-height: 1 !important;
    transform: none !important;
    transition: transform .18s ease !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle[aria-expanded="true"] .l2-ts-filter-dropdown-chevron,
  body > .l2-course-filters-toggle[aria-expanded="true"] .l2-ts-filter-dropdown-chevron {
    transform: rotate(180deg) !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle .l2-ts-filter-clear-corner,
  body > .l2-course-filters-toggle .l2-ts-filter-clear-corner {
    position: absolute !important;
    inset-block-start: -6px !important;
    inset-inline-start: -6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 2px solid #fff !important;
    border-radius: 50% !important;
    background: #fff !important;
    color: #c93645 !important;
    box-shadow: 0 2px 7px rgba(15, 35, 65, .18) !important;
    font: 900 15px/1 Vazirmatn, sans-serif !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle .l2-ts-filter-clear-corner[hidden],
  body > .l2-course-filters-toggle .l2-ts-filter-clear-corner[hidden] {
    display: none !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown {
    position: fixed !important;
    inset-inline: 12px !important;
    inset-block-start: auto !important;
    inset-block-end: calc(76px + env(safe-area-inset-bottom)) !important;
    z-index: 2147483646 !important;
    display: none !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(68vh, 620px) !important;
    height: auto !important;
    margin: 0 !important;
    padding: 14px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    border: 1px solid #d8e3ef !important;
    border-radius: 19px !important;
    background: #fff !important;
    box-shadow: 0 18px 48px rgba(15, 35, 65, .22) !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown.is-open {
    display: block !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown.is-collapsed {
    display: none !important;
    pointer-events: none !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown::before {
    content: "فیلترهای اساتید";
    display: block !important;
    margin: 0 0 12px !important;
    padding: 0 0 10px !important;
    border-bottom: 1px solid #edf1f6 !important;
    color: #172b4d !important;
    font: 900 13px/1.6 Vazirmatn, sans-serif !important;
    text-align: right !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: start !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 5px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    grid-column: auto !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field > span {
    display: block !important;
    min-height: 20px !important;
    margin: 0 !important;
    padding: 0 2px !important;
    color: #536174 !important;
    font: 800 10px/1.5 Vazirmatn, sans-serif !important;
    text-align: right !important;
    white-space: normal !important;
    overflow: visible !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field select,
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field input[type="number"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 42px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 8px 9px !important;
    border: 1px solid #d9e3ee !important;
    border-radius: 10px !important;
    background: #f9fbfe !important;
    color: #25364b !important;
    font: 700 10px/1.5 Vazirmatn, sans-serif !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field select[multiple] {
    min-height: 112px !important;
    max-height: 154px !important;
    padding: 7px !important;
    overflow-y: auto !important;
    background: #f4f7fb !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field select[multiple] option {
    margin: 3px 1px !important;
    padding: 7px 8px !important;
    border: 1px solid #e1e8f0 !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #344054 !important;
    font: 650 10px/1.5 Vazirmatn, sans-serif !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field select[multiple] option:checked {
    border-color: #a9c4e5 !important;
    background: #eaf2fc !important;
    color: #2457a6 !important;
    font-weight: 900 !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field:has([data-teacher-price]) {
    grid-column: 1 / -1 !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-ts-clear-all-inline {
    display: none !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field select:focus,
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field input:focus {
    outline: none !important;
    border-color: #8fb1da !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(36, 87, 166, .08) !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown::-webkit-scrollbar {
    width: 5px !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown::-webkit-scrollbar-thumb {
    border-radius: 99px !important;
    background: #c7d5e6 !important;
  }
}

@media (max-width: 390px) {
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}


/* Mobile-only behavior: no floating filter button; reveal filters below search while typing. */
@media (max-width: 700px) {
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-toggle.l2-ts-filter-dropdown-toggle,
  body > .l2-course-filters-toggle.l2-ts-filter-dropdown-toggle {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown,
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown.is-collapsed {
    position: relative !important;
    inset: auto !important;
    display: none !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(58vh, 520px) !important;
    height: auto !important;
    margin: 10px 0 0 !important;
    padding: 12px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    border: 1px solid #d8e3ef !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 8px 24px rgba(15, 35, 65, .10) !important;
    transform: none !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown.is-open {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: start !important;
    gap: 9px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
}

@media (max-width: 390px) {
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}


/* Deterministic mobile search reveal: JS sets this attribute when text is entered. */
@media (max-width: 700px) {
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown,
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown.is-open,
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown.is-collapsed {
    display: block !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(58vh, 520px) !important;
    height: auto !important;
    margin: 10px 0 0 !important;
    padding: 12px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    background: #fff !important;
    border: 1px solid #d8e3ef !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 24px rgba(15, 35, 65, .10) !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filter-buttons.l2-ts-filter-buttons,
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filter-buttons.l2-ts-filter-buttons.is-collapsed {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 9px !important;
    overflow: visible !important;
  }
}

@media (max-width: 390px) {
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filter-buttons.l2-ts-filter-buttons {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}


/* Final mobile filter alignment + compact dropdown controls. */
@media (max-width: 700px) {
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    align-items: stretch !important;
    gap: 12px 9px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 84px !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    grid-column: auto !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field > span {
    display: flex !important;
    align-items: flex-end !important;
    min-height: 32px !important;
    max-height: 32px !important;
    margin: 0 !important;
    padding: 0 2px 1px !important;
    color: #536174 !important;
    font: 800 10px/1.45 Vazirmatn, sans-serif !important;
    text-align: right !important;
    white-space: normal !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  /* Hide the native multi-select list; the JS-generated dropdown replaces it. */
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-field select[multiple][data-teacher-filter].l2-desktop-multi-native {
    display: none !important;
    visibility: hidden !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-desktop-multi {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-desktop-multi-trigger,
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-field > select:not([multiple]),
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-field > input[type="number"] {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    align-items: center !important;
    gap: 7px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 46px !important;
    height: 46px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 1px solid #d7e2ee !important;
    border-radius: 11px !important;
    background: #fff !important;
    color: #25364b !important;
    font: 750 10px/1.45 Vazirmatn, sans-serif !important;
    text-align: right !important;
    box-shadow: 0 2px 7px rgba(23,63,122,.035) !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-field > select:not([multiple]) {
    display: block !important;
    padding-inline: 9px 24px !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-field > input[type="number"] {
    display: block !important;
    padding-inline: 10px !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-desktop-multi-trigger-text {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-desktop-multi-trigger-meta {
    color: #2457a6 !important;
    font-size: 9px !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-desktop-multi-chevron {
    color: #667085 !important;
    font-size: 16px !important;
    line-height: 1 !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-desktop-multi.is-open .l2-desktop-multi-trigger {
    border-color: #8fb1da !important;
    background: #f6faff !important;
  }

  /* Price fields remain side-by-side like the other compact filter controls. */
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field:has([data-teacher-price]) {
    grid-column: auto !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-ts-clear-all-inline {
    display: none !important;
  }

  /* Dropdown options are portaled to body so they are never clipped by the panel. */
  body > .l2-desktop-multi-popover-portal {
    position: fixed !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 2147483647 !important;
    min-width: min(220px, calc(100vw - 28px)) !important;
    max-width: calc(100vw - 28px) !important;
    max-height: min(360px, 68vh) !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid #d5e0ed !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 18px 44px rgba(15,35,65,.22) !important;
    direction: rtl !important;
    box-sizing: border-box !important;
  }

  body > .l2-desktop-multi-popover-portal[hidden] {
    display: none !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-head {
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 9px 11px !important;
    border-bottom: 1px solid #e8eef5 !important;
    background: #f7faff !important;
    box-sizing: border-box !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-head strong {
    color: #173f7a !important;
    font: 900 11px/1.5 Vazirmatn, sans-serif !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-clear {
    min-height: 29px !important;
    padding: 4px 8px !important;
    border: 1px solid #f0cdd2 !important;
    border-radius: 8px !important;
    background: #fff7f8 !important;
    color: #c73544 !important;
    font: 850 9px/1.4 Vazirmatn, sans-serif !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    max-height: min(290px, 56vh) !important;
    margin: 0 !important;
    padding: 8px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    box-sizing: border-box !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-option {
    display: grid !important;
    grid-template-columns: 20px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    border: 1px solid #e1e8f0 !important;
    border-radius: 9px !important;
    background: #fbfdff !important;
    color: #344054 !important;
    font: 700 10px/1.5 Vazirmatn, sans-serif !important;
    text-align: right !important;
    box-sizing: border-box !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-option.is-selected {
    border-color: #a9c4e5 !important;
    background: #eef5ff !important;
    color: #2457a6 !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-option-all {
    border-color: #d9e5f3 !important;
    background: #f4f8fe !important;
    font-weight: 900 !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-checkbox {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    accent-color: #2457a6 !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-option-label {
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
    line-height: 1.6 !important;
  }
}

@media (max-width: 360px) {
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}


/* 2026-11-21 — Compact mobile filters: no nested scrolling and less whitespace. */
@media (max-width: 700px) {
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown,
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown.is-open {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
    padding: 8px !important;
    margin: 7px 0 0 !important;
    border-radius: 13px !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filters-body.l2-ts-filter-dropdown::before {
    margin: 0 0 7px !important;
    padding: 0 0 6px !important;
    font-size: 11px !important;
    line-height: 1.4 !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons,
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filter-buttons.l2-ts-filter-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: start !important;
    gap: 7px 8px !important;
    overflow: visible !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field {
    min-height: 0 !important;
    height: auto !important;
    gap: 3px !important;
    align-self: start !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field > span {
    display: block !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    padding: 0 2px !important;
    font-size: 9px !important;
    line-height: 1.35 !important;
    overflow: visible !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-desktop-multi-trigger,
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-course-filter-field > select:not([multiple]),
  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-course-filter-field > input[type="number"] {
    min-height: 39px !important;
    height: 39px !important;
    max-height: 39px !important;
    padding: 0 8px !important;
    font-size: 9.5px !important;
  }

  /* The option menu grows to its content; options are arranged in columns
     instead of forcing an inner scrollbar. */
  body > .l2-desktop-multi-popover-portal {
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    border-radius: 13px !important;
    box-shadow: 0 10px 28px rgba(15,35,65,.18) !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-head {
    min-height: 38px !important;
    padding: 6px 9px !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-head strong {
    font-size: 10px !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-clear {
    min-height: 25px !important;
    padding: 3px 7px !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-content: start !important;
    gap: 4px !important;
    max-height: none !important;
    height: auto !important;
    padding: 6px !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-option {
    grid-template-columns: 15px minmax(0, 1fr) !important;
    gap: 5px !important;
    min-height: 30px !important;
    padding: 4px 5px !important;
    border-radius: 7px !important;
    font-size: 9px !important;
    line-height: 1.35 !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-checkbox {
    width: 14px !important;
    height: 14px !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-option-label {
    line-height: 1.35 !important;
    overflow-wrap: anywhere !important;
  }
}

@media (max-width: 380px) {
  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}


/* Mobile option menus: center in the visible viewport instead of opening below
   an off-screen filter control. The option list remains content-sized (no inner scroll). */
@media (max-width: 700px) {
  body > .l2-desktop-multi-popover-portal {
    position: fixed !important;
    top: 50% !important;
    right: 10px !important;
    left: 10px !important;
    bottom: auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    max-height: calc(100vh - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    transform: translateY(-50%) !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 16px 42px rgba(15,35,65,.28) !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-head {
    min-height: 40px !important;
    padding: 6px 10px !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 5px !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 7px !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-option {
    grid-template-columns: 14px minmax(0, 1fr) !important;
    gap: 4px !important;
    min-width: 0 !important;
    min-height: 32px !important;
    padding: 4px 5px !important;
    font-size: 9px !important;
    line-height: 1.3 !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-checkbox {
    width: 13px !important;
    height: 13px !important;
  }
}

@media (max-width: 340px) {
  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}


/* Final mobile menu density: fit larger option sets in the visible viewport. */
@media (max-width: 700px) {
  body > .l2-desktop-multi-popover-portal {
    top: 50% !important;
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    transform: translateY(-50%) !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-head {
    min-height: 34px !important;
    padding: 5px 8px !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-head strong {
    font-size: 9px !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-clear {
    min-height: 23px !important;
    padding: 2px 6px !important;
    font-size: 8px !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-list {
    max-height: none !important;
    height: auto !important;
    padding: 5px !important;
    gap: 3px !important;
    overflow: visible !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-option {
    min-height: 27px !important;
    padding: 3px 4px !important;
    gap: 3px !important;
    font-size: 8px !important;
    line-height: 1.2 !important;
  }

  body > .l2-desktop-multi-popover-portal .l2-desktop-multi-option-label {
    line-height: 1.2 !important;
    overflow-wrap: anywhere !important;
  }
}



/* Mobile filter panel: anchor to the visible screen area above the keyboard. */
@media (max-width: 700px) {
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown,
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown.is-open,
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown.is-collapsed {
    display: block !important;
    position: fixed !important;
    inset-inline: 10px !important;
    inset-block: auto !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - 150px) !important;
    height: auto !important;
    margin: 0 !important;
    padding: 8px !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
    z-index: 2147483646 !important;
    border: 1px solid #d8e3ef !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 12px 34px rgba(15,35,65,.22) !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown::before {
    margin: 0 0 5px !important;
    padding: 0 0 5px !important;
    font-size: 10px !important;
    line-height: 1.35 !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filter-buttons.l2-ts-filter-buttons {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-items: start !important;
    gap: 6px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field {
    min-height: 0 !important;
    height: auto !important;
    gap: 2px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field > span {
    display: block !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    padding: 0 1px !important;
    font-size: 8px !important;
    line-height: 1.25 !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-desktop-multi-trigger,
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-course-filter-field > select:not([multiple]),
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filter-buttons.l2-ts-filter-buttons .l2-course-filter-field > input[type="number"] {
    min-height: 34px !important;
    height: 34px !important;
    max-height: 34px !important;
    padding: 0 6px !important;
    font-size: 8px !important;
    border-radius: 8px !important;
  }
}



/* One unified mobile filter popup. Individual filter choices expand inline. */
@media (max-width: 700px) {
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    max-height: calc(100dvh - 24px) !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
    align-items: start !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-course-filter-buttons.l2-ts-filter-buttons > .l2-course-filter-field:has(.l2-desktop-multi.is-open) {
    grid-column: 1 / -1 !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi-popover:not(.l2-desktop-multi-popover-portal) {
    position: static !important;
    inset: auto !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    height: auto !important;
    margin: 5px 0 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    transform: none !important;
    border: 1px solid #dce6f1 !important;
    border-radius: 10px !important;
    background: #f9fbfe !important;
    box-shadow: none !important;
    direction: rtl !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi.is-open > .l2-desktop-multi-trigger {
    border-color: #8fb1da !important;
    background: #f0f6ff !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi-popover:not(.l2-desktop-multi-popover-portal) .l2-desktop-multi-head {
    position: static !important;
    min-height: 32px !important;
    padding: 4px 7px !important;
    gap: 6px !important;
    background: #f1f6fc !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi-popover:not(.l2-desktop-multi-popover-portal) .l2-desktop-multi-head strong {
    font-size: 9px !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi-popover:not(.l2-desktop-multi-popover-portal) .l2-desktop-multi-clear {
    min-height: 22px !important;
    padding: 2px 6px !important;
    font-size: 8px !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi-popover:not(.l2-desktop-multi-popover-portal) .l2-desktop-multi-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-content: start !important;
    gap: 4px !important;
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 6px !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
    box-sizing: border-box !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi-popover:not(.l2-desktop-multi-popover-portal) .l2-desktop-multi-option {
    display: grid !important;
    grid-template-columns: 14px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 4px !important;
    min-width: 0 !important;
    min-height: 29px !important;
    margin: 0 !important;
    padding: 3px 5px !important;
    border-radius: 7px !important;
    font-size: 8px !important;
    line-height: 1.3 !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi-popover:not(.l2-desktop-multi-popover-portal) .l2-desktop-multi-checkbox {
    width: 13px !important;
    height: 13px !important;
  }

  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi-popover:not(.l2-desktop-multi-popover-portal) .l2-desktop-multi-option-label {
    line-height: 1.3 !important;
    overflow-wrap: anywhere !important;
  }
}
@media (max-width: 380px) {
  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi-popover:not(.l2-desktop-multi-popover-portal) .l2-desktop-multi-list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}


@media (max-width: 700px) {
  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi-popover[hidden] {
    display: none !important;
  }
  .l2-teacher-search[data-l2-teacher-search] .l2-desktop-multi.is-open > .l2-desktop-multi-popover:not([hidden]) {
    display: block !important;
  }
}


/* Hard visibility guard: mobile parent popup must always retain all filter fields. */
@media (max-width: 700px) {
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown .l2-course-filter-buttons.l2-ts-filter-buttons,
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown .l2-course-filter-buttons.l2-ts-filter-buttons.is-collapsed {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown .l2-course-filter-field,
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown .l2-desktop-multi,
  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown .l2-desktop-multi-trigger {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown .l2-desktop-multi {
    display: block !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown .l2-desktop-multi-trigger {
    display: grid !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown .l2-desktop-multi-popover[hidden] {
    display: none !important;
  }

  .l2-teacher-search[data-l2-teacher-search][data-mobile-search-active="true"] .l2-course-filters-body.l2-ts-filter-dropdown .l2-desktop-multi.is-open > .l2-desktop-multi-popover:not([hidden]) {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
