/* style.css - MundialLibre (Figma Mockup Recreation) */

/* ==========================================
   RESET & SYSTEM INITIALIZATION
   ========================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Color Palette */
  --color-bg-deep: #090909;
  --color-bg-base: #111111;
  --color-border: rgba(255, 255, 255, 0.08);

  /* Brand Accents */
  --color-accent-yellow: #ffe600;
  --color-live-red: #ff3b30;

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #a8a8a8;

  /* Fonts */
  --font-display: "Urbanist", sans-serif;
  --font-body: "Urbanist", sans-serif;

  /* System Properties */
  --radius-sm: 3px;
  --radius-md: 8px;
  --radius-lg: 24px; /* Radios: 24px Todos los componentes */

  /* Shadows */
  --shadow-premium: 0 40px 100px -20px rgba(0, 0, 0, 0.95);
  --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.2s ease;
}

/* Custom Selection Colors matching Branding Yellow */
::selection {
  background-color: var(--color-accent-yellow);
  color: #000000;
}

::-moz-selection {
  background-color: var(--color-accent-yellow);
  color: #000000;
}

/* ==========================================
   CUSTOM PREMIUM SCROLLBAR
   ========================================== */
::-webkit-scrollbar {
  width: 6px; /* Ancho: 6px */
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent; /* Track: Transparente */
}

::-webkit-scrollbar-thumb {
  background: #2a2a2a; /* Thumb: #2A2A2A */
  border-radius: 3px; /* Radio: 3px */
  transition: background 200ms ease; /* Transición: 200ms ease */
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent-yellow); /* Hover: #FFE600 */
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  background-color: var(--color-bg-deep); /* Background #090909 */
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.player-container-relative {
  position: relative;
  width: 100%;
  z-index: 2;
}

.player-wrapper,
.player-glow-backdrop,
.custom-player-controls {
  contain: paint;
}

/* Stadium Glow - applied to a separate backdrop behind .player-wrapper. 
   Keeping it on a separate empty div avoids the GPU compositing bug in Chrome! */
.player-glow-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  background: transparent;
  box-shadow:
    0px 20px 60px rgba(255, 230, 0, 0.15),
    0px 0px 120px 40px rgba(255, 230, 0, 0.06),
    0px 0px 200px 80px rgba(255, 230, 0, 0.03);
  z-index: 1;
  pointer-events: none;
}

/* ==========================================
   APP CONTAINER LAYOUT (1440px wide viewport specs)
   ========================================== */
.app-container {
  max-width: 1440px; /* Contenedor centrado: 1200px + Padding lateral: 120px */
  margin: 0 auto;
  padding: 0 120px; /* Padding lateral: 120px */
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================
   MODERN STICKY NAVBAR (Full-width, Glassmorphism)
   ========================================== */
.app-header {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  z-index: 100;
  background: rgba(9, 9, 9, 0.97);
  border-bottom: 1px solid var(--color-border);
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.app-header.scrolled {
  background: rgba(9, 9, 9, 0.92);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

/* Inner container: centers content like app-container */
.navbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 120px;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Brand Logo Link */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: opacity 0.2s ease;
  border: none;
  background: transparent;
  padding: 0;
}

.brand-logo:hover {
  opacity: 0.85;
}

.brand-logo-img {
  height: 48px;
  width: 48px;
  object-fit: contain;
  border-radius: 12px;
}

.brand-logo-text-img {
  height: 44px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Signal status badge */
.signal-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 6px 14px;
  height: 32px;
  transition: var(--transition-fast);
}

.signal-badge:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.live-dot {
  width: 6px;
  height: 6px;
  background-color: var(--color-live-red);
  border-radius: 50%;
  position: relative;
}

.live-dot::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  border: 1px solid var(--color-live-red);
  animation: pulse-ring 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  80%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.live-text {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
}

/* ==========================================
   MAIN STREAMING CONTENT (Espaciado superior del header al player: 72px)
   ========================================== */
.main-content {
  margin-top: 72px; /* Espaciado superior del header al player: 72px */
  display: flex;
  flex-direction: column;
  gap: 40px; /* Espaciado player a título: 40px */
}

.player-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 675px; /* Altura del player: 675px (16:9) */
  background-color: #000000;
  border-radius: var(--radius-lg); /* Radios: 24px */
  overflow: hidden;
  /* Yellow stadium glow moved to .player-glow-backdrop */
  border: 1px solid var(--color-border);
}

.player-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Loader overlay */
.player-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-bg-deep);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.5s ease;
}

