/* =========================
   FUTBOL40 CORE - PARTIDOS (ficha + tarjetas + interlinking)
   v2.56.41 - carga condicional por contexto
========================= */

/* =========================
   SINGLE PARTIDO: IMAGEN + FICHA
========================= */
.f40-match-media-ficha {
    display: grid;
    grid-template-columns: minmax(260px, 42%) 1fr;
    gap: 24px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 34px 0 36px;
    padding: 18px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.f40-match-media-ficha.has-no-image {
    display: block;
}

.f40-match-poster-side {
    margin: 0;
}

.f40-match-poster-img {
    display: block;
    width: 100%;
    max-width: 520px;
    height: auto;
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.f40-match-ficha-box h2 {
    margin: 0 0 12px;
}

/* Información del partido: compacta el bloque sin reducir legibilidad. */
.f40-match-ficha {
    margin: 0;
    padding: 0;
}

.f40-match-ficha li {
    margin: 0 0 6px;
    line-height: 1.35;
}

.f40-match-ficha li:last-child {
    margin-bottom: 0;
}

.f40-match-ficha-box {
    min-width: 0;
}

/* Ficha técnica: espaciado horizontal uniforme sin alterar el layout original. */
.f40-match-ficha .f40-ficha-icon {
    display: inline-block;
    width: 1.25em;
    margin-right: 5px;
    text-align: center;
}

.f40-match-ficha strong {
    margin-right: 4px;
}

@media (max-width: 768px) {
    .f40-match-media-ficha {
        display: block;
        margin: 28px 0 32px;
        padding: 14px;
        border-radius: 16px;
        align-items: initial;
    }

    .f40-match-poster-side {
        margin: 0 0 16px;
    }
}


/* =========================
   LISTADOS DE PARTIDOS — CONTRATO RESPONSIVE CANÓNICO
   v2.56.37
   Una sola fuente de verdad para el comportamiento del componente .f40-table.
   - Escritorio/tablet: fila horizontal compacta.
   - Móvil: equipos + chips + CTA ancho completo, con menos espacio vertical.
========================= */
.f40-table .f40-row,
.f40-table .f40-row * {
    box-sizing: border-box !important;
}

.f40-table .f40-row {
    display: flex !important;
}

.f40-table .f40-row .f40-teams,
.f40-table .f40-row .f40-meta {
    min-width: 0 !important;
}

.f40-table .f40-row .f40-teams {
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
}

.f40-table .f40-row .f40-team-logo-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    line-height: 1 !important;
}

.f40-table .f40-row .f40-team-logo {
    display: block !important;
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    object-fit: contain !important;
    flex: 0 0 auto !important;
}

.f40-table .f40-row .f40-team-logo-link:hover .f40-team-logo,
.f40-table .f40-row .f40-team-logo-link:focus .f40-team-logo {
    transform: scale(1.04) !important;
}

.f40-table .f40-row .f40-match-title-link {
    display: inline-block !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: #111827 !important;
    text-decoration: none !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
}

.f40-table .f40-row .f40-match-title-link:hover,
.f40-table .f40-row .f40-match-title-link:focus {
    color: #2563eb !important;
    text-decoration: none !important;
}

.f40-table .f40-row .f40-meta > a:not(.f40-league):not(.f40-channel) {
    white-space: nowrap !important;
}

@media (min-width: 701px) {
    .f40-table .f40-row {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        /* Igualamos el espacio visual del borde izquierdo (4px)
           con el derecho (1px), conservando el padding derecho 18px. */
        padding-left: 15px !important;
    }

    .f40-table .f40-row .f40-teams {
        width: auto !important;
        flex: 1 1 300px !important;
        max-width: none !important;
        justify-content: flex-start !important;
        text-align: left !important;
        align-self: center !important;
        font-size: 14.5px !important;
        overflow: hidden !important;
        flex-wrap: nowrap !important;
    }

    /* Resultado oficial: menor separación horizontal, sin alterar otras tarjetas. */
    .f40-table .f40-row[data-match-final="1"] .f40-teams {
        gap: 3px !important;
    }
    .f40-table .f40-row[data-match-final="1"] .f40-meta {
        gap: 3px !important;
    }

    .f40-table .f40-row .f40-meta {
        width: auto !important;
        flex: 0 1 auto !important;
        margin: 0 0 0 auto !important;
        justify-content: flex-end !important;
        align-items: center !important;
        gap: 5px !important;
        flex-wrap: nowrap !important;
        overflow: visible !important;
    }

    .f40-table .f40-row .f40-match-title-link {
        max-width: clamp(150px, 26vw, 340px) !important;
    }

    .f40-table .f40-row .f40-meta a.f40-league,
    .f40-table .f40-row .f40-meta span.f40-league {
        max-width: 112px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .f40-table .f40-row .f40-meta a.f40-channel,
    .f40-table .f40-row .f40-meta span.f40-channel {
        max-width: 86px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .f40-table .f40-row .f40-status {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }

    .f40-table .f40-row .f40-meta > a:not(.f40-league):not(.f40-channel) {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 84px !important;
        max-width: none !important;
        padding-left: 7px !important;
        padding-right: 7px !important;
        justify-content: center !important;
        text-align: center !important;
    }
}

@media (min-width: 701px) and (max-width: 1050px) {
    .f40-table .f40-row {
        gap: 8px !important;
        padding-right: 18px !important;
    }

    .f40-table .f40-row .f40-teams {
        flex: 1 1 250px !important;
        gap: 5px !important;
    }

    .f40-table .f40-row .f40-team-logo-link {
        width: 30px !important;
        height: 30px !important;
        border-radius: 7px !important;
    }

    .f40-table .f40-row .f40-team-logo {
        width: 29px !important;
        height: 29px !important;
        max-width: 29px !important;
        max-height: 29px !important;
    }

    .f40-table .f40-row .f40-match-title-link {
        max-width: clamp(128px, 23vw, 245px) !important;
    }

    .f40-table .f40-row .f40-meta {
        gap: 4px !important;
    }

    .f40-table .f40-row .f40-meta a.f40-league,
    .f40-table .f40-row .f40-meta span.f40-league {
        max-width: 96px !important;
    }

    .f40-table .f40-row .f40-meta a.f40-channel,
    .f40-table .f40-row .f40-meta span.f40-channel {
        max-width: 74px !important;
    }
}

/* En escritorio ancho, el tema usa 12px a la derecha en vez de 18px.
   Conservamos ese valor y compensamos los 3px del borde izquierdo. */
@media (min-width: 1051px) {
    .f40-table .f40-row {
        padding-left: 9px !important;
    }
}

@media (min-width: 1024px) {
    .f40-table .f40-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
    }
    .f40-table .f40-row[data-match-final="1"] {
        column-gap: 8px !important;
    }

    .f40-table .f40-row .f40-meta {
        max-width: 100% !important;
    }

    .f40-table .f40-row .f40-meta > span,
    .f40-table .f40-row .f40-meta > a,
    .f40-table .f40-row .f40-status {
        flex-shrink: 0 !important;
    }
}

@media (max-width: 700px) {
    .f40-table .f40-row {
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        padding: 14px !important;
    }

    .f40-table .f40-row .f40-teams {
        width: 100% !important;
        flex: 0 0 auto !important;
        justify-content: center !important;
        text-align: center !important;
        align-self: center !important;
        gap: 4px !important;
        overflow: hidden !important;
        flex-wrap: nowrap !important;
    }

    .f40-table .f40-row .f40-team-logo-link {
        width: 31px !important;
        height: 31px !important;
        border-radius: 7px !important;
    }

    .f40-table .f40-row .f40-team-logo {
        width: 28px !important;
        height: 28px !important;
        max-width: 28px !important;
        max-height: 28px !important;
    }

    .f40-table .f40-row .f40-match-title-link {
        max-width: calc(100% - 76px) !important;
    }

    /* Chips centrados por filas con salto natural; CTA a todo el ancho. */
    .f40-table .f40-row .f40-meta {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important;
        column-gap: 6px !important;
        row-gap: 7px !important;
        width: 100% !important;
        flex: 0 0 auto !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    .f40-table .f40-row .f40-meta .f40-time,
    .f40-table .f40-row .f40-meta .f40-status {
        flex: 0 0 auto !important;
        width: auto !important;
        white-space: nowrap !important;
    }

    .f40-table .f40-row .f40-meta a.f40-league,
    .f40-table .f40-row .f40-meta span.f40-league,
    .f40-table .f40-row .f40-meta a.f40-channel,
    .f40-table .f40-row .f40-meta span.f40-channel {
        flex: 0 1 auto !important;
        width: auto !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        justify-content: center !important;
    }

    .f40-table .f40-row .f40-meta > a:not(.f40-league):not(.f40-channel) {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        min-height: 42px !important;
        margin: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }
}

@media (max-width: 380px) {
    .f40-table .f40-row {
        padding: 12px !important;
    }

    .f40-table .f40-row .f40-teams {
        gap: 3px !important;
    }

    .f40-table .f40-row .f40-team-logo-link {
        width: 29px !important;
        height: 29px !important;
    }

    .f40-table .f40-row .f40-team-logo {
        width: 26px !important;
        height: 26px !important;
        max-width: 26px !important;
        max-height: 26px !important;
    }

    .f40-table .f40-row .f40-match-title-link {
        max-width: calc(100% - 70px) !important;
    }

    .f40-table .f40-row .f40-meta {
        column-gap: 4px !important;
    }

    .f40-table .f40-row .f40-meta a.f40-league,
    .f40-table .f40-row .f40-meta span.f40-league,
    .f40-table .f40-row .f40-meta a.f40-channel,
    .f40-table .f40-row .f40-meta span.f40-channel {
        padding-left: 7px !important;
        padding-right: 7px !important;
    }
}



/* =========================
   LISTADOS — MARCADOR Y ESTADOS (reglas del componente compartido)
   Resultado verificado en lugar de «vs»; FINALIZADO diferenciable de PRÓXIMO
   sin modificar el diseño original del marcador ni fichas individuales.
========================= */
.f40-table .f40-row .f40-match-title-link.f40-with-final-score {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    text-overflow: clip !important;
}
.f40-table .f40-row .f40-with-final-score .f40-card-team-name {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
.f40-table .f40-row .f40-with-final-score .f40-card-score {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    min-height: 26px !important;
    padding: 4px 6px !important;
    border-radius: 8px !important;
    background: #0f172a !important;
    color: #fff !important;
    font-size: .82rem !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}
/* Ajuste compacto del marcador entre los nombres solo en móvil. */
@media (max-width: 700px) {
    .f40-table .f40-row[data-match-final="1"] .f40-with-final-score {
        gap: 5px !important;
    }
    .f40-table .f40-row[data-match-final="1"] .f40-card-score {
        min-height: 26px !important;
        padding: 4px 6px !important;
        font-size: .8rem !important;
    }
}

/* Estados neutros en listados: FINALIZADO comparte colores con PRÓXIMO.
   EN VIVO conserva el rojo; no modificar los estados del hero individual. */
.f40-table .f40-row .f40-meta .f40-status.finalizado {
    background: #e5e7eb;
    color: #374151;
}


/* Botón de video en resultados finales: icono CSS ligero + texto compacto.
   Conserva una sola línea y el mismo alto; no afecta el CTA sin vídeo.
   Móvil mantiene el ancho completo aprobado mediante la regla responsive. */
.f40-table .f40-row[data-match-final="1"] .f40-meta > a.f40-video-cta {
    gap: 3px !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
    font-size: 11px !important;
    letter-spacing: normal !important;
    white-space: nowrap !important;
}
.f40-table .f40-row[data-match-final="1"] .f40-meta > a.f40-video-cta::before {
    content: "";
    display: inline-block;
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 7px solid currentColor;
}

/* =========================
   INTERLINKING CONTEXTUAL EN FICHAS DE PARTIDO
   v2.55.64
========================= */
.f40-single-related-competition {
    clear: both;
    margin: 30px 0 26px;
}

.f40-single-related-competition > h2 {
    margin-bottom: 16px;
}

.f40-related-competition-more {
    margin: 12px 0 0;
    text-align: right;
}

.f40-related-competition-more a {
    text-decoration: none;
}

.f40-related-competition-more a:hover,
.f40-related-competition-more a:focus {
    text-decoration: underline;
}



/* v2.55.86 - contexto de calendario en cohorte LaLiga */
.f40-laliga-team-context{margin-top:28px;margin-bottom:28px}.f40-laliga-team-context p{margin:0 0 14px}.f40-laliga-team-context p:last-child{margin-bottom:0}



/* v2.56.149: estados no finales confirmados; mismo chip neutral que FINALIZADO,
   sin recolorear EN VIVO ni alterar geometrías de tarjetas y hero. */
.f40-status.interrumpido, .f40-status.suspendido, .f40-status.aplazado,
.f40-status.cancelado, .f40-status.abandonado, .f40-status.administrativo,
.f40-status.incomparecencia {
    background: #e5e7eb !important;
    color: #374151 !important;
}
