/* ========================================= */
/* 1. CONTENEDOR PRINCIPAL DEL WIDGET (ph-fixtures) */
/* ========================================= */

.ph-fixtures {
    /* Fondo y estructura general */
    max-width: 98%;
    margin: 20px auto;
    background-color: #f2f2f2;
    border-radius: 0px;
    padding: 2px;
    margin: 0 auto !important;
    background: linear-gradient(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)),
        url('https://vivepotosi.com/wp-content/uploads/2025/10/fondopartidos.webp');
    
    /* === CLAVES PARA EL CENTRADO CONDICIONAL EN PC === */
    display: flex; /* 1. Convertimos el padre en Flex */
    flex-direction: column; /* Apila los hijos verticalmente */
    justify-content: center; /* 2. Siempre intentamos centrar el contenido (útil para el listado) */
    align-items: center; /* Centra el carrusel horizontalmente */
}

/* ========================================= */
/* 2. TÍTULO PRINCIPAL DEL WIDGET (ph-widget-title) */
/* ========================================= */

.ph-widget-title {
    width: 100%; /* Ocupa todo el ancho */
    text-align: center; /* Centra el texto */
    font-size: 1.2em;
    font-weight: bold;
    color: black;
    padding: 10px 0 5px 0;
    margin-bottom: 5px;
}

/* ========================================= */
/* 3. CONTENEDOR DE LA LISTA / CARRUSEL (ph-list) */
/* ========================================= */

.ph-list {
    display: flex;
    flex-direction: row; /* Carrusel horizontal */
    flex-wrap: nowrap;
    gap: 20px;
    
    /* Scroll y posicionamiento */
    overflow-x: auto; /* Activa el scroll horizontal SÓLO si el contenido desborda */
    scroll-snap-type: x mandatory;
    max-width: 100%;
    width: auto;
    margin-left: 0;
    margin-right: 0;
    padding-bottom: 10px;
    
    /* Estilos de scroll estándar (Para Firefox) */
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* ========================================= */
/* 4. TARJETA INDIVIDUAL DE PARTIDO (ph-card) */
/* ========================================= */

.ph-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    color: #333;
    
    /* Apariencia */
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #FAFAFA;
    transition: box-shadow 0.2s;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    position: relative;
    
    /* Flex y dimensiones */
    flex-shrink: 0;
    flex-grow: 0;
    min-width: 260px;
    min-height: 10px;
    scroll-snap-align: start;
}

.ph-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* 4.1. Contenido del partido (Logos y Marcador) */

.ph-match {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 5px 5px;
    flex-grow: 1;
}

.ph-team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-weight: 600;
}

