/* ============================================================
   ShotPropz v2 — Elevated Design (Beta)
   Only loaded when Settings → "Elevated Visual Design" is on.
   Layers on top of spz-gamelog.css's existing --gl-* tokens and
   spz-dark-mode.css's [data-spz-theme="dark"] overrides rather
   than redefining a parallel theme system.
   ============================================================ */

:root {
  /* Display font for headlines and big stat numbers ONLY — never
     applied to body/table text, where the system font stack stays
     faster to load and more legible for dense data. */
  --spz-elev-font-display: 'Inter', var(--gl-font, sans-serif);
}

/* ── Team chip ───────────────────────────────────────────── */
.spz-team-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 6px;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}
.spz-chip-sm { font-size: 10px; padding: 2px 6px; border-radius: 5px; }
.spz-chip-lg { font-size: 15px; padding: 5px 12px; border-radius: 8px; }

/* ── Player avatar (photo + initials fallback) ─────────────── */
.spz-player-avatar {
  position: relative;
  display: inline-block;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--gl-border, #e5e7eb);
  background: var(--gl-bg-alt, #f8f9fa);
}
.spz-player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.spz-player-avatar-fallback {
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1em;
}

/* ── Elevated header (avatar + name + team chip), sits above
      the filter bar on the chart / shot map ─────────────────── */
.spz-elevated-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--gl-radius, 6px);
  background: linear-gradient(135deg, var(--spz-elev-primary, #1e293b) 0%, var(--spz-elev-primary-dark, #0f172a) 100%);
  color: #fff;
  margin-bottom: 14px;
}
.spz-elevated-header .spz-player-avatar {
  width: 52px;
  height: 52px;
  border-color: rgba(255, 255, 255, 0.35);
}
.spz-elevated-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.spz-elevated-header-name {
  font-family: var(--spz-elev-font-display);
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spz-elevated-header-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  opacity: 0.85;
}

/* ── Hit-rate summary strip ─────────────────────────────────── */
.spz-hitrate-strip {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  flex-wrap: wrap;
  background: var(--gl-bg-alt, #f8f9fa);
  border-bottom: 1px solid var(--gl-border, #e5e7eb);
}
.spz-hitrate-card {
  flex: 1 1 auto;
  min-width: 110px;
  background: var(--gl-bg, #fff);
  border: 1px solid var(--gl-border, #e5e7eb);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.spz-hitrate-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.spz-hitrate-card .value {
  font-family: var(--spz-elev-font-display);
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.spz-hitrate-card .value.is-good { color: #16a34a; }
.spz-hitrate-card .value.is-bad  { color: #dc2626; }
.spz-hitrate-card .label {
  font-size: 11px;
  color: var(--gl-text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ── Shot map: rink-outline background behind the zones,
      and a dark-mode-safe background for the SVG itself ─────── */
.spz-elevated-rink-bg {
  fill: none;
  stroke: var(--gl-border, #e2e8f0);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  opacity: 0.6;
}
.spz-shot-map.spz-elevated-map svg {
  background: var(--gl-bg, #ffffff);
  border-radius: var(--gl-radius, 6px);
  filter: drop-shadow(0 4px 24px rgba(0, 145, 61, 0.35)); /* fallback: color-mix() unsupported */
  filter: drop-shadow(0 4px 24px color-mix(in srgb, var(--spz-elev-primary, #00913d) 35%, transparent));
  transition: filter .3s ease;
}
.spz-elevated-map .spz-shot-map-svg-wrap {
  border: 1px solid var(--gl-border, #e5e7eb); /* fallback: color-mix() unsupported */
  border: 1px solid color-mix(in srgb, var(--spz-elev-primary, #00913d) 25%, var(--gl-border, #e5e7eb));
  border-radius: var(--gl-radius, 6px);
  padding: 4px;
  transition: border-color .3s ease;
}

/* ── Dark mode companions for the new components ─────────────
   (spz-dark-mode.css doesn't know about these yet — kept here so
   both files can be reviewed/updated together) ─────────────── */
[data-spz-theme="dark"] .spz-hitrate-strip {
  background: #1e293b;
  border-color: #334155;
}
[data-spz-theme="dark"] .spz-hitrate-card {
  background: #0f172a;
  border-color: #334155;
}
[data-spz-theme="dark"] .spz-player-avatar {
  border-color: #334155;
  background: #1e293b;
}
[data-spz-theme="dark"] .spz-shot-map.spz-elevated-map svg {
  background: #0f172a;
}
[data-spz-theme="dark"] .spz-elevated-rink-bg {
  stroke: #334155;
}

/* ── Elevated table: sortable headers, team-color accent, zebra + hover ── */
.spz-elevated-table thead th.spz-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 18px !important;
}
.spz-elevated-table thead th.spz-sortable::after {
  content: '⇅';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  opacity: 0.55;
}
.spz-elevated-table thead th.spz-sortable.is-sorted-asc::after {
  content: '▲';
  opacity: 1;
  color: #fff;
}
.spz-elevated-table thead th.spz-sortable.is-sorted-desc::after {
  content: '▼';
  opacity: 1;
  color: #fff;
}

/* Bold, solid team-color header — not a subtle tint. This is the
   single biggest lever for "does this look redesigned or just
   touched up," so it needs to actually read as a strong brand bar,
   matching the same treatment already used on the header card above
   the table, not blend into the row beneath it. */
.spz-elevated-table thead tr {
  background: var(--spz-elev-primary, #1e293b);
}
.spz-elevated-table thead th {
  color: #fff !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  font-size: 11px !important;
  letter-spacing: 0.04em;
  padding: 12px 10px !important;
}
.spz-elevated-table thead th.spz-sortable:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Real row height — dense spreadsheet rows are the opposite of what
   a modern sports-data card looks like. */
.spz-elevated-table tbody td {
  padding: 11px 10px !important;
  font-size: 14px;
}
.spz-elevated-table tbody tr:nth-child(even):not(.spz-l10-avg-row) {
  background: var(--gl-bg-alt, #f8f9fa);
}
.spz-elevated-table tbody tr:hover:not(.spz-l10-avg-row) {
  background: var(--gl-bg, #ffffff); /* fallback: color-mix() unsupported */
  background: color-mix(in srgb, var(--spz-elev-primary, #1e293b) 8%, var(--gl-bg, #ffffff));
}

/* The selected/primary stat column is the ONE number someone came to
   this table for — it should look like it, not blend in as just
   another column with a faint tint. */
.spz-elevated-table th.stat-col.is-selected-stat {
  background: var(--spz-elev-primary, #00913d) !important;
  filter: brightness(1.25);
}
.spz-elevated-table td.stat-col.is-selected-stat {
  background: var(--gl-bg, #fff); /* fallback: color-mix() unsupported */
  background: color-mix(in srgb, var(--spz-elev-primary, #00913d) 14%, var(--gl-bg, #fff));
  font-weight: 800 !important;
  font-size: 16px !important;
  color: var(--spz-elev-primary, #00913d);
}

/* Real elevation on the table container — a card, not a flat grid. */
.spz-elevated-table {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.spz-elevated-table td,
.spz-elevated-table th {
  font-variant-numeric: tabular-nums;
}
@keyframes spz-sort-flash-anim {
  0%   { background-color: color-mix(in srgb, var(--spz-elev-primary, #00913d) 20%, transparent); }
  100% { background-color: transparent; }
}
.spz-elevated-table td.spz-sort-flash {
  animation: spz-sort-flash-anim .6s ease-out;
}
[data-spz-theme="dark"] .spz-elevated-table tbody tr:nth-child(even):not(.spz-l10-avg-row) {
  background: #1a2332;
}
[data-spz-theme="dark"] .spz-elevated-table tbody tr:hover:not(.spz-l10-avg-row) {
  background: #0f172a; /* fallback: color-mix() unsupported */
  background: color-mix(in srgb, var(--spz-elev-primary, #1e293b) 16%, #0f172a);
}
[data-spz-theme="dark"] .spz-elevated-table td.stat-col.is-selected-stat {
  background: #0f172a; /* fallback: color-mix() unsupported */
  background: color-mix(in srgb, var(--spz-elev-primary, #00913d) 22%, #0f172a);
}

/* ── Pill-style filter bar ────────────────────────────────────
   Replaces the raw bordered <select> boxes with a single cohesive
   rounded container holding individually-pilled filters — the most
   visible structural difference between "decorated classic" and an
   actual redesign, since every tool's filter bar looked identical
   to a plain HTML form before this. ─────────────────────────────── */
.spz-elevated-filters {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px !important;
  margin: 0 0 16px 0 !important;
  padding: 10px !important;
  background: var(--gl-bg-alt, #f8f9fa);
  border-radius: 16px;
  border: 1px solid var(--gl-border, #e5e7eb);
}
.spz-elevated-filters label:not(.spz-line-label) {
  position: relative;
  display: flex !important;
  align-items: center;
  gap: 5px !important;
  background: var(--gl-bg, #fff);
  border: 1.5px solid var(--gl-border, #e5e7eb);
  border-radius: 999px;
  padding: 6px 24px 6px 14px !important;
  font-size: 10px !important;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gl-text-muted, #6b7280);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.spz-elevated-filters label:not(.spz-line-label):hover,
.spz-elevated-filters label:not(.spz-line-label):focus-within {
  border-color: var(--spz-elev-primary, #00913d);
  box-shadow: 0 0 0 3px rgba(0, 145, 61, 0.18); /* fallback: color-mix() unsupported */
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--spz-elev-primary, #00913d) 18%, transparent);
}
.spz-elevated-filters label:not(.spz-line-label)::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  pointer-events: none;
  color: var(--spz-elev-primary, #00913d);
}
.spz-elevated-filters select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0;
  height: auto !important;
  font-size: 13px !important;
  font-weight: 700;
  font-family: var(--gl-font);
  color: var(--gl-text, #1f2937);
  max-width: 130px;
  cursor: pointer;
  color-scheme: light;
}
.spz-elevated-filters select:focus { outline: none; }
/* Chromium-based browsers respect limited <option> styling — a bonus
   for the browsers that support it, harmless no-op elsewhere. Firefox
   and Safari fall back to their own native option list styling, which
   color-scheme below at least makes theme-appropriate. */
.spz-elevated-filters select option {
  background: var(--gl-bg, #fff);
  color: var(--gl-text, #1f2937);
  font-weight: 600;
}
[data-spz-theme="dark"] .spz-elevated-filters select {
  color-scheme: dark;
}
[data-spz-theme="dark"] .spz-elevated-filters select option {
  background: #0f172a;
  color: #f1f5f9;
}
.spz-elevated-filters .spz-line-label {
  background: var(--gl-bg, #fff);
  border: 1.5px solid var(--gl-border, #e5e7eb);
  border-radius: 999px;
  padding: 6px 16px !important;
}
[data-spz-theme="dark"] .spz-elevated-filters {
  background: #1e293b;
  border-color: #334155;
}
[data-spz-theme="dark"] .spz-elevated-filters label:not(.spz-line-label),
[data-spz-theme="dark"] .spz-elevated-filters .spz-line-label {
  background: #0f172a;
  border-color: #334155;
}

/* ── Matchup: VS card treatment ──────────────────────────────
   Each half of the table gets a subtle gradient tint from its own
   team's color, meeting in the middle at a bold VS badge — the one
   tool where the layout itself (two sides facing off) already suits
   a genuinely different treatment, not just a restyled table. ───── */
.spz-elevated-matchup thead th.team-left {
  background: var(--gl-bg, #ffffff); /* fallback: color-mix() unsupported */
  background: linear-gradient(90deg, color-mix(in srgb, var(--spz-away-hex, #334155) 22%, var(--gl-bg, #fff)) 0%, var(--gl-bg, #fff) 100%);
}
.spz-elevated-matchup thead th.team-right {
  background: var(--gl-bg, #ffffff); /* fallback: color-mix() unsupported */
  background: linear-gradient(270deg, color-mix(in srgb, var(--spz-home-hex, #334155) 22%, var(--gl-bg, #fff)) 0%, var(--gl-bg, #fff) 100%);
}
.spz-elevated-matchup tbody td.val-left {
  background: transparent; /* fallback: color-mix() unsupported */
  background: color-mix(in srgb, var(--spz-away-hex, #334155) 4%, transparent);
}
.spz-elevated-matchup tbody td.val-right {
  background: transparent; /* fallback: color-mix() unsupported */
  background: color-mix(in srgb, var(--spz-home-hex, #334155) 4%, transparent);
}
.spz-vs-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--spz-elev-font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gl-th-bg, #f1f5f9);
  border: 2px solid var(--gl-border, #e5e7eb);
  color: var(--gl-text-muted, #6b7280);
}
.spz-elevated-matchup .team-cell-chip-wrap,
.spz-elevated-matchup th.team-left,
.spz-elevated-matchup th.team-right {
  padding: 14px 10px !important;
}
[data-spz-theme="dark"] .spz-elevated-matchup thead th.team-left {
  background: #0f172a; /* fallback: color-mix() unsupported */
  background: linear-gradient(90deg, color-mix(in srgb, var(--spz-away-hex, #334155) 30%, #0f172a) 0%, #0f172a 100%);
}
[data-spz-theme="dark"] .spz-elevated-matchup thead th.team-right {
  background: #0f172a; /* fallback: color-mix() unsupported */
  background: linear-gradient(270deg, color-mix(in srgb, var(--spz-home-hex, #334155) 30%, #0f172a) 0%, #0f172a 100%);
}
[data-spz-theme="dark"] .spz-vs-badge {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

/* ============================================================
   MOBILE (640px — matches this codebase's existing breakpoint
   used throughout spz-gamelog.css and spz-v2.css, rather than
   inventing a new one)
   ============================================================ */
@media (max-width: 640px) {
  /* Elevated header: shrink avatar and type so long names/team
     combos don't force awkward wrapping on a narrow screen. */
  .spz-elevated-header {
    padding: 10px 12px;
    gap: 10px;
  }
  .spz-elevated-header .spz-player-avatar {
    width: 40px !important;
    height: 40px !important;
  }
  .spz-elevated-header-name {
    font-size: 15px;
  }
  .spz-elevated-header-sub {
    font-size: 11px;
    flex-wrap: wrap;
  }

  /* Hit-rate strip: three squeezed tiles read worse than one column
     of full-width rows on a phone. */
  .spz-hitrate-strip {
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
  }
  .spz-hitrate-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 8px 12px;
  }
  .spz-hitrate-card .label {
    margin-top: 0;
  }

  /* Pill filters: keep the pill shape but tighten padding/type so
     more fit per row before wrapping. */
  .spz-elevated-filters {
    gap: 6px !important;
    padding: 8px !important;
  }
  .spz-elevated-filters label:not(.spz-line-label) {
    padding: 5px 20px 5px 10px !important;
    font-size: 9px !important;
  }
  .spz-elevated-filters select {
    max-width: 100px;
    font-size: 12px !important;
  }

  /* Ranking tables (Team Off/Def, Against-by-Position): these have
     no horizontal-scroll wrapper at all in the base codebase, so a
     wide multi-column table just overflows the page on a phone.
     Not something this redesign introduced, but worth fixing while
     doing a real mobile pass rather than leaving it broken. */
  .spz-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .spz-table .cheat-sheet-table {
    min-width: 480px;
  }

  /* Matchup: the desktop <thead> (with the VS badge) is hidden below
     560px in favor of .spz-matchup-mobile-head — give that bar's own
     VS badge matching sizing so the redesign doesn't disappear on
     the exact screens most likely to view a quick matchup check. */
  .spz-vs-badge-mobile {
    width: 26px;
    height: 26px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
  }
}
