/* =====================================================================
   FPL Analyzer — Player info card, restyled after the official FPL
   player cards.

   Borrows the layout language of the real thing:
     • a full-bleed gradient header banner behind the player
     • position spelled out, given name light above a bold surname
     • a divided horizontal stat strip instead of separate tiles
     • fixtures as a scrollable row of FDR-coloured chips

   Every value the card already showed is retained — this only changes
   presentation. Loaded after style.css so it wins the cascade.
   ===================================================================== */

.pm-card {
  width: min(520px, 96vw);
  border-radius: 14px;

  /* The card had `overflow: hidden` and no height limit, so on a tall profile
     — header, six stat tiles, five fixtures, the xPts breakdown and set-piece
     row — everything past the fold was clipped away with no way to reach it.
     Capping the height and scrolling inside the card fixes that. `hidden` on
     the x axis keeps the corner radius clipping the header gradient. */
  max-height: min(88vh, 940px);
  overflow-y: auto;
  overflow-x: hidden;

  /* Stops the page behind from scrolling once the card reaches its end, which
     is what makes a scrollable overlay feel contained rather than leaky. */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;

  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

/* A thin scrollbar, so the card does not gain a wide OS-styled gutter that the
   header gradient would have to sit beside. */
.pm-card::-webkit-scrollbar { width: 8px; }
.pm-card::-webkit-scrollbar-track { background: transparent; }
.pm-card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}
.pm-card::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

:root.light-mode .pm-card {
  scrollbar-color: rgba(26, 8, 32, 0.22) transparent;
}
:root.light-mode .pm-card::-webkit-scrollbar-thumb { background: rgba(26, 8, 32, 0.22); }

/* ─── Header banner ─────────────────────────────────────────────────── */

.pm-header {
  position: relative;
  padding: 26px 20px 20px;
  gap: 18px;
  align-items: flex-end;
  background:
    radial-gradient(120% 140% at 88% 0%, rgba(0, 212, 255, 0.55) 0%, transparent 58%),
    linear-gradient(115deg, #2f0a4e 0%, #4b1178 45%, #7a2ea8 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

/* Soft vignette so the text stays legible over the gradient */
.pm-header::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.28) 100%);
}

.pm-header > * { position: relative; z-index: 1; }

.pm-avatar {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.pm-avatar-initials { color: #ffffff; font-size: 1.35rem; }

.pm-header-top { margin-bottom: 6px; }

/* Position spelled out, like the official card */
.pm-pos-badge,
.pm-pos-badge.GKP,
.pm-pos-badge.DEF,
.pm-pos-badge.MID,
.pm-pos-badge.FWD {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 0.6rem;
  letter-spacing: 1.1px;
  padding: 3px 9px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.pm-first-name {
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.1;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.01em;
}

.pm-name {
  font-size: 1.85rem !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
  color: #ffffff !important;
  letter-spacing: -0.02em;
  margin-bottom: 6px !important;
}

.pm-club-name { color: rgba(255, 255, 255, 0.86); font-weight: 600; }

.pm-price {
  color: #ffffff;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  padding: 2px 9px;
  border-radius: 999px;
}

.pm-close {
  background: rgba(0, 0, 0, 0.32);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

/* ─── Stat strip (divided row, like the official card) ──────────────── */

.pm-key-row {
  gap: 0 !important;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  overflow: hidden;
}

.pm-key-stat {
  position: relative;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 13px 8px !important;
  text-align: center;
}

/* Hairline divider between cells rather than gaps between tiles */
.pm-key-stat + .pm-key-stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 1px;
  background: rgba(255, 255, 255, 0.10);
}

.pm-key-val {
  font-size: 1.35rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em;
}

.pm-key-lbl {
  font-size: 0.6rem !important;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  opacity: 0.75;
}

/* ─── Fixtures as a chip row ────────────────────────────────────────── */

.pm-fixtures-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.pm-fix-row {
  flex: 0 0 auto;
  width: 86px;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 9px 6px 0 !important;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  overflow: hidden;
  text-align: center;
}

.pm-fix-gw {
  font-size: 0.58rem !important;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  opacity: 0.7;
  width: auto !important;
}

.pm-fix-opp {
  font-size: 0.86rem !important;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pm-fix-ha { font-size: 0.62rem !important; opacity: 0.7; }

/* FDR reads as a full-width footer bar on the chip, as it does on FPL */
.pm-fix-fdr {
  width: calc(100% + 14px) !important;
  margin: 6px -7px 0 !important;
  border-radius: 0 !important;
  padding: 4px 0 !important;
  font-size: 0.66rem !important;
  font-weight: 800;
  text-align: center;
}

/* ─── Section titles ────────────────────────────────────────────────── */

.pm-section-title {
  font-size: 0.66rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  opacity: 0.65;
}

/* ─── Light mode ────────────────────────────────────────────────────── */

:root.light-mode .pm-key-row {
  background: rgba(26, 8, 32, 0.03);
  border-color: rgba(26, 8, 32, 0.10);
}

:root.light-mode .pm-key-stat + .pm-key-stat::before { background: rgba(26, 8, 32, 0.10); }

:root.light-mode .pm-fix-row {
  background: rgba(26, 8, 32, 0.03);
  border-color: rgba(26, 8, 32, 0.10);
}

@media (prefers-reduced-motion: reduce) {
  .pm-card { animation: none !important; }
}

@media (max-width: 420px) {
  .pm-name { font-size: 1.5rem !important; }
  .pm-avatar { width: 60px; height: 60px; }
  .pm-key-val { font-size: 1.15rem !important; }
}
