/* listing.css — the firm list on /best-prop-firms/ pages (markup from tools/bestfor/render-tables.js,
   sorting/filtering from js/listing.js). Desktop: a table. 768px and below: each row becomes a card. */

/* ---------- filter bar (best-for pages; shown by listing.js) ---------- */
.lst-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 0 0 18px; padding: 16px 18px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px; }
.lst-filters[hidden] { display: none; }
.lst-f { display: flex; flex-direction: column; gap: 6px; min-width: 150px; flex: 1 1 150px; }
.lst-f-q { flex: 2 1 220px; }
.lst-f-end { flex: 0 0 auto; min-width: 0; }
.lst-f label { font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-tertiary); }
.lst-f input, .lst-f select { width: 100%; padding: 9px 12px; background: var(--bg-elevated); border: 1px solid var(--border-light); border-radius: 8px; color: var(--text-primary); font: inherit; font-size: .95rem; }
.lst-f input:focus-visible, .lst-f select:focus-visible, .lst-clear:focus-visible, .lst-sort:focus-visible, .lst-more:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.lst-clear { padding: 9px 12px; background: none; border: 1px solid var(--border-light); border-radius: 8px; color: var(--orange); font: inherit; font-size: .9rem; cursor: pointer; }
.lst-clear:hover { border-color: var(--orange); }
.lst-count { flex: 1 1 100%; margin: 0; font-size: .85rem; color: var(--text-secondary); }

