/*
 * Legacy overlay — light touch only.
 * Goal: unify FONTS and ROOT BG. Leave Tosha's component colors mostly alone
 * because his dark theme already looks great. Only fix the daisyUI primary
 * (magenta) leak.
 */

/* ===== Unified font stack across all pages ===== */
html, body, button, input, textarea, select {
  font-family: 'Geist', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
}

/* daisyUI .btn / .btn-sm font-metrics conflict with Geist — re-center text */
.btn, .btn-sm, .btn-xs, .btn-md, .btn-lg {
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.btn-sm { min-height: 32px !important; height: auto !important; padding: 6px 14px !important; }
.btn-xs { min-height: 28px !important; height: auto !important; padding: 4px 10px !important; }
.btn-md, .btn:not(.btn-sm):not(.btn-xs):not(.btn-lg) { min-height: 40px !important; height: auto !important; padding: 8px 18px !important; }
.btn-lg { min-height: 48px !important; height: auto !important; padding: 12px 22px !important; }

.mono, .font-mono, code, kbd, samp,
[class*="text-mono"], [class*="font-mono"],
.tabular {
  font-family: 'JetBrains Mono', 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace !important;
}

h1, h2, h3, h4 {
  font-family: 'Geist', 'Inter', system-ui, sans-serif !important;
  letter-spacing: -0.02em !important;
}

/* ===== Body bg match home (#0a0a0a) + pitch pattern ===== */
html[data-theme="dark"] body,
html:not([data-theme="light"]) body {
  background: #0a0a0a !important;
  position: relative;
}

html[data-theme="dark"] body::before,
html:not([data-theme="light"]) body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px;
  background-position: 0 0, 0 0;
}

html[data-theme="dark"] body::after,
html:not([data-theme="light"]) body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at top, rgba(220, 38, 38, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at bottom, rgba(220, 38, 38, 0.10) 0%, transparent 70%);
}

/* Tosha's body has positioned nav/main — only need z-index above pseudo,
   NOT position:relative (that breaks position:sticky on header + ticker). */
html[data-theme="dark"] body > *,
html:not([data-theme="light"]) body > * {
  z-index: 1;
}

/* Force ticker + header sticky behaviour against Tailwind / daisyUI overrides */
.site-header { position: sticky !important; top: 0 !important; z-index: 50 !important; }
.ticker-bar { position: sticky !important; top: 72px !important; z-index: 40 !important; }

/* The `body > * { z-index: 1 }` rule above also clobbers the slide-over menu
   (drawer + backdrop are direct children of body), sending the menu BEHIND the
   page content when the burger is tapped. Re-assert the overlay stacking. */
.drawer { z-index: 100 !important; }
.drawer-backdrop { z-index: 90 !important; }
@media (max-width: 768px) {
  .ticker-bar { top: 64px !important; }
}

/* ===== Fix daisyUI primary leaking magenta — repaint specific utility classes
   directly to our brand red. Do NOT touch --p / --pc internal vars (they break
   contrast on Tosha's red blocks). ===== */

/* daisyUI tabs (Summary / Lineups / Stats / Players) — they default to magenta */
.tab-active, .tabs-bordered .tab-active {
  color: #dc2626 !important;
  border-color: #dc2626 !important;
}

