/* ============================================
   ESTILOS GENERALES
   ============================================ */
body {
    font-family: 'Righteous', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
}

/* ============================================
   NAVBAR
   ============================================ */
nav.navbar,
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f6f6f6;
    padding: 10px 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.logoLiga {
    position: relative;
    z-index: 102;
}

.logoLiga img {
    max-height: 60px;
    padding-top: 2px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 15px;
    flex-direction: row;
    position: static;
    height: auto;
    width: auto;
    background: transparent;
    margin: 0;
    padding: 0;
}

.nav-links li a {
    text-decoration: none;
    font-family: 'Righteous', sans-serif;
    color: #2c2c2c;
    font-size: 18px;
    padding: 10px;
    transition: color 0.3s, background-color 0.3s;
    border-radius: 1px;
}

.nav-links li a:hover {
    color: #ffffff;
    background-color: #ef3340;
}

.menu-toggle {
    display: none;
}

/* ============================================
   HEADER EQUIPOS
   ============================================ */
.equipos-header {
    background-color: #ef3340;
    height: 300px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 15px;
    padding-bottom: 20px;
    flex-direction: column;
    color: white;
}

.equipos-header h2 {
    color: white;
    font-family: 'Righteous', sans-serif;
    font-size: 62px;
    margin-bottom: 6px;
    line-height: 1;
    transform: translateY(40px);
    padding-right: 0px;
}

.equipos-header h3 {
    color: #ffe1dd;
    font-family: 'Righteous', sans-serif;
    font-size: 16px;
    margin-top: 15px;
    line-height: 1;
    transform: translateY(40px);
    padding-right: 0px;
}

/* ============================================
   LAYOUT ESTADÍSTICAS
   ============================================ */
.estadisticas-container {
    max-width: 1500px;
    margin: 40px auto;
    display: flex;
    gap: 20px;
}

.col-izquierda {
    flex: 1;
}

.col-derecha {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tabla-box {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* ============================================
   TÍTULOS
   ============================================ */
h2 {
    text-align: left;
    color: #ef3340;
    margin-bottom: 15px;
    font-size: 20px;
}

#tituloEstadisticas {
    text-align: left;
    margin: 20px 0;
    font-size: 28px;
    font-family: 'Righteous', sans-serif;
    color: #2c2c2c;
    padding-left: 48px;
}

#tituloPlayoffs {
    text-align: left;
    margin: 30px 0 15px 0;
    font-size: 32px;
    font-weight: bold;
    font-family: 'Righteous', sans-serif;
    color: #2c2c2c;
    padding-left: 49px;
}

/* ============================================
   TABLAS GENERALES
   ============================================ */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ef3340;
    box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    overflow-x: auto;
    color: #2c2c2c;
    font-family: 'Righteous', sans-serif;
}

thead {
    background-color: #e63946;
    color: white;
}

th,
td {
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid #2c2c2c;
}

table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

table tbody tr:hover {
    background-color: #ffe6e6;
}

.equipo-logo {
    height: 25px;
    width: 25px;
    object-fit: contain;
    margin-right: 8px;
}

.th-equipo {
    text-align: left !important;
    padding-left: 15px !important;
}

/* ============================================
   ESTADÍSTICAS (Tablas específicas)
   ============================================ */
.estadisticas {
    width: 100%;
    margin: 30px 0;
    text-align: center;
    font-family: 'Righteous', sans-serif;
    color: #2c2c2c;
}

.estadisticas h2 {
    text-align: center;
    margin: 20px 0;
    font-size: 28px;
    font-family: 'Righteous', sans-serif;
    color: #2c2c2c;
    padding-left: 0px;
}

.estadisticas table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

.estadisticas thead th,
#tablaEstadisticas thead th {
    background-color: #d32f2f;
    color: #ffffff;
    padding: 12px;
    position: sticky;
    top: 0;
    z-index: 2;
    text-align: center;
    font-weight: bold;
}

.estadisticas thead th:nth-child(2),
#tablaEstadisticas thead th:nth-child(2) {
    text-align: left;
    padding-left: 12px;
}

.estadisticas tbody tr:nth-child(odd),
#tablaEstadisticas tbody tr:nth-child(odd) {
    background-color: #f5f5f5;
    color: #2c2c2c;
}

.estadisticas tbody tr:nth-child(even),
#tablaEstadisticas tbody tr:nth-child(even) {
    background-color: #fffafa;
    color: #2c2c2c;
}

.estadisticas tbody tr:hover,
#tablaEstadisticas tbody tr:hover {
    background-color: #f1dbdd;
    color: #2c2c2c;
    transition: 0.3s;
}

.estadisticas tbody tr:first-child {
    background-color: #fff4d1;
}

