/* ========================================
   Pitch Overlay Styles
   Matchup details, fouls history, stat
   boxes, and game filtering.
   Extracted from _formation_tactics_board.html.erb
   ======================================== */

/* ---- Matchup Details ---- */

.matchup-details {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 0.75rem;
  max-width: 100%;
}

/* Ensure stat box rows don't wrap and can scroll horizontally */
.matchup-details .fouls-hit-rates,
.matchup-details .flex {
  flex-wrap: nowrap;
  min-width: max-content;
}

/* Unified matchup details - no background since parent is already dark */
.unified-matchup-details {
  background: transparent;
  padding: 0;
  padding-top: 0.5rem;
  padding-left: 0.3rem;
  width: 100%;
}

/* Ensure fouls history row expands to full width */
.unified-matchup-details > .flex {
  width: 100%;
}

/* Matchup player card - ensure full width */
.matchup-player-card {
  width: 100%;
}

/* ---- Matchup Chips ---- */

.matchup-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(100, 100, 100, 0.5);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 11px;
}

.matchup-chip--primary {
  background: rgba(var(--glow-rgb), 0.2);
  border: 1px solid rgba(var(--glow-rgb), 0.4);
}

.matchup-chip__position {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}

.matchup-chip__name {
  color: #fff;
}

.matchup-chip__score {
  background: rgba(255, 255, 255, 0.1);
  padding: 0 0.25rem;
  border-radius: 2px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}

.matchup-chip--primary .matchup-chip__score {
  background: rgba(var(--glow-rgb), 0.3);
  color: #4ade80;
}

/* ---- Fouls History ---- */

.fouls-player-label {
  width: 75px;
  min-width: 75px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
}

.fouls-hit-rates {
  display: flex;
  width: 44px;
  min-width: 44px;
  flex-shrink: 0;
}

/* Stat boxes container - horizontal scroll */
.fouls-stat-boxes {
  flex: 1;
  min-width: 475px;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: visible;
  gap: 2px;
  padding-top: 10px;
  padding-bottom: 4px;
  margin-bottom: -4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.fouls-stat-boxes:hover {
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* Webkit scrollbar styling */
.fouls-stat-boxes::-webkit-scrollbar {
  height: 4px;
}

.fouls-stat-boxes::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 2px;
}

.fouls-stat-boxes::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  transition: background 0.2s ease;
}

.fouls-stat-boxes:hover::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
}

.fouls-stat-boxes:hover::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.35);
}

/* Hit rate percentage boxes */
.hit-rate-box {
  position: relative;
}

.hit-rate-box::before {
  content: '%';
  position: absolute;
  top: 1px;
  right: 1px;
  font-size: 6px;
  opacity: 0.7;
}

/* Smaller stat boxes for fouls history */
.matchup-details .stat-box-container {
  width: auto;
  margin-right: 2px;
  padding-right: 0;
}

.matchup-details .stat-value-box {
  width: 18px;
  height: 22px;
  font-size: 10px;
  border-radius: 3px;
}

.matchup-details .stat-value-box::after {
  height: 2px;
  border-radius: 0 0 3px 3px;
}

/* ---- Game Filtering ---- */

/* Hide extended games (11-20) and L20 stats by default */
.game-box-extended {
  display: none;
}

.stats-grid-extended {
  display: none;
}

/* When showing L20, hide L10 stats grid and show L20 */
.show-extended-games .stats-grid-l10 {
  display: none;
}

.show-extended-games .stats-grid-extended {
  display: flex;
}

.game-box {
  transition: opacity 0.2s ease;
}

.game-box-hidden {
  display: none !important;
}

.game-box-visible {
  display: block;
}

/* ---- Matchup Player Expand/Collapse ---- */

.matchup-player-hidden {
  display: none;
}

.matchup-collapse-btn {
  display: none;
}

.matchup-players-expanded .matchup-player-hidden {
  display: block;
}

.matchup-players-expanded .matchup-expand-btn {
  display: none;
}

.matchup-players-expanded .matchup-collapse-btn {
  display: block;
}

.matchup-expand-btn:hover,
.matchup-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}
