/* ========================================
   LIVE GAMES SECTION
   Add this to style.css
   ======================================== */

.live-games-section {
  margin-top: 50px;
  margin-bottom: 50px;
  width: 100%;
  justify-content: center;
}

.live-games-container {
  background: whitesmoke;
  padding: 20px;
  border: 3px solid rgb(232, 232, 232);
  border-radius: 10px;
  max-width: 1200px;
  margin: 0 auto;
}

.live-games-header {
  text-align: center;
  margin-bottom: 16px;
  width: 100%;
}

.live-games-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.live-games-title {
  flex: 0 1 auto;
  text-align: center;
}


.live-games-header h3 {
  color: #000;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-games-date {
  color: #6c757d;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.live-games-scroll-hint {
  text-align: center;
  color: #aaa;
  font-size: 12px;
  margin-top: 8px;
  font-weight: 500;
}

.live-games-scroll::-webkit-scrollbar {
  height: 8px;
}

.live-games-scroll::-webkit-scrollbar-track {
  background: #e9ecef;
  border-radius: 4px;
}

.live-games-scroll::-webkit-scrollbar-thumb {
  background: #6c757d;
  border-radius: 4px;
}

.live-games-scroll::-webkit-scrollbar-thumb:hover {
  background: #495057;
}

/* This is the scrollable wrapper for the games */
#live-games-list {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 0 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #6c757d #e9ecef;
}

@media (max-width: 800px){
    #live-games-list {
      display: grid;
      grid-auto-flow: column;
      grid-auto-columns: 100px;
      grid-template-rows: repeat(2,auto);
      gap: 16px;
      overflow-x: auto;
      overflow-y: hidden;
      padding: 10px 0 16px;
      scroll-behavior: smooth;
      -webkit-overflow-scrolling: touch;
      scrollbar-color: #6c757d #e9ecef;
  }
}

#live-games-list::-webkit-scrollbar {
  height: 8px;
}
#live-games-list::-webkit-scrollbar-track {
  background: #e9ecef;
  border-radius: 4px;
}

#live-games-list::-webkit-scrollbar-thumb {
  background: #6c757d;
  border-radius: 4px;
}

#live-games-list::-webkit-scrollbar-thumb:hover {
  background: #495057;
}


/* ── Individual Game Card ──────────────── */
.live-game-card {
  flex: 0 0 180px;
  min-width: 180px;
  width: 180px;
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  scroll-snap-align: start;
  box-sizing: border-box;
  text-align: center;
}

.live-game-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  border-color: #4a9eff;
}

.live-game-card.live {
  border-color: #2ecc71;
  box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.2);
}

.live-game-card.upcoming {
  border-style: dashed;
  border-color: #bbb;
  opacity: 0.85;
}

.live-game-card.final {
  border-color: #dee2e6;
}

.live-game-card.final .live-status-text{
  display: none;
}

@media (min-width: 800px){
    .live-game-card.final .live-matchup{
    border-color: #dee2e6;
    padding-top: 25px;
  }
}

/* ── Badges ────────────────────────────── */
.live-badge,
.upcoming-badge,
.final-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  position: absolute; 
  top: 5px;
  left: 5px;
}

.live-badge {
  background: #2ecc71;
  color: white;
  animation: livePulse 2s ease-in-out infinite;
}

.upcoming-badge {
  background: #f0f0f0;
  color: #888;
}

