/* ==========================================================================
   CSS SYSTEM DESIGN - CUPA FUTBOLITO BROADCAST SCREEN LIGHT DESIGN (LIVE.CSS)
   ========================================================================== */

:root {
    --bg-main: #f8fafc; /* Claro - Slate 50 */
    --bg-card: #ffffff; /* Blanco limpio */
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0; /* Slate 200 */
    --border-glow: rgba(221, 31, 40, 0.08);
    
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #475569; /* Slate 600 */
    --text-muted: #94a3b8; /* Slate 400 */
    
    --primary: #DD1F28; /* Rojo de marca */
    --primary-glow: rgba(221, 31, 40, 0.15);
    
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --gold: #d97706;
    --silver: #475569;
    --bronze: #b45309;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Montserrat', monospace;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.08);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1. BASE RESET & PITCH BACKGROUND */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow: hidden; /* Strict viewport lock for TV displays */
    position: relative;
}

/* STADIUM GRAPHICS IN LIGHT THEME */
.stadium-grid-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(#cbd5e1 1.2px, transparent 1.2px);
    background-size: 28px 28px;
    z-index: -1;
    opacity: 0.45;
    pointer-events: none;
}

/* SOFT PASTEL AMBIENT TEAM GLOW BLOBS */
.pitch-glow {
    position: absolute;
    width: 40vw;
    height: 40vh;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.08;
    z-index: -2;
    transition: var(--transition-smooth);
    pointer-events: none;
}
.glow-1 {
    top: 10%;
    left: -5%;
    background-color: var(--home-color-glow, var(--primary));
}
.glow-2 {
    bottom: 10%;
    right: -5%;
    background-color: var(--away-color-glow, var(--info));
}

/* 2. MAIN LAYOUT CONTAINER */
.live-app-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    padding: 24px 36px;
    justify-content: space-between;
}

/* 3. HEADER SYSTEM */
.live-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(221, 31, 40, 0.06);
    border: 1px solid rgba(221, 31, 40, 0.15);
    padding: 5px 12px;
    border-radius: 50px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 6px var(--primary);
    animation: pulse-indicator 1.2s infinite;
}

.live-header h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.live-clock {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 5px 14px;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
}

/* 4. THE STAGE (MAIN CONTENT WINDOW) */
.live-stage {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 8px;
}

/* MINIMALIST GLASS WHITE CARD */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
}
.card:hover {
    box-shadow: var(--shadow-lg);
}

/* 5. ACTIVE MATCH SCREEN */
.active-match-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.active-match-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1.15fr;
    gap: 32px;
    width: 100%;
    align-items: center;
}

/* TEAM CARDS */
.team-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 20px;
    text-align: center;
    border-radius: var(--radius-lg);
    position: relative;
}

.team-home-card {
    border-left: 4px solid var(--home-color, var(--primary));
}
.team-away-card {
    border-right: 4px solid var(--away-color, var(--info));
}

.logo-outer {
    position: relative;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-outer::before {
    content: '';
    position: absolute;
    width: 125%;
    height: 125%;
    border-radius: 50%;
    z-index: -1;
    opacity: 0.08;
}
.team-home-card .logo-outer::before {
    background: radial-gradient(circle, var(--home-color, var(--primary)) 0%, transparent 70%);
}
.team-away-card .logo-outer::before {
    background: radial-gradient(circle, var(--away-color, var(--info)) 0%, transparent 70%);
}

.logo-container.xxl-logo img,
.logo-container.xxl-logo .team-logo,
.logo-container.xxl-logo .team-logo-fallback {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    background: #f8fafc;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem; /* Fallback emoji */
}

.team-name {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.players-box {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
}

.players-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.players-names {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* SCOREBOARD CENTER CARD */
.scoreboard-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 20px;
    background: #ffffff;
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
    border-bottom: 3px solid var(--primary);
}

.match-info-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 12px;
    background: var(--bg-main);
    padding: 3px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
}

.score-digit {
    font-family: var(--font-mono);
    font-size: 4.8rem;
    font-weight: 800;
    color: var(--text-primary);
    min-width: 65px;
    text-align: center;
}

.score-separator {
    font-family: var(--font-mono);
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 4px var(--primary-glow);
    animation: blink-colon 1.5s infinite;
}

/* 15-MINUTE DYNAMIC COUNTDOWN BOX */
.match-timer-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 4px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    min-width: 150px;
    box-shadow: var(--shadow-sm);
}

.match-timer-status {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.match-timer-clock {
    font-family: var(--font-mono);
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 1px;
}

/* PENALTY KICKS IN LIGHT THEME */
.pk-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.2);
    padding: 6px 18px;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.pk-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--warning);
    letter-spacing: 1.5px;
    margin-bottom: 2px;
}
.pk-digits {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pk-val {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--warning);
}
.pk-sep {
    color: var(--text-muted);
    font-weight: 700;
}