.spinner {
  position: relative;
  width: 36px;
  height: 36px;
}

.spinner-circle {
  width: 100%;
  height: 100%;
  border: 2px solid transparent;
  border-top: 2px solid var(--color-accent-yellow);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader-text {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-align: center;
  padding: 0 20px;
}

/* Center HUD Play */
.center-play-hud {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  pointer-events: none;
  z-index: 8;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.center-play-hud.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.hud-circle {
  width: 64px;
  height: 64px;
  background: rgba(
    17,
    17,
    17,
    0.85
  ); /* Slightly darker to compensate for no blur */
  border: 1px solid var(--color-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-play-icon {
  color: #ffffff;
  margin-left: 3px;
}

/* Custom Player Controls Bar */
.custom-player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(
    to top,
    rgba(9, 9, 9, 0.98) 0%,
    rgba(9, 9, 9, 0.4) 75%,
    transparent 100%
  );
  padding: 40px 24px 16px 24px;
  z-index: 7;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.player-wrapper.show-controls .custom-player-controls {
  opacity: 1;
  transform: translateY(0);
}

.player-wrapper.hide-cursor,
.player-wrapper.hide-cursor * {
  cursor: none !important;
}

/* iOS pseudo-fullscreen: CSS-only fullscreen that keeps the ManagedMediaSource
   pipeline intact. webkitEnterFullscreen() hands control to native iOS player
   which breaks our Shaka response filters on orientation change. */
.player-wrapper.ios-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  border: none !important;
}

/* Custom Seekbar */
.progress-bar-container {
  width: 100%;
  height: 3px;
  position: relative;
  cursor: pointer;
  margin-bottom: 12px;
}

.progress-bar-hover-zone {
  position: absolute;
  top: -6px;
  left: 0;
  width: 100%;
  height: 14px;
  z-index: 3;
}

.progress-bar-bg {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 1.5px;
  position: absolute;
  top: 0;
  left: 0;
}

.progress-bar-buffer {
  height: 100%;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 1.5px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.progress-bar-play {
  height: 100%;
  background: var(--color-accent-yellow); /* Yellow timeline seek */
  border-radius: 1.5px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.progress-bar-buffer {
  height: 100%;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 1.5px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.progress-bar-scrubber {
  position: absolute;
  top: 50%;
  left: var(--scrubber-x, 0%);
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 50%;
  transform: translate(-50%, -50%)
    scale(var(--scrubber-scale, 0));
  z-index: 4;
  transition: transform 0.15s ease;
  --scrubber-scale: 0;
  --scrubber-x: 0%;
}

.progress-bar-container:hover .progress-bar-scrubber {
  --scrubber-scale: 1;
}

.progress-bar-container:hover .progress-bar-bg,
.progress-bar-container:hover .progress-bar-play {
  height: 3px;
}

/* Control Buttons row */
.controls-buttons-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.left-controls,
.right-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.control-btn {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  opacity: 0.75;
}

.control-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  opacity: 1;
}

/* Directo/Live Sync badge */
#live-sync-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 0;
  transition: var(--transition-fast);
}

#live-sync-btn .sync-dot {
  background: var(--color-live-red); /* Red dot */
}

#live-sync-btn .sync-text {
  color: #ffffff; /* White EN VIVO text */
  font-weight: 600;
}

.sync-dot {
  width: 6px;
  height: 6px;
  background: var(--color-live-red);
  border-radius: 50%;
}

.sync-text {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
}

/* Volume panel */
.volume-control {
  display: flex;
  align-items: center;
  gap: 2px;
}

.volume-slider-container {
  width: 0px;
  overflow: hidden;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
}

.volume-control:hover .volume-slider-container {
  width: 60px;
  margin-right: 6px;
}

.volume-slider {
  width: 100%;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 1.5px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
}

/* Time display */
.time-display {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  gap: 4px;
}

.time-separator {
  color: var(--text-muted);
}

/* Quality selector */
.quality-selector-container {
  position: relative;
}

.quality-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  right: -20px;
  background: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 6px;
  width: 140px;
  box-shadow: var(--shadow-premium);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  z-index: 12;
  transition: all 0.2s ease;
  background: rgba(17, 17, 17, 0.95); /* Solid fallback */
}

.quality-menu.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.quality-option {
  padding: 8px 12px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.quality-option:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.quality-option.active {
  color: var(--color-accent-yellow);
  font-weight: 700;
}

/* ==========================================
   SIGNAL DESCRIPTION CARD (Editorial Spacings)
   ========================================== */
.signal-details {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: flex;
  flex-direction: column;
  gap: 16px; /* Espaciado entre elementos: 12px - 28px */
}

.signal-subtitle {
  font-family: var(--font-display);
  font-size: 18px; /* H2: 18px */
  font-weight: 600; /* H2 weight: 600 */
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.signal-subtitle .dot {
  color: var(--text-secondary);
}

.signal-subtitle .live {
  color: var(--color-accent-yellow); /* "En vivo" in yellow #FFE600 */
}

.signal-title {
  font-family: var(--font-display);
  font-size: 52px; /* H1: 52px */
  font-weight: 800; /* H1 weight: 800 */
  color: #ffffff;
  letter-spacing: -1.5px;
  line-height: 1.1;
}

.match-timer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 230, 0, 0.1);
  border: 1px solid rgba(255, 230, 0, 0.35);
  color: var(--color-accent-yellow); /* #FFE600 */
  padding: 6px 14px;
  border-radius: var(--radius-sm); /* 8px or similar rounded */
  font-size: 18px; /* Slightly smaller than title for hierarchy */
  font-weight: 700;
  font-family: monospace;
  margin-left: 18px;
  vertical-align: middle;
  box-shadow: 0px 4px 15px rgba(255, 230, 0, 0.08);
  letter-spacing: normal;
  text-transform: uppercase;
}

/* Live Scoreboard Container styling */
.live-scoreboard-container {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  background: rgba(17, 17, 17, 0.85); /* Solid fallback */
  border: 1px solid var(--color-border);
  padding: 12px 24px;
  border-radius: 16px;
  margin: 12px 0 20px 0;
  box-shadow: 0px 10px 40px rgba(0, 0, 0, 0.25);
}

.scoreboard-team {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0px 4px 6px rgba(0, 0, 0, 0.3));
}

