/**
 * Golf Post Live Scoring CSS
 * World-class redesign for tournament leaderboards, teetimes, scorecards
 * Compatible with existing Twig 1.x templates + Bootstrap 4
 *
 * Targets actual HTML classes:
 *   - #tournament-overview (.area-info-container)
 *   - .ls-header (new gradient header)
 *   - .table-leaderboard (leaderboard table)
 *   - .table-teetimes (teetimes table)
 *   - .hole-score.hole-score-to-par-{N} (scorecard cells)
 *   - .table-secondary (DACH player rows)
 *   - .ls-pos--gold/silver/bronze (position medals)
 *   - .ls-topar--under/over (to-par coloring)
 *   - .ls-row--dach (DACH highlight)
 *   - .ls-row--cut (cut line)
 *   - .ls-live-badge (LIVE indicator)
 */

/* =========================================================
   1. TOURNAMENT HEADER — Dark Gradient
   ========================================================= */

.ls-header {
  background: linear-gradient(135deg, #0f1f18 0%, #1a3a2a 60%, #04AD79 100%);
  padding: 20px 20px 16px;
  position: relative;
  color: #fff;
  overflow: hidden;
}

.ls-header::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(4, 173, 121, 0.25), transparent 70%);
  pointer-events: none;
}

.ls-header__tour {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.ls-header__name {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}

.ls-header__link {
  color: #fff;
  text-decoration: none;
}

.ls-header__link:hover {
  color: #fff;
  text-decoration: underline;
}

.ls-header__venue {
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 8px;
}

.ls-header__meta {
  font-size: 12px;
  opacity: 0.65;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: center;
}

.ls-header__sep {
  margin: 0 6px;
}

/* =========================================================
   2. TOURNAMENT OVERVIEW CARD (existing #tournament-overview)
   ========================================================= */

.ls-tournament-card {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

#tournament-overview {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* =========================================================
   3. LIVE BADGE — Pulsing red dot
   ========================================================= */

.ls-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: absolute;
  top: 16px;
  right: 16px;
}

.ls-live-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #fff;
  border-radius: 50%;
  animation: ls-pulse 1.5s infinite;
  flex-shrink: 0;
}

@keyframes ls-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Legacy live-badge class (embeds) */
.live-badge {
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.live-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: ls-pulse 1.5s infinite;
  flex-shrink: 0;
}

/* Round indicator pill */
.list-tournament-round-indicator {
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =========================================================
   4. TABLE WRAPPER — Card container with rounded corners
   ========================================================= */

.ls-table-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
}

/* Also style any .table-responsive on tournament pages */
.table-responsive {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

/* =========================================================
   5. LEADERBOARD TABLE
   ========================================================= */

.table-leaderboard {
  font-size: 13px;
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 0;
}

/* Table header row */
.table-leaderboard thead tr.bg-white th,
.table-leaderboard thead th {
  background: #f8fafc !important;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  border-top: none;
  padding: 8px 6px;
  white-space: nowrap;
}

/* Body rows */
.table-leaderboard tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}

.table-leaderboard tbody tr:hover {
  background: #f0fdf4 !important;
}

/* Body cells */
.table-leaderboard td {
  padding: 7px 6px;
  vertical-align: middle;
  font-size: 12px;
  color: #334155;
  border-top: none;
}

/* --- Position column --- */
.table-leaderboard .ls-pos {
  font-weight: 800;
  font-size: 13px;
  min-width: 32px;
  text-align: center;
  color: #334155;
}

/* Position medal colors */
.table-leaderboard .ls-pos.ls-pos--gold {
  color: #d4a00a;
  font-size: 14px;
}

.table-leaderboard .ls-pos.ls-pos--silver {
  color: #7c8594;
  font-size: 14px;
}

.table-leaderboard .ls-pos.ls-pos--bronze {
  color: #b45309;
  font-size: 14px;
}

/* --- DACH player highlighting (green left border) --- */
.table-leaderboard tbody tr.table-secondary,
.table-leaderboard tbody tr.ls-row--dach {
  background: rgba(4, 173, 121, 0.04) !important;
  border-left: 3px solid #04AD79;
}

.table-leaderboard tbody tr.table-secondary:hover,
.table-leaderboard tbody tr.ls-row--dach:hover {
  background: rgba(4, 173, 121, 0.08) !important;
}

