/* ============================================================
   FPLMan redesign — shared team/player page components
   Loaded by both team.html and player.html; each then layers its
   own layout file (redesign-team.css / redesign-player.css).
   Everything here is a component both pages use, so neither page
   redeclares it. Layers on top of redesign.css.
   ============================================================ */

/* ---- sections ---- */
.tsec { padding: 26px 0; border-top: 1px solid var(--border); min-width: 0; }
.tsec:first-of-type { border-top: none; padding-top: 6px; }
.tsec-label { font-size: 13px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-3); margin: 0 0 18px; }
.tsec-empty { font-size: 15px; color: var(--text-3); margin: 0; }
.tsec-note { font-size: 13px; color: var(--text-3); margin: -10px 0 16px; }
.muted { color: var(--text-4); }

/* ---- verdict / tone badges ---- */
.tone { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; line-height: 1.4; }
.tone--good { background: var(--green-tint); color: var(--green-deep); }
.tone--warn { background: var(--orange-tint); color: var(--orange-fg); }
.tone--bad { background: var(--red-tint); color: var(--red-fg); }
.tone--neutral { background: var(--neutral-tint); color: var(--text-2); }

.tag { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: var(--purple-tint); color: var(--purple); border-radius: 6px; padding: 2px 7px; margin-left: 6px; }

/* ---- fixture difficulty chip ---- */
.fdr { display: inline-grid; place-items: center; width: 28px; height: 24px; border-radius: 7px;
  font-family: var(--mono); font-size: 12px; font-weight: 800; }
.fdr1 { background: var(--fdr1-bg); color: var(--fdr1-fg); }
.fdr2 { background: var(--fdr2-bg); color: var(--fdr2-fg); }
.fdr3 { background: var(--fdr3-bg); color: var(--fdr3-fg); }
.fdr4 { background: var(--fdr4-bg); color: var(--fdr4-fg); }
.fdr5 { background: var(--fdr5-bg); color: var(--fdr5-fg); }

/* ---- metric grid ---- */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px 16px 14px; min-width: 0; }
.metric-card .v { font-family: var(--mono); font-size: 25px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.metric-card .k { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3); margin-top: 10px; }
@media (max-width: 900px) { .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- player cards ---- */
.pcard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1080px) { .pcard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .pcard-grid { grid-template-columns: 1fr; } }

.pcard { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--radius-md); color: inherit; text-decoration: none;
  transition: border-color .14s, transform .14s, box-shadow .14s; min-width: 0; }
.pcard:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.pcard-kit { display: grid; place-items: center; flex-shrink: 0; }
.pcard-body { min-width: 0; flex: 1; display: block; }
.pcard-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pcard-name { font-size: 15px; font-weight: 700; letter-spacing: -.005em; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.pcard-xp { display: inline-flex; align-items: baseline; gap: 4px; flex-shrink: 0; }
.pcard-xp b { font-family: var(--mono); font-size: 15px; font-weight: 800; color: var(--green-deep); }
.pcard-xp i { font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3); }
.pcard-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 12.5px;
  font-weight: 600; color: var(--text-2); flex-wrap: wrap; }
.pcard-stats { display: flex; gap: 10px; margin-top: 6px; font-size: 11.5px; color: var(--text-3);
  flex-wrap: wrap; }

.plink { font-weight: 700; color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; }
.plink:hover { color: var(--green-deep); text-decoration: underline; text-underline-offset: 2px; }
.plink-pos { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--text-3); }

.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--border); }
.plist li:first-child { border-top: none; }
.plist-note { font-family: var(--mono); font-size: 12.5px; font-weight: 700; color: var(--text-2); }

/* ---- tables ---- */
.table-scroll { overflow-x: auto; }
.ptable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ptable th { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3); text-align: left; padding: 0 10px 8px; white-space: nowrap; }
.ptable td { padding: 11px 10px; border-top: 1px solid var(--border); vertical-align: middle; }
.ptable .r { text-align: right; }
.ptable .mono { font-family: var(--mono); font-feature-settings: "tnum" 1; }
.ptable tbody tr:hover { background: var(--surface-3); }
/* Filtered-out rows. Declared here rather than left to the browser's `[hidden]` rule because the
   phone layout below turns rows into blocks, and any author `display` beats the UA one — without
   this the search box hides nothing at all under 620px. */