.final-badge {
  background: #e8e8e8;
  color: #666;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── Status text ─────────────────────── */
.live-status-text {
  font-size: 11px;
  color: #888;
  margin-bottom: 8px;
  margin-top: 20px;
  font-weight: 500;
  min-height: 14px;
}

.live-game-card.live .live-status-text {
  color: #2ecc71;
  font-weight: 600;
}

/* ── Matchup layout ────────────────────── */
.live-matchup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-game-card.final .live-matchup {
  margin-top: 15px;
}

@media (max-width: 800px){
  .live-game-card.final .live-matchup {
      margin-top: 20px;
  }
}

.live-team {
  display: grid;
  grid-template-columns: 24px 42px 1fr auto;
  align-items: center;
  gap: 6px;
}

.live-team-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.live-team-abbr {
  font-weight: 700;
  font-size: 14px;
  color: #333;
}

.live-team-record {
  font-size: 11px;
  color: #aaa;
  font-weight: 400;
}

.live-score {
  font-weight: 700;
  font-size: 16px;
  color: #333;
  text-align: right;
  min-width: 28px;
}

.live-score.winner {
  color: #000;
}

.live-team.winner .live-team-abbr {
  color: #000;
}


/* ═══════════════════════════════════════════
   PBP PANEL STYLES
   ═══════════════════════════════════════════ */

.pbp-panel {
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  margin-top: 16px;
  max-height: 500px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pbp-header {
  padding: 12px 16px;
  border-bottom: 2px solid #eee;
  position: relative;
  flex-shrink: 0;
}

.pbp-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #999;
  padding: 4px 8px;
  border-radius: 4px;
}

.pbp-close:hover {
  background: #f0f0f0;
  color: #333;
}

.pbp-score-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.pbp-team-score {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pbp-team-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.pbp-team-name {
  font-weight: 700;
  font-size: 18px;
}

.pbp-score {
  font-weight: 800;
  font-size: 28px;
  color: #111;
}

.pbp-clock {
  text-align: center;
}

.pbp-status {
  font-size: 13px;
  font-weight: 600;
  color: #888;
}

/* ── PBP Feed ──────────────────────────── */

.pbp-feed {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

.pbp-feed::-webkit-scrollbar {
  width: 6px;
}

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

.pbp-feed::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* ── Period Divider ────────────────────── */

.pbp-period-divider {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 0 6px;
  margin: 4px 16px;
  border-bottom: 1px solid #eee;
}

/* ── Individual Play Row ───────────────── */

.pbp-play {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  border-left: 3px solid transparent;
  transition: background 0.15s ease;
  font-size: 13px;
  line-height: 1.4;
}

.pbp-play:hover {
  background: #fafafa;
}

/* ── Player Headshot ───────────────────── */

.pbp-headshot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid #e0e0e0;
}

/* ── Clock ─────────────────────────────── */

.pbp-play-time {
  font-size: 11px;
  color: #999;
  font-weight: 500;
  min-width: 38px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Play Content ──────────────────────── */

.pbp-play-content {
  flex: 1;
  min-width: 0;
}

.pbp-play-team {
  font-weight: 700;
  font-size: 12px;
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pbp-play-desc {
  color: #444;
  word-wrap: break-word;
}

/* ── Score Badge ───────────────────────── */

.pbp-play-score {
  font-size: 11px;
  font-weight: 700;
  color: #555;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Play Type Colors ──────────────────── */

.pbp-play.play-made {
  background: rgba(46, 204, 113, 0.04);
}

.pbp-play.play-made .pbp-play-score {
  background: rgba(46, 204, 113, 0.12);
  color: #27ae60;
}

.pbp-play.play-miss {
  opacity: 0.7;
}

.pbp-play.play-turnover {
  background: rgba(231, 76, 60, 0.04);
}

.pbp-play.play-steal .pbp-play-desc,
.pbp-play.play-block .pbp-play-desc {
  font-weight: 500;
}

.pbp-play.play-foul {
  opacity: 0.75;
}

.pbp-play.play-sub {
  opacity: 0.5;
  font-size: 12px;
}

.pbp-play.play-sub .pbp-headshot {
  display: none;
}

.pbp-play.play-timeout {
  background: #fafafa;
  font-style: italic;
  opacity: 0.7;
}

.pbp-play.play-timeout .pbp-headshot {
  display: none;
}

.pbp-play.play-period {
  justify-content: center;
  font-weight: 600;
  color: #888;
  font-size: 12px;
  opacity: 0.6;
}

.pbp-play.play-period .pbp-headshot {
  display: none;
}

/* ── Neutral plays (no team) ───────────── */

.pbp-play.neutral {
  border-left-color: transparent;
  opacity: 0.6;
}

.pbp-play.neutral .pbp-headshot {
  display: none;
}

/* ── Loading / Error / Empty ───────────── */

.pbp-loading,
.pbp-error,
.pbp-empty {
  text-align: center;
  padding: 32px;
  color: #888;
  font-size: 14px;
}

.pbp-error {
  color: #d9534f;
}


.card-insight{
  font-size: 10px;
  font-weight: 600;
  position: absolute;
  top: 7px;
  left: 40px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

#calendar-strip {
  min-height: 72px; /* match your cal-day height */
  display: flex;
  align-items: center;
}


/* has-insight: no padding/margin changes — layout stays stable before/after insight loads */

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 800px) {

  .live-games-section {
    margin-top: 0;
    margin-bottom: 0;
  }

  /* has-insight mobile: no layout changes */

  .live-games-container {
    border: none;
    border-radius: 0;
    margin-top: 50px;
  }

  .live-games-header {
    text-align: center;
    margin-bottom: 12px;
    padding: 0;
  }

  .live-games-header h3 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #000;
    margin: 0 0 4px;
  }

  #live-games-list {
    flex-wrap: wrap;
    gap: 25px;
    padding: 8px 0;
  }

  .live-game-card {
    flex: none;
    width: 100px;
    height: 100px;
    min-width: 85px;
    min-height: 80px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-direction: column;
    justify-content: center;
  }

  .live-matchup {
    gap: 15px;
    text-align: center;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
  }

  .live-games-date {
    font-size: 9px;
  }

  .live-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 0px;
    gap: 1px;
  }

  .live-team-logo {
    width: 28px;
    height: 28px;
    margin-bottom: 2px;
  }

  .live-game-card.live .live-score {
    display: block;
    font-size: 12px;
    font-weight: 700;
  }


  .live-team-record{
    margin-bottom: 5px;
  }


  .live-game-card.final .live-team-record {
    margin-bottom: 0px;
  }
  
  .live-game-card.live .live-team-record {
    display: none;
  }


  .live-game-card.clutch .live-team-record {
    display: none;
  }



  .live-game-card.upset .live-team-record {
    display: none;
  }


  .live-team-abbr {
    font-size: 9px;
    font-weight: 600;
  }

  .live-score {
    font-size: 12px;
    text-align: center;
  }

  .live-status-text {
    font-size: 7px;
    margin-bottom: 2px;
    text-align: center;
    line-height: 1.2;
    min-height: 0;
  }

  .live-team-record {
    font-size: 7px;
  }

  .live-badge,
  .upcoming-badge,
  .final-badge,
  .clutch-badge,
  .upset-badge{
    font-size: 7px;
    padding: 1px 4px;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
    position: absolute;
    top: 5px;
    left: 5px;
  }

  .card-insight{
    font-size: 7px;
    font-weight: 700;
    position: absolute;
    top: 5px;
    left: 10px;
  }

  /* ── PBP Panel Mobile ───────────────── */

  .pbp-panel {
    max-height: 400px;
    margin-top: 10px;
  }

  .pbp-score-header {
    gap: 12px;
  }

  .pbp-team-logo {
    width: 24px;
    height: 24px;
  }

  .pbp-team-name {
    font-size: 14px;
  }

  .pbp-score {
    font-size: 22px;
  }

  .pbp-play {
    padding: 5px 10px;
    font-size: 12px;
    gap: 6px;
  }

  .pbp-headshot {
    width: 24px;
    height: 24px;
  }

  .pbp-play-time {
    font-size: 10px;
    min-width: 30px;
  }

  .pbp-play-score {
    font-size: 10px;
    padding: 1px 5px;
  }

}

/* ═══════════════════════════════════════════════════════════════════════════
   CALENDAR STRIP
   ═══════════════════════════════════════════════════════════════════════════ */

.calendar-section {
  width: 100%;
  background: whitesmoke;
  position: sticky;
  top: 70px;
  z-index: 90;
}

.calendar-strip {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 8px;
  border-bottom: 2px solid #e8e8e8;
  gap: 2px;
  max-width: 1200px;
  margin: 0 auto;
}

.calendar-strip::-webkit-scrollbar {
  display: none;
}

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 52px;
  padding: 8px 4px 6px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  gap: 1px;
  position: relative;
  color: #ccc;
}