/* Striped override for DACH rows */
.table-leaderboard.table-striped tbody tr.table-secondary:nth-of-type(odd),
.table-leaderboard.table-striped tbody tr.ls-row--dach:nth-of-type(odd) {
  background: rgba(4, 173, 121, 0.06) !important;
}

/* --- To-Par coloring --- */
.ls-topar--under {
  color: #dc2626 !important;
  font-weight: 700;
}

.ls-topar--over {
  color: #2563eb !important;
  font-weight: 700;
}

/* Also style text-danger on leaderboard (existing class used for position) */
.table-leaderboard td.text-danger {
  color: #dc2626;
}

/* --- CUT / Muted rows --- */
.table-leaderboard tbody tr.text-muted td,
.table-leaderboard tbody tr.ls-row--cut td {
  color: #94a3b8 !important;
}

.table-leaderboard tbody tr.ls-row--cut {
  border-top: 2px dashed #cbd5e1;
  position: relative;
}

/* Only show cut line border on the FIRST cut row */
.table-leaderboard tbody tr.ls-row--cut + tr.ls-row--cut {
  border-top: 1px solid #f1f5f9;
}

/* --- Player name column --- */
.table-leaderboard .column-player-name {
  min-width: 9rem;
  text-align: left;
}

.table-leaderboard .column-player-name a,
.table-leaderboard td.text-left a {
  color: #1a2e1e;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}

.table-leaderboard .column-player-name a:hover,
.table-leaderboard td.text-left a:hover {
  color: #04AD79;
  text-decoration: underline;
}

/* --- Striped rows override --- */
.table-leaderboard.table-striped tbody tr:nth-of-type(odd) {
  background: rgba(248, 250, 252, 0.6);
}

/* =========================================================
   6. SCORECARD SCORE INDICATORS
   .hole-score.hole-score-to-par-{N} with ::before and <span>
   ========================================================= */

/* Base hole-score: flex container for the indicator */
.hole-score {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 1.8rem;
  min-height: 1.8rem;
}

.hole-score span {
  font-weight: 700;
  z-index: 2;
  position: relative;
  font-size: 12px;
}

/* ::before pseudo-element is the colored shape behind the number */
.hole-score::before {
  content: '';
  position: absolute;
  top: calc(50% - 0.9rem);
  left: calc(50% - 0.9rem);
  border: 2px solid transparent;
  width: 1.8rem;
  height: 1.8rem;
  z-index: 1;
}

/* Eagle or better (-2): GOLD circle */
.hole-score-to-par--2 {
  color: #fff !important;
}

.hole-score-to-par--2::before {
  border-radius: 50% !important;
  background: #d4a00a !important;
  border-color: #d4a00a !important;
}

/* Birdie (-1): RED circle */
.hole-score-to-par--1 {
  color: #fff !important;
}

.hole-score-to-par--1::before {
  border-radius: 50% !important;
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}

/* Par (0): no decoration — gray text */
.hole-score-to-par-0 span {
  color: #94a3b8;
  font-weight: 500;
}

/* Bogey (+1): BLUE square outline */
.hole-score-to-par-1 {
  color: #fff !important;
}

.hole-score-to-par-1::before {
  background: #2563eb !important;
  border-color: #2563eb !important;
  border-radius: 3px !important;
}

/* Double bogey+ (+2): DARK filled square */
.hole-score-to-par-2 {
  color: #fff !important;
}

.hole-score-to-par-2::before {
  background: #1e293b !important;
  border-color: #1e293b !important;
  border-radius: 3px !important;
}

/* Scorecard legend (slightly smaller) */
.scorecard-legend {
  transform: scale(0.85);
  opacity: 0.9;
  padding: 4px 0;
}

.scorecard-legend .hole-score {
  margin-right: 0.5rem;
}

.scorecard-legend .hole-score::before {
  top: calc(50% - 0.7rem);
  left: calc(50% - 0.7rem);
  width: 1.4rem;
  height: 1.4rem;
}

/* =========================================================
   7. SCORECARD TABLE (table.table-sm.text-center)
   ========================================================= */

/* Scorecard overview block */
.ls-scorecard-overview {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Focus player summary row */
.focus-player-row {
  font-size: 12px;
}

.focus-player-row td {
  padding: 8px 6px;
  vertical-align: middle;
}

.focus-player-row td small.text-muted {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* thead-green: Green header for scorecard rounds */
.table .thead-green tr,
.table .thead-green tr:hover {
  color: #fff !important;
  background: #04AD79 !important;
  border-color: #04AD79 !important;
}

.table .thead-green th {
  font-size: 11px;
  font-weight: 700;
  padding: 6px 4px;
  text-align: center;
  border: none !important;
  letter-spacing: 0.3px;
  color: #fff !important;
}

/* Scorecard table cells */
.table.table-sm.text-center td {
  padding: 5px 4px;
  text-align: center;
  vertical-align: middle;
  font-size: 12px;
}

/* Par row: bg-light text-muted */
.table.table-sm.text-center tr.bg-light td {
  font-weight: 600;
  background: #f8fafc !important;
  color: #64748b;
  font-size: 11px;
}

/* Score row (after par) */
.table.table-sm.text-center tbody tr:not(.bg-light) td {
  font-weight: 600;
  color: #1a2e1e;
}

/* Out/In/Total subtotal cells */
.table.table-sm.text-center td.text-muted {
  font-weight: 700;
  color: #64748b;
}

.table.table-sm.text-center td.font-weight-bold {
  font-weight: 800;
  color: #1e293b;
}

/* Scorecard round titles */
.bg-white .hl-4 {
  font-size: 14px;
  font-weight: 700;
  color: #1a2e1e;
}

/* =========================================================
   8. TEETIMES TABLE
   ========================================================= */

.table-teetimes {
  font-size: 13px;
  width: 100%;
  margin-bottom: 0;
}

.table-teetimes thead tr th,
.table-teetimes thead th {
  background: #f8fafc !important;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  border-top: none !important;
  padding: 8px 8px;
  white-space: nowrap;
}

.table-teetimes tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}

.table-teetimes tbody tr:hover {
  background: #f8fafc !important;
}

/* DACH players in teetimes */
.table-teetimes tbody tr.table-secondary {
  background: rgba(4, 173, 121, 0.04) !important;
  border-left: 3px solid #04AD79;
}

.table-teetimes tbody tr.table-secondary:hover {
  background: rgba(4, 173, 121, 0.08) !important;
}

.table-teetimes td {
  padding: 8px 8px;
  vertical-align: middle;
  color: #334155;
  border-top: none;
}

/* Tee time column (bold time) */
.table-teetimes td.text-nowrap {
  font-size: 14px;
  font-weight: 800;
  color: #1a2e1e;
  min-width: 60px;
}

/* Player names */
.table-teetimes .flex-fill a,
.table-teetimes a.ln_player_scorecard {
  color: #1a2e1e;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}

.table-teetimes .flex-fill a:hover,
.table-teetimes a.ln_player_scorecard:hover {
  color: #04AD79;
}

.table-teetimes .font-weight-bold {
  font-weight: 700;
}

/* Striped teetimes */
.table-teetimes.table-striped tbody tr:nth-of-type(odd) {
  background: rgba(248, 250, 252, 0.6);
}

.table-teetimes.table-striped tbody tr.table-secondary:nth-of-type(odd) {
  background: rgba(4, 173, 121, 0.06) !important;
}

/* =========================================================
   9. TOURNAMENT SERIES INDICATOR BAR
   ========================================================= */

.tournament-series-bg {
  display: block;
  overflow: hidden;
}

.tournament-series-bg-pga  { background: #002D62; }
.tournament-series-bg-eu   { background: #1E3A2A; }
.tournament-series-bg-let  { background: #7B2D8B; }
.tournament-series-bg-lpga { background: #C41A6A; }
.tournament-series-bg-liv  { background: #0d0d0d; }
.tournament-series-bg-asian { background: #B22222; }
.tournament-series-bg-web  { background: #004B28; }
.tournament-series-bg-cht  { background: #005C2A; }

.tournament-card-indicator {
  padding: 6px 12px;
  display: flex;
  align-items: center;
}

/* =========================================================
   10. CARD CONTAINERS (feed-card)
   ========================================================= */

.card.feed-card {
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  margin-bottom: 12px;
}

/* Section titles within tournament pages */
.section-title h1,
.section-title h2,
.section-title h3 {
  font-size: 16px;
  font-weight: 800;
  color: #0f1f18;
  margin-bottom: 8px;
}

/* =========================================================
   11. FLAG ICONS
   ========================================================= */

.flag {
  display: inline-block;
  vertical-align: middle;
  border-radius: 2px;
}

/* =========================================================
   12. FOURSOME RESULT TABLE
   ========================================================= */

.bg-white.p-2.mb-15 {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table-foursome-result {
  font-size: 13px;
}

.table-foursome-result thead th {
  background: #f8fafc;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  padding: 6px 8px;
}

.table-foursome-result td {
  padding: 7px 8px;
  vertical-align: middle;
}

/* =========================================================
   13. ROUND LINK LIST (teetimes page round selector)
   ========================================================= */

.teetimes-round-link-list {
  margin-bottom: 12px;
}

.teetimes-round-link-list .list-inline-item {
  margin-bottom: 4px;
}

.teetimes-round-link-list .list-inline-item a,
.teetimes-round-link-list .list-inline-item.active a {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #64748b;
  text-decoration: none;
  transition: all 0.15s;
}

.teetimes-round-link-list .list-inline-item a:hover {
  background: #f0fdf4;
  border-color: #04AD79;
  color: #04AD79;
}

.teetimes-round-link-list .list-inline-item.active a {
  background: #04AD79;
  color: #fff;
  border-color: #04AD79;
}

/* =========================================================
   14. EVENT GRID (tournament profile stats)
   ========================================================= */

.event-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.event-item {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #475569;
  gap: 4px;
  flex-shrink: 0;
}

.event-item i {
  color: #04AD79;
  font-size: 14px;
}

.event-item a {
  color: #04AD79;
  text-decoration: none;
}

.event-item a:hover {
  text-decoration: underline;
}

/* =========================================================
   15. HELPFUL LINKS / SHORTCODES
   ========================================================= */

.gp-shortcode {
  padding: 8px 0;
}

/* =========================================================
   16. LOADING / EMPTY STATES
   ========================================================= */

.content-items-list:empty {
  min-height: 60px;
}

/* =========================================================
   17. RESPONSIVE — MOBILE
   ========================================================= */

@media (max-width: 767px) {
  .ls-header {
    padding: 16px;
  }

  .ls-header__name {
    font-size: 18px;
  }

  .ls-header__venue {
    font-size: 12px;
  }

  .ls-header__meta {
    font-size: 11px;
  }

  .ls-live-badge {
    top: 12px;
    right: 12px;
    font-size: 9px;
    padding: 3px 8px;
  }

  .table-leaderboard td,
  .table-leaderboard th,
  .table-teetimes td,
  .table-teetimes th {
    padding: 6px 4px;
    font-size: 11px;
  }

  .table-leaderboard .column-player-name {
    min-width: 7rem;
  }

  .table-leaderboard .column-player-name a,
  .table-leaderboard td.text-left a {
    font-size: 12px;
  }

  .table-teetimes td.text-nowrap {
    font-size: 12px;
  }

  .ls-table-wrap,
  .table-responsive {
    border-radius: 8px;
  }

  .card.feed-card {
    border-radius: 10px;
  }

  .ls-tournament-card,
  #tournament-overview {
    border-radius: 8px;
  }

  /* Scorecard tables on mobile */
  .table.table-sm.text-center td {
    padding: 3px 2px;
    font-size: 11px;
  }

  .table .thead-green th {
    font-size: 10px;
    padding: 5px 3px;
  }

  .hole-score {
    min-width: 1.5rem;
    min-height: 1.5rem;
  }

  .hole-score span {
    font-size: 11px;
  }

  .event-grid {
    gap: 6px;
  }

  .event-item {
    font-size: 12px;
  }

  .section-title h1,
  .section-title h2,
  .section-title h3 {
    font-size: 15px;
  }
}

@media (max-width: 576px) {
  .table-leaderboard td,
  .table-teetimes td {
    padding: 5px 3px;
    font-size: 11px;
  }

  .table-teetimes .d-flex {
    flex-wrap: wrap;
  }

  .ls-header__name {
    font-size: 16px;
  }
}

/* =========================================================
   18. PRINT STYLES
   ========================================================= */

@media print {
  .ls-live-badge,
  .ls-live-badge::before,
  .live-badge,
  .live-badge::before {
    animation: none;
    background: #666;
  }

  .ls-header {
    background: #333;
    -webkit-print-color-adjust: exact;
  }

  .table-leaderboard,
  .table-teetimes {
    font-size: 10px;
  }
}
