/* ============================================
   NBA PROJECTIONS - REDESIGNED TABLE UI
   Full stats with premium visual treatment
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  --font-display: 'Sora', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;

  --glow-primary: rgba(30, 251, 151, 0.4);
  --glow-subtle: rgba(30, 251, 151, 0.15);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rowSlide {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ===== PAGE ===== */
.projections-page {
  min-height: 100vh;
  background: var(--color-gray-950);
  padding-bottom: 80px;
}

/* ===== HEADER ===== */
.proj-header {
  max-width: 1400px;
  margin: 0 auto;
  padding: 64px 24px 32px;
  animation: fadeUp 0.5s ease-out;
}

.proj-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-white);
  margin: 0 0 12px;
  line-height: 1.1;
}

.proj-subtitle {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin: 0;
  max-width: 500px;
}

/* ===== FILTER BAR ===== */
.proj-filters {
  position: sticky;
  top: 72px;
  z-index: 100;
  background: rgba(3, 7, 18, 0.9);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  animation: fadeUp 0.5s ease-out 0.1s both;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-tertiary);
}

/* Position Tabs */
.position-tabs {
  display: flex;
  background: var(--color-gray-800);
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
}

.pos-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pos-tab:hover {
  color: var(--color-text-primary);
  background: var(--color-gray-700);
}

.pos-tab.active {
  background: var(--color-primary);
  color: var(--color-gray-950);
  box-shadow: 0 2px 12px var(--glow-primary);
}

/* Filter Dropdowns */
.filter-dropdown {
  appearance: none;
  background: var(--color-gray-800);
  border: 1px solid var(--color-border-light);
  border-radius: 10px;
  padding: 10px 40px 10px 14px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%231EFB97' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  min-width: 140px;
}

.filter-dropdown:hover,
.filter-dropdown:focus {
  border-color: var(--color-primary);
  outline: none;
}

/* ===== TABLE CONTAINER ===== */
.proj-table-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  animation: fadeUp 0.5s ease-out 0.15s both;
}

.proj-table-scroll {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--color-border-light);
  background: var(--color-gray-900);
}

/* ===== DATA TABLE ===== */
.proj-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

/* Table Header */
.proj-table thead {
  background: var(--color-gray-800);
}

.proj-table thead th {
  padding: 14px 12px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-tertiary);
  border-bottom: 2px solid var(--color-border-light);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  position: relative;
}

.proj-table thead th:hover {
  color: var(--color-primary);
  background: var(--color-gray-750);
}

.proj-table thead th.sorted {
  color: var(--color-primary);
}

.proj-table thead th.sorted::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
}

.proj-table thead th .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  opacity: 0;
  transition: all 0.15s ease;
  font-size: 0.6rem;
}

.proj-table thead th:hover .sort-arrow {
  opacity: 0.5;
}

.proj-table thead th.sorted .sort-arrow {
  opacity: 1;
}

.proj-table thead th.sorted.desc .sort-arrow {
  transform: rotate(180deg);
}

/* Column classes */
.proj-table .col-rank {
  width: 48px;
  text-align: center;
}

.proj-table .col-player {
  width: 240px;
}

.proj-table .col-pts {
  width: 70px;
  text-align: right;
}

.proj-table .col-stat {
  width: 60px;
  text-align: right;
}

/* Table Body */
.proj-table tbody tr {
  transition: all 0.15s ease;
  animation: rowSlide 0.3s ease-out both;
}

.proj-table tbody tr:nth-child(1) {
  animation-delay: 0.02s;
}

.proj-table tbody tr:nth-child(2) {
  animation-delay: 0.04s;
}

.proj-table tbody tr:nth-child(3) {
  animation-delay: 0.06s;
}

.proj-table tbody tr:nth-child(4) {
  animation-delay: 0.08s;
}

.proj-table tbody tr:nth-child(5) {
  animation-delay: 0.10s;
}

.proj-table tbody tr:nth-child(n+6) {
  animation-delay: 0.12s;
}

.proj-table tbody tr:hover {
  background: rgba(30, 251, 151, 0.05);
}

.proj-table tbody td {
  padding: 14px 12px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

/* Rank cell */
.proj-table .cell-rank {
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-tertiary);
}

/* Player cell with badge */
.proj-table .cell-player {
  vertical-align: middle;
}