.cal-day:hover {
  background: #e8e8e8;
}


.cal-day.has-games:hover {
  color: #111;
}

.cal-day.active {
  background: #e8e8e8;
  color: black;
}

.cal-month {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
  color: inherit;
}

.cal-num {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
}

.cal-dow {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1;
  color: inherit;
}

.cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ccc;
  margin-top: 3px;
}

.cal-dot.hidden {
  visibility: hidden;
}

.cal-day.active .cal-dot {
  background: #ccc;
}


.cal-day.future.has-games {
  opacity: 1;
}

/* ── Clutch card state ───────────────────────────────────────── */
.live-game-card.clutch {
  border-color: #e63946;
  box-shadow: 0 0 0 1px rgba(230, 57, 70, 0.4);
  animation: clutch-pulse 1.5s ease-in-out infinite;
}


@keyframes clutch-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(230, 57, 70, 0.4), 0 0 12px rgba(230, 57, 70, 0.15); }
  50%       { box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.7), 0 0 24px rgba(230, 57, 70, 0.35); }
}

/* Replace the green LIVE badge with a red CLUTCH badge */
.live-game-card.clutch .live-badge, .live-game-card.upset .live-badge {
  display: none;
}

.live-game-card.clutch .clutch-badge, .live-game-card.upset .live-badge {
  display: inline-block;
  border-radius: 4px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: #e63946;
  color: #fff;
  animation: clutch-badge-pulse 1.5s ease-in-out infinite;
  border-radius: 4px;
  margin-bottom: 6px;
  padding: 2px 8px;
  position: absolute;
  top: 5px;
  left: 5px;
}