.ptable tr[hidden] { display: none; }
.ptable .pts.hi { color: var(--green-deep); font-weight: 700; }
.ptable .pts.zero { color: var(--red); }
.ptable .opp { display: inline-flex; align-items: center; gap: 8px; }
.ptable .opp + .opp { margin-left: 10px; }
.ptable .ha { color: var(--text-3); font-weight: 600; }
.ptable--sortable th[data-sort] { cursor: pointer; user-select: none; }
.ptable--sortable th[data-sort]:hover { color: var(--text); }
.ptable--sortable th[data-sort]::after { content: '↕'; margin-left: 5px; opacity: .35; }
.ptable--sortable th[aria-sort="ascending"]::after { content: '↑'; opacity: 1; }
.ptable--sortable th[aria-sort="descending"]::after { content: '↓'; opacity: 1; }
.ptable--sortable th[data-sort]:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.table-note { font-size: 14px; color: var(--text-3); margin: 14px 2px 0; }

.risk-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 7px;
  vertical-align: middle; }
.risk-dot--good { background: var(--green); }
.risk-dot--warn { background: var(--amber); }
.risk-dot--bad { background: var(--red); }
.risk-dot--neutral { background: var(--text-4); }

.squad-tools { margin-bottom: 14px; max-width: 320px; }

/* ---- Pro upsell inline note ---- */
.pro-note { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.pro-note a { font-weight: 700; color: var(--green-deep); text-decoration: underline; text-underline-offset: 2px; }
.pro-hint { margin: 12px 2px 0; }

/* ---- Pro-gate locked placeholder ---- */
.locked-placeholder { position: relative; border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; min-height: 130px; }
.locked-blur-content { filter: blur(4px); pointer-events: none; padding: 16px; display: flex;
  flex-direction: column; gap: 10px; }
.locked-dummy-card { height: 52px; background: var(--surface-3); border-radius: var(--radius-sm); }
.locked-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 9px; }
.locked-icon { color: var(--text-3); }
.locked-label { font-size: 14px; font-weight: 700; color: var(--text-2); }
.locked-cta { background: var(--green); color: #fff; font-weight: 700; font-size: 13px; padding: 8px 16px;
  border-radius: 9px; box-shadow: 0 2px 8px -2px rgba(21,160,106,.55); }
.locked-cta:hover { filter: brightness(1.05); }

/* ---- results rows ---- */
.res-row { display: grid; grid-template-columns: 48px 26px 1fr auto 34px; gap: 12px; align-items: center;
  padding: 12px 2px; border-top: 1px solid var(--border); }
.res-row:first-of-type { border-top: none; }
.res-gw { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-3); }
.res-kit { display: grid; place-items: center; }
.res-name { font-size: 14.5px; font-weight: 700; line-height: 1.15; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.res-name .ha { display: block; font-size: 12px; font-weight: 600; color: var(--text-3); margin-top: 2px; }
.res-score { font-family: var(--mono); font-size: 16px; font-weight: 700; text-align: right; }
.res-score.w { color: var(--green-deep); }
.res-score.l { color: var(--red); }
.res-badge { width: 28px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; font-family: var(--mono); }
.res-badge.w { background: var(--green-tint); color: var(--green-deep); }
.res-badge.l { background: var(--red-tint); color: var(--red-fg); }
.res-badge.d { background: var(--neutral-tint); color: var(--text-2); }

/* ---- league table (navigation rail) ---- */
.pl-list { display: block; }
.pl-list .pl-row { display: grid; grid-template-columns: 30px 1fr 34px 40px; gap: 10px; align-items: center;
  padding: 8px 6px; border-radius: var(--radius-sm); color: inherit; text-decoration: none; font-size: 13.5px; }
/* Before the first result there is no rank, played or points to render — the club gets the row,
   the same way the index and the dashboard card collapse theirs. */
.pl-list--preseason .pl-row { grid-template-columns: 1fr; }
.pl-list .pl-row:hover { background: var(--surface-3); }
.pl-list .pl-row.current-team { background: var(--green-tint); font-weight: 700; }
.pl-list .pl-rank { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-3);
  text-align: center; border-radius: 5px; }
.pl-list .pl-rank.cl { background: var(--green-tint); color: var(--green-deep); }
.pl-list .pl-rank.el { background: var(--blue-tint); color: var(--blue); }
.pl-list .pl-rank.rel { background: var(--red-tint); color: var(--red-fg); }
/* The club name ellipsizes rather than widening the rail — from the base `.pl-team` in
   redesign.css, which every table shares. Do not restate it here. */
