:host {
    display: block;
    margin: 1rem 0;
}

.tabla-container h2 {
    color: #1e2f40;
    margin-bottom: 1.5rem;
    margin-top: 0;
    font-size: 1.8rem;
    font-weight: bold;
    border-bottom: 3px solid var(--secondary-blue);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1px;
    padding-bottom: 5px;
}

table {
    width: 100%;
    min-width: 800px; /* Minimum width to ensure readability */
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.table-container th, td {
    padding: 0.8rem 0.8rem;
    text-align: center;
    white-space: nowrap;
}

th {
    background-color: #1e2f40;
    color: white;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:hover {
    background-color: #f1f4ff;
}

.equipo-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    min-width: 200px;
}

.escudo {
    width: 45px;
    height: 45px;
    object-fit: cover;
    overflow-clip-margin: unset;
    border-radius: 50%;
    background: white;
    padding: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.nombre-equipo {
    font-weight: 500;
    text-align: left;
}

.posicion {
    font-weight: bold;
    color: #000000;;
}

/* Estilos para las posiciones destacadas */
tr.campeon td.posicion {
    color: #32d100;
}

tr.campeon {
    background-color: #f0ffeb;
}

tr.clasificado td.posicion {
    color: #007cd7;
}

tr.descenso {
    background-color: rgba(245, 101, 101, 0.15);
}

tr.descenso:hover {
    background-color: rgba(245, 101, 101, 0.25);
}

tr.descenso td.posicion {
    color: #f56565;
}

.red {
    color: red;
}

/* Leyenda */
.leyenda {
    margin-top: 1rem;
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.leyenda-item {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.leyenda-item::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 5px;
    border-radius: 2px;
}

.leyenda-item.campeon::before {
    background-color: rgba(255, 215, 0, 0.5);
}

.leyenda-item.clasificado::before {
    background-color: rgba(72, 187, 120, 0.5);
}

.leyenda-item.descenso::before {
    background-color: rgba(245, 101, 101, 0.5);
}

/* Leyenda de sanción */
.leyenda-sancion {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #ffebcd;
    border: 1px solid #ffbaa7;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #9b2806;
    text-align: center;
}

/* Scroll indicator styles */
.scroll-indicator {
    display: none;
    text-align: center;
    color: var(--primary-blue);
    padding: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

#loading.loading {
    top: 100px;
}

.sistema-clasificacion {
    margin-top: 2rem;
    margin-bottom: 2rem;
    font-family: Arial, sans-serif;
}

.sistema-titulo {
    font-family: 'Raleway', sans-serif;
    color: #23374d;
    border-bottom: 2px solid #1fb5d1;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-weight: 600;
}

.sistema-card {
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background-color: #fff;
    border-top: 4px solid #1fb5d1;
}

.sistema-card-header {
    font-family: 'Raleway', sans-serif;
    background-color: #23374d;
    color: white;
    border-radius: 4px 4px 0 0;
    padding: 15px 20px;
    font-weight: 600;
}

.sistema-clasificacion-item {
    display: flex;
    margin-bottom: 10px;
    padding: 5px 0;
}

.sistema-icono {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    text-align: center;
    font-size: 14px;
    line-height: 24px;
    border-radius: 50%;
    background-color: #23374d;
    color: white;
    flex-shrink: 0;
}

.sistema-info {
    font-family: 'Raleway', sans-serif;
    color: #333;
    flex-grow: 1;
}

.sistema-info strong {
    font-family: 'Raleway', sans-serif;
}

.sistema-nota {
    font-style: italic;
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 15px;
    border-top: 1px solid #e9ecef;
    padding-top: 15px;
}

.tag-clasificacion {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 5px;
}

.tag-clasificado {
    background-color: #28a745;
    color: white;
}

.tag-ventaja {
    background-color: #007bff;
    color: white;
}

.tag-riesgo {
    background-color: #dc3545;
    color: white;
}

.leyenda {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.leyenda-item {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.color-box {
    width: 15px;
    height: 15px;
    margin-right: 5px;
    border-radius: 3px;
}

.clasificacion-box {
    background-color: #28a745;
}

.ventaja-box {
    background-color: #007bff;
}

.descenso-box {
    background-color: #dc3545;
}

/* Media query */
@media (max-width: 768px) {
    h2 {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }

    .scroll-indicator {
        display: block;
    }

    table {
        font-size: 0.9rem;
    }

    th, td {
        padding: 0.8rem 0rem;
    }

    td:nth-child(1) {
        width: 50px;
    }

    td:nth-child(2) {
        width: 100px;
    }

    .escudo {
        width: 30px;
        height: 30px;
    }
    
    .table-container {
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
    }

    .table-container::-webkit-scrollbar {
        height: 6px;
    }

    .table-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }

    .table-container::-webkit-scrollbar-thumb {
        background: var(--secondary-blue);
        border-radius: 3px;
    }

    .equipo-info {
        min-width: 150px;
    }

        .sistema-clasificacion-item {
        flex-direction: column;
    }
    
    .sistema-icono {
        margin-bottom: 5px;
    }

    .sistema-info {
        font-size: 14px;
    }
}