/* ═══════════════════════════════════════════════════════════════════
   live.css — Pantalla pública de torneo en vivo (TorneoLive.razor)
   Diseño oscuro, legible en TV, tablet y móvil.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────────────── */
.live-page {
    --live-bg:       #090909;
    --live-surface:  #181B20;
    --live-elevated: #20242B;
    --live-border:   #2a2f38;
    --live-blue:     #00A2E8;
    --live-text:     #F5F7FA;
    --live-muted:    #B8C0CC;
    --live-green:    #4caf50;
    --live-orange:   #e8a900;
    --live-orange2:  #ff8000;
    --live-red:      #f44336;
    --live-gold:     #B79A5B;
    --live-radius:   12px;
    --live-font:     'Inter', system-ui, sans-serif;
}

/* ── Layout raíz ──────────────────────────────────────────────────── */
.live-page {
    background: var(--live-bg);
    color: var(--live-text);
    font-family: var(--live-font);
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* ── Loading / error ──────────────────────────────────────────────── */
.live-loading,
.live-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1rem;
    color: var(--live-muted);
    font-size: 1.1rem;
}
.live-error .bi {
    font-size: 2.5rem;
    color: var(--live-red);
}

/* ── Cabecera ─────────────────────────────────────────────────────── */
.live-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--live-surface);
    border-bottom: 2px solid var(--live-blue);
    position: sticky;
    top: 0;
    z-index: 10;
}
.live-header-logo img {
    height: 36px;
    width: auto;
}
.live-header-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.live-header-title h1 {
    margin: 0;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    font-weight: 700;
    color: var(--live-text);
    line-height: 1.2;
}
.live-ronda-badge {
    background: var(--live-blue);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    white-space: nowrap;
}
.live-ronda-badge-done {
    background: rgba(76,175,80,0.2);
    color: #81c784;
}
.live-ronda-total {
    opacity: 0.75;
}