.ph-names {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.ph-names img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.ph-name-full {
    display: none;
}

.ph-name-short {
    display: inline;
    font-size: 1.0em;
}

.ph-center {
    flex-shrink: 0;
    width: 70px;
    text-align: center;
}

.ph-vs {
    font-size: 1.4em;
    color: #222222;
    font-weight: bold;
    margin-bottom: 5px;
}

.ph-score {
    font-size: 1.5em;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1;
    margin-top: 10px;
}

.ph-status-time {
    font-size: 1.0em;
    color: #333;
    font-weight: 500;
    line-height: 1.2;
    padding-top: 5px;
}

/* 4.2. Metadatos (Torneo Jor. 13 - ph-meta-line) */

.ph-meta-line {
    display: flex;
    flex-direction: column; /* Apilamos verticalmente */
    justify-content: center;
    align-items: center; /* Centra el contenido horizontalmente */
    font-size: 1.0em;
    color: #000000;
    padding: 2px 0;
    border-top: 2px solid #eee;
    width: 100%;
    margin: 0;
    background-color: #FAFAFA;
    font-weight: bold;
}

.ph-meta-line .ph-separator {
    margin: 0 5px;
    color: #999;
}

/* 4.3. Modificadores de estado (Borde izquierdo de ph-meta-line) */

.ph-card[data-status="PARTIDO EN JUEGO"] .ph-meta-line {
    border-left: 4px solid #e74c3c;
    background-color: #FDEDEC;
}

.ph-card[data-status="PROXIMAMENTE"] .ph-meta-line {
    border-left: 4px solid #27ae60;
    background-color: #EAFAF1;
}

.ph-card[data-status="FINALIZADO"] .ph-meta-line {
    border-left: 4px solid #2f2f2f;
    background-color: #f2f2f2;
}

.ph-card[data-status="MEDIO TIEMPO"] .ph-meta-line {
    border-left: 4px solid #f39c12;
    background-color: #FEF5E7;
}

/* 4.4. Etiqueta de estado (ph-status-tag) */

.ph-card > .ph-status-tag {
    margin: 10px auto 10px;
    width: fit-content;
    display: block;
}

.ph-status-tag {
    padding: 7px 14px;
    font-size: 0.9em;
    font-weight: bold;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    text-transform: uppercase;
    line-height: 1;
}

.ph-status-tag[data-status="PARTIDO EN JUEGO"] {
    background-color: #e74c3c;
}

.ph-status-tag[data-status="PROXIMAMENTE"] {
    background-color: #27ae60;
}

.ph-status-tag[data-status="FINALIZADO"] {
    background-color: #2f2f2f;
}

.ph-status-tag[data-status="MEDIO TIEMPO"] {
    background-color: #f39c12;
}


/* ========================================= */
/* 5. BOTONES Y ENLACES */
/* ========================================= */

.ph-link-btn {
    display: block;
    margin-top: 5px;
    padding: 2px 5px;
    background-color: #696969;
    color: #ffffff;
    font-size: 0.7em;
    font-weight: bold;
    border-radius: 3px;
    text-decoration: none;
    text-align: center;
    line-height: 1.1;
}

.ph-link-btn-live {
    display: flex;
    justify-content: center; /* Centra horizontalmente */
    align-items: center; /* Centra verticalmente */
    margin-top: 5px;
    padding: 2px 5px;
    background-color: #e74c3c;
    color: #fff;
    font-size: 0.75em;
    font-weight: bold;
    border-radius: 3px;
    text-align: center;
    text-decoration: none;
    line-height: 1.1;
}

/* ========================================= */
/* 6. COMPONENTES DE OCULTACIÓN FORZADA */
/* ========================================= */

.ph-selectbar,
.ph-select,
.ph-goals,
.ph-city,
.ph-dt,
.ph-live-tag,
.ph-live-time,
.ph-resumen {
    display: none !important;
}

/* ========================================= */
/* 7. AJUSTES PARA COMPONENTES EXTERNOS (WP) */
/* ========================================= */

.stream-item-below-header:has(.vp-modulo-fixtures) {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}


/* Fix exclusivo para el módulo de partidos */
.stream-item-below-header:has(.ph-fixtures),
.stream-item:has(.ph-fixtures) {
    margin: 0 !important;
    padding: 0 !important;
}

/* ========================================= */
/* 8. MEDIA QUERIES (COMPORTAMIENTO RESPONSIVO) */
/* ========================================= */

/* 📱 MÓVIL (<= 768px) */
@media (max-width: 768px) {
    /* Comportamiento por defecto (scroll si hay muchos partidos) */
    .ph-list {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        gap: 15px;
        scroll-snap-type: x mandatory;
    }
    
    /* Centrado condicional (si hay 1 o 2 partidos) */
    .ph-list.center-align {
        justify-content: center;
        overflow-x: hidden;
    }

    /* Estilos de margen para las tarjetas en móvil si se usa centrado */
    .ph-card {
        margin: 10px;
    }
    
    .ph-widget-title {
        margin-bottom: 5px; /* Ejemplo: Duplicar el espacio en móvil */
    }    
}

/* 💻 PC (> 768px) */
@media (min-width: 769px) {
    /* Comportamiento por defecto (scroll si hay muchos partidos) */
    .ph-list {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        gap: 20px;
        scroll-snap-type: x mandatory;
    }
    
    /* Centrado condicional (si hay 1–4 partidos) */
    .ph-list.center-align {
        justify-content: center;
        overflow-x: hidden;
    }

    /* Estilos de Scrollbar para PC (WebKit/Chrome/Safari) */
    .ph-list::-webkit-scrollbar {
        height: 8px;
    }

    .ph-list::-webkit-scrollbar-thumb {
        background: #999;
        border-radius: 4px;
    }

    .ph-list::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
}