#tablaEstadisticas tbody tr.playoff {
    background-color: #fff4d1;
    color: #2c2c2c;
}

.estadisticas td img,
#tablaEstadisticas td img {
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    height: 20px;
}

.estadisticas td:nth-child(2),
#tablaEstadisticas td:nth-child(2) {
    text-align: left;
    padding-left: 12px;
}

.estadisticas td:not(:nth-child(2)),
#tablaEstadisticas td:not(:nth-child(2)) {
    text-align: center;
}

.estadisticas tbody tr {
    border-bottom: 1px solid #2c2c2c;
}

/* ============================================
   BLOQUE LÍDERES
   ============================================ */
.bloque-lideres {
    display: flex;
    margin: 70px auto;
    margin-bottom: -20px;
    height: 400px;
    max-width: 1500px;
    width: 100%;
    gap: 20px;
}

.bloque-izquierda {
    flex: 1;
    background-color: #ef3340;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.bloque-top {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.cuadro-numero {
    background-color: #722323;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.cuadro-numero span {
    color: gold;
    font-weight: bold;
    font-size: 20px;
}

.titulo-lideres {
    color: white;
    font-family: 'Righteous', sans-serif;
    font-size: 28px;
    margin: 0;
    padding-left: 5px;
}

.bloque-imagen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 0px;
}

.bloque-imagen img {
    width: 100%;
    max-width: 420px;
    margin-bottom: 20px;
}

.equipo-nombre {
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    font-size: 22px;
    margin: 0;
}

.bloque-derecha {
    flex: 1;
    background-color: #c42f36;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.clasificacion-lideres ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.clasificacion-lideres li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: rgba(255, 188, 188, 0.05);
    border-radius: 6px;
}

.clasificacion-lideres .posicion {
    background-color: #722323;
    color: silver;
    font-weight: bold;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.clasificacion-lideres .equipo-info {
    display: flex;
    align-items: center;
    flex: 1;
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.clasificacion-lideres .equipo-info img {
    width: 25px;
    height: 25px;
    margin-right: 8px;
}

.clasificacion-lideres .puntos {
    color: #fff;
    font-weight: bold;
    min-width: 40px;
    text-align: right;
}

/* ============================================
   JORNADAS
   ============================================ */
#jornadas-container {
    width: 80%;
    max-width: 700px;
    margin: 20px auto;
}

.jornada {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #444;
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 8px;
}

.jornada-title {
    font-size: 1.2em;
    margin-bottom: 10px;
    font-weight: bold;
    text-align: center;
}

.partido {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-top: 1px solid #555;
    width: 100%;
    box-sizing: border-box;
}

.partido:first-child {
    border-top: none;
}

.equipo {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.equipo img {
    width: 48px;
    height: 48px;
    margin-bottom: 4px;
}

.resultado {
    font-size: 1em;
    font-weight: bold;
    text-align: right;
    white-space: nowrap;
    min-width: 50px;
}

.estado {
    font-size: 0.9em;
    color: #32CD32;
}

/* ============================================
   PLAYOFFS
   ============================================ */
#playoffResults {
    width: 100%;
    margin: 40px 0;
    font-family: 'Oswald', sans-serif;
    color: #2c2c2c;
}

.playoff-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.playoff-winner {
    display: flex;
    align-items: center;
    background-color: #fff4d1;
    padding: 40px;
    border-radius: 12px;
    flex: 1 1 300px;
    font-family: 'Oswald', sans-serif;
    color: #2c2c2c;
}

.playoff-winner .team-logo {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
}

.playoff-winner .team-logo img {
    max-width: 70px;
    max-height: 70px;
}

.playoff-winner .team-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.playoff-winner .team-info .title {
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #484948;
}

.playoff-winner .team-info .name {
    font-size: 18px;
    font-weight: 700;
    font-family: "Righteous";
}

.playoff-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 300px;
    background-color: #f5f5f5;
    border-radius: 12px;
    padding: 16px;
    font-family: 'Oswald', sans-serif;
    color: #2c2c2c;
}

.playoff-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    color: inherit;
    font-family: inherit;
}

