/* ═══════════════════════════════════════════════════════════════════
   Games Ticker — Live scoreboard + upcoming schedule for bracket pages
   ═══════════════════════════════════════════════════════════════════ */

.lg-ticker {
  --lg-surface: var(--pms-surface-elevated, #fff);
  --lg-surface-card: var(--pms-surface, #f8fafc);
  --lg-border: var(--pms-border, #e2e8f0);
  --lg-text: var(--pms-text, #1e293b);
  --lg-text-muted: var(--pms-text-muted, #64748b);
  --lg-accent: var(--pms-primary, #2563eb);
  --lg-live: #ef4444;
  --lg-winning: #22c55e;
  --lg-losing: #ef4444;
  --lg-tied: #f59e0b;
  --lg-glow-winning: rgba(34, 197, 94, 0.25);
  --lg-glow-losing: rgba(239, 68, 68, 0.2);
  --lg-glow-tied: rgba(245, 158, 11, 0.2);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid var(--lg-border);
  background: var(--lg-surface);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: opacity 0.3s, max-height 0.4s ease;
}

/* ── Header bar ────────────────────────────────────────────────── */
.lg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg,
    var(--pms-primary, #1e3a5f) 0%,
    color-mix(in srgb, var(--pms-primary, #1e3a5f) 70%, #000) 100%);
  color: #fff;
  cursor: pointer;
  user-select: none;
  min-height: 44px;
}

.lg-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lg-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lg-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lg-live);
  box-shadow: 0 0 6px var(--lg-live), 0 0 12px rgba(239, 68, 68, 0.4);
  animation: lg-pulse 1.4s ease-in-out infinite;
}

@keyframes lg-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.lg-game-count {
  font-size: 0.75rem;
  opacity: 0.8;
  font-weight: 500;
}

.lg-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.3s;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.lg-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}
.lg-toggle i {
  transition: transform 0.3s ease;
}
.lg-ticker.lg-collapsed .lg-toggle i {
  transform: rotate(180deg);
}

/* ── Collapsible body ──────────────────────────────────────────── */
.lg-body {
  max-height: 600px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              padding 0.3s ease;
  opacity: 1;
  padding: 0.75rem;
}
.lg-ticker.lg-collapsed .lg-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* ── Horizontal scroll container ──────────────────────────────── */
.lg-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--lg-border) transparent;
  padding-bottom: 4px;
}
.lg-scroll::-webkit-scrollbar {
  height: 5px;
}
.lg-scroll::-webkit-scrollbar-thumb {
  background: var(--lg-border);
  border-radius: 4px;
}

/* ── Game card ─────────────────────────────────────────────────── */
.lg-card {
  flex: 0 0 auto;
  width: 210px;
  min-width: 210px;
  scroll-snap-align: start;
  border-radius: 12px;
  border: 1px solid var(--lg-border);
  background: var(--lg-surface-card);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
  position: relative;
}
.lg-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

/* Pick status glow effects */
.lg-card[data-pick-status="winning"] {
  border-color: var(--lg-winning);
  box-shadow: 0 0 0 1px var(--lg-winning), 0 2px 16px var(--lg-glow-winning);
}
.lg-card[data-pick-status="losing"] {
  border-color: var(--lg-losing);
  box-shadow: 0 0 0 1px var(--lg-losing), 0 2px 16px var(--lg-glow-losing);
}
.lg-card[data-pick-status="tied"] {
  border-color: var(--lg-tied);
  box-shadow: 0 0 0 1px var(--lg-tied), 0 2px 16px var(--lg-glow-tied);
}

/* ── Card header ───────────────────────────────────────────────── */
.lg-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  background: var(--lg-surface);
  border-bottom: 1px solid var(--lg-border);
  gap: 0.35rem;
}

.lg-round-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lg-accent);
  background: color-mix(in srgb, var(--lg-accent) 12%, transparent);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.lg-region {
  font-size: 0.65rem;
  color: var(--lg-text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: center;
}

.lg-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lg-live);
  flex-shrink: 0;
}
.lg-live-dot-sm {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lg-live);
  animation: lg-pulse 1.4s ease-in-out infinite;
}

.lg-clock-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--lg-live);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Matchup rows ──────────────────────────────────────────────── */
.lg-matchup {
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lg-team-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem;
  border-radius: 8px;
  transition: background 0.2s;
  min-height: 34px;
}
.lg-team-row.lg-leading {
  background: color-mix(in srgb, var(--lg-accent) 8%, transparent);
}

.lg-team-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 3px;
}

.lg-seed {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--lg-text-muted);
  min-width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.lg-team-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--lg-text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
