/* MODO OSCURO (por defecto) */
:root {
    --bg:     #0a0e1a;
    --bg2:    #111827;
    --bg3:    #1a2235;
    --border: #1e2d45;
    --text:   #e8edf5;
    --text2:  #8899b4;
    --accent: #00d4ff;
    --gold:   #ffd700;
    --green:  #00a854;
    --orange: #ff9800;
    --red:    #ff4444;
    --purple: #9c27b0;
}

/* MODO CLARO */
[data-theme="light"] {
    --bg:     #f0f3f8;
    --bg2:    #ffffff;
    --bg3:    #e8edf5;
    --border: #d4dce8;
    --text:   #0d1117;
    --text2:  #52637a;
    --accent: #0052cc;
    --gold:   #8a6000;
    --green:  #0a7040;
    --orange: #c05a00;
    --red:    #c41c00;
    --purple: #6200a0;
}

/* Header oscuro en modo claro — mantiene identidad de la web */
[data-theme="light"] header {
    background: #0d1424;
    border-bottom-color: #0d1424;
}
[data-theme="light"] .logo { color: #ffffff; }
[data-theme="light"] .logo span { color: #00d4ff; }
[data-theme="light"] .footer-logo span { color: #00d4ff; }
[data-theme="light"] nav a { color: rgba(255,255,255,0.6); }
[data-theme="light"] nav a:hover,
[data-theme="light"] nav a.active { background: rgba(255,255,255,0.12); color: #ffffff; }

/* Barra competiciones oscura */
[data-theme="light"] .comp-bar { background: #172035; border-bottom-color: #172035; }
[data-theme="light"] .comp-tab { color: rgba(255,255,255,0.5); border-bottom-color: transparent; }
[data-theme="light"] .comp-tab:hover { color: rgba(255,255,255,0.8); }
[data-theme="light"] .comp-tab.active { color: #33c8ff; border-bottom-color: #33c8ff; }

/* Cards con sombra sutil */
[data-theme="light"] .card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    border-color: #d4dce8;
}
[data-theme="light"] .explicativo-card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-color: #d4dce8;
}

/* Tabla */
[data-theme="light"] tbody tr:nth-child(even) { background: #f7f9fc; }
[data-theme="light"] tbody tr { border-bottom-color: #e4eaf3; }
[data-theme="light"] tbody tr:hover { background: #eaf0fa; }
[data-theme="light"] thead th { background: #f0f4fa; border-bottom-color: #d4dce8; }

/* Barras de probabilidad más visibles */
[data-theme="light"] .prob-bar { background: #dde5f0; }

/* Barras de predicción de partidos */
[data-theme="light"] .pred-ganador  { background: #d4f0e2; color: #0a6035; }
[data-theme="light"] .pred-empate   { background: #fde8cc; color: #a04000; }
[data-theme="light"] .pred-perdedor { background: #fdd8d4; color: #a81800; }

/* Dots clasificación */
[data-theme="light"] .dot-champions  { background: #0052cc; }
[data-theme="light"] .dot-europa     { background: #0a7040; }
[data-theme="light"] .dot-conference { background: #c05a00 !important; }
[data-theme="light"] .dot-descenso   { background: #c41c00; }

/* Badge de actualizado */
[data-theme="light"] .actualizado-dot { background: #0052cc; box-shadow: 0 0 0 0 rgba(0,82,204,0.4); }
[data-theme="light"] .actualizado-badge { color: #52637a; }
[data-theme="light"] .actualizado-texto strong { color: #0d1117; }

/* Jornada nav */
[data-theme="light"] .jornada-label { color: #52637a !important; }
[data-theme="light"] .jornada-btn { border-color: #d4dce8; color: #52637a; }
[data-theme="light"] .jornada-btn:hover:not(:disabled) { background: #eaf0fa; color: #0d1117; }

/* Badge Monte Carlo */
[data-theme="light"] .badge { background: rgba(0,82,204,0.1); color: #0052cc; }
[data-theme="light"] .num-blue   { color: #0052cc; }
[data-theme="light"] .num-orange { color: #c05a00; }
[data-theme="light"] .num-red    { color: #c41c00; }
[data-theme="light"] .num-gold   { color: #8a6000; }
[data-theme="light"] .num-purple { color: #6200a0; }
[data-theme="light"] .fill-blue   { background: #0066dd; }
[data-theme="light"] .fill-green  { background: #0a8040; }
[data-theme="light"] .fill-orange { background: #d06800; }
[data-theme="light"] .fill-red    { background: #d42000; }
[data-theme="light"] .fill-gold   { background: #9a7000; }
[data-theme="light"] .fill-purple { background: #7200b8; }

/* Footer */
[data-theme="light"] footer { border-top-color: #d4dce8; }
[data-theme="light"] .footer-logo { color: #0d1117; }
[data-theme="light"] .theme-toggle { background: #e8edf5; border-color: #d4dce8; color: #52637a; }

/* Página title */
[data-theme="light"] .page-subtitle { color: #52637a; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: 'Barlow', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* HEADER */
header { background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-family: 'Barlow Condensed', sans-serif; font-size: 1.6rem; font-weight: 800; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo span { color: var(--accent); }
nav { display: flex; gap: 0.5rem; flex-shrink: 0; }
nav a { padding: 0.4rem 1rem; border-radius: 6px; text-decoration: none; color: var(--text2); font-size: 0.85rem; font-weight: 500; transition: all 0.2s; white-space: nowrap; }
nav a:hover, nav a.active { background: var(--bg3); color: var(--text); }

/* COMPETICIONES */
.comp-bar { background: var(--bg2); border-bottom: 1px solid var(--border); }
.comp-bar-inner { max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.comp-bar-inner::-webkit-scrollbar { display: none; }
.comp-tab { padding: 0.8rem 1.2rem; text-decoration: none; color: var(--text2); font-size: 0.85rem; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; transition: all 0.2s; flex-shrink: 0; display: flex; align-items: center; gap: 0.4rem; }
.comp-tab .fi { font-size: 1rem; border-radius: 2px; }
.comp-tab:hover { color: var(--text); }
.comp-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* MAIN */
main { max-width: 1400px; margin: 0 auto; padding: 2rem 1.5rem; box-sizing: border-box; width: 100%; }
.page-title { font-family: 'Barlow Condensed', sans-serif; font-size: 2rem; font-weight: 800; margin-bottom: 0.3rem; }
.page-subtitle { color: var(--text2); font-size: 0.9rem; margin-bottom: 2rem; }

/* GRID — flex column por defecto, grid en pantallas grandes */
.grid { display: flex; flex-direction: column; gap: 2rem; }
.grid > * { min-width: 0; width: 100%; }
.col-izq, .col-der { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }

@media (min-width: 1101px) {
    .grid { display: grid; grid-template-columns: 1fr 380px; align-items: start; gap: 2rem; }
    .grid > * { width: auto; }
}

/* CARD */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-family: 'Barlow Condensed', sans-serif; font-size: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text2); }

/* TABLA — scroll horizontal propio */
.tabla-wrap { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; min-width: 600px; }
thead th { padding: 0.6rem 0.5rem; text-align: center; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text2); border-bottom: 1px solid var(--border); white-space: nowrap; }
thead th:nth-child(1), thead th:nth-child(2) { text-align: left; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }
td { padding: 0.6rem 0.5rem; text-align: center; white-space: nowrap; }
td:nth-child(2) { text-align: left; }

.pos { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 0.9rem; }
.pos-indicator { display: flex; align-items: center; gap: 6px; }
.pos-dot { width: 3px; height: 20px; border-radius: 2px; flex-shrink: 0; }
.dot-champions  { background: var(--accent); }
.dot-europa     { background: var(--green); }
.dot-conference { background: var(--orange); }
.dot-descenso   { background: var(--red); }
.dot-normal     { background: transparent; }

.equipo-cell { display: flex; align-items: center; gap: 6px; }
.escudo { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
.equipo-nombre { font-weight: 600; font-size: 0.875rem; }
.pts { font-family: 'Barlow Condensed', sans-serif; font-size: 1rem; font-weight: 800; }

.prob-bar-wrap { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 70px; }
.prob-bar { height: 6px; border-radius: 3px; flex: 1; background: var(--bg3); overflow: hidden; }
.prob-fill { height: 100%; border-radius: 3px; }
.fill-gold   { background: var(--gold); }
.fill-blue   { background: var(--accent); }
.fill-green  { background: var(--green); }
.fill-orange { background: var(--orange); }
.fill-red    { background: var(--red); }

.prob-num { font-size: 0.72rem; font-weight: 700; min-width: 34px; text-align: left; }
.num-gold   { color: var(--gold); }
.num-blue   { color: var(--accent); }
.num-green  { color: var(--green); }
.num-orange { color: var(--orange); }
.num-red    { color: var(--red); }


.leyenda { display: flex; gap: 1.5rem; padding: 0.8rem 1.5rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.leyenda-item { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text2); }
.leyenda-dot { width: 8px; height: 8px; border-radius: 2px; }

/* PRÓXIMOS PARTIDOS */
.partido-card { padding: 0.7rem 1.5rem; }
.partido-fecha { font-size: 0.68rem; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
.partido-fecha-sep {
    text-align: center;
    padding: 0.6rem 1.5rem 0.3rem;
    border-top: 1px solid var(--border);
}
.partido-fecha-sep:first-child { border-top: none; padding-top: 0.5rem; }
.partido-equipos { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; width: 100%; }
.partido-equipo { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.partido-equipo.visitante { justify-content: flex-end; }
.partido-equipo img { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.partido-equipo span { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.partido-vs { font-size: 0.7rem; color: var(--text2); font-weight: 700; padding: 0 0.3rem; flex-shrink: 0; }
/* Cabecera única de predicciones */
.pred-header {
    display: flex;
    padding: 0.3rem 1.5rem 0.3rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text2);
    border-bottom: 1px solid var(--border);
}
.pred-header span:first-child { flex: 1; }
.pred-header span:nth-child(2) { flex: 0 0 auto; text-align: center; }
.pred-header span:last-child { flex: 1; text-align: right; }

/* Barra proporcional */
.pred-bar {
    display: flex;
    width: 100%;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    gap: 2px;
}
.pred-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    transition: opacity 0.2s;
    min-width: 28px;
    overflow: hidden;
}
.pred-seg span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}
.pred-seg:hover { opacity: 0.85; }
.pred-ganador  { background: rgba(0,230,118,0.2); color: #00e676; }
.pred-perdedor { background: rgba(255,68,68,0.18); color: #ff4444; }
.pred-empate   { background: rgba(255,152,0,0.15); color: #ff9800; }

/* Border radius en los extremos */
.pred-bar .pred-seg:first-child { border-radius: 6px 0 0 6px; }
.pred-bar .pred-seg:last-child  { border-radius: 0 6px 6px 0; }

/* MISC */
.badge { font-size: 0.7rem; padding: 0.2rem 0.6rem; border-radius: 20px; background: rgba(0,212,255,0.1); color: var(--accent); font-weight: 600; white-space: nowrap; }
.no-data { padding: 3rem; text-align: center; color: var(--text2); }
.no-data a { color: var(--accent); text-decoration: none; font-weight: 600; }
footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    color: var(--text2);
    font-size: 0.8rem;
    margin-top: 3rem;
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.footer-logo { font-family: 'Barlow Condensed', sans-serif; font-size: 1.3rem; font-weight: 800; color: var(--text); text-decoration: none; }
.footer-logo span { color: var(--accent); }
.footer-text { color: var(--text2); font-size: 0.8rem; }
.footer-legal { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-legal a { color: var(--text2); text-decoration: none; font-size: 0.78rem; transition: color 0.2s; }
.footer-legal a:hover { color: var(--text); }

/* TOGGLE MODO CLARO/OSCURO */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text2);
    transition: all 0.2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text2); }
.theme-toggle-icon { font-size: 0.9rem; }
.col-elo { color: var(--text2); }

/* RESPONSIVE */
@media (max-width: 900px) {
    .col-elo { display: none; }
    main { padding: 1.5rem 1rem; }
}
@media (max-width: 768px) {
    main { padding: 1rem; }
    .page-title { font-size: 1.4rem; }
    .header-inner { padding: 0 1rem; height: 52px; }
    .comp-bar-inner { padding: 0 0.5rem; }
    .comp-tab { padding: 0.65rem 0.8rem; font-size: 0.78rem; }
    .partido-card { padding: 0.8rem 1rem; }
    .prob-pill { font-size: 0.7rem; padding: 0.25rem; }
    .pill-label { font-size: 0.58rem; }
    .leyenda { gap: 0.8rem; padding: 0.6rem 1rem; }
    .leyenda-item { font-size: 0.7rem; }
    thead th { padding: 0.4rem 0.2rem; font-size: 0.6rem; text-align: center !important; }
    thead th:nth-child(2) { text-align: left !important; }
    td { padding: 0.4rem 0.2rem; }
    td:nth-child(1) { padding-left: 0.5rem; padding-right: 0.2rem; width: 30px; }
    td:nth-child(2) { padding-left: 0.1rem; padding-right: 0.05rem; }
    td:nth-child(3) { padding-left: 0.05rem; padding-right: 0.05rem; }
    td:nth-child(4) { padding-left: 0.05rem; padding-right: 0.1rem; }
    /* Columnas de probabilidad menos separadas */
    td:nth-child(5), td:nth-child(6), td:nth-child(7), td:nth-child(8) { padding-left: 0.05rem; padding-right: 0.05rem; }
    thead th:nth-child(5), thead th:nth-child(6), thead th:nth-child(7), thead th:nth-child(8) { padding-left: 0.05rem; padding-right: 0.05rem; }
    .escudo { width: 15px; height: 15px; }
    .equipo-cell { gap: 5px; } /* más separación escudo-nombre */
    .equipo-nombre { font-size: 0.8rem; } /* fuente más grande */
    .pts { font-size: 0.85rem; }
    .prob-bar { display: none; }
    .prob-bar-wrap { min-width: auto; gap: 0; }
    .prob-num { min-width: auto; font-size: 0.72rem; text-align: center; } /* % más grande */
}
@media (max-width: 480px) {
    main { padding: 0.75rem; }
    .page-title { font-size: 1.2rem; }
    .comp-tab { padding: 0.6rem 0.6rem; font-size: 0.72rem; }
    thead th { font-size: 0.58rem; padding: 0.35rem 0.2rem; }
    td { padding: 0.35rem 0.2rem; }
    td:nth-child(1) { padding-left: 0.4rem; }
    .card-header { padding: 0.75rem 1rem; }
}
@media (max-width: 360px) {
    .comp-tab { padding: 0.5rem 0.5rem; font-size: 0.65rem; }
    .page-title { font-size: 1rem; }
}

/* ACTUALIZADO */
.actualizado-wrap {
    margin-top: 0.6rem;
    display: flex;
    justify-content: flex-start;
}
.actualizado-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: var(--text2);
    letter-spacing: 0.2px;
}
.actualizado-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4);
    animation: pulse-dot 2.5s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse-dot {
    0%   { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4); }
    50%  { box-shadow: 0 0 0 5px rgba(0, 212, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0); }
}
.actualizado-texto { color: var(--text2); }
.actualizado-texto strong { color: var(--text); font-weight: 500; }

/* NAVEGACIÓN DE JORNADAS */
.card-header-jornada {
    justify-content: center;
    gap: 1rem;
}
.jornada-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 100px;
    text-align: center;
}
.jornada-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text2);
    border-radius: 6px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: all 0.15s;
    padding: 0;
}
.jornada-btn:hover:not(:disabled) {
    background: var(--bg3);
    color: var(--text);
    border-color: var(--text2);
}
.jornada-btn:disabled {
    opacity: 0.25;
    cursor: default;
}

/* RESULTADO DE PARTIDO FINALIZADO */
.partido-resultado {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem 0;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
}
.gol-local, .gol-visitante { color: var(--text); }
.gol-sep { color: var(--text2); font-weight: 400; }

/* PARTIDO APLAZADO */
.partido-aplazado {
    text-align: center;
    padding: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text2);
    border: 1px dashed var(--border);
    border-radius: 6px;
}

/* MARCADOR INTEGRADO */
.partido-equipos-resultado {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.partido-marcador {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    flex-shrink: 0;
}
.gol-local, .gol-visitante { color: var(--text); }
.gol-sep { color: var(--text2); font-weight: 400; font-size: 1rem; }

/* Barra de predicción pequeña para partidos finalizados */
.pred-bar-small {
    height: 22px;
    margin-top: 0.3rem;
    opacity: 0.6;
}
.pred-bar-small .pred-seg { font-size: 0.65rem; }

/* Separación entre partidos y texto en móvil */
@media (max-width: 1100px) {
    .col-der { gap: 1.5rem; }
    .col-izq { gap: 1.5rem; }
}

/* SECCIONES EXPLICATIVAS */
.explicativo-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.8rem 2rem;
    line-height: 1.75;
    color: var(--text2);
}
.explicativo-titulo {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text);
    margin-bottom: 1.1rem;
}
.explicativo-card p {
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
}
.explicativo-card p:last-child { margin-bottom: 0; }
.explicativo-card strong { color: var(--text); font-weight: 600; }
.explicativo-nota {
    font-size: 0.82rem !important;
    color: var(--text2);
    opacity: 0.7;
    border-top: 1px solid var(--border);
    padding-top: 0.8rem;
    margin-top: 0.5rem;
}

/* En móvil: todo apilado */
@media (max-width: 1100px) {
    .explicativo-card { padding: 1.3rem 1.2rem; }
    .explicativo-titulo { font-size: 1rem; }
    .explicativo-card p { font-size: 0.85rem; }
}

[data-theme="light"] .col-elo { color: #52637a !important; }
