/**
 * sports.css - Estilos Premium para el Módulo de Marcador Deportivo & Partidos en Vivo
 * Compatible con OBS Studio (fondo transparente) y Panel de Control Glassmorphism.
 */

:root {
  --sports-live-green: #34d399;
  --sports-live-glow: rgba(52, 211, 153, 0.4);
  --sports-card-bg: #202124;
  --sports-card-border: #303134;
  --sports-text-subtle: #9aa0a6;
  --sports-goal-gold: #fbbf24;
}

/* =======================================================
   1. DASHBOARD & PANEL DE CONTROL
   ======================================================= */

.sports-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 1024px) {
  .sports-grid {
    grid-template-columns: 1fr;
  }
}

/* Pestañas de navegación */
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block !important;
}

/* Selector de Competiciones & Ligas (Cuadrícula Wrap Limpia sin Scroll Horizontal) */
.league-chips-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0 0.8rem 0;
  max-width: 100%;
}

.league-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  user-select: none;
}

.league-chip img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.league-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.league-chip.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(147, 51, 234, 0.2));
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

/* Chip especial para "EN DIRECTO AHORA" */
.league-chip.live-all-chip {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  font-weight: 800;
}

.league-chip.live-all-chip.active {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(245, 158, 11, 0.3));
  border-color: #ef4444;
  color: #fff;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Barra de Filtros de Partidos (Todos, En Juego, Por Jugar, Finalizados) */
.matches-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.match-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.match-filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.match-filter-btn.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

.match-filter-btn .filter-count {
  font-size: 0.72rem;
  opacity: 0.8;
  font-weight: 600;
}

/* Lista de Partidos Disponibles */
.matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 560px;
  overflow-y: auto;
  padding: 4px 6px 12px 4px;
}

.match-item-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: visible;
  flex-shrink: 0;
  min-height: 80px;
  box-sizing: border-box;
}

.match-item-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Estado de visualización en Web (Inspeccionando sin enviar a OBS) */
.match-item-card.inspected {
  border-color: rgba(147, 51, 234, 0.7);
  background: rgba(147, 51, 234, 0.08);
  box-shadow: 0 0 14px rgba(147, 51, 234, 0.2);
}

/* Estado Activo en OBS */
.match-item-card.selected {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.25);
}

.match-item-card.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
  background: var(--accent-cyan);
}

.match-teams-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.match-team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.team-info-side {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  overflow: hidden;
}

.team-logo-small {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  flex-shrink: 0;
}

.team-name-text {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-score-text {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.match-status-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.4rem;
  min-width: 125px;
  flex-shrink: 0;
}

.match-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid var(--sports-live-green);
  color: var(--sports-live-green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.match-live-badge.ended {
  background: rgba(148, 163, 184, 0.15);
  border-color: #64748b;
  color: #94a3b8;
}

.match-live-badge.upcoming {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fbbf24;
}

.match-clock-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-subtle);
}

/* Panel de Control Manual y Acciones */
.quick-score-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1rem;
}

.quick-score-teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.score-control-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.score-control-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  text-align: center;
}

.score-control-col .score-display {
  font-size: 2.5rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent-gold);
}

.score-btn-group {
  display: flex;
  gap: 0.5rem;
}

.score-btn-group .btn {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

/* =======================================================
   2. WIDGET / OVERLAY OBS (ESTILOS Y TEMAS)
   ======================================================= */

.sports-overlay-container {
  display: inline-block;
  user-select: none;
  transition: transform 0.2s ease, opacity 0.3s ease;
}

/* TEMA 1: GOOGLE SPORTS CARD (EXACTO A LA FOTO) */
.sports-theme-google-card {
  width: 580px;
  background: #202124;
  border: 1px solid #303134;
  border-radius: 12px;
  color: #e8eaed;
  font-family: 'Roboto', 'Outfit', system-ui, -apple-system, sans-serif;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  position: relative;
}

.google-card-header {
  padding: 14px 20px 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.google-match-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e8eaed;
  margin: 0;
}

.google-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 4px 20px;
}

.google-league-name {
  font-size: 0.95rem;
  color: #9aa0a6;
  font-weight: 500;
}

.google-clock-badge {
  font-size: 0.88rem;
  font-weight: 700;
  color: #81c995;
  font-family: var(--font-mono);
  position: relative;
}

@keyframes livePulseUnderline {
  0% { opacity: 0.6; transform: scaleX(0.92); }
  50% { opacity: 1; transform: scaleX(1); box-shadow: 0 0 8px #81c995; }
  100% { opacity: 0.6; transform: scaleX(0.92); }
}

.google-clock-badge.live::after {
  content: '';
  display: block;
  height: 2px;
  background: #81c995;
  width: 100%;
  margin-top: 2px;
  border-radius: 1px;
  animation: livePulseUnderline 2s ease-in-out infinite;
}

/* Cuerpo central: Escudos y Marcador */
.google-match-main {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px 20px;
  gap: 1rem;
}

.google-team-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  text-align: center;
}

.google-team-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.google-team-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: #e8eaed;
}

.google-team-rank {
  font-size: 0.72rem;
  color: #9aa0a6;
  background: #303134;
  padding: 1px 6px;
  border-radius: 10px;
}

.google-score-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.google-score-digit {
  font-size: 2.8rem;
  font-weight: 700;
  font-family: 'Roboto', 'Outfit', sans-serif;
  color: #e8eaed;
  min-width: 32px;
  text-align: center;
}

.google-score-divider {
  font-size: 1.8rem;
  color: #9aa0a6;
  font-weight: 300;
}