.playoff-entry .entry-logo {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playoff-entry .entry-logo img {
    max-width: 35px;
    max-height: 35px;
}

.playoff-entry .entry-info {
    display: flex;
    flex-direction: column;
}

.playoff-entry .entry-info .title {
    font-size: 12px;
    font-weight: bold;
    line-height: 1.2;
    text-transform: uppercase;
    color: #484948;
}

.playoff-entry .entry-info .name {
    font-size: 14px;
    font-weight: 500;
    font-family: "Righteous";
    color: inherit;
}

.playoff-entry .match-result {
    margin-left: auto;
    font-weight: bold;
    font-size: 14px;
    color: #2c2c2c;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: #222;
    color: white;
    padding: 20px 0;
    text-align: center;
    margin-top: 40px;
}

footer img {
    max-height: 50px;
    margin: 10px;
}

.footer-logos {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.footer-logo {
    text-align: center;
    margin-bottom: 10px;
}

/* ============================================
   RESPONSIVE: MÓVILES PEQUEÑOS (max-width: 600px)
   ============================================ */
@media (max-width: 600px) {
    .equipo img {
        width: 36px;
        height: 36px;
    }

    .jornada-title {
        font-size: 0.9em;
        /* Reducido de 1em */
    }

    .partido {
        padding: 6px;
        /* Reducido de 8px */
    }

    .resultado {
        font-size: 0.7em;
        /* Reducido de 0.8em */
    }

    .estado {
        font-size: 0.7em;
        /* Reducido de 0.8em */
    }

    .jornada {
        padding: 6px;
        /* Reducido de 8px */
    }

    /* Banner de equipos */
    .equipos-header {
        height: 180px;
        /* Reducido de 300px */
        padding-left: 10px;
        padding-bottom: 10px;
    }

    .equipos-header h2 {
        font-size: 36px;
        /* Reducido de 62px */
        transform: translateY(20px);
        /* Reducido de 40px */
        padding-right: 0px;
    }

    .equipos-header h3 {
        font-size: 12px;
        /* Reducido de 16px */
        transform: translateY(20px);
        /* Reducido de 40px */
        padding-right: 0px;
    }

    /* Bloque líderes */
    .bloque-lideres {
        flex-direction: column;
        height: auto;
        /* Antes: 400px */
        gap: 15px;
        /* Reducido de 20px */
        margin: 50px auto 0 auto;
        /* Ajuste márgenes */
    }

    .bloque-izquierda,
    .bloque-derecha {
        padding: 10px;
        /* Reducido de 20px */
    }

    .bloque-top {
        margin-bottom: 10px;
        /* Reducido de 20px */
    }

    .cuadro-numero {
        width: 30px;
        /* Reducido de 40px */
        height: 30px;
        /* Reducido de 40px */
    }

    .cuadro-numero span {
        font-size: 16px;
        /* Reducido de 20px */
    }

    .titulo-lideres {
        font-size: 24px;
        /* Reducido de 28px */
        text-align: center;
    }

    .bloque-imagen img {
        max-width: 80%;
        /* Mantener proporción */
        margin-bottom: 15px;
        /* Reducido de 20px */
    }

    .equipo-nombre {
        font-size: 18px;
        /* Reducido de 22px */
    }

    .clasificacion-lideres .equipo-info {
        font-size: 14px;
        /* Reducido de 16px */
    }

    #tituloEstadisticas {
        font-size: 19px;
        padding-left: 12px;
    }

    #tituloPlayoffs {
        font-size: 22px;
        padding-left: 12px;
    }
}


/* ============================================
   RESPONSIVE: TABLETS Y MÓVILES (max-width: 900px)
   ============================================ */
@media (max-width: 900px) {
    body {
        padding-top: 70px;
    }

    .estadisticas-container {
        flex-direction: column;
    }

    /* Banner de equipos */
    .equipos-header {
        height: 180px;
        /* Reducido de 300px */
        padding-left: 10px;
        padding-bottom: 10px;
    }

    .equipos-header h2 {
        transform: translateY(0px);
        padding-right: 0px;
    }

    .equipos-header h3 {

        /* Reducido de 16px */
        transform: translateY(0px);
        /* Reducido de 40px */
        padding-right: 0px;
    }

    .menu-toggle {
        display: block !important;
        font-size: 30px;
        color: #2c2c2c;
        cursor: pointer;
        position: fixed;
        top: 14px;
        right: 18px;
        background: transparent;
        border: none;
        padding: 10px;
        line-height: 1;
        z-index: 10000;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);

        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 30px;

        margin: 0;
        padding: 0;
        list-style: none;

        /* Oculto por defecto */
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-20px);
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0.3s;

        z-index: 9999;
        overflow-y: auto;
    }

    .nav-links.show {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translateY(0) !important;
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0s;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
        list-style: none;
    }

    .nav-links li a {
        font-size: 24px;
        color: #2c2c2c;
        display: block;
        width: 100%;
        padding: 15px;
    }

    .logoLiga img {
        max-height: 42px;
    }

    .estadisticas h2 {
        font-size: 19px;
        padding-left: 12px;
    }

    .bloque-lideres {
        flex-direction: column;
        height: auto;
        gap: 20px;
    }

    .bloque-izquierda,
    .bloque-derecha {
        width: 96%;
        max-width: 100%;
    }

    .bloque-imagen img {
        max-width: 80%;
    }

    .titulo-lideres {
        font-size: 24px;
        text-align: center;
    }

    .equipo-nombre {
        font-size: 18px;
    }

    .clasificacion-lideres li {
        flex-direction: row;
        justify-content: space-between;
    }

    #tituloEstadisticas {
        font-size: 19px;
        padding-left: 12px;
    }

    #tituloPlayoffs {
        font-size: 22px;
        padding-left: 12px;
    }

    table td:nth-child(6),
    table th:nth-child(6),
    table td:nth-child(8),
    table th:nth-child(8),
    table td:nth-child(9),
    table th:nth-child(9) {
        display: none;
    }

    .playoff-container {
        flex-direction: column;
    }

    .playoff-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .playoff-entry .match-result {
        margin-left: 0;
    }
}

