/* NHL Player Beta – samlad grundstil och responsiv layout */
:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --panel-3: #edf2f7;
  --text: #10233f;
  --muted: #65758b;
  --border: #dce4ee;
  --border-strong: #cbd6e3;
  --blue: #1769e0;
  --blue-dark: #0d4fae;
  --blue-soft: #e7f0ff;
  --shadow: 0 10px 28px rgba(31, 57, 90, 0.08);
  --shadow-small: 0 3px 12px rgba(31, 57, 90, 0.07);

  --elite: #128044;
  --very-good: #22b96b;
  --good: #92d82d;
  --average: #f2bd19;
  --weak: #f47a20;
  --bad: #d92d36;

  --summary-blue: #e7f0ff;
  --summary-blue-text: #174ea6;
  --summary-green: #e4f7eb;
  --summary-green-text: #17633a;
  --summary-yellow: #fff4cf;
  --summary-yellow-text: #815d00;
  --summary-red: #ffe7e7;
  --summary-red-text: #a82128;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(23, 105, 224, 0.08), transparent 30rem),
    linear-gradient(180deg, #f8fbff 0, var(--bg) 34rem);
  border-top: 4px solid var(--blue);
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 36px 244px 64px 32px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  margin-bottom: 8px;
}

.hero h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: #0b1f3a;
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.hero h1::before {
  width: 9px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3b82f6, #1554bd);
  box-shadow: 0 4px 10px rgba(23, 105, 224, 0.25);
  content: "";
}

.hero h1::after {
  align-self: center;
  margin-left: 2px;
  padding: 5px 9px;
  border: 1px solid #cbdcf7;
  border-radius: 999px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  content: "2026–27 BETA";
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.nav-tabs {
  display: inline-flex;
  gap: 5px;
  margin: 16px 0 22px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-small);
}

.nav-tab,
.split-btn,
.day-btn {
  border: 1px solid transparent;
  color: #42536a;
  background: transparent;
  font-weight: 750;
}

.nav-tab {
  min-width: 112px;
  padding: 10px 16px;
  border-radius: 9px;
}