/* ── Sección de grupo ─────────────────────────────────────────────── */
.live-grupo {
    padding: 1.25rem 1.5rem 1.5rem;
    border-bottom: 1px solid var(--live-border);
    min-height: calc(100vh - 72px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.live-grupo-header {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    display: inline-block;
    margin-bottom: 0;
}
.live-grupo-a { background: rgba(76,175,80,0.15); color: #81c784; }
.live-grupo-b { background: rgba(244,67,54,0.15); color: #ef9a9a; }
.live-grupo-c { background: rgba(76,175,80,0.15); color: #a5d6a7; }

/* ── Cronómetro ───────────────────────────────────────────────────── */
.live-cronometro-wrap {
    text-align: center;
    margin-bottom: 1rem;
}
.live-cronometro {
    display: inline-block;
    background: var(--live-elevated);
    border-radius: var(--live-radius);
    padding: 0.75rem 2rem;
    margin-bottom: 0.4rem;
}
.live-timer-digits {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    line-height: 1;
    display: block;
    transition: color 0.5s;
    color: var(--live-green);
}
.live-timer-excedido .live-timer-digits {
    animation: live-pulse 1s infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.live-timer-nostart .live-timer-digits {
    color: var(--live-muted);
}
.live-aviso {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--live-blue);
    letter-spacing: 0.06em;
    min-height: 1.5em;
}

/* ── Barra stats ──────────────────────────────────────────────────── */
.live-stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    color: var(--live-muted);
}
.live-stat-sep { opacity: 0.4; }
.live-stat-done { color: var(--live-green); }
.live-stat-pending { color: var(--live-orange); }
.live-stat-zero { color: var(--live-green); }

/* ── Grid de mesas ────────────────────────────────────────────────── */
.live-grid-mesas {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 10px;
    padding: 0.5rem;
}

/* Fila */
.lgr-row {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    padding: 0.42rem 0.6rem;
    border-radius: 1px;
    background: var(--live-surface);
    border-bottom: 1px solid var(--live-border);
    font-size: clamp(0.9rem, 1.6vw, 1.08rem);
    color: var(--live-text);
    overflow: hidden;
}

/* Estado: en juego (azul a la izquierda) */
.lgr-active {
    border-left: 3px solid var(--live-blue);
}

/* Estado: terminada (levemente atenuada) */
.lgr-done {
    opacity: 0.62;
}

/* Resultados: texto pleno (sin atenuación) */
.lgr-result {
    opacity: 1;
}
.lgr-active:hover {
    background: rgba(0, 162, 232, 0.09);
}

/* Número de mesa */
.lgr-mesa {
    flex-shrink: 0;
    min-width: 30px;
    text-align: center;
    color: var(--live-muted);
    font-weight: 700;
    font-size: 0.82em;
}

/* Nombres */
.lgr-local {
    flex: 1;
    text-align: right;
    font-weight: 600;
    color: var(--live-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lgr-visit {
    flex: 1;
    font-weight: 600;
    color: var(--live-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Score */
.lgr-score {
    flex-shrink: 0;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-size: 0.9em;
    color: var(--live-text);
    background: var(--live-elevated);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    white-space: nowrap;
}

.lgr-score-sep {
    color: var(--live-muted);
    font-weight: 400;
    padding: 0 1px;
}

/* Ganador en verde, perdedor en rojo */
.lgr-winner {
    color: #4caf50;
    font-weight: 800;
}
.lgr-loser {
    color: #e53935;
    font-weight: 600;
    opacity: 0.85;
}

/* Icono estado */
.lgr-estado {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.live-badge-done { color: var(--live-green); font-size: 1rem; }
.live-badge-play { color: var(--live-blue); font-size: 1rem; }

.lgr-num {
    color: var(--live-blue);
    font-weight: 700;
    font-size: 0.88em;
    margin-right: 0.25em;
}

/* Ronda info header */
.live-partidas-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--live-muted);
    white-space: nowrap;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
}
.live-partidas-done { color: var(--live-green); background: rgba(76,175,80,0.12); }
.live-partidas-pend { color: var(--live-orange); background: rgba(255,152,0,0.12); }
.live-partidas-sep  { color: var(--live-border); font-weight: 300; font-size: 1.1rem; padding: 0; background: none; }

/* Contador terminadas/vivas junto al crono */
.live-contador {
    display: inline-flex;
    align-items: center;
    gap: 1.2rem;
    margin-top: 0.5rem;
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    font-weight: 700;
}
.live-contador-done {
    color: var(--live-green);
}
.live-contador-pending {
    color: var(--live-orange);
}
.live-contador-sep {
    color: var(--live-border);
    font-weight: 300;
    font-size: 1.2em;
}

/* Responsive */
@media (max-width: 900px) {
    .live-grid-mesas { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
    .live-grid-mesas { grid-template-columns: 1fr; }
}

/* ── Finalizado ───────────────────────────────────────────────────── */
.live-finalizado {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--live-gold);
}
.live-finalizado .bi { font-size: 2rem; }

/* ── Estado LOGO (pantalla completa entre rondas) ─────────────────── */
.live-logo-fullscreen {
    position: fixed;
    inset: 0;
    background: var(--live-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    z-index: 100;
}
.live-logo-fullscreen img {
    width: clamp(200px, 40vw, 480px);
    max-height: 40vh;
    object-fit: contain;
}
.live-logo-nombre {
    font-size: clamp(1rem, 3vw, 1.8rem);
    font-weight: 600;
    color: var(--live-text-muted);
    text-align: center;
    padding: 0 1rem;
}
.live-logo-sub {
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    font-weight: 500;
    color: var(--live-gold);
    margin-top: 0.75rem;
    opacity: 0.85;
}

/* ── Estado TIMER: cronómetro full-width ────────────────────────── */
.live-timer-fullwidth {
    text-align: center;
    margin-bottom: 0.5rem;
}
.live-timer-fullwidth .live-cronometro {
    display: block;
    padding: 0.5rem 2rem;
    background: none;
}
.live-timer-fullwidth .live-timer-digits {
    font-size: clamp(8rem, 28vw, 18rem);
}

/* Últimas terminadas label (encima del grid) */
.live-ultimas-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--live-muted);
    margin-bottom: 0.4rem;
    padding: 0.3rem 0.5rem;
}
.live-score-win  { color: #4caf50; }
.live-score-loss { color: #ef5350; }
.live-score-draw { color: #ffd54f; }
.live-score-sep  { color: var(--live-text-muted); margin: 0 0.1rem; }

/* ── Estado RESULTADOS ────────────────────────────────────────────── */
.live-grupo-resultados {
    padding: 0.5rem 1.5rem 1rem;
}
.live-resultados {
    padding: 0.25rem 0;
}
/* Barra única: grupo + ronda + partidas en una línea */
.live-resultados-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}
.live-grupo-badge {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
}
.live-resultados-ronda {
    font-size: 1rem;
    font-weight: 700;
    color: var(--live-green);
    display: flex;
    align-items: center;
}
.live-resultados-partidas {
    font-size: 0.88rem;
    color: var(--live-green);
    display: flex;
    align-items: center;
    opacity: 0.8;
}
.live-score-final {
    font-weight: 700;
    font-size: 1rem;
}
.live-winner {
    font-weight: 700;
    color: var(--live-text);
}

.live-pagina-badge {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--live-muted);
    background: var(--live-elevated);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}

@keyframes live-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.live-grid-fade {
    animation: live-fade-in 0.4s ease;
}

/* ── Footer ───────────────────────────────────────────────────────── */
.live-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
    color: var(--live-muted);
    border-top: 1px solid var(--live-border);
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}
.live-footer-sep { opacity: 0.4; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (min-width: 768px) {
    .live-header { padding: 1.25rem 2.5rem; }
    .live-grupo  { padding: 1.5rem 2.5rem 2rem; }
}
@media (min-width: 1200px) {
    .live-header { padding: 1.5rem 4rem; }
    .live-grupo  { padding: 2rem 4rem 2.5rem; }
}
