@import url('https://fonts.googleapis.com/css2?family=Host+Grotesk:ital,wght@0,300..800;1,300..800&display=swap');

/* --- Root & Design Tokens (Swiss Minimalist System) --- */
:root {
  --font-display: 'Host Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Host Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Solid Color System - Swiss Design Theme */
  --bg-darker: #080808;
  --bg-page: #080808;
  --bg-panel: #121212;
  --bg-card: #181818;
  --bg-card-hover: #222222;
  --bg-control: #121212;

  --border-light: #262626;
  --border-glow: #333333;
  --border-active: #ffffff;

  /* West Conference Accent - Stark Terracotta (rgb(217, 158, 115)) */
  --cyan: rgb(217, 158, 115);
  --cyan-glow: transparent;
  --cyan-light: rgb(228, 197, 155);

  /* East Conference Accent - Stark Forest Green (rgb(25, 151, 0)) */
  --pink: rgb(25, 151, 0);
  --pink-glow: transparent;
  --pink-light: rgb(149, 255, 128);

  /* UI Highlight Color - Cobalt Blue */
  --highlight: rgb(0, 71, 171);
  --highlight-light: rgb(77, 137, 222);

  /* Championship Gold Accent - Flat Gold */
  --gold: hsl(45, 100%, 50%);
  --gold-glow: transparent;
  --gold-light: hsl(45, 100%, 75%);

  /* Functional Colors */
  --text-main: #ffffff;
  --text-muted: #a3a3a3;
  --text-dim: #737373;
  --shadow-main: none;
  --shadow-inset: none;

  /* Dimensions - Sharp Right Angles */
  --border-radius-lg: 0px;
  --border-radius-md: 0px;
  --border-radius-sm: 0px;
  --transition-smooth: all 0.2s ease-in-out;
  --transition-bounce: all 0.2s ease-in-out;

  /* NBA Team Colors (Flat Solid Theme Hues) */
  --team-color-ATL: hsl(358, 75%, 50%);
  --team-color-BOS: hsl(145, 80%, 26%);
  --team-color-BKN: hsl(0, 0%, 50%);
  --team-color-CHA: hsl(188, 80%, 29%);
  --team-color-CHI: hsl(345, 85%, 45%);
  --team-color-CLE: hsl(335, 80%, 28%);
  --team-color-DAL: hsl(204, 85%, 30%);
  --team-color-DEN: hsl(43, 90%, 50%);
  --team-color-DET: hsl(350, 75%, 44%);
  --team-color-GSW: hsl(220, 70%, 35%);
  --team-color-HOU: hsl(345, 85%, 45%);
  --team-color-IND: hsl(43, 90%, 50%);
  --team-color-LAC: hsl(210, 80%, 40%);
  --team-color-LAL: hsl(271, 60%, 40%);
  --team-color-MEM: hsl(221, 40%, 50%);
  --team-color-MIA: hsl(342, 85%, 32%);
  --team-color-MIL: hsl(145, 60%, 20%);
  --team-color-MIN: hsl(212, 70%, 20%);
  --team-color-NOP: hsl(212, 70%, 20%);
  --team-color-NYK: hsl(27, 90%, 50%);
  --team-color-OKC: hsl(202, 90%, 40%);
  --team-color-ORL: hsl(203, 90%, 40%);
  --team-color-PHI: hsl(205, 90%, 40%);
  --team-color-PHX: hsl(19, 85%, 50%);
  --team-color-POR: hsl(358, 75%, 50%);
  --team-color-SAC: hsl(272, 50%, 40%);
  --team-color-SAS: hsl(210, 10%, 75%);
  --team-color-TOR: hsl(345, 85%, 45%);
  --team-color-UTA: hsl(208, 90%, 20%);
  --team-color-WAS: hsl(355, 80%, 45%);
}

/* --- Base Resets & Typography --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-darker);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
  background: #333333;
  border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: #444444;
}

/* --- App Container Grid --- */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: 
    "header header"
    "sidebar main";
  min-height: 100vh;
  max-width: 1700px;
  margin: 0 auto;
  gap: 20px;
  padding: 20px;
}