.team-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.scoreboard-score {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 4px 18px;
  border-radius: 8px;
}

.score-num {
  font-family: monospace;
  font-size: 32px;
  font-weight: 900;
  color: var(--color-accent-yellow); /* Yellow scoreboard digits */
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.4);
}

.score-divider {
  font-size: 26px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.3);
}

.live-scoreboard-container .match-timer-badge {
  margin-left: 8px;
}

.signal-desc {
  font-size: 18px; /* Body: 18px */
  font-weight: 400; /* Body weight: 400 */
  color: var(--text-secondary); /* Secondary text #A8A8A8 */
  line-height: 1.7;
}

.signal-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.spec-tag {
  background: var(--color-bg-base); /* Surface background #111111 */
  border: 1px solid var(--color-border); /* Borders rgba(255,255,255,0.08) */
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 14px; /* Small: 14px */
  font-weight: 500; /* Small weight: 500 */
  padding: 8px 18px;
  border-radius: var(--radius-lg); /* Radios: 24px Todos los componentes */
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.spec-tag:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
}

.spec-icon {
  width: 16px;
  height: 16px;
  color: var(--color-accent-yellow); /* Yellow spec icons */
  flex-shrink: 0;
}

/* ==========================================
   FOOTER
   ========================================== */
.app-footer {
  border-top: 1px solid var(--color-border);
  padding: 32px 0; /* Footer padding: 32px top / 32px bottom */
  text-align: center;
  margin-top: 24px;
}

