
/* 
  =============================================================
  TDV ECOSYSTEM DESIGN TOKENS (Linear / Vercel / Stripe Grade)
  =============================================================
*/
:root {
  /* LIGHT MODE SURFACES (Alabaster & Pure White) */
  --surface-bg: #F8FAFC;
  --surface-card: #FFFFFF;
  --surface-elevated: #F1F5F9;
  
  /* BORDERS */
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-hover: rgba(0, 0, 0, 0.12);
  
  /* SHADOWS (Surface elevation, not heavy black boxes) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.02);

  /* SPRING PHYSICS & ANIMATIONS */
  --transition-spring: 150ms cubic-bezier(0.22, 1, 0.36, 1);
  --transition-spring-slow: 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

html.dark {
  /* DARK MODE SURFACES (Deep Charcoal / Slate) */
  --surface-bg: #090A0F;
  --surface-card: #0F1117;
  --surface-elevated: #161922;
  
  /* BORDERS */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  
  /* SHADOWS (Dark mode uses almost no shadow, relies on border & elevation) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Base resets for optical perfection */
body {
  background-color: var(--surface-bg);
  transition: background-color var(--transition-spring), color var(--transition-spring);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography refinements */
.tabular-nums { font-variant-numeric: tabular-nums; }
.tracking-tight { letter-spacing: -0.02em; }
.max-w-65ch { max-width: 65ch; }

/* Concentric Border Radius Utility Math */
.radius-card { border-radius: 20px; padding: 12px; }
.radius-inner { border-radius: 8px; /* 20 - 12 = 8 */ }

/* Micro-interactions: Buttons */
.btn-spring {
  transition: all var(--transition-spring);
}
.btn-spring:active {
  transform: scale(0.98);
}

/* Micro-interactions: Cards */
.card-spring {
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-spring);
}
.card-spring:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Skeleton Loading (No Layout Shifts) */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton-pulse {
  background: linear-gradient(90deg, var(--surface-elevated) 25%, var(--border-subtle) 50%, var(--surface-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: inherit;
}

/* Ensure minimum touch targets for mobile */
@media (max-width: 768px) {
  button, a.tap-target, .tap-target {
    min-height: 44px;
    min-width: 44px;
  }
}

/* TDV Community Labs - Sports Minifootball Tournament
   Official Dual-Theme Design System (zinc-950 / zinc-50) & WCAG AA Contrast Standards */

:root {
  color-scheme: light dark;
  --color-zinc-950: #09090b;
  --color-zinc-900: #18181b;
  --color-zinc-800: #27272a;
  --color-zinc-200: #e4e4e7;
  --color-zinc-50: #fafafa;
  --bg-main: #fafafa;
  --bg-card: #ffffff;
  --border: #e4e4e7;
  --text-primary: #09090b;
  --text-secondary: #71717a;
  --accent-purple: #7e22ce;
  --accent-purple-light: #9333ea;
  --accent-purple-dark: #581c87;
  --accent-purple-glow: rgba(126, 34, 206, 0.15);
  --accent-emerald: #059669;
  --accent-emerald-light: #10b981;
}

html.dark {
  --color-zinc-950: #09090b;
  --color-zinc-900: #18181b;
  --color-zinc-800: #27272a;
  --color-zinc-200: #e4e4e7;
  --color-zinc-50: #fafafa;
  --bg-main: #09090b;
  --bg-card: #18181b;
  --border: #27272a;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --accent-purple: #a855f7;
  --accent-purple-light: #c084fc;
  --accent-purple-dark: #3b0764;
  --accent-purple-glow: rgba(168, 85, 247, 0.3);
  --accent-emerald: #10b981;
  --accent-emerald-light: #34d399;
}

html {
  max-width: 100vw;
  overflow-x: clip;
}

/* Base Body Styles */
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  max-width: 100vw;
  overflow-x: clip;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, transform;
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .animate-fadeIn {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Bento Glass Card */
.glass-card {
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(228, 228, 231, 0.9);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

.dark .glass-card {
  background-color: rgba(24, 24, 27, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
}

/* Scrollbars */
.no-scrollbar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
}
.no-scrollbar {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #d4d4d8;
  border-radius: 9999px;
}
.dark ::-webkit-scrollbar-thumb {
  background: #3f3f46;
}
::-webkit-scrollbar-thumb:hover {
  background: #a1a1aa;
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: #52525b;
}

/* Sofascore Rating Badge Colors (Official Tiering) */
.rating-sofascore-legendary,
.rating-sofascore-9plus,
.bg-\[\#1e3a8a\] {
  background-color: #1d4ed8 !important; /* 9+ Deep Blue */
  color: #ffffff !important;
}

.rating-sofascore-excellent,
.rating-sofascore-8plus,
.bg-\[\#2563eb\] {
  background-color: #0284c7 !important; /* 8+ Sky Blue */
  color: #ffffff !important;
}

.rating-sofascore-good,
.rating-sofascore-7plus,
.bg-\[\#15803d\] {
  background-color: #15803d !important; /* 7+ Deep Emerald */
  color: #ffffff !important;
}

.rating-sofascore-65plus,
.bg-\[\#eab308\] {
  background-color: #ca8a04 !important; /* 6.5+ Amber/Yellow */
  color: #ffffff !important;
}

.rating-sofascore-average,
.rating-sofascore-6plus,
.bg-\[\#f97316\] {
  background-color: #ea580c !important; /* 6+ Orange */
  color: #ffffff !important;
}

.rating-sofascore-bad,
.rating-sofascore-below6,
.bg-\[\#dc2626\] {
  background-color: #dc2626 !important; /* 6- Red */
  color: #ffffff !important;
}

/* Card Hover Elevation */
.sport-card-hover {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}
.sport-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}
.dark .sport-card-hover:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

/* Standings Table Theme & WCAG AA Contrast */
table.standings-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

html:not(.dark) table.standings-table tbody tr.srow-first {
  background-color: #f0fdf4 !important;
  color: #09090b !important;
  border-left: 3px solid #10b981;
}
html:not(.dark) table.standings-table tr.srow-second {
  background-color: #f4f4f5 !important;
  color: #09090b !important;
  border-left: 3px solid #3b82f6;
}
html:not(.dark) table.standings-table tr.srow-other {
  background-color: #ffffff !important;
  color: #09090b !important;
}
html:not(.dark) table.standings-table tr.srow-first:hover {
  background-color: #dcfce7 !important;
}
html:not(.dark) table.standings-table tr.srow-second:hover {
  background-color: #e4e4e7 !important;
}
html:not(.dark) table.standings-table tr.srow-other:hover {
  background-color: #f4f4f5 !important;
}

html.dark table.standings-table tbody tr.srow-first {
  background-color: rgba(6, 78, 59, 0.22) !important;
  color: #fafafa !important;
  border-left: 3px solid #10b981;
}
html.dark table.standings-table tr.srow-second {
  background-color: rgba(30, 58, 138, 0.2) !important;
  color: #fafafa !important;
  border-left: 3px solid #3b82f6;
}
html.dark table.standings-table tr.srow-other {
  background-color: #18181b !important;
  color: #fafafa !important;
}
html.dark table.standings-table tr.srow-first:hover {
  background-color: rgba(6, 78, 59, 0.35) !important;
}
html.dark table.standings-table tr.srow-second:hover {
  background-color: rgba(30, 58, 138, 0.35) !important;
}
html.dark table.standings-table tr.srow-other:hover {
  background-color: #27272a !important;
}

/* Playoff Tournament Bracket Connectors */
.bracket-connector-branch {
  border-color: #d4d4d8;
}
.dark .bracket-connector-branch {
  border-color: #3f3f46;
}
.bracket-connector-stem {
  background-color: #d4d4d8;
}
.dark .bracket-connector-stem {
  background-color: #3f3f46;
}

/* Goal & Assist Badges */
.goal-badge {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-weight: 800;
}
.dark .goal-badge {
  background-color: rgba(6, 78, 59, 0.45);
  color: #6ee7b7;
  border-color: rgba(5, 150, 105, 0.4);
}

.assist-badge {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-weight: 800;
}
.dark .assist-badge {
  background-color: rgba(30, 58, 138, 0.45);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
}

/* Print Optimization */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .no-print,
  #tdv-ecosystem-topbar,
  header,
  nav,
  button:not(.print-include) {
    display: none !important;
  }
  .glass-card,
  .sport-card-hover {
    box-shadow: none !important;
    border: 1px solid #cccccc !important;
    break-inside: avoid;
  }
}


/* ========================================================
   UI/UX PROMAX ENHANCEMENTS (Glassmorphism & Motion)
   ======================================================== */

/* Advanced View Transitions */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.4s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
::view-transition-old(root) {
  animation-name: fade-out, slide-out;
}
::view-transition-new(root) {
  animation-name: fade-in, slide-in;
  mix-blend-mode: normal;
}
@keyframes fade-out { to { opacity: 0; filter: blur(4px); } }
@keyframes fade-in { from { opacity: 0; filter: blur(4px); } }
@keyframes slide-out { to { transform: translateY(-10px) scale(0.98); } }
@keyframes slide-in { from { transform: translateY(10px) scale(0.98); } }

/* Global Scrollbar Styling (Premium) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: rgba(168, 85, 247, 0.15); /* light purple */
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
html.dark ::-webkit-scrollbar-thumb {
  background-color: rgba(168, 85, 247, 0.3);
}
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(168, 85, 247, 0.5);
}

/* Global Selection */
::selection {
  background-color: rgba(168, 85, 247, 0.3);
  color: inherit;
}

/* Animated Glassmorphism Backgrounds for Modals */
dialog::backdrop {
  background: rgba(9, 10, 15, 0.6);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  animation: backdrop-fade-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes backdrop-fade-in {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to { opacity: 1; backdrop-filter: blur(12px); }
}

/* General Layout Tweaks for premium feel */
body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Glow effects for cards */
.hover-glow:hover {
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.4);
}

@keyframes shine {
  100% { left: 200%; }
}
.animate-shine {
  animation: shine 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ProMax Match Player Profile Animations */
@keyframes drawArrow {
  from { stroke-dasharray: 0 100; opacity: 0; }
  to { stroke-dasharray: 100 0; opacity: 1; }
}

@keyframes popIn {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  80% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Match Player Profile SVG Utilities */
.origin-left { transform-origin: left center; }
