/* TradingView mobile fixes */
@media (max-width: 768px) {
  /* Reduce gap between our dropdown row and the chart - collapse TradingView top area */
  [class*="layout__area--top"],
  [class*="chart-controls-bar"],
  [class*="chart-controls"] {
    min-height: 0 !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    margin-bottom: 0 !important;
  }

  /* Fix 1: Make the dropdown list scrollable - TradingView uses scrollable-* class */
  [class*="scrollable-"] {
    max-height: 50vh !important;
    min-height: 120px !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior: contain;
    pointer-events: auto !important;
  }

  /* Ensure parent allows overflow - sometimes flex parent clips */
  [class*="scrollable-"] {
    flex: 1 1 auto !important;
  }

  /* Fix 2: Constrain dropdown width - target dialog/popup containers */
  [class*="dialog-"][class*="container"],
  [class*="popup-"][class*="container"] {
    max-width: 280px !important;
    width: 70vw !important;
  }

  /* Flex parent fix - allow scrollable to shrink and scroll (min-height: 0) */
  div:has(> [class*="scrollable-"]) {
    min-height: 0 !important;
    overflow: hidden !important; /* parent clips, child scrolls */
  }
}