/* --- Header Section --- */
header {
  grid-area: header;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  background: transparent;
  border: none;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  background: rgb(115, 15, 31);
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
  color: #ffffff;
}

h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -1px;
  color: #ffffff;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 2px;
}

.header-meta {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
}

.meta-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 6px 14px;
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-pill span {
  font-weight: 600;
  color: var(--text-main);
}

/* --- Sidebar Panels (Controls Hub) --- */
.sidebar-panel {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: calc(100vh - 120px);
  position: sticky;
  top: 100px;
  overflow-y: auto;
}

.control-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Ensure card rises above other cards when custom multi-select is open to fix stacking context issues */
.control-card:has(.custom-multiselect.active) {
  position: relative;
  z-index: 10;
}

.control-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Modern Select Elements */
.select-wrapper {
  position: relative;
}

.select-wrapper select {
  width: 100%;
  background: var(--bg-control);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 10px 32px 10px 12px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.85rem;
  appearance: none;
  cursor: pointer;
  outline: none;
  transition: var(--transition-smooth);
}

.select-wrapper select:focus {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.select-wrapper::after {
  content: "▼";
  font-size: 0.65rem;
  color: var(--text-dim);
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Custom Multi-Select Dropdown styling */
.custom-multiselect {
  position: relative;
  width: 100%;
}

.multiselect-trigger {
  width: 100%;
  background: var(--bg-control);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-smooth);
}

.multiselect-trigger:hover,
.custom-multiselect.active .multiselect-trigger {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.multiselect-trigger .trigger-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.multiselect-trigger .trigger-arrow {
  font-size: 0.65rem;
  color: var(--text-dim);
  transition: transform 0.3s ease;
}

.custom-multiselect.active .multiselect-trigger .trigger-arrow {
  transform: rotate(180deg);
}

.multiselect-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--border-radius-md);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 8px;
  max-height: 280px;
  box-sizing: border-box;
}

.multiselect-actions {
  display: flex;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}

.multiselect-actions .action-btn {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  padding: 6px 0;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.multiselect-actions .action-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-active);
}

.multiselect-options {
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 4px;
}

/* Custom Scrollbar for Options List */
.multiselect-options::-webkit-scrollbar {
  width: 6px;
}

.multiselect-options::-webkit-scrollbar-track {
  background: transparent;
}

.multiselect-options::-webkit-scrollbar-thumb {
  background: var(--border-glow);
  border-radius: 3px;
}

.multiselect-options::-webkit-scrollbar-thumb:hover {
  background: var(--border-active);
}

.multiselect-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-smooth);
}

.multiselect-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.multiselect-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-control);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.multiselect-item:hover input[type="checkbox"] {
  border-color: var(--border-active);
}

.multiselect-item input[type="checkbox"]:checked {
  border-color: var(--highlight);
  background: var(--highlight);
}

.multiselect-item input[type="checkbox"]:checked::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 0px;
  background: #080808;
}

.multiselect-item.checked {
  color: var(--text-main);
  background: #222222;
}

/* Custom Premium Range Sliders */
.custom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 0px;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.custom-slider:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

/* Webkit Thumb */
.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 0px;
  background: var(--text-main);
  border: 2px solid var(--highlight);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.custom-slider::-webkit-slider-thumb:hover {
  background: var(--highlight);
  border-color: #ffffff;
}

/* Firefox Thumb */
.custom-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 0px;
  background: var(--text-main);
  border: 2px solid var(--highlight);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.custom-slider::-moz-range-thumb:hover {
  background: var(--highlight);
  border-color: #ffffff;
}

/* Search Bar styling */
.search-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--bg-control);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px 10px 36px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-smooth);
}

.search-input:focus {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  font-size: 0.9rem;
}

/* Filter Badge Selection Grid */
.badge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
}

.filter-badge:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.filter-badge.active-cyan {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #080808;
  font-weight: 700;
}

.filter-badge.active-pink {
  background: var(--pink);
  border-color: var(--pink);
  color: #ffffff;
  font-weight: 700;
}

