/* ==========================================================================
   play-by-play.css — NBA Play-by-Play Feed Styles
   ========================================================================== */

.pbp-container {
  margin-top: 16px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface, #1a1d24);
  border: 1px solid var(--border, #2a2d35);
}

.pbp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #2a2d35);
  background: var(--surface-raised, #1e2128);
}

.pbp-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #e0e0e0);
}

.pbp-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary, #9ca3af);
  cursor: pointer;
  user-select: none;
}

.pbp-filter input[type="checkbox"] {
  accent-color: #3b82f6;
}

/* Feed scroll area */
.pbp-feed {
  max-height: 400px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Individual play row */
.pbp-play {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.04));
  transition: background 0.15s;
}

.pbp-play:last-child {
  border-bottom: none;
}

.pbp-play:hover {
  background: rgba(255,255,255,0.02);
}

/* Scoring play highlight */
.pbp-play--scoring {
  border-left: 3px solid #22c55e;
  background: rgba(34, 197, 94, 0.04);
}

.pbp-play--scoring:hover {
  background: rgba(34, 197, 94, 0.08);
}

/* Team badge */
.pbp-play-left {
  flex-shrink: 0;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
}

.pbp-team-badge {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.pbp-team-badge--empty {
  display: inline-block;
  width: 22px;
  height: 22px;
}

/* Player avatar (headshot → initials fallback) with corner team badge */
.pbp-avatar {
  position: relative;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pbp-headshot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: #1f2937;
}

.pbp-initials {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #9ca3af;
}

.pbp-avatar-badge {
  position: absolute;
  bottom: -2px;
  right: -4px;
  width: 15px;
  height: 15px;
}

.pbp-avatar-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Play body */
.pbp-play-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pbp-description {
  font-size: 13px;
  color: var(--text-primary, #e0e0e0);
  line-height: 1.4;
}

.pbp-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted, #6b7280);
}

.pbp-clock {
  font-variant-numeric: tabular-nums;
}

.pbp-score {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary, #9ca3af);
}

/* Empty state */
.pbp-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted, #6b7280);
  font-size: 14px;
}

/* Scrollbar styling */
.pbp-feed::-webkit-scrollbar {
  width: 6px;
}

.pbp-feed::-webkit-scrollbar-track {
  background: transparent;
}

.pbp-feed::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

.pbp-feed::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* Responsive */
@media (max-width: 600px) {
  .pbp-play {
    padding: 8px 12px;
    gap: 8px;
  }

  .pbp-description {
    font-size: 12px;
  }
}

/* Mobile — PBP in its own tab: clean, full-bleed, large cards.
   Each play becomes a card with a dim meta row on top (period · clock · score),
   then a large headshot beside bold play text. The shared markup is rearranged
   with CSS grid only (no JS branch) so desktop is untouched. */
@media (max-width: 1000px) {
  /* Full-bleed feed — drop the panel chrome so cards sit on the page bg */
  .pbp-container {
    margin-top: 0;
    border: none;
    border-radius: 0;
    background: transparent;
  }

  .pbp-feed {
    max-height: none;
  }

  /* Tab already labels this "Play-by-Play" — hide the redundant in-panel title,
     keep the scoring-only toggle right-aligned. */
  .pbp-header {
    padding: 12px 20px;
    background: transparent;
    border-bottom: none;
    justify-content: flex-end;
  }

  .pbp-title {
    display: none;
  }

  .pbp-filter span {
    font-size: 16px;
  }

  /* Card layout: meta row spans the top, headshot + play text below */
  .pbp-play {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "meta   meta"
      "avatar body";
    column-gap: 16px;
    row-gap: 8px;
    align-items: center;
    padding: 18px 20px;
  }

  /* Let the body's children become grid items of the card */
  .pbp-play-body {
    display: contents;
  }

  .pbp-meta {
    grid-area: meta;
    justify-content: flex-start;
    gap: 16px;
    font-size: 15px;
  }

  .pbp-clock,
  .pbp-score {
    font-size: 15px;
  }

  .pbp-play-left {
    grid-area: avatar;
    width: auto;
    padding-top: 0;
  }

  .pbp-description {
    grid-area: body;
    min-width: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  /* Large circular headshot / team badge */
  .pbp-avatar,
  .pbp-headshot,
  .pbp-initials {
    width: 56px;
    height: 56px;
  }

  .pbp-initials {
    font-size: 18px;
  }

  .pbp-team-badge,
  .pbp-team-badge--empty {
    width: 44px;
    height: 44px;
  }

  .pbp-avatar-badge {
    width: 22px;
    height: 22px;
    right: -6px;
    bottom: -3px;
  }
}
