/* ============================================
   Matchup Grid — 18-week Visual Grid
   ============================================ */

.matchup-grid-section {
  padding: var(--space-section) 0;
}

.matchup-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.matchup-grid-header h2 {
  margin-bottom: 0;
}

.matchup-grid-legend {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-dot.easy { background: #22c55e; }
.legend-dot.medium { background: #64748b; }
.legend-dot.hard { background: #ef4444; }
.legend-dot.bye { background: #334155; }

/* ── Grid Wrapper ── */
.matchup-grid-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

/* ── Grid Table ── */
.matchup-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  min-width: 900px;
}

.matchup-grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 6px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-default);
  text-align: center;
  white-space: nowrap;
}

.matchup-grid-table thead th:first-child {
  text-align: left;
  padding-left: 12px;
  position: sticky;
  left: 0;
  z-index: 15;
  background: var(--bg-elevated);
}

/* ── Grid Rows ── */
.matchup-grid-table td {
  padding: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  text-align: center;
}

.matchup-grid-table td:first-child {
  text-align: left;
  padding-left: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--bg-base);
}

.matchup-grid-table tbody tr:nth-child(even) td:first-child {
  background: var(--bg-elevated);
}

/* ── Grid Cells ── */
.grid-cell {
  width: 40px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  position: relative;
  margin: 0 auto;
}

.grid-cell.easy {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.grid-cell.medium {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(100, 116, 139, 0.15);
}

.grid-cell.hard {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.grid-cell.bye {
  background: rgba(51, 65, 85, 0.3);
  color: var(--text-muted);
  border: 1px solid rgba(51, 65, 85, 0.3);
}

.grid-cell.best-week {
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
  border-color: rgba(34, 197, 94, 0.5);
}

.grid-cell:hover {
  transform: scale(1.15);
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ── Tooltip ── */
.grid-tooltip {
  position: fixed;
  z-index: 300;
  padding: 10px 14px;
  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-3);
  font-size: 0.8125rem;
  color: var(--text-primary);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-default);
  max-width: 200px;
}

.grid-tooltip.visible {
  opacity: 1;
}

.grid-tooltip-team {
  font-weight: 600;
  margin-bottom: 4px;
}

.grid-tooltip-detail {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.grid-tooltip-difficulty {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ── Loading ── */
.grid-loading {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .matchup-grid-wrap {
    margin: 0 calc(-1 * var(--space-lg));
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .grid-cell {
    width: 36px;
    height: 28px;
    font-size: 0.625rem;
  }

  .matchup-grid-header {
    flex-direction: column;
    align-items: stretch;
  }
}