.filter-badge.active-standard {
  background: #ffffff;
  border-color: #ffffff;
  color: #080808;
  font-weight: 700;
}

/* Preset Pill buttons */
.preset-button {
  background: hsla(0, 0%, 100%, 0.03);
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.preset-button:hover {
  background: hsla(0, 0%, 100%, 0.07);
  color: var(--text-main);
  border-color: var(--border-glow);
}

.preset-button.active {
  background: var(--border-active);
  border-color: var(--border-active);
  color: #080808;
  font-weight: 700;
}

/* --- Main Dashboard Area --- */
main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Layout Modes Panel (Toggles: Chart View vs Grid Cards) */
.view-tabs {
  display: flex;
  background: transparent;
  border: none;
  padding: 0;
  align-self: flex-start;
  gap: 8px;
}

.view-tab {
  background: transparent;
  border: none;
  padding: 8px 18px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-tab:hover {
  color: var(--text-main);
}

.view-tab.active {
  background: var(--bg-control);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.view-tab span.badge {
  background: #333333;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 0px;
  color: var(--text-muted);
}

/* --- Visualizer Area --- */
.visualizer-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.chart-info {
  display: flex;
  flex-direction: column;
}

.chart-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.chart-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Chart Legend Styling */
.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: 0px;
  border: 1px solid var(--border-light);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

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

.legend-color.west {
  background: var(--cyan);
}

.legend-color.east {
  background: var(--pink);
}

.legend-color.ring {
  background: transparent;
  border: 2px solid var(--gold);
}

/* SVG Chart Elements */
.svg-chart-container {
  width: 100%;
  flex: 1;
  min-height: 400px;
  position: relative;
}

.svg-chart {
  width: 100%;
  height: 100%;
  min-height: 420px;
  display: block;
}

.chart-grid-line {
  stroke: hsla(224, 20%, 30%, 0.15);
  stroke-dasharray: 4, 4;
}

.chart-grid-line-solid {
  stroke: hsla(224, 20%, 30%, 0.35);
}

.chart-axis-text {
  fill: var(--text-dim);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  user-select: none;
}

.chart-axis-title {
  fill: var(--text-muted);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  user-select: none;
}

/* Bubbles in the Chart */
.chart-bubble {
  cursor: pointer;
  transition: var(--transition-bounce);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

.chart-bubble circle.core {
  r: var(--base-r, 14px);
  transition: r 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), fill 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chart-bubble circle.ring-gold {
  stroke: var(--gold);
  stroke-width: 2px;
  fill: none;
  opacity: 0.85;
}

/* Bubble Interactive States */
.chart-bubble:hover circle.core {
  r: calc(var(--base-r, 14px) + 5px);
}

.chart-bubble.dimmed {
  opacity: 0.12;
  pointer-events: none;
}

.chart-bubble.highlighted {
  opacity: 1;
  z-index: 100;
}

/* Interactive SVG tooltips in HTML overlays */
.chart-tooltip {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  color: var(--text-main);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.9) translate(-50%, -100%);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
  margin-top: -12px;
}

.chart-tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: rgba(13, 17, 28, 0.95) transparent;
  display: block;
  width: 0;
}

.chart-tooltip.visible {
  opacity: 1;
  transform: scale(1) translate(-50%, -100%);
}

.tooltip-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 2px;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.tooltip-row span.val {
  font-weight: 600;
  color: var(--text-main);
}

/* --- Player Card Grid System --- */
.player-grid-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Player Glassmorphic Card */
.player-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--conf-color, var(--border-light)); /* Bold solid conference top strip */
  border-radius: var(--border-radius-md);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-card:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.player-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 2;
}

.card-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-main);
}

.card-team {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-team-badge {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: var(--border-radius-sm);
  display: inline-block;
  margin-top: 4px;
}

.position-tag {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
}

.card-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  z-index: 2;
  margin-top: 4px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255,255,255,0.03);
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 1px;
}

.card-playoffs-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
  margin-top: auto;
}

.playoffs-title {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 500;
}

.playoffs-title span.val {
  color: var(--text-muted);
  font-weight: 600;
}