/* daisyUI link / hover primary */
.link-primary { color: #dc2626 !important; }
.link-primary:hover { color: #b91c1c !important; }

/* Arrows / chevrons that Tosha uses `text-primary` for — repaint */
[class*="text-primary"]:not([class*="content"]) {
  color: #dc2626 !important;
}

/* daisyUI primary buttons */
.btn-primary {
  background-color: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}
.btn-primary:hover {
  background-color: #b91c1c !important;
  border-color: #b91c1c !important;
}

/* Badge primary */
.badge-primary {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}

/* daisyUI btn-secondary (magenta) → our emerald success */
.btn-secondary {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
  color: #042f1a !important;
}
.btn-secondary:hover { background-color: #059669 !important; border-color: #059669 !important; }

/* Tosha's accent-violet / pink Team Stats / Player Stats buttons → our red */
.bg-pink-500, .bg-pink-600, .bg-violet-500, .bg-violet-600,
.bg-fuchsia-500, .bg-fuchsia-600, .bg-purple-500, .bg-purple-600 {
  background-color: #dc2626 !important;
}
.text-pink-400, .text-pink-500, .text-violet-400, .text-violet-500,
.text-fuchsia-400, .text-fuchsia-500, .text-purple-400, .text-purple-500 {
  color: #dc2626 !important;
}
.border-pink-500, .border-violet-500, .border-fuchsia-500, .border-purple-500 {
  border-color: #dc2626 !important;
}
/* Hover variants */
.hover\:bg-pink-600:hover, .hover\:bg-violet-600:hover,
.hover\:bg-fuchsia-600:hover, .hover\:bg-purple-600:hover {
  background-color: #b91c1c !important;
}

/* Hide Tosha's "Back" button on detail pages — we have header nav */
main > .btn.btn-ghost.btn-sm[onclick*="history.back"] { display: none !important; }

/* Hide any stray Tosha navbar inside main if it leaks */
main > nav.navbar { display: none !important; }

/* ===== Wider container on data pages — Tosha used max-w-7xl (1280px),
   we want closer to full width like FlashScore. ===== */
main.container,
main.container.mx-auto {
  max-width: 1440px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Tailwind .container (loaded via CDN) overrides our .container in footer →
   force margin auto on every direct .container so footer + nested wrappers
   stay centered on wide screens. */
.site-footer > .container,
.site-header > .container,
.cookie-banner .container {
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 1440px !important;
  width: 100% !important;
}

/* On large screens, push to nearly full viewport for heatmap / pitches */
@media (min-width: 1280px) {
  main.container,
  main.container.mx-auto {
    max-width: min(1600px, 95vw) !important;
  }
}

/* Match loading screen — center properly + restyle to our brand */
main > .flex.flex-col.items-center.justify-center {
  min-height: 50vh;
  margin-inline: auto;
}

/* Tosha's "Back" button — restyle to match our buttons */
main > .btn.btn-ghost.btn-sm:not([onclick*="history.back"]),
.btn.btn-ghost.btn-sm.gap-1 {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default) !important;
  color: var(--text-secondary) !important;
  border-radius: var(--radius-md) !important;
  padding: 8px 14px !important;
  transition: all 150ms ease !important;
}
main > .btn.btn-ghost.btn-sm:hover,
.btn.btn-ghost.btn-sm.gap-1:hover {
  border-color: var(--brand-primary) !important;
  color: var(--brand-primary) !important;
}

/* ===== Fractional → decimal odds conversion on Tosha's preview page =====
   The text content is rewritten in JS but we ensure visual styling matches */
.odds-decimal {
  font-variant-numeric: tabular-nums;
}

/* ===== League sub-nav (injected by league_inject.js) ===== */
.fc-league-subnav {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 110px; /* under header (72) + ticker (38) */
  z-index: 20;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  border-radius: 0;
}
.fc-league-subnav::-webkit-scrollbar { display: none; }

.fc-subnav-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  border-radius: 9999px !important;
  font-size: 13px;
  font-weight: 600;
  color: #a3a3a3 !important;
  white-space: nowrap;
  text-decoration: none !important;
  transition: all 150ms;
  flex-shrink: 0;
}
.fc-subnav-chip:hover {
  color: #fafafa !important;
  border-color: rgba(220, 38, 38, 0.40) !important;
  background: rgba(220, 38, 38, 0.08) !important;
}
.fc-subnav-chip.is-active {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: white !important;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.30);
}
.fc-subnav-chip.is-anchor {
  background: rgba(251, 191, 36, 0.06) !important;
  border-color: rgba(251, 191, 36, 0.25) !important;
  color: #fcd34d !important;
}
.fc-subnav-chip.is-anchor:hover {
  background: rgba(251, 191, 36, 0.14) !important;
  border-color: rgba(251, 191, 36, 0.50) !important;
}

/* Heatmap and pitch SVGs — make them stretch to card width */
.card svg[viewBox*="0 0 100"],
.card canvas {
  width: 100% !important;
  height: auto !important;
}

/* Specific heatmap card — force full available width */
.card:has(.heatmap-container),
.card:has(canvas[id*="heatmap"]),
.heatmap-container {
  width: 100% !important;
  max-width: none !important;
}