@media (width >=800px){
    .live-game-card.clutch {
      font-size: 10px;
  }
}

@keyframes clutch-badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* Scores glow red in clutch time */
.live-game-card.clutch .live-score {
  color: #e63946;
  transition: color 0.3s ease;
}

.live-game-card.clutch .live-status-text{
  color: #e63946;
}

.live-game-card.clutch .card-insight{
  display: none;
}

/* ── Upset Alert card state ──────────────────────────────────── */
.live-game-card.upset {
  border-color: #9b5de5;
  box-shadow: 0 0 0 1px rgba(155, 93, 229, 0.4);
  animation: upset-pulse 2s ease-in-out infinite;
}

@keyframes upset-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(155, 93, 229, 0.4), 0 0 12px rgba(155, 93, 229, 0.15); }
  50%       { box-shadow: 0 0 0 2px rgba(155, 93, 229, 0.7), 0 0 28px rgba(155, 93, 229, 0.3); }
}

.upset-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: #9b5de5;
  color: #fff;
  animation: upset-badge-pulse 2s ease-in-out infinite;
}

@keyframes upset-badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* Scores tint purple */
.live-game-card.upset .live-score {
  color: #9b5de5;
  transition: color 0.3s ease;
}

/* Hide the regular LIVE badge when upset is showing */
.live-game-card.upset .live-badge {
  display: none;
}


.live-game-card.upset .card-insight{
  display: none;
}


.live-game-card.upset .live-status-text{
  color: #9b5de5;
}