.match-time-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    background: rgba(221, 31, 40, 0.04);
    border: 1px solid rgba(221, 31, 40, 0.12);
    padding: 3px 10px;
    border-radius: 4px;
}

/* 6. IDLE STANDBY DASHBOARD SCREEN */
.idle-dashboard-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}

.idle-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 36px;
    width: 100%;
    height: 100%;
    align-items: stretch;
}

.idle-left-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
}

/* WELCOME BLOCK */
.welcome-card {
    flex-grow: 1;
    padding: 36px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-bottom: 3px solid var(--primary);
}

.trophy-wrapper {
    margin-bottom: 16px;
}
.animated-trophy {
    font-size: 3.5rem;
    color: var(--gold);
    filter: drop-shadow(0 4px 6px rgba(217, 119, 6, 0.25));
    animation: float-y 3s ease-in-out infinite;
}

.welcome-card h2 {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.welcome-card .desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 400px;
    margin-bottom: 20px;
}

.idle-pulse-footer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 5px 14px;
    border-radius: 50px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.spinner-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--warning);
    box-shadow: 0 0 6px var(--warning);
    animation: pulse-indicator 1.5s infinite;
}

/* IDLE STATS PANEL */
.idle-stats-card {
    padding: 20px 24px;
}

.idle-stats-card h3 {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.live-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.live-stat-box {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.stat-num {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1px;
}

.stat-text {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* 7. ALL 3 GROUP STANDINGS STATIC STACK PANEL */
.live-groups-panel {
    display: flex;
    flex-direction: column;
    padding: 24px;
    height: 100%;
}

.panel-header-simple {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.panel-header-simple h3 {
    font-size: 0.9rem;
    font-family: var(--font-mono);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.groups-tables-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.group-table-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.group-title-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 800;
    margin-bottom: 8px;
    padding-left: 6px;
}
.group-a-label { border-left: 3px solid var(--primary); color: var(--primary); }
.group-b-label { border-left: 3px solid var(--warning); color: var(--warning); }
.group-c-label { border-left: 3px solid var(--success); color: var(--success); }

.table-responsive-compact {
    width: 100%;
}

.live-table-compact {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.live-table-compact th {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 4px 6px;
    border-bottom: 1px solid var(--border-color);
}

.live-table-compact td {
    padding: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.02);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.col-pos-compact { width: 20px; font-weight: 700 !important; text-align: center; }
.col-team-compact { font-weight: 700 !important; }
.col-stat-compact { width: 34px; font-family: var(--font-mono); text-align: center; }

.live-table-compact th.col-stat-compact {
    text-align: center;
}

.live-table-compact-team {
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-table-compact-team img,
.live-table-compact-team .team-logo-fallback {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: #ffffff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}

.live-table-compact-team-name {
    font-weight: 700;
    color: var(--text-primary);
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 8. ANIMATIONS */
@keyframes pulse-indicator {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes blink-colon {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

@keyframes float-y {
    0% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

/* PROVISIONAL STANDINGS BOTTOM ROW (LIVE BROADCAST) */
.provisional-standings-card {
    width: 100%;
    padding: 12px 18px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border-top: 3px solid var(--success);
    transition: var(--transition-smooth);
}

.provisional-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.provisional-header h3 {
    font-size: 1.15rem;
    font-family: var(--font-mono);
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-pulse-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-indicator 1.2s infinite;
}

.provisional-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.table-responsive-provisional {
    width: 100%;
}

.live-table-provisional {
    width: 100%;
    border-collapse: collapse;
}

.live-table-provisional th {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 8px 12px;
    border-bottom: 2px solid var(--border-color);
    text-align: center;
}

.live-table-provisional th.col-team {
    text-align: left;
}

.live-table-provisional td {
    padding: 12px 12px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.live-table-provisional td.col-team {
    text-align: left;
}

.live-table-provisional tr.live-row-playing {
    background: rgba(16, 185, 129, 0.05);
}

.live-table-provisional tr.live-row-playing td {
    color: var(--text-primary);
    font-weight: 800;
}

.live-row-playing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--primary);
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 10px;
    letter-spacing: 0.5px;
    animation: pulse-indicator 1.5s infinite;
}

/* Table Columns Width Formatting for Provisional Standings */
.live-table-provisional th.col-pos,
.live-table-provisional td:first-child {
    width: 80px;
    text-align: center;
}
.live-table-provisional th.col-team,
.live-table-provisional td.col-team {
    text-align: left;
}
.live-table-provisional th:not(.col-team):not(.col-pos),
.live-table-provisional td:not(.col-team):not(:first-child) {
    width: 95px;
    text-align: center;
}
.live-table-provisional th.col-pts,
.live-table-provisional td:last-child {
    width: 130px;
    text-align: center;
}