.app-footer p {
  font-size: 13px; /* Caption: 13px */
  font-weight: 400; /* Caption weight: 400 */
  color: var(--text-secondary);
}

/* ==========================================
   RESPONSIVE DESIGN MEDIA QUERIES
   ========================================== */
@media (max-width: 1024px) {
  .app-container {
    padding: 0 40px; /* Scale down padding lateral for tablets */
  }
  .navbar-inner {
    padding: 0 40px; /* Scale down navbar inner padding for tablets */
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 0 20px; /* Scale down padding lateral for mobile */
  }
  .navbar-inner {
    padding: 0 20px; /* Scale down navbar inner padding for mobile */
  }

  .app-header {
    height: 64px;
  }

  .brand-logo-img {
    height: 36px;
    width: 36px;
    border-radius: 9px;
  }

  .brand-logo-text-img {
    height: 32px;
  }

  .signal-title {
    font-size: 36px;
  }

  .signal-desc {
    font-size: 16px;
  }
}

@media (max-width: 400px) {
  .brand-logo {
    gap: 8px;
  }
  .brand-logo-img {
    height: 30px;
    width: 30px;
    border-radius: 8px;
  }
  .brand-logo-text-img {
    height: 26px;
  }
  .signal-badge {
    padding: 4px 10px;
    height: 28px;
    gap: 6px;
  }
  .live-text {
    font-size: 10px;
  }
}

@media (max-width: 768px) {
  /* Scoreboard Widget Mobile optimization */
  .live-scoreboard-container {
    width: 100%;
    justify-content: space-between;
    padding: 12px;
    gap: 8px;
  }

  .scoreboard-team {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    width: 35%;
  }

  .scoreboard-team:last-of-type {
    flex-direction: column-reverse;
  }

  .team-name {
    font-size: 13px !important;
    font-weight: 700;
    line-height: 1.2;
    word-break: break-word;
  }

  .team-logo {
    width: 32px;
    height: 32px;
  }

  .scoreboard-score {
    padding: 4px 12px;
    gap: 6px;
  }

  .score-num {
    font-size: 24px;
  }

  .score-divider {
    font-size: 20px;
  }

  .live-scoreboard-container .match-timer-badge {
    margin-left: 0;
    margin-top: 4px;
    font-size: 11px;
    padding: 4px 8px;
  }

  /* Match Events / Stats Section Mobile optimization */
  .match-stats-container {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }

  .stats-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
  }

  .away-stats .stats-item {
    justify-content: flex-start;
    flex-direction: row;
  }

  .away-stats .stats-column-header {
    flex-direction: row;
  }
}

/* Animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}



/* ==========================================
   GOAL CELEBRATION EFFECT OVERLAY
   ========================================== */
.goal-celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65); /* Solid fallback */
  z-index: 99999; /* Display on top of all visual contexts */
  pointer-events: none;
  opacity: 0;
}

.goal-text-glow {
  font-family: var(--font-display);
  font-size: clamp(48px, 10vw, 110px);
  font-weight: 900;
  color: var(--color-accent-yellow); /* Glow yellow theme matching brand */
  text-transform: uppercase;
  letter-spacing: -2px;
  text-shadow:
    0 0 20px rgba(255, 230, 0, 0.8),
    0 0 40px rgba(255, 230, 0, 0.5),
    0 0 80px rgba(255, 230, 0, 0.2);
  transform-origin: center;
  display: inline-block;
  user-select: none;
}

/* ==========================================
   MATCH EVENTS / STATS SECTION (Goles & Tarjetas)
   ========================================== */