.mini-bar-track {
  height: 4px;
  background: rgba(0,0,0,0.3);
  border-radius: 2px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  background: var(--conf-color, var(--cyan));
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Gold border for championship winners */
.player-card.has-championships {
  border-left: 3px solid var(--gold);
}

.card-champs-badge {
  color: var(--gold);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
  font-family: var(--font-display);
  z-index: 2;
}

.player-card.dimmed {
  opacity: 0.15;
  transform: scale(0.96);
  pointer-events: none;
}

/* --- Slide-Out Detail Drawer System --- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
  z-index: 999;
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.detail-drawer {
  position: fixed;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: 440px;
  max-width: calc(100vw - 40px);
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  transform: translateX(110%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-drawer.active {
  transform: translateX(0);
}

/* Drawer Header and Hero */
.drawer-hero {
  position: relative;
  padding: 30px 24px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  overflow: hidden;
}

.drawer-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg-card);
  pointer-events: none;
  z-index: 1;
}

.close-drawer-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 0px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition-smooth);
}

.close-drawer-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  transform: rotate(90deg);
}

.drawer-team-pill {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 0px;
  background: var(--team-pill-border, var(--cyan));
  color: var(--team-pill-text-color, #080808);
  z-index: 2;
}

.drawer-player-name {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
  z-index: 2;
}

.drawer-player-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  z-index: 2;
}

.drawer-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Multi-Player Drawer Tabs */
.drawer-player-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  z-index: 2;
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

.drawer-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.drawer-tab-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-active);
}

.drawer-tab-btn.active {
  background: #ffffff;
  border-color: #ffffff;
  color: #080808;
  font-weight: 700;
}

/* Scrollable Details Body */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Playoff Milestone Visualizer (Circular gauges) */
.milestones-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drawer-section-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.gauges-row {
  display: flex;
  justify-content: space-around;
  background: var(--bg-card);
  border-radius: var(--border-radius-md);
  padding: 20px 10px;
  border: 1px solid var(--border-light);
}

.radial-gauge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

.radial-svg {
  width: 76px;
  height: 76px;
  transform: rotate(-90deg);
}

.radial-bg-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 5px;
}

.radial-fill-ring {
  fill: none;
  stroke-width: 5px;
  stroke-linecap: square;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.radial-fill-ring.playoffs { stroke: var(--fill-color, var(--cyan)); }
.radial-fill-ring.conf-finals { stroke: var(--gold); }
.radial-fill-ring.finals { stroke: var(--pink); }

.gauge-center-val {
  position: absolute;
  top: 38px;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.gauge-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* Linear Career Metrics */
.drawer-career-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 0px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.metric-details {
  display: flex;
  flex-direction: column;
}

.metric-title {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric-val span.sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 400;
  margin-left: 2px;
}

/* Simulated AI Career Report Card */
.ai-summary-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.02), rgba(255,255,255,0.005));
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cyan-light);
}

.ai-header-sparkle {
  color: var(--gold);
  animation: sparkle-pulse 2s infinite ease-in-out;
}

.ai-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Custom animations */
@keyframes sparkle-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* --- Media Queries for Responsive Design --- */
@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
    grid-template-areas: 
      "header"
      "sidebar"
      "main";
    height: auto;
  }
  .sidebar-panel {
    height: auto;
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .control-card {
    height: 100%;
  }
}

@media (max-width: 680px) {
  .sidebar-panel {
    grid-template-columns: 1fr;
  }
  .gauges-row {
    flex-wrap: wrap;
    gap: 16px;
  }
  .detail-drawer {
    width: 100%;
    right: 0;
    top: 0;
    bottom: 0;
    border-radius: 0;
    max-width: 100%;
  }
}

/* --- Elegant Glassmorphic Loader --- */
.chart-loader {
  position: absolute;
  inset: 0;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  border-radius: var(--border-radius-md);
}

.chart-loader.active {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--cyan);
  border-right-color: var(--pink);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