a.lg-team-name {
  text-decoration: none;
  color: var(--lg-text);
}
a.lg-team-name:hover {
  text-decoration: underline;
}
a.lg-team-name .lg-gear-icon {
  font-size: 0.6rem;
  opacity: 0;
  transition: opacity 0.2s;
  margin-left: 2px;
}
a.lg-team-name:hover .lg-gear-icon {
  opacity: 0.6;
}

.lg-score {
  font-size: 1rem;
  font-weight: 800;
  color: var(--lg-text);
  min-width: 26px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.lg-leading .lg-score {
  color: var(--lg-accent);
}

/* Divider between teams */
.lg-matchup-divider {
  height: 1px;
  background: var(--lg-border);
  margin: 0 0.4rem;
  opacity: 0.5;
}

/* ── Card footer (pick status + find btn) ──────────────────────── */
.lg-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.6rem;
  border-top: 1px solid var(--lg-border);
  background: var(--lg-surface);
  gap: 0.35rem;
  min-height: 30px;
}

.lg-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}
.lg-pick-winning {
  color: var(--lg-winning);
}
.lg-pick-losing {
  color: var(--lg-losing);
}
.lg-pick-tied {
  color: var(--lg-tied);
}

.lg-find-btn {
  background: color-mix(in srgb, var(--lg-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--lg-accent) 25%, transparent);
  border-radius: 6px;
  color: var(--lg-accent);
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.lg-find-btn:hover {
  background: color-mix(in srgb, var(--lg-accent) 20%, transparent);
  transform: scale(1.04);
}
.lg-find-btn:active {
  transform: scale(0.97);
}
.lg-find-btn.active {
  background: var(--lg-accent);
  color: #fff;
  border-color: var(--lg-accent);
}

/* ── View button (for board context) ───── */
.lg-view-btn {
  background: color-mix(in srgb, var(--lg-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--lg-accent) 25%, transparent);
  border-radius: 6px;
  color: var(--lg-accent);
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.lg-view-btn:hover {
  background: color-mix(in srgb, var(--lg-accent) 20%, transparent);
  transform: scale(1.04);
}
.lg-view-btn:active {
  transform: scale(0.97);
}
.lg-view-btn.active {
  background: var(--lg-accent);
  color: #fff;
  border-color: var(--lg-accent);
}

/* ── Bracket highlight classes (applied by JS on Find click) ───── */
.ib-cell.ib-live-highlight {
  outline: 3px solid #ef4444;
  outline-offset: 3px;
  box-shadow:
    0 0 0 6px rgba(239, 68, 68, 0.2),
    0 0 24px rgba(239, 68, 68, 0.45),
    0 0 48px rgba(239, 68, 68, 0.15);
  z-index: 10;
  position: relative;
  animation: lg-highlight-pulse 1.6s ease-in-out infinite;
}
.ib-cell.ib-live-highlight::after {
  content: '\f52a';
  font-family: 'bootstrap-icons';
  position: absolute;
  top: -12px;
  right: -8px;
  font-size: 1rem;
  color: #ef4444;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
  animation: lg-pin-bounce 1s ease-in-out infinite;
  z-index: 11;
}

.ib-cell.ib-downstream-highlight {
  outline: 2px dashed #f59e0b;
  outline-offset: 3px;
  box-shadow:
    0 0 0 4px rgba(245, 158, 11, 0.12),
    0 0 16px rgba(245, 158, 11, 0.25);
  z-index: 9;
  animation: lg-downstream-fade-in 0.6s ease both;
}

@keyframes lg-highlight-pulse {
  0%, 100% {
    outline-color: #ef4444;
    box-shadow:
      0 0 0 6px rgba(239, 68, 68, 0.2),
      0 0 24px rgba(239, 68, 68, 0.45),
      0 0 48px rgba(239, 68, 68, 0.15);
  }
  50% {
    outline-color: #f87171;
    box-shadow:
      0 0 0 8px rgba(239, 68, 68, 0.3),
      0 0 32px rgba(239, 68, 68, 0.55),
      0 0 60px rgba(239, 68, 68, 0.2);
  }
}

@keyframes lg-pin-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes lg-downstream-fade-in {
  0% { opacity: 0; outline-offset: 10px; }
  100% { opacity: 1; outline-offset: 3px; }
}

/* ── Gear CTA — visible affiliate link per card ────────────────── */
a.lg-gear-cta,
a.lg-gear-cta:link,
a.lg-gear-cta:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg,
    var(--pms-primary, #1B4D6E) 0%,
    var(--pms-primary-hover, #153F5A) 100%);
  text-decoration: none;
  transition: filter 0.2s, transform 0.15s;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.lg-gear-cta:hover,
a.lg-gear-cta:focus {
  filter: brightness(1.2);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}
a.lg-gear-cta:active {
  color: #fff;
  transform: translateY(0);
}

/* ── Ad card — blends into the scroll as a sponsored card ──────── */
.lg-ad-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--lg-surface-card);
  border-style: dashed;
}
.lg-ad-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  gap: 0.5rem;
  min-height: 100%;
}
.lg-ad-label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lg-text-muted);
  opacity: 0.7;
}