.match-stats-container {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 20px;
  margin-top: 16px;
  margin-bottom: 24px;
  box-shadow: 0px 8px 32px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.4s ease;
}

.stats-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stats-column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 8px;
}

.stats-team-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.stats-team-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
  opacity: 0;
  animation: statsFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes statsFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home-stats .stats-item {
  justify-content: flex-start;
}

.away-stats .stats-item {
  justify-content: flex-end;
  flex-direction: row-reverse; /* Right aligned items */
}

.stats-item-time {
  font-family: monospace;
  font-size: 12px;
  color: var(--color-accent-yellow);
  background: rgba(255, 230, 0, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.stats-item-player {
  font-weight: 600;
  font-size: 14px;
}

.stats-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.06);
  align-self: stretch;
}

.stats-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ==========================================
   MATCHES AGENDA SECTION (Partido Anterior / Próximo)
   ========================================== */
.matches-agenda-container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 12px;
  margin-bottom: 24px;
  animation: fadeIn 0.4s ease;
}

.agenda-card {
  flex: 1;
  background: rgba(18, 18, 22, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(12px);
  transition: border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, border-color, background-color, opacity;
}

.agenda-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(18, 18, 22, 0.55);
  transform: translateY(-2px);
}

.prev-match-card {
  opacity: 0.75;
}

.prev-match-card:hover {
  opacity: 1;
}

.agenda-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 10px;
}

.agenda-card-title {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.agenda-card-status {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  white-space: nowrap;
}

.next-match-status {
  background: rgba(0, 158, 227, 0.1);
  color: #009ee3;
}

.agenda-card-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.agenda-team {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 38%;
}

.home-agenda {
  justify-content: flex-end;
  text-align: right;
}

.away-agenda {
  justify-content: flex-start;
  text-align: left;
}

.agenda-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.agenda-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-score-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 16px;
  border-radius: 6px;
  min-width: 80px;
}

.agenda-score {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.agenda-score-divider {
  color: var(--text-secondary);
  font-size: 14px;
  opacity: 0.5;
}

.agenda-time-box {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 14px;
  border-radius: 6px;
}

.agenda-time-val {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Mobile query for agenda */
@media (max-width: 600px) {
  .matches-agenda-container {
    flex-direction: column;
    gap: 16px;
  }
  .agenda-card {
    padding: 12px 12px;
  }
  .agenda-team {
    width: 35%;
    gap: 6px;
  }
  .home-agenda {
    justify-content: flex-end;
    text-align: right;
  }
  .away-agenda {
    justify-content: flex-start;
    text-align: left;
  }
  .agenda-logo {
    width: 22px;
    height: 22px;
  }
  .agenda-name {
    font-size: 12px;
  }
  .agenda-score-box {
    padding: 4px 8px;
    min-width: 60px;
    gap: 4px;
    margin: 0 12px; /* Garantiza separación para que no se encime */
  }
  .agenda-score {
    font-size: 14px;
  }
  .agenda-time-box {
    padding: 4px 8px;
    margin: 0 12px; /* Garantiza separación para que no se encime */
  }
  .agenda-time-val {
    font-size: 9px;
  }
}

.match-section-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 24px 0;
}

/* ==========================================
   PENALTY SHOOTOUT (Tanda de Penales)
   ========================================== */
.stats-shootout-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  animation: fadeIn 0.3s ease;
}

.home-stats .stats-shootout-row {
  justify-content: flex-start;
}

.away-stats .stats-shootout-row {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.stats-shootout-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-shootout-dots {
  display: flex;
  gap: 6px;
}

.shootout-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  transition: transform 0.2s ease;
}

.shootout-dot.score {
  background: #34c759;
  border-color: rgba(52, 199, 89, 0.4);
  box-shadow: 0 0 8px rgba(52, 199, 89, 0.4);
}

.shootout-dot.miss {
  background: #ff3b30;
  border-color: rgba(255, 59, 48, 0.4);
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.4);
}

/* ==========================================
   TOURNAMENT BRACKET SECTION (Knockout Phase)
   ========================================== */