.loader-text {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  animation: pulse-light 1.8s infinite ease-in-out;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse-light {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* --- Career Timelines Screen --- */
.player-timeline-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-header.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.timeline-controls,
.catalog-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mini custom overrides */
.search-wrapper.mini .search-input {
  width: 220px;
  padding: 8px 10px 8px 32px;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
}

.search-wrapper.mini .search-icon {
  font-size: 0.8rem;
  left: 10px;
}

.select-wrapper.mini select {
  padding: 8px 28px 8px 10px;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
}

.select-wrapper.mini::after {
  right: 10px;
  font-size: 0.55rem;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

/* Glassmorphic Timeline Row */
.timeline-row {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-bottom: none;
  border-radius: 0;
  padding: 6px 20px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: center;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.timeline-row:first-child {
  border-top-left-radius: var(--border-radius-md);
  border-top-right-radius: var(--border-radius-md);
}

.timeline-row:last-child {
  border-bottom: 1px solid var(--border-light);
  border-bottom-left-radius: var(--border-radius-md);
  border-bottom-right-radius: var(--border-radius-md);
}


/* Left Panel: Info & Badges */
.timeline-player-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timeline-player-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.timeline-player-name-text {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
  transition: var(--transition-smooth);
}

.timeline-player-name:hover .timeline-player-name-text {
  color: var(--highlight);
}

.timeline-seasons-box {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 0px;
  padding: 1px 5px;
  opacity: 0.55;
  display: inline-block;
  transition: var(--transition-smooth);
  letter-spacing: 0;
}

.timeline-player-name:hover .timeline-seasons-box {
  opacity: 0.85;
  border-color: var(--highlight);
}

.timeline-player-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.timeline-team-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 0px;
  color: var(--text-muted);
}

.timeline-tenure-text {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* Right Panel: Track Outer & Bar */
.timeline-track-outer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.timeline-bar {
  width: 100%;
  height: 26px;
  background: #111111;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
  display: flex;
  align-self: flex-start;
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Segment Styling */
.timeline-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  border-right: 1px solid rgba(0, 0, 0, 0.35);
  position: relative;
  transition: var(--transition-smooth);
  cursor: pointer;
  box-sizing: border-box;
}

.timeline-segment:hover {
  outline: 2px solid var(--highlight);
  outline-offset: -2px;
  z-index: 10;
}

.timeline-segment:last-child {
  border-right: none;
}


/* Custom internal label */
.timeline-segment-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
}

/* Tick scale at the bottom of the timeline */
.timeline-scale-ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 500;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  margin-top: 2px;
  padding-top: 2px;
  align-self: flex-start;
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Custom Tooltip Specifics for Segments */
.timeline-segment-tooltip {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--bg-card);
  border: 1px solid var(--highlight);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 0.75rem;
  color: var(--text-main);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
  white-space: nowrap;
  z-index: 50;
  text-align: center;
}

.timeline-segment-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px 5px 0;
  border-style: solid;
  border-color: rgba(13, 17, 28, 0.95) transparent;
  display: block;
  width: 0;
}

.timeline-segment:hover .timeline-segment-tooltip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: all;
}

.tooltip-team-title {
  font-weight: 700;
  margin-bottom: 2px;
  color: #fff;
}

.tooltip-years-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Proportional Switch Slider Toggle */
.timeline-toggle-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin-left: 8px;
}

.timeline-toggle-switch input {
  display: none;
}

.timeline-toggle-slider {
  position: relative;
  width: 32px;
  height: 16px;
  background: var(--bg-control);
  border: 1px solid var(--border-light);
  border-radius: 0px;
  transition: var(--transition-smooth);
}

.timeline-toggle-slider::before {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  background: var(--text-dim);
  border-radius: 0px;
  transition: var(--transition-smooth);
}

.timeline-toggle-switch input:checked + .timeline-toggle-slider {
  background: var(--highlight);
  border-color: var(--highlight);
}

.timeline-toggle-switch input:checked + .timeline-toggle-slider::before {
  transform: translateX(14px);
  background: #080808;
}

.timeline-toggle-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: var(--transition-smooth);
}

.timeline-toggle-switch input:checked ~ .timeline-toggle-label {
  color: var(--text-main);
}