.lg-ad-card-amazon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  text-decoration: none;
  color: var(--lg-text);
  height: 100%;
  transition: transform 0.2s;
}
.lg-ad-card-amazon:hover {
  text-decoration: none;
  color: var(--lg-text);
  transform: scale(1.02);
}
.lg-ad-amazon-icon {
  font-size: 1.6rem;
  color: #f59e0b;
}
.lg-ad-amazon-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
}
.lg-ad-amazon-sub {
  font-size: 0.65rem;
  color: var(--lg-text-muted);
  text-align: center;
  line-height: 1.3;
}
.lg-ad-amazon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  transition: filter 0.2s;
}
.lg-ad-card-amazon:hover .lg-ad-amazon-btn {
  filter: brightness(1.1);
}

/* ── Affiliate disclosure ──────────────────────────────────────── */
.lg-affiliate-disclosure {
  font-size: 0.58rem;
  color: var(--lg-text-muted);
  text-align: center;
  padding: 0.35rem 0.5rem 0;
  opacity: 0.7;
  line-height: 1.3;
}

/* ── Empty / no-pick state ─────────────────────────────────────── */
.lg-no-pick {
  font-size: 0.65rem;
  color: var(--lg-text-muted);
  font-style: italic;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .lg-ticker {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-left: -1px;
    margin-right: -1px;
  }
  .lg-body {
    padding: 0.5rem;
  }
  .lg-card {
    width: 190px;
    min-width: 190px;
  }
  .lg-header {
    padding: 0.5rem 0.75rem;
  }
}
@media (min-width: 576px) and (max-width: 767.98px) {
  .lg-card {
    width: 200px;
    min-width: 200px;
  }
}

/* ── Upcoming-only mode — darker teal header when no live games ── */
.lg-header-upcoming {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--pms-primary, #1B4D6E) 85%, #2dd4bf) 0%,
    var(--pms-primary, #1B4D6E) 100%);
}

.lg-upcoming-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lg-upcoming-indicator i {
  font-size: 0.9rem;
  opacity: 0.85;
}

/* ── Inline section divider (between live & upcoming in single scroll row) ── */
.lg-section-divider-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0.25rem 0.4rem;
  align-self: stretch;
  border-left: 2px solid var(--lg-border);
  margin: 0 0.15rem;
}
.lg-section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lg-text-muted);
  white-space: nowrap;
}
.lg-section-label i {
  font-size: 0.75rem;
}

/* ── Upcoming game card — no scores, show scheduled time ──────── */
.lg-card-upcoming {
  border-style: solid;
  border-color: color-mix(in srgb, var(--lg-border) 70%, transparent);
  opacity: 0.92;
}
.lg-card-upcoming:hover {
  opacity: 1;
}

.lg-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--lg-accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.lg-time-badge i {
  font-size: 0.65rem;
  opacity: 0.8;
}

.lg-vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.4rem;
}
.lg-vs-divider span {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--lg-text-muted);
  opacity: 0.6;
}

.lg-gear-cta-upcoming {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--pms-primary, #1B4D6E) 80%, #2dd4bf) 0%,
    var(--pms-primary, #1B4D6E) 100%);
}

/* ── Dark theme adjustments ────────────────────────────────────── */
[data-theme="dark"] .lg-ticker {
  --lg-surface: var(--dark-surface, #161b22);
  --lg-surface-card: var(--dark-card, #1c2128);
  --lg-border: var(--dark-border, #30363d);
  --lg-text: var(--dark-text, #e6edf3);
  --lg-text-muted: var(--dark-text-muted, #8b949e);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .lg-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
[data-theme="dark"] .lg-header {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
}
[data-theme="dark"] .lg-leading {
  background: rgba(56, 139, 253, 0.1);
}
[data-theme="dark"] .lg-header-upcoming {
  background: linear-gradient(135deg, #1c2128 0%, #0d1117 100%);
}
[data-theme="dark"] .lg-card-upcoming {
  border-color: var(--dark-border, #30363d);
}

/* ── Loading skeleton (shown while ticker HTMX loads) ── */
.lg-ticker-loading {
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid var(--pms-border, #e2e8f0);
  background: var(--pms-surface-elevated, #fff);
  height: 44px;
}
.lg-ticker-loading-bar {
  height: 100%;
  background: linear-gradient(90deg,
    var(--pms-surface-elevated, #f1f5f9) 25%,
    var(--pms-border, #e2e8f0) 50%,
    var(--pms-surface-elevated, #f1f5f9) 75%);
  background-size: 200% 100%;
  animation: lgLoadingShimmer 1.5s ease-in-out infinite;
}
@keyframes lgLoadingShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