/* ============================================
   RESPONSIVE: ESCRITORIO (min-width: 901px)
   ============================================ */
@media (min-width: 901px) {
    .menu-toggle {
        display: none !important;
    }

    .nav-links {
        display: flex !important;
        position: static !important;
        background: transparent !important;
        flex-direction: row !important;
        height: auto !important;
        width: auto !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: none !important;
    }
}

/* ==========================================
   ESTILOS PARA GRÁFICOS - RESPONSIVE
   ========================================== */

.graficos-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 20px;
}

.graficos-titulo {
    text-align: center;
    font-family: 'Righteous', sans-serif;
    font-size: 36px;
    color: #2c2c2c;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.graficos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.grafico-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 400px;
    position: relative;
    overflow: hidden;
}

.grafico-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.grafico-card canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Gráfico grande (evolución) */
.grafico-grande {
    grid-column: span 2;
    height: 500px;
}

/* Gráfico pequeño (donut) */
.grafico-pequeno {
    height: 400px;
}

/* ==========================================
   RESPONSIVE - TABLETS (max-width: 1200px)
   ========================================== */
@media (max-width: 1200px) {
    .graficos-container {
        padding: 20px 15px;
    }

    .graficos-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .grafico-grande {
        grid-column: span 1;
        height: 400px;
    }

    .grafico-card {
        height: 380px;
    }
}

/* ==========================================
   RESPONSIVE - MÓVILES GRANDES (max-width: 768px)
   ========================================== */
@media (max-width: 768px) {
    .graficos-container {
        margin: 30px auto;
        padding: 15px 10px;
    }

    .graficos-titulo {
        font-size: 28px;
        margin-bottom: 25px;
        letter-spacing: 1.5px;
    }

    .graficos-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .grafico-card {
        padding: 20px 15px;
        height: 350px;
        border-radius: 12px;
    }

    .grafico-grande,
    .grafico-pequeno {
        height: 350px;
    }

    /* Ajustar hover para móviles (desactivar) */
    .grafico-card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
}

/* ==========================================
   RESPONSIVE - MÓVILES PEQUEÑOS (max-width: 480px)
   ========================================== */
@media (max-width: 480px) {
    .graficos-container {
        margin: 20px auto;
        padding: 10px 8px;
    }

    .graficos-titulo {
        font-size: 24px;
        margin-bottom: 20px;
        letter-spacing: 1px;
    }

    .graficos-grid {
        gap: 15px;
    }

    .grafico-card {
        padding: 15px 10px;
        height: 320px;
        border-radius: 10px;
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    }

    .grafico-grande,
    .grafico-pequeno {
        height: 320px;
    }
}

/* ==========================================
   RESPONSIVE - MÓVILES MUY PEQUEÑOS (max-width: 360px)
   ========================================== */
@media (max-width: 360px) {
    .graficos-container {
        padding: 8px 5px;
    }

    .graficos-titulo {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .grafico-card {
        padding: 12px 8px;
        height: 280px;
    }

    .grafico-grande,
    .grafico-pequeno {
        height: 280px;
    }
}

/* ==========================================
   MEJORAS ESPECÍFICAS PARA CHART.JS EN MÓVIL
   ========================================== */
@media (max-width: 768px) {

    /* Hacer las leyendas más compactas en móvil */
    .grafico-card canvas {
        font-size: 10px !important;
    }
}

/* ==========================================
   MODO LANDSCAPE EN MÓVILES
   ========================================== */
@media (max-width: 900px) and (orientation: landscape) {
    .grafico-card {
        height: 300px;
    }

    .grafico-grande,
    .grafico-pequeno {
        height: 300px;
    }

    .graficos-grid {
        gap: 15px;
    }
}

/* ==========================================
   OPTIMIZACIÓN PARA IMPRESIÓN
   ========================================== */
@media print {
    .grafico-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e0e0e0;
    }

    .grafico-card:hover {
        transform: none;
    }
}