.tournament-bracket-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
  margin-bottom: 24px;
  animation: fadeIn 0.4s ease;
}

.bracket-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.bracket-section-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-secondary);
  text-transform: uppercase;
}



.bracket-tree-view {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: stretch;
  width: 100%;
  padding: 10px 0;
}

.bracket-half {
  display: flex;
  gap: 8px;
  flex: 1;
}

.bracket-left {
  flex-direction: row;
}

.bracket-right {
  flex-direction: row;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.round-title {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 8px;
  opacity: 0.7;
}

.round-matches-list {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 16px;
  height: 100%;
}

.bracket-match-slot {
  min-width: 95px;
}

.bracket-match-node {
  background: rgba(18, 18, 22, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, border-color, background-color;
}

.bracket-match-node:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(18, 18, 22, 0.6);
  transform: translateY(-1px);
}

.bracket-match-team {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bracket-team-info {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 80%;
}

.bracket-flag {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.bracket-team-name {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bracket-match-team.winner .bracket-team-name {
  font-weight: 800;
  color: #ffffff;
}

.bracket-match-team.loser {
  opacity: 0.35;
}

.bracket-team-score {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
}

.bracket-match-team.winner .bracket-team-score {
  color: var(--color-accent-yellow);
}

.bracket-match-meta {
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 800;
  color: var(--text-secondary);
  opacity: 0.5;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  padding-top: 4px;
  text-align: center;
  letter-spacing: 0.5px;
}

.bracket-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 125px;
  padding: 0 4px;
}

.final-match-slot {
  width: 100%;
}

.final-match-card {
  background: linear-gradient(135deg, rgba(255, 230, 0, 0.04) 0%, rgba(18, 18, 22, 0.6) 100%);
  border: 1px solid rgba(255, 230, 0, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(255, 230, 0, 0.05);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.final-match-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 230, 0, 0.4);
}

.final-match-card .bracket-team-name {
  font-size: 11px;
}

.final-match-card .bracket-team-score {
  font-size: 13px;
}

.final-match-card .bracket-flag {
  width: 20px;
  height: 20px;
}

.bracket-expand-overlay {
  display: none;
}

/* Mobile responsive layout for tournament bracket (vertical stack tree + accordion) */
@media (max-width: 1024px) {
  .tournament-bracket-container {
    position: relative;
    border-radius: 12px;
    background: rgba(18, 18, 22, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 12px;
    max-height: 4000px;
    overflow: hidden; /* ALWAYS hidden on mobile to prevent WebKit scroll clipping bugs */
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease, background-color 0.3s ease;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  .tournament-bracket-container.collapsed {
    border-color: rgba(255, 230, 0, 0.1);
    background: rgba(255, 230, 0, 0.01);
    max-height: 175px !important;
    overflow: hidden !important;
  }

  .bracket-section-header {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
  }

  .tournament-bracket-container:not(.collapsed) .bracket-section-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .bracket-section-header::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    transition: transform 0.3s ease;
    margin-right: 8px;
  }

  .tournament-bracket-container:not(.collapsed) .bracket-section-header::after {
    transform: rotate(-135deg);
  }

  .bracket-tree-view {
    flex-direction: column !important;
    gap: 28px !important;
  }

  .bracket-expand-overlay {
    display: flex;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 90px;
    background: linear-gradient(to bottom, transparent 0%, rgba(10, 10, 12, 0.98) 100%);
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 16px;
    cursor: pointer;
    z-index: 10;
    gap: 6px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    transition: opacity 0.3s ease;
  }

  .tournament-bracket-container:not(.collapsed) .bracket-expand-overlay {
    opacity: 0;
    pointer-events: none;
  }

  .expand-text {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    color: var(--color-accent-yellow);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
  }

  .expand-chevron {
    width: 14px;
    height: 14px;
    stroke: var(--color-accent-yellow);
    animation: bracketBounce 2s infinite;
  }

  .bracket-half {
    flex-direction: column !important;
    gap: 20px !important;
  }
  .bracket-left {
    order: 1;
  }
  .bracket-center {
    order: 2;
    width: 100% !important;
    padding: 0 !important;
  }
  .bracket-right {
    order: 3;
  }
  .bracket-round {
    width: 100% !important;
  }
  .bracket-match-slot {
    min-width: 100% !important;
  }
}

@keyframes bracketBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-4px);
  }
  60% {
    transform: translateY(-2px);
  }
}

/* ==========================================
   TOURNAMENT BRACKET CONNECTING LINES (Desktop Only)
   ========================================== */
@media (min-width: 1025px) {
  /* Connectors layout setup */
  .bracket-left .bracket-round:not(.round-4) .bracket-match-node,
  .bracket-right .bracket-round:not(.round-4) .bracket-match-node {
    position: relative;
  }

  /* Left Side: Outgoing connectors (extends right) */
  .bracket-left .bracket-round:not(.round-4) .bracket-match-node::after {
    content: "";
    position: absolute;
    right: -4px;
    width: 4px;
    border-right: 1px solid #25252b;
    z-index: 1;
  }

  .bracket-left .bracket-round:not(.round-4) .bracket-match-slot:nth-child(odd) .bracket-match-node::after {
    top: 50%;
    border-top: 1px solid #25252b;
  }

  .bracket-left .bracket-round:not(.round-4) .bracket-match-slot:nth-child(even) .bracket-match-node::after {
    bottom: 50%;
    border-bottom: 1px solid #25252b;
  }

  /* Right Side: Outgoing connectors (extends left) */
  .bracket-right .bracket-round:not(.round-4) .bracket-match-node::after {
    content: "";
    position: absolute;
    left: -4px;
    width: 4px;
    border-left: 1px solid #25252b;
    z-index: 1;
  }

  .bracket-right .bracket-round:not(.round-4) .bracket-match-slot:nth-child(odd) .bracket-match-node::after {
    top: 50%;
    border-top: 1px solid #25252b;
  }

  .bracket-right .bracket-round:not(.round-4) .bracket-match-slot:nth-child(even) .bracket-match-node::after {
    bottom: 50%;
    border-bottom: 1px solid #25252b;
  }

  /* Heights of vertical lines based on round match densities */
  /* R32 -> R16 */
  .round-32 .bracket-match-slot:nth-child(odd) .bracket-match-node::after {
    height: calc(100% + 8px);
  }
  .round-32 .bracket-match-slot:nth-child(even) .bracket-match-node::after {
    height: calc(100% + 8px);
  }

  /* R16 -> R8 */
  .round-16 .bracket-match-slot:nth-child(odd) .bracket-match-node::after {
    height: calc(200% + 16px);
  }
  .round-16 .bracket-match-slot:nth-child(even) .bracket-match-node::after {
    height: calc(200% + 16px);
  }

  /* R8 -> R4 */
  .round-8 .bracket-match-slot:nth-child(odd) .bracket-match-node::after {
    height: calc(400% + 32px);
  }
  .round-8 .bracket-match-slot:nth-child(even) .bracket-match-node::after {
    height: calc(400% + 32px);
  }

  /* Input connectors (horizontal entry lines from previous rounds) */
  .bracket-left .bracket-round:not(.round-32) .bracket-match-node::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 50%;
    width: 4px;
    height: 1px;
    background: #25252b;
    z-index: 1;
  }

  .bracket-right .bracket-round:not(.round-32) .bracket-match-node::before {
    content: "";
    position: absolute;
    right: -4px;
    top: 50%;
    width: 4px;
    height: 1px;
    background: #25252b;
    z-index: 1;
  }

  /* Semifinal direct horizontal connectors to the Final card */
  .bracket-left .round-4 .bracket-match-node::after {
    content: "";
    position: absolute;
    right: -10px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: #25252b;
  }

  .bracket-right .round-4 .bracket-match-node::after {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: #25252b;
  }
}

/* Visually Hidden Utility for Screen Readers & SEO */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}


