/* =========================================================
   Phương Nguyễn Advisor — Bộ lọc cổ phiếu (bo-loc-co-phieu.html)
   Khu dữ liệu (mẫu 2): dùng token dark/light của stock.css, component chung của styles.css.
   ========================================================= */
.screener { padding-top: 28px; padding-bottom: 8px; }

/* Đầu trang */
.sc-head { padding-bottom: 20px; }
.sc-head .eyebrow { font-size: 13px; color: var(--text); }
.sc-head .eyebrow a { color: var(--text-muted); }
.sc-head__main { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 40px; flex-wrap: wrap; margin-top: 14px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.sc-head__title { font-size: clamp(30px, 4.2vw, 50px); font-weight: 800; letter-spacing: -.035em; line-height: 1.08; color: var(--heading); }
.sc-head__lead { margin-top: 12px; max-width: 620px; color: var(--text-muted); }
.sc-head__src { text-align: right; }

/* Bộ lọc */
.sc-controls { display: grid; gap: 16px; padding: 20px; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.sc-controls__row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; }
.sc-field { display: grid; gap: 6px; min-width: 0; }
.sc-field small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.sc-field input, .sc-field select {
  width: 100%; min-height: 46px; padding: 0 16px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px; appearance: none;
}
.sc-field select {
  padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.sc-field input:focus, .sc-field select:focus { border-color: var(--text); }
.sc-field input:focus:not(:focus-visible), .sc-field select:focus:not(:focus-visible) { outline: none; }
.sc-field input::placeholder { color: var(--text-muted); }
.sc-field select option { background: var(--surface); color: var(--text); }

.sc-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.sc-chips legend { padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: transparent;
  font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.chip:hover { color: var(--text); border-color: var(--text-muted); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip--ceil[aria-pressed="true"] { background: var(--ceiling); border-color: var(--ceiling); color: #fff; }
.chip--floor[aria-pressed="true"] { background: var(--floor); border-color: var(--floor); color: var(--floor-text); }
.chip--reset { border-style: dashed; margin-left: auto; }

/* Kết quả */
.sc-result { padding-bottom: 48px; }
.sc-result__bar { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 24px; flex-wrap: wrap; margin-bottom: 6px; }
.sc-result__count { font-size: 15px; font-weight: 700; color: var(--heading); }
.sc-result__dist .change--up { color: var(--up); }
.sc-result__dist .change--down { color: var(--down); }

.sctable { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.sctable th, .sctable td { padding: 10px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.sctable .num { text-align: right; }
.sctable thead th { padding: 0; position: sticky; top: 0; background: var(--bg); }
.sctable thead button {
  display: inline-flex; align-items: center; gap: 4px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; background: none; cursor: pointer;
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); justify-content: inherit;
}
.sctable thead th.num button { justify-content: flex-end; }
.sctable thead button:hover { color: var(--text); }
.sctable thead th[aria-sort] button { color: var(--text); }
.sctable thead th[aria-sort="ascending"] button::after { content: "▲"; font-size: 8px; }
.sctable thead th[aria-sort="descending"] button::after { content: "▼"; font-size: 8px; }
.sctable tbody th { font-weight: 700; color: var(--heading); }
.sctable tbody th a { color: inherit; text-decoration: underline; text-underline-offset: 3px; display: inline-block; padding-block: 4px; }
.sctable tbody tr { transition: background .2s; }
.sctable tbody tr:hover { background: var(--surface); }
.sctable .change--up { color: var(--up); }
.sctable .change--down { color: var(--down); }
.sctable .is-ceiling { color: var(--ceiling); }
.sctable .is-floor { color: var(--floor); }
.sctable .pill { color: #fff; background: var(--surface-muted); }
.sctable .pill.change--up { background: var(--up); color: #fff; }
.sctable .pill.change--down { background: var(--down); color: #fff; }
.sctable .pill.is-ceiling { background: var(--ceiling); color: #fff; }
.sctable .pill.is-floor { background: var(--floor); color: var(--floor-text) !important; }
.sctable td.sc-col-sector { color: var(--text-muted); font-size: 12.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.sc-tag { margin-left: 6px; font-size: 9px; font-weight: 600; letter-spacing: .06em; color: var(--text-muted); vertical-align: middle; }
.sc-empty { padding: 32px 10px !important; color: var(--text-muted); white-space: normal !important; text-align: center !important; }
.linklike { border: 0; background: none; padding: 8px 4px; font: inherit; color: var(--text); text-decoration: underline; cursor: pointer; }
.sc-more { display: flex; margin: 20px auto 0; }
.sc-notes { margin-top: 14px; max-width: 920px; }

/* Responsive */
@media (max-width: 960px) {
  .sc-controls__row { grid-template-columns: 1fr 1fr; }
  .sc-field--q { grid-column: 1 / -1; }
  .sctable .sc-col-sector { display: none; }
}
@media (max-width: 640px) {
  .screener { padding-top: 18px; }
  .sc-head__src { text-align: left; }
  .sc-controls { padding: 16px; }
  .sc-controls__row { grid-template-columns: 1fr; }
  .chip { padding: 0 13px; font-size: 10.5px; }
  .chip--reset { margin-left: 0; }
  .sctable .sc-col-fvol { display: none; }
  .sctable th, .sctable td { padding-inline: 6px; }
  .sctable thead button { padding: 0 6px; }
  .sctable .pill { min-width: 64px; padding-inline: 6px; }
}