/* ---------- table (desktop) ---------- */
.lst { width: 100%; overflow-x: auto; }
table.lst-table { width: 100%; min-width: 0 !important; border-collapse: collapse; table-layout: auto; }
.lst-table th { padding: 12px 10px; text-align: left; background: var(--bg-card); color: var(--text-primary); font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border-bottom: 2px solid var(--border-subtle); vertical-align: bottom; }
.lst-table td { padding: 14px 10px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; color: var(--text-secondary); }
.lst-table tbody tr:hover { background: var(--bg-card); }
.lst-row[hidden] { display: none !important; }
.lst-rank { width: 40px; color: var(--text-tertiary); font-weight: 700; }
.lst-firm { min-width: 120px; }
.lst-name { color: var(--text-primary); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.lst-name:hover { color: var(--orange); text-decoration: underline; }
.lst-split, .lst-price { white-space: nowrap; }
.lst-k { display: none; }
.lst-rating { white-space: nowrap; }
.lst-badge { display: inline-block; padding: 3px 8px; border-radius: 6px; background: var(--orange); color: #000; font-size: .82rem; font-weight: 700; }
.lst-prov { display: block; margin-top: 4px; font-size: .78rem; color: var(--text-secondary); }
.lst-unrated { font-size: .85rem; color: var(--text-tertiary); }
.lst-review, .lst-visit { width: 1%; white-space: nowrap; }
.lst-review-btn { display: inline-block; padding: 7px 12px; background: var(--bg-elevated); border: 1px solid var(--border-light); border-radius: 8px; color: var(--text-primary); font-size: .85rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.lst-review-btn:hover { border-color: var(--orange); color: var(--orange); }
.lst .visit-btn { display: inline-block; padding: 7px 12px; background: var(--orange); border: 1px solid var(--orange); border-radius: 8px; color: #000; font-size: .85rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.lst .visit-btn:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.lst-empty td { padding: 40px 14px; text-align: center; color: var(--text-tertiary); }
.lst-empty-msg { padding: 32px 0; text-align: center; color: var(--text-tertiary); }
.lst-empty-msg a, .lst-note a { color: var(--orange); }
.lst-note { margin: 12px 0 0; font-size: .82rem; line-height: 1.6; color: var(--text-secondary); }
.lst-more { display: block; margin: 18px auto 0; padding: 10px 20px; background: var(--bg-elevated); border: 1px solid var(--border-light); border-radius: 10px; color: var(--text-primary); font: inherit; font-weight: 600; cursor: pointer; }
.lst-more[hidden] { display: none; }
.lst-more:hover { border-color: var(--orange); color: var(--orange); }

/* sortable headings (buttons added by listing.js) */
.lst-sort { display: inline-flex; align-items: center; gap: 6px; padding: 0; background: none; border: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.lst-sort:hover { color: var(--orange); }
.lst-sort-ico::after { content: '\2195'; opacity: .45; font-size: .9em; }
th[aria-sort] .lst-sort { color: var(--orange); }
th[aria-sort="ascending"] .lst-sort-ico::after { content: '\2191'; opacity: 1; }
th[aria-sort="descending"] .lst-sort-ico::after { content: '\2193'; opacity: 1; }

/* "More lists" on the index */
.more-lists { margin: 48px 0 8px; padding-top: 28px; border-top: 1px solid var(--border-subtle); }
.more-lists-title { font-size: 1.4rem; font-weight: 700; margin: 0 0 8px; }
.more-lists-group { font-size: .85rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-tertiary); margin: 22px 0 10px; }
.more-lists-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.more-lists-list li { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 8px; font-size: .9rem; }
.more-lists-list a { color: var(--text-primary); text-decoration: none; font-weight: 500; }
.more-lists-list a:hover { color: var(--orange); text-decoration: underline; }
.more-lists-n { font-size: .78rem; color: var(--text-tertiary); }

/* ---------- cards (768px and below) ---------- */
@media (max-width: 768px) {
  .lst-filters { padding: 14px; gap: 10px; }
  .lst-f { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .lst-f-q { flex: 1 1 100%; }
  .lst-f-end { flex: 0 0 auto; order: 2; }
  .lst-count { flex: 1 1 0; order: 1; align-self: center; }
  .lst-f select { padding: 9px 8px; }
  .lst-f input, .lst-f select { font-size: 16px; }

  table.lst-table, .lst-table tbody { display: block; width: 100%; }
  .lst-table thead { display: block; }
  .lst-table thead tr { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 12px; }
  .lst-table thead th { display: none; padding: 0; background: none; border: 0; }
  /* keep the sort controls usable on mobile as small chips (only once listing.js has turned them into buttons) */
  .lst-table thead th[data-lst-sort]:has(.lst-sort) { display: block; }
  .lst-table thead .lst-sort { padding: 6px 10px; border: 1px solid var(--border-light); border-radius: 999px; font-size: .72rem; color: var(--text-secondary); }
  .lst-table thead th[aria-sort] .lst-sort { color: var(--orange); border-color: var(--orange); }

  .lst-table tr.lst-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "rank firm firm" ". rating rating" ". split price" ". review visit";
    gap: 8px 12px; align-items: center;
    margin: 0 0 12px; padding: 14px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px;
  }
  .lst-table tr.lst-row:hover { background: var(--bg-card); }
  .lst-table td { display: block; padding: 0; border: 0; min-width: 0; width: auto; white-space: normal; }
  .lst-rank { grid-area: rank; width: auto; display: flex !important; align-items: center; justify-content: center; height: 28px; border-radius: 6px; background: var(--bg-elevated); font-size: .85rem; }
  .lst-firm { grid-area: firm; min-width: 0; }
  .lst-name { font-size: 1.05rem; }
  .lst-rating { grid-area: rating; white-space: normal; }
  .lst-prov { display: inline; margin: 0; }
  .lst { overflow: visible; }
  .lst-split { grid-area: split; }
  .lst-price { grid-area: price; }
  .lst-split, .lst-price { font-size: .9rem; color: var(--text-primary); white-space: normal; }
  .lst-k { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 2px; }
  .lst-review { grid-area: review; }
  .lst-visit { grid-area: visit; }
  .lst-review-btn, .lst .visit-btn { display: block; width: 100%; text-align: center; padding: 10px 8px; white-space: nowrap; }
  .lst-empty { display: block; }
  .lst-empty td { display: block; }
}