.nav-tab:hover,
.split-btn:hover,
.day-btn:hover {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.nav-tab.active,
.split-btn.active,
.day-btn.active {
  color: #fff;
  background: linear-gradient(180deg, #2778e8, #1761cf);
  border-color: #1761cf;
  box-shadow: 0 4px 10px rgba(23, 97, 207, 0.2);
}

.view-hidden {
  display: none !important;
}

.toolbar,
.player-card,
.panel,
details.accordion,
.schedule-controls,
.schedule-grid,
.status,
.empty,
.error {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
  padding: 20px;
  border-radius: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label,
.schedule-controls label {
  color: #52647b !important;
  font-size: 0.77rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 10px 38px 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  font-size: 0.93rem;
}

select:hover {
  border-color: #aebdce;
}

select:focus,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(23, 105, 224, 0.18);
  outline-offset: 2px;
  border-color: var(--blue);
}

.status,
.empty,
.error {
  padding: 18px 20px;
  border-radius: 14px;
  color: var(--muted);
}

.empty::before {
  margin-right: 8px;
  color: var(--blue);
  content: "●";
  font-size: 0.7rem;
}

.error {
  color: #a31f28;
  border-color: #fac5c7;
  background: #fff4f4;
}

.footer-note {
  margin: 16px 2px 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.legend {
  position: fixed;
  z-index: 10;
  top: 116px;
  right: max(22px, calc((100vw - 1440px) / 2 + 28px));
  width: 178px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.legend h4 {
  margin: 0 0 11px;
  color: #24364d;
  font-size: 0.78rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.8rem;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-color {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
}

.player-card {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
  padding: 22px;
  border-radius: 17px;
}

.player-card img {
  width: 108px;
  height: 108px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-2);
}

.player-meta h2 {
  margin: 0 0 10px;
  font-size: 1.7rem;
  letter-spacing: -0.025em;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill,
.profile-badge,
.game-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  font-weight: 750;
}

.pill {
  padding: 6px 10px;
  border-radius: 8px;
  color: #4f6178;
  background: var(--panel-2);
  font-size: 0.8rem;
}

.main-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel,
details.accordion {
  overflow: hidden;
  border-radius: 16px;
}

.panel {
  margin-bottom: 0;
}

.panel-header,
details.accordion summary {
  background: linear-gradient(180deg, #ffffff, #f9fbfd);
}

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-header h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.profile-grid,
.season-stats-grid {
  display: grid;
  gap: 11px;
  padding: 15px 17px 17px;
}

.profile-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.season-stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-card,
.season-stat {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel-2);
}

.profile-label,
.season-stat-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.profile-value {
  margin-bottom: 7px;
  font-weight: 800;
}

.season-stat-value {
  font-size: 1.25rem;
  font-weight: 850;
}

.profile-badge {
  padding: 4px 8px;
  border-color: transparent;
  border-radius: 999px;
  font-size: 0.69rem;
}

.badge-elite { color: #fff; background: var(--elite); }
.badge-very-good { color: #fff; background: var(--very-good); }
.badge-good { color: #18350c; background: var(--good); }
.badge-average { color: #473500; background: var(--average); }
.badge-weak { color: #fff; background: var(--weak); }
.badge-bad { color: #fff; background: var(--bad); }

.summary-wrap {
  display: grid;
  gap: 11px;
  padding: 16px 18px 18px;
}

.summary-line {
  padding: 0;
  border: 0;
  background: transparent;
}

.player-type-box strong {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.player-type-panel {
  margin-bottom: 18px;
}

.player-type-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.player-type-heading strong {
  font-size: 1.05rem;
}

.player-type-detail {
  margin-top: 6px;
  color: #52647b;
  line-height: 1.55;
}

.player-type-flag {
  margin-top: 6px;
}

.accordion-group {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

details.accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  list-style: none;
  cursor: pointer;
  font-weight: 800;
}

details.accordion summary::-webkit-details-marker {
  display: none;
}

details.accordion summary::after {
  margin-left: 12px;
  color: var(--blue);
  content: "+";
  font-size: 1.25rem;
}

details.accordion[open] summary::after {
  content: "−";
}

.accordion-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 500;
}

.accordion-content {
  border-top: 1px solid var(--border);
}

.accordion-toolbar {
  display: flex;
  padding: 14px 18px 0;
}

.split-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}

.split-btn {
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 0.8rem;
}

.stats-list {
  padding: 9px 0;
}

.stat-row {
  display: grid;
  grid-template-columns: 1.15fr 0.7fr 1.3fr 116px;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: 0;
}

.stat-name,
.stat-value {
  font-weight: 800;
}

.stat-rank {
  color: var(--muted);
  font-size: 0.85rem;
}

.percentile {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe6ee;
}

.percentile-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.elite { background: var(--elite); }
.very-good { background: var(--very-good); }
.good { background: var(--good); }
.average { background: var(--average); }
.weak { background: var(--weak); }
.bad { background: var(--bad); }

.schedule-controls {
  margin-bottom: 16px;
  padding: 20px;
  border-radius: 16px;
}

.schedule-controls h2 {
  margin: 0 0 6px;
  color: #142945;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.schedule-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.schedule-week-field {
  max-width: 280px;
  margin-top: 15px;
}

.schedule-week-field label {
  display: block;
  margin-bottom: 6px;
}

.schedule-controls select {
  margin-top: 2px;
}

.day-toggle {
  display: grid;
  grid-template-columns: 84px repeat(7, minmax(100px, 1fr)) 56px;
  gap: 0;
  margin: 15px -20px 0;
}

.day-btn {
  width: calc(100% - 16px);
  min-width: 0;
  justify-self: center;
  padding: 8px 11px;
  border-radius: 8px;
}

.day-btn:first-child {
  grid-column: 2;
}

.day-btn:not(.active) {
  color: #667a92;
  background: #f4f7fa;
  border-color: #b8c7d8;
  box-shadow: none;
}

.schedule-scroll {
  overflow-x: auto;
  padding-bottom: 3px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.schedule-grid {
  min-width: 940px;
  overflow: hidden;
  border: 2px solid #819ab6;
  border-radius: 16px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 84px repeat(7, minmax(100px, 1fr)) 56px;
  border-bottom: 1px solid #a7b9cc;
}

.schedule-row:last-child {
  border-bottom: 0;
}

.schedule-row:not(.schedule-head):hover .schedule-cell {
  background-color: #f8fbff;
}

.schedule-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 78px;
  padding: 10px;
  border-right: 2px solid #8fa6bf;
  text-align: center;
  font-size: 0.82rem;
}

.schedule-cell:last-child {
  border-right: 0;
}

.schedule-head {
  color: #53677f;
  background: #f1f5f9;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.schedule-head .schedule-cell {
  padding-right: 0;
  padding-left: 0;
  border-right-color: #819ab6;
  text-align: center;
}

.team-cell {
  justify-content: center;
  padding: 8px;
}

.team-logo {
  width: 100px;
  height: 100px;
  flex: 0 0 54px;
  object-fit: contain;
}

.gp-cell {
  justify-content: center;
  color: var(--blue-dark);
  font-size: 0.95rem;
  font-weight: 900;
}

.game-pill {
  justify-content: center;
  gap: 5px;
  min-width: 72px;
  min-height: 58px;
  padding: 4px 8px;
}

.opponent-logo {
  width: 80px;
  height: 80px;
  flex: 0 0 48px;
  object-fit: contain;
}

.game-location {
  color: #6b7e95;
  font-size: 0.7rem;
  font-weight: 900;
}

.schedule-row:not(.schedule-head) .schedule-cell:not(.team-cell):not(.gp-cell) {
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.inactive-day {
  opacity: 0.28;
}

@media (max-width: 1400px) {
  .page {
    padding-right: 32px;
  }

  .legend {
    position: static;
    display: flex;
    width: auto;
    max-width: calc(100% - 64px);
    align-items: center;
    gap: 13px;
    margin: 0 auto 18px;
    padding: 11px 14px;
  }

  .legend h4,
  .legend-item {
    margin: 0;
  }
}

@media (max-width: 900px) {
  .page {
    padding: 24px 18px 48px;
  }

  .legend {
    max-width: calc(100% - 36px);
    flex-wrap: wrap;
  }

  .toolbar,
  .main-grid {
    grid-template-columns: 1fr;
  }

  .season-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-row {
    grid-template-columns: 1fr auto;
  }

  .stat-rank {
    grid-column: 1 / -1;
  }

  .percentile {
    display: none;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 18px 12px 40px;
  }

  .hero {
    min-height: 48px;
  }

  .hero h1::after {
    display: none;
  }

  .nav-tabs {
    display: flex;
    width: 100%;
  }

  .nav-tab {
    flex: 1;
    min-width: 0;
    padding-right: 10px;
    padding-left: 10px;
  }

  .toolbar,
  .schedule-controls {
    padding: 14px;
  }

  .toolbar {
    gap: 12px;
  }

  .legend {
    max-width: 100%;
    margin-bottom: 14px;
  }

  .player-card {
    grid-template-columns: 76px 1fr;
    padding: 16px;
  }

  .player-card img {
    width: 76px;
    height: 76px;
  }

  .player-meta h2 {
    font-size: 1.35rem;
  }

  .profile-grid,
  .season-stats-grid {
    grid-template-columns: 1fr;
  }

  .schedule-controls h2 {
    font-size: 1.1rem;
  }

  .schedule-week-field {
    max-width: none;
  }

  .day-toggle {
    grid-template-columns: repeat(7, minmax(52px, 1fr));
    gap: 6px;
    margin: 14px 0 0;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .day-btn {
    width: 100%;
    min-height: 40px;
    padding: 8px 5px;
    font-size: 0.78rem;
  }

  .day-btn:first-child {
    grid-column: auto;
  }

  .schedule-scroll {
    margin-right: -12px;
    margin-left: -12px;
  }

  .schedule-grid {
    min-width: 768px;
    border-radius: 0;
  }

  .schedule-row {
    grid-template-columns: 72px repeat(7, 92px) 52px;
  }

  .schedule-cell {
    min-height: 72px;
    padding: 6px;
  }

  .team-logo {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }

  .opponent-logo {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }

  .game-pill {
    min-width: 66px;
    min-height: 54px;
    padding: 3px 5px;
  }

  .game-location {
    font-size: 0.64rem;
  }

  .team-cell,
  .schedule-head .schedule-cell:first-child {
    position: sticky;
    z-index: 3;
    left: 0;
    background: var(--panel);
  }

  .gp-cell {
    position: sticky;
    z-index: 3;
    right: 0;
    background: var(--panel);
    box-shadow: -5px 0 10px rgba(31, 57, 90, 0.08);
  }

  .schedule-head .schedule-cell:first-child,
  .schedule-head .gp-cell {
    z-index: 4;
    background: #f1f5f9;
  }
}

/* Desktop: retain the existing day buttons above the schedule. */
.schedule-day-button {
  display: none;
}

.schedule-head .schedule-cell {
  flex-direction: column;
  gap: 2px;
}

@media (max-width: 640px) {
  /* On mobile, the clickable days live in the table header. */
  .day-toggle {
    display: none;
  }

  .schedule-scroll {
    width: calc(100% + 24px);
    margin-right: -12px;
    margin-left: -12px;
    overflow-x: auto;
  }

  .schedule-grid {
    width: 100%;
    min-width: 0;
    border-width: 1px;
    border-radius: 0;
  }

  .schedule-row {
    grid-template-columns: 46px repeat(7, minmax(0, 1fr)) 34px;
  }

  .schedule-cell {
    min-width: 0;
    min-height: 58px;
    padding: 2px;
    border-right-width: 1px;
    font-size: 0.7rem;
  }

  .schedule-head .schedule-cell {
    min-height: 62px;
    padding: 2px 0;
    font-size: 0.58rem;
  }

  .schedule-day-label {
    display: none;
  }

  .schedule-day-button {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 28px;
    padding: 2px 0;
    border-radius: 4px;
    font-size: 0.62rem;
    box-shadow: none;
  }

  .schedule-day-date {
    font-size: 0.58rem;
    letter-spacing: 0;
    white-space: nowrap;
  }

  .team-cell {
    padding: 2px;
  }

  .team-logo {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
  }

  .game-pill {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    flex-direction: column;
    gap: 0;
    padding: 1px;
    border: 0;
    background: transparent;
  }

  .opponent-logo {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
  }

  .game-location {
    font-size: 0.58rem;
    line-height: 1;
  }

  .gp-cell {
    padding: 0;
    font-size: 0.76rem;
  }
}

/* Shared period selector for player underlying statistics */
.player-period-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel, #fff);
}

.player-period-copy h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.player-period-copy p {
  margin: 0;
  color: var(--muted, #64748b);
  font-size: 0.85rem;
  line-height: 1.5;
}

.player-period-controls .split-toggle {
  flex-shrink: 0;
}

.player-period-controls .split-btn {
  min-height: 44px;
  min-width: 88px;
  padding: 10px 16px;
  font-size: 0.95rem;
}

.player-period-controls .split-btn:focus-visible {
  outline: 2px solid #1769d9;
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .player-period-controls {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    gap: 12px;
  }

  .player-period-controls .split-toggle {
    display: flex;
    width: 100%;
  }

  .player-period-controls .split-btn {
    flex: 1;
    min-width: 0;
  }
}