.pl-list .pl-p, .pl-list .pl-pts { font-family: var(--mono); text-align: right; color: var(--text-2); }

/* ---- recent-form chart (player page, Pro) ---- */
.form-chart { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.form-col { display: flex; flex-direction: column; }
.form-bar-track { height: 150px; display: flex; align-items: flex-end; }
.form-bar { width: 100%; border-radius: 7px 7px 4px 4px; min-height: 13px; transition: height .2s; }
.form-bar.b0 { background: #f0b9c0; }
.form-bar.b1 { background: #f4d49a; }
.form-bar.b2 { background: var(--amber); }
.form-bar.b3 { background: var(--green-tint-2); }
.form-bar.b4 { background: var(--green); }
.form-bar.b5 { background: var(--green-deep); }
html[data-theme="dark"] .form-bar.b0 { background: #7c3a46; }
html[data-theme="dark"] .form-bar.b1 { background: #7c5c2e; }
html[data-theme="dark"] .form-bar.b3 { background: #178a5f; }
.form-cap { text-align: center; margin-top: 9px; }
.form-cap .v { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--text); line-height: 1; }
.form-cap .gw { font-size: 11px; font-weight: 600; color: var(--text-3); margin-top: 5px; letter-spacing: .02em; }

/* ---- price history ---- */
.ph-summary { display: flex; gap: 8px; align-items: baseline; font-size: 14px; color: var(--text-2); margin-bottom: 8px; }
.ph-delta { font-family: var(--mono); font-size: 14px; font-weight: 700; }
.ph-delta.up, .ph-dir.up { color: var(--green-deep); }
.ph-delta.down, .ph-dir.down { color: var(--red); }
.ph-row { display: grid; grid-template-columns: 64px 20px 1fr; gap: 8px; align-items: center;
  padding: 9px 2px; border-top: 1px solid var(--border); }
.ph-date { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-3); }
.ph-dir { font-size: 12px; }
.ph-move { font-size: 14px; font-weight: 600; }

/* ---- mentions ---- */
.mention-card { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; margin-bottom: 8px; }
.mention-card-header { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.mention-gw-label { font-size: 11px; color: var(--text-3); }
.mention-gw-value { font-size: 12px; font-weight: 700; font-family: var(--mono); }
.mention-rec-badge { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 8px;
  border-radius: 999px; white-space: nowrap; text-transform: uppercase; display: inline-block; }
.rec-BUY { background: var(--green-tint); color: var(--green-deep); }
.rec-SELL { background: var(--red-tint); color: var(--red-fg); }
.rec-HOLD { background: var(--neutral-tint); color: var(--text-2); }
.rec-CAPTAIN { background: var(--purple-tint); color: var(--purple); }
.mention-context { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.mention-episode-count { font-size: 11.5px; color: var(--text-3); margin-left: auto; font-family: var(--mono); }
.mention-source-label { font-size: 12.5px; font-weight: 700; color: var(--text-2); text-decoration: none; }
.mention-source-label:hover { color: var(--green-deep); text-decoration: underline; }
.mention-expand-hint { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.mention-details > summary { list-style: none; cursor: pointer; }
.mention-details > summary::-webkit-details-marker { display: none; }
.mention-card-source { margin-left: 8px; border-left: 2px solid var(--border); padding-left: 11px;
  background: var(--surface); }
.show-more-btn { margin-top: 8px; background: var(--surface-3); border: 1px solid var(--border-2);
  border-radius: 9px; padding: 8px 14px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.show-more-btn:hover { background: var(--hover); }

.club-updated { text-align: right; color: var(--text-3); font-size: 12.5px; margin: 22px 2px 0;
  font-family: var(--mono); }

/* Phone: the wide stat tables become label/value rows rather than a sideways scroll. */
@media (max-width: 620px) {
  .ptable, .ptable tbody, .ptable tr, .ptable td { display: block; width: 100%; }
  .ptable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .ptable tr { border-top: 1px solid var(--border); padding: 10px 0; }
  .ptable td { border-top: none; padding: 4px 2px; display: flex; align-items: center;
    justify-content: space-between; gap: 14px; text-align: right; }
  .ptable td::before { content: attr(data-label); font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--text-3); text-align: left; }
  .ptable td:first-child { justify-content: flex-start; font-size: 15px; font-weight: 700; }
  .ptable td:first-child::before { content: none; }
  .ptable .r { text-align: right; }
  .form-chart { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .form-bar { transition: none; }
  .pcard:hover { transform: none; }
}
