/* The Golf Weekend mobile cleanup — Pass 2
   Free Agents: keep waiver controls above the long player list.
   Trade Center: reduce dead space and tighten the offer-building flow.
*/

@media (max-width: 1023px) {
  /* FREE AGENTS ---------------------------------------------------------- */
  main:has(input[placeholder="Search free agents…"]) {
    overflow-x: clip;
    overscroll-behavior-x: none;
  }

  main:has(input[placeholder="Search free agents…"]) > div,
  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside),
  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > div:first-child,
  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > aside,
  main:has(input[placeholder="Search free agents…"]) section {
    min-width: 0;
    max-width: 100%;
  }

  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) {
    display: grid !important;
    width: 100%;
    gap: 1rem !important;
  }

  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > div:first-child,
  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > aside {
    display: contents !important;
  }

  /* Default the left-column content between the rules card and waiver queue. */
  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > div:first-child > * {
    order: 2;
  }

  /* Weekly rules first. */
  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > div:first-child > section:first-child {
    order: 1;
  }

  /* Pending claims stay visible before search/player results. */
  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > aside > section:first-child {
    order: 3;
  }

  /* Search directly follows the user's waiver queue. */
  main:has(input[placeholder="Search free agents…"]) section:has(input[placeholder="Search free agents…"]) {
    order: 4;
    padding: 0.75rem !important;
  }

  /* The long free-agent pool comes after claim management. */
  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > div:first-child > section:has(a[href*="/golfers/"]) {
    order: 5;
    width: 100%;
    overflow-x: clip;
  }

  /* Keep every golfer row inside the phone viewport. */
  main:has(input[placeholder="Search free agents…"]) section:has(a[href*="/golfers/"]) > div {
    min-width: 0;
    max-width: 100%;
  }

  main:has(input[placeholder="Search free agents…"]) section:has(a[href*="/golfers/"]) button {
    min-width: 82px !important;
    flex-shrink: 0;
  }

  /* Processed waiver results are useful but less urgent than today's list. */
  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > aside > section:nth-child(2) {
    order: 6;
  }

  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > aside > section:first-child {
    padding: 0.9rem !important;
  }

  main:has(input[placeholder="Search free agents…"]) div.grid:has(> aside) > aside > section:first-child h2 {
    font-size: 1.25rem !important;
    line-height: 1.2 !important;
  }

  main:has(input[placeholder="Search free agents…"]) input[placeholder="Search free agents…"] {
    width: 100%;
    min-width: 0;
    font-size: 16px !important;
  }

  /* TRADE CENTER -------------------------------------------------------- */
  /* This placeholder is unique to the 'choose a team' side of Trade Center. */
  [class~="min-h-[310px]"] {
    min-height: 145px !important;
    padding: 1rem !important;
  }

  main:has([class~="min-h-[310px]"]) h1 {
    font-size: 2rem !important;
    line-height: 1.05 !important;
  }

  main:has([class~="min-h-[310px]"]) h2.text-3xl {
    font-size: 1.5rem !important;
    line-height: 1.15 !important;
  }

  main:has([class~="min-h-[310px]"]) section.mt-6 {
    margin-top: 1rem !important;
  }

  main:has([class~="min-h-[310px]"]) .mt-5.flex.flex-wrap.items-center {
    margin-top: 0.9rem !important;
    padding: 0.65rem 0.8rem !important;
  }

  main:has([class~="min-h-[310px]"]) [class~="rounded-[1.7rem]"] {
    padding: 0.85rem !important;
  }

  main:has([class~="min-h-[310px]"]) select {
    font-size: 16px !important;
  }
}