/* Sección de Goleadores (Idéntico a Google) */
.google-scorers-box {
  display: grid;
  grid-template-columns: 1fr 24px 1fr;
  padding: 10px 20px 14px 20px;
  font-size: 0.85rem;
  color: #9aa0a6;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  min-height: 48px;
}

.google-scorers-home {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: left;
}

.google-scorers-icon {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-size: 0.95rem;
  color: #bdc1c6;
  padding-top: 2px;
}

.google-scorers-away {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: right;
}

.google-scorer-line {
  color: #bdc1c6;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer Opcional del Google Card */
.google-card-footer {
  padding: 8px 20px;
  background: #18191b;
  border-top: 1px solid #303134;
  font-size: 0.75rem;
  color: #70757a;
  display: flex;
  justify-content: space-between;
}

/* TEMA 2: BROADCAST TV CHYRON (ESTILO TELEVISIÓN) */
.sports-theme-broadcast-chyron {
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #090a0f 0%, #151824 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  height: 52px;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
}

.chyron-league-box {
  background: #000;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-right: 2px solid var(--accent-cyan);
}

.chyron-league-box img {
  height: 28px;
  object-fit: contain;
}

.chyron-team-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 14px;
}

.chyron-team-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.chyron-team-name {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.chyron-score-badge {
  background: #000;
  color: var(--accent-gold);
  font-size: 1.3rem;
  font-weight: 900;
  font-family: var(--font-mono);
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.chyron-clock-box {
  background: rgba(52, 211, 153, 0.15);
  color: var(--sports-live-green);
  font-weight: 800;
  font-size: 0.9rem;
  font-family: var(--font-mono);
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
}

/* TEMA 3: CYBER PILL */
.sports-theme-cyber-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 8px 18px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 25px rgba(6, 182, 212, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-family: 'Outfit', sans-serif;
}

.pill-team {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
}

.pill-score {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 10px;
  border-radius: 999px;
}

.pill-clock {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--sports-live-green);
  font-weight: 800;
}

/* TEMA 4: CLEAN FLOATING */
.sports-theme-clean-floating {
  background: rgba(18, 18, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.75);
  width: 380px;
  color: #fff;
}

/* =======================================================
   TEMA 5: MLS BROADCAST TV BUG (INTER MIAMI STYLE)
   ======================================================= */

.sports-theme-mls-broadcast {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.85));
}

/* 1. Minutero / Cuenta Regresiva Superior */
.mls-top-clock {
  font-family: 'Outfit', 'Roboto', system-ui, sans-serif;
  font-size: 2.7rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.95),
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 0 15px rgba(255, 255, 255, 0.2);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 2. Scorebug Frame con Acabado Metálico Biselado y Brillo de Cristal */
.mls-scorebug-frame {
  display: flex;
  align-items: stretch;
  background: #0d0f14;
  border-radius: 6px;
  border: 2px solid #5a6270;
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.9),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1.5px 0 rgba(0, 0, 0, 0.9),
    0 5px 22px rgba(6, 182, 212, 0.55);
  overflow: hidden;
  position: relative;
  min-width: 440px;
  height: 68px;
}

/* Reflejo de Cristal Superior (Gloss TV Effect) */
.mls-scorebug-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  z-index: 20;
}

/* 3. Columna de Equipo (Superior: Color + Escudo + Gol; Inferior: Nombre Negro) */
.mls-team-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.mls-team-upper {
  height: 44px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  background-color: var(--team-bg, #f4b5cd);
}

/* Escudo Circular */
.mls-crest-box {
  width: 36px;
  height: 36px;
  margin: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 5;
}

.mls-crest-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.65));
}

.mls-team-upper-spacer {
  flex: 1;
}

/* Recuadro Blanco de Gol con Dígito Negro */
.mls-score-box {
  width: 46px;
  height: 100%;
  background: #ffffff;
  color: #050505;
  font-family: 'Outfit', 'Roboto', sans-serif;
  font-size: 2.15rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 5;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.15);
}

.mls-team-col.home .mls-score-box {
  border-left: 2px solid #111;
}

.mls-team-col.away .mls-score-box {
  border-right: 2px solid #111;
}

/* Franja Inferior Negra con el Nombre Completo del Club */
.mls-team-lower {
  height: 24px;
  background: #000000;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1.5px solid rgba(255, 255, 255, 0.15);
}

/* 4. Divisor Central Segmentado */
.mls-center-divider {
  width: 32px;
  background: #0a0c10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border-left: 2px solid #2e3440;
  border-right: 2px solid #2e3440;
  position: relative;
  z-index: 15;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.95);
}

.mls-div-seg {
  width: 100%;
  height: 12px;
  background: #ffffff;
}

.mls-div-seg.top {
  border-bottom: 2px solid #000;
}

.mls-div-seg.bottom {
  border-top: 2px solid #000;
}

.mls-div-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #000000;
}

.mls-div-bar {
  width: 14px;
  height: 4px;
  background: #ffffff;
  border-radius: 1px;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

/* Luz Cyan / Neón Inferior */
.mls-cyan-glow {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 6px;
  background: #00e5ff;
  border-radius: 50%;
  filter: blur(4px);
  opacity: 0.9;
  pointer-events: none;
  z-index: 30;
}


/* =======================================================
   3. ANIMACIONES Y EFECTOS DE GOL
   ======================================================= */

@keyframes goalFlashAnimation {
  0% { transform: scale(1); filter: drop-shadow(0 0 0px #fbbf24); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 35px #fbbf24); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0px #fbbf24); }
}

.goal-scored-active {
  animation: goalFlashAnimation 1.5s ease-in-out infinite;
}

.goal-banner-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 2.2rem;
  font-weight: 900;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 2px;
  padding: 10px 30px;
  border-radius: 999px;
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 100;
}

.goal-banner-popup.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