.proj-table .cell-player .player-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-name {
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proj-table tbody tr:hover .player-name {
  color: var(--color-primary);
}

.player-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.badge-pos {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(30, 251, 151, 0.12);
  padding: 3px 6px;
  border-radius: 4px;
}

.badge-team {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text-tertiary);
  background: var(--color-gray-700);
  padding: 3px 6px;
  border-radius: 4px;
}

/* Points cell */
.proj-table .cell-pts {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-primary);
}

/* Stat cells */
.proj-table .cell-stat {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* Empty/loading state */
.proj-table .row-empty td,
.proj-table .row-loading td {
  text-align: center;
  color: var(--color-text-tertiary);
  padding: 48px 24px;
  font-family: var(--font-display);
}

.proj-table .row-loading td {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ===== FROZEN COLUMNS ===== */
.proj-table thead th:first-child,
.proj-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--color-gray-900);
}

.proj-table thead th:first-child {
  background: var(--color-gray-800);
  z-index: 3;
}

.proj-table thead th:nth-child(2),
.proj-table tbody td:nth-child(2) {
  position: sticky;
  left: 48px;
  z-index: 2;
  background: var(--color-gray-900);
}

.proj-table thead th:nth-child(2) {
  background: var(--color-gray-800);
  z-index: 3;
}

.proj-table thead th:nth-child(2)::after,
.proj-table tbody td:nth-child(2)::after {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  bottom: 0;
  width: 8px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.15), transparent);
  pointer-events: none;
}

.proj-table tbody tr:hover td:first-child,
.proj-table tbody tr:hover td:nth-child(2) {
  background: rgba(30, 251, 151, 0.05);
}

/* ===== EXPLAINER ===== */
.proj-explainer {
  max-width: 1400px;
  margin: 64px auto 0;
  padding: 0 24px 48px;
}

.proj-explainer h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 20px;
}

.explainer-intro {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin: 0 0 32px;
  max-width: 800px;
}

.explainer-intro strong {
  color: var(--color-text-primary);
}

.explainer-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.explainer-section {
  background: var(--color-gray-800);
  border: 1px solid var(--color-border-light);
  border-radius: 16px;
  padding: 24px;
}

.explainer-section h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.explainer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.explainer-section li {
  font-family: var(--font-display);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin: 10px 0;
  padding-left: 16px;
  position: relative;
}

.explainer-section li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-size: 0.8rem;
}

.explainer-section li strong {
  color: var(--color-text-primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .proj-header {
    padding: 40px 16px 24px;
  }

  .proj-title {
    font-size: 2rem;
  }

  .proj-filters {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 16px;
    top: 64px;
  }

  .filter-group {
    width: 100%;
    justify-content: space-between;
  }

  .position-tabs {
    flex-wrap: wrap;
  }

  .pos-tab {
    padding: 8px 12px;
    font-size: 0.75rem;
  }

  .filter-dropdown {
    flex: 1;
    min-width: 0;
  }

  .proj-table-container {
    padding: 16px 8px;
  }

  .proj-table {
    min-width: 700px;
  }

  .proj-table thead th,
  .proj-table tbody td {
    padding: 10px 8px;
    font-size: 0.8rem;
  }

  .proj-table .col-rank {
    width: 36px;
  }

  .proj-table .col-player {
    width: 180px;
  }

  .proj-table thead th:nth-child(2),
  .proj-table tbody td:nth-child(2) {
    left: 36px;
  }

  .player-name {
    font-size: 0.85rem;
  }

  .player-badges {
    gap: 4px;
  }

  .badge-pos,
  .badge-team {
    font-size: 0.6rem;
    padding: 2px 4px;
  }

  .explainer-sections {
    grid-template-columns: 1fr;
  }

  .proj-explainer {
    padding: 0 16px 32px;
    margin-top: 48px;
  }

  .proj-explainer h2 {
    font-size: 1.25rem;
  }

  .explainer-intro {
    font-size: 0.9rem;
  }

  .explainer-section {
    padding: 20px;
  }
}

/* ===== SCROLLBAR ===== */
.proj-table-scroll::-webkit-scrollbar {
  height: 8px;
}

.proj-table-scroll::-webkit-scrollbar-track {
  background: var(--color-gray-900);
}

.proj-table-scroll::-webkit-scrollbar-thumb {
  background: var(--color-gray-700);
  border-radius: 4px;
}

.proj-table-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-600);
}
