/* ----------------------------------- */
/* --- 1. COLORES Y VARIABLES CSS --- */
/* ----------------------------------- */
:root {
    --color-primario: #243746; /* Azul Oscuro */
    --color-secundario: #eb0045; /* ROJO VIBRANTE */
    --color-secundario-hover: #ffffff;
    --color-regalo-hover: #ffffff;
    --color-skeleton: #e0e0e0;
    --color-agotado-bg: var(--color-secundario);
    --color-fecha-en-curso:#4CAF50; /* verde */
    --color-fecha-hoy: var(--color-secundario); /* rojo que ya usas */
    --color-fecha-normal: var(--color-fecha-bg); /* azul actual */
    --color-fecha-bg: rgba(36, 55, 70, 0.9); /* Azul oscuro transparente para fecha/ciudad */
    --color-fondo-tarjeta-titulo: #ffffff; /* Fondo blanco para el título */
    --color-titulo-text: #333; /* Color oscuro para el título */
    --color-contador: var(--color-secundario); /* EN ROJO */
}

/* Estados de la barra de fecha */
.event-card .fecha-badge { background-color: var(--color-fecha-normal); }
.event-card .fecha-badge.en-curso { background-color: var(--color-fecha-en-curso); }
.event-card .fecha-badge.hoy { background-color: var(--color-fecha-hoy); }

/* ----------------------------------- */
/* --- 2. ESTILOS DE CARGA (SKELETON) --- */
/* ----------------------------------- */
.event-card.loading {
    background-color: #f4f4f4;
    border: 1px solid #eee;
    cursor: default;
}
.event-card.loading:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.event-card.loading .skeleton-image {
    width: 100%;
    height: 300px;
    background-color: var(--color-skeleton);
    animation: pulse 1.5s infinite ease-in-out;
}
.event-card.loading .skeleton-title {
    height: 1.2rem;
    margin: 10px;
    background-color: var(--color-skeleton);
    animation: pulse 1.5s infinite ease-in-out 0.2s;
}
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1.0; }
    100% { opacity: 0.6; }
}

/* ----------------------------------- */
/* --- 3. GALERÍA GLOBAL Y TARJETAS (UNIFICADO) --- */
/* ----------------------------------- */

/* Clase Global de Galería (Aplica a la general y las de categoría,
   funciona tanto en <div> como en <main> o cualquier otra etiqueta) */
.agenda-galeria-eventos {
    display: flex; /* CRÍTICO: Muestra las tarjetas en fila */
    overflow-x: scroll; /* CRÍTICO: Permite el desplazamiento horizontal */
    white-space: nowrap; /* Evita que las tarjetas salten de línea */
    gap: 20px;
    padding: 0 20px 20px 20px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    justify-content: flex-start;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto; /* Centra el carrusel en el contenedor padre */
}

/* Estilo para la barra de scroll (Aplicación Global) */
.agenda-galeria-eventos::-webkit-scrollbar {
    height: 8px; /* Tamaño más visible y manejable */
}
.agenda-galeria-eventos::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.event-card {
    width: 200px;
    flex-shrink: 0;
    scroll-snap-align: start;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: var(--color-fondo-tarjeta-titulo);
    border-radius: 8px;
    overflow: hidden;
    height: 385px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.event-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Contenedor de la Imagen */
.card-image-container {
    width: 100%;
    height: 300px;
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.entry > p:first-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}
.event-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
}

/* Contenedor Inferior (Título y Footer de Fecha/Ciudad) */
.card-content-footer {
    height: 85px;
    padding: 5px 0 0 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ----------------------------------- */
/* --- 4. BADGES DE TARJETA --- */
/* ----------------------------------- */

/* Badge Agotado */
.event-card .agotado-badge {
    position: absolute;
    top: 150px;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-20deg);
    background-color: var(--color-agotado-bg);
    color: white;
    padding: 8px 25px;
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 1px;
    border-radius: 5px;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    text-transform: uppercase;
}

/* Badge Destacado */
.event-card .destacado-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: var(--color-secundario);
    color: white;
    padding: 4px 10px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 3px;
    z-index: 10;
    text-transform: uppercase;
}

/* ✅ Opción B: Banner superior completo (reemplaza la cinta inclinada) */
.event-card .oferta-badge{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 15;
    background-color: var(--color-secundario);
    color: #fff;
    padding: 8px 10px;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    box-sizing: border-box;
    border-radius: 8px 8px 0 0;  /* sigue el radio de la imagen/tarjeta */
    display: flex;
    align-items: center;
    justify-content: center;     /* ✅ centrado horizontal */
    text-align: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
/* Texto largo: permite hasta 2 líneas y recorta con ellipsis */
.event-card .oferta-badge span{
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.event-card .oferta-badge i{ font-size: 0.9rem; }

/* Título */
.event-card .card-title {
    color: var(--color-titulo-text);
    font-size: 1rem;
    font-weight: bold;
    padding: 5px 10px;
    height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.2;
}

/* Footer de fecha/ciudad */
.event-card .fecha-badge {
    width: 100%;
    background-color: var(--color-fecha-bg);
    color: white;
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: normal;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    line-height: 1.2;
}
.event-card .fecha-badge i {
    margin-right: 5px;
    font-size: 0.9rem;
}
.event-card .fecha-badge div {
    white-space: nowrap;
}

/* ----------------------------------- */
/* --- 5. ESTILOS DEL MODAL --- */
/* ----------------------------------- */
.modal {
    display: none;
    font-size: 0.98rem;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* Permite scroll del fondo oscuro */
    background-color: rgba(0,0,0,0.8);
    padding: 20px 0; 
}
.modal.show {
    display: flex;
    justify-content: center;
}
.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    margin: auto 40px; 
    min-height: 700px;
    display: flex;
    flex-direction: column; /* Contenedor vertical */
    height: auto; /* Permite que crezca con el contenido */

}

/* ESTILO BOTÓN CERRAR - Versión PC */
.close-button {
    color: white;
    background-color: var(--color-secundario);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: background-color 0.2s ease;
    z-index: 1010;
}
.close-button:hover {
    background-color: var(--color-primario);
    color: white;
}

.modal-main-info {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    /* ✅ Mantenemos flex-grow: 1 REMOVIDO para que su altura sea la de su contenido más alto */
    min-height: 1px;
    align-items: flex-start; 
}

/* IMAGEN DEL MODAL (PC): Rellena el espacio */
#modal-foto {
    width: auto;
    max-width: 40%;
    height: 380px; 
    object-fit: cover; 
    border-radius: 5px;
    margin-right: 20px;
    display: block;
    flex-shrink: 0;
}
.modal-details {
    width: 60%;
    line-height: 1.5;
    overflow-y: visible; /* Asegura que el contenido (video) pueda determinar la altura total */
    max-height: none; 
    flex-grow: 1;
    flex-basis: 60%;
    /* 💥 CORRECCIÓN FINAL: Eliminamos min-height forzado para que la altura la defina el contenido real (incluyendo el video) */
    /* min-height: 380px; */ 
}
.modal-details p {
    margin: 5px 0;
}
.modal-details strong {
    color: var(--color-primario);
    font-size: 1em !important;
}

/* TÍTULO DEL MODAL */
#modal-titulo {
    text-align: center;
    color: var(--color-primario);
    padding-bottom: 5px;
    margin-bottom: 20px;
    border-bottom: 3px solid var(--color-secundario);
    font-size: 1.6em;
}

/* CONTADOR */
.modal-details #modal-countdown {
    text-align: center;
    margin-top: 15px;
    font-weight: bold;
    padding: 5px 0;
    border-top: 1px solid #eee;
    color: var(--color-contador);
    font-size: 1.1em;
}

/* Estilo específico para el mensaje de HOY (¡ES HOY!!!) */
.modal-details #modal-countdown.is-today {
    font-size: 1.5rem;
    padding: 10px 0;
    border-top: 2px solid var(--color-secundario);
}

.modal-video {
    margin-bottom: 20px;
}
.modal-video iframe {
    border-radius: 5px;
}

/* ESTILOS DE BOTONES */
.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-shrink: 0; /* Evita que los botones se encojan */
}
.action-btn {
    width: 45%;
    padding: 15px;
    text-align: center;
    color: white !important;
    text-decoration: none;
    font-size: 1.1rem;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#modal-entradas-btn {
    background-color: var(--color-secundario);
}
#modal-entradas-btn:hover {
    background-color: var(--color-secundario-hover);
    color: var(--color-primario) !important;
}
#modal-regalo-btn {
    background-color: var(--color-regalo);
}
#modal-regalo-btn:hover {
    background-color: var(--color-regalo-hover);
    color: var(--color-primario) !important;
}
.action-btn.hidden {
    display: none;
}

/* NAVEGACIÓN MODAL (Flechas) */
.modal-nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 15px 10px;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1001;
    opacity: 0.8;
    transition: opacity 0.3s, background 0.3s;
    border: none;
    outline: none;
    height: 100px;
    display: flex;
    align-items: center;
}
.modal-nav-arrow:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}
.modal-nav-arrow.disabled {
    opacity: 0.3;
    cursor: default;
}
#prev-event-btn {
    left: 0;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}
#next-event-btn {
    right: 0;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

/* ----------------------------------- */
/* --- 6. RESPONSIVE (MÓVIL) --- */
/* ----------------------------------- */
@media (max-width: 600px) {
    /* Ocultar scrollbars en carrusel */
    .agenda-galeria-eventos {
        /* Ocultar barra de desplazamiento en webkit */
        -webkit-overflow-scrolling: touch;
        -ms-overflow-style: none;
        scrollbar-width: none;
        padding: 0 20px 20px 20px;
    }
    .agenda-galeria-eventos::-webkit-scrollbar {
        display: none;
    }

    .modal-content {
        min-height: auto;
        margin: 10px;
        max-height: 95vh;
        overflow-y: auto;
        padding: 10px;
    }

    /* AJUSTE FINAL: Botón 'X' más arriba en móvil */
    .close-button {
        width: 25px;
        height: 25px;
        font-size: 18px;
        top: 2px;
        right: 5px;
        z-index: 100;
    }

    /* Título del Modal en móvil */
    #modal-titulo {
        font-size: 1.4rem;
        margin-top: 10px;
    }

    /* Secciones del Modal */
    .modal-main-info {
        flex-direction: column;
        min-height: auto;
        align-items: center;
    }

    /* IMAGEN DEL MODAL (MÓVIL) */
    #modal-foto {
        width: 100%;
        max-width: 98%;
        height: 460px;
        margin-right: 0;
        margin-bottom: 15px;
        object-fit: cover;
    }
    .modal-details {
        width: 100%;
        max-height: none;
        overflow-y: visible; 
        min-height: auto; 
    }
    .modal-buttons {
        flex-direction: column;
    }
    .action-btn {
        width: 90%;
        margin: 5px auto;
    }

    /* Flechas en móvil */
    .modal-nav-arrow {
        top: 50%;
        transform: translateY(-50%);
        padding: 5px;
        height: 60px;
        font-size: 1.5rem;
        background: rgba(0, 0, 0, 0.3);
        display: flex !important;
    }
    #prev-event-btn {
        left: 5px;
    }
    #next-event-btn {
        right: 5px;
    }

    /* Tamaños de tarjeta */
    .event-card {
        width: 180px;
        height: 365px;
    }
    .card-image-container {
        height: 280px;
    }
    .card-content-footer {
        height: 85px;
    }
    .event-card .agotado-badge {
        padding: 6px 15px;
        font-size: 1rem;
        top: 140px;
    }

    /* ✅ Ajuste móvil para el banner superior */
    .event-card .oferta-badge{
        font-size: 0.85rem;
        padding: 5px 8px;
    }

    .modal-details #modal-countdown {
        font-size: 1rem;
    }
    .modal-details #modal-countdown.is-today {
        font-size: 1.3rem;
    }
} /* Cierre de media query (max-width: 600px) para estilos de tarjeta */

/* ----------------------------------- */
/* --- 7. ESTILOS DE FILTROS --- */
/* ----------------------------------- */
.filter-container {
    display: flex;
    overflow-x: scroll; /* Permite scroll horizontal si hay muchas categorías */
    white-space: nowrap;
    gap: 10px;
    padding: 10px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}
.filter-container::-webkit-scrollbar {
    display: none; /* Ocultar barra de desplazamiento en webkit */
}
.filter-button {
    flex-shrink: 0;
    padding: 8px 15px;
    border: 2px solid var(--color-primario);
    background-color: transparent;
    color: var(--color-primario);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.2s ease;
    text-transform: uppercase;
}
.filter-button:hover {
    background-color: var(--color-primario);
    color: white;
}
.filter-button.active {
    background-color: var(--color-secundario);
    border-color: var(--color-secundario);
    color: white;
}

/* Responsividad para móviles */
@media (max-width: 600px) {
    .filter-container {
        padding: 10px 10px;
    }
} /* Cierre de media query (max-width: 600px) para filtros */

/* ----------------------------------- */
/* --- ESTILOS DEL DESPLEGABLE DE FILTRO --- */
/* ----------------------------------- */

/* Contenedor del desplegable */
#category-filters {
    display: flex;
    justify-content: flex-start;
    align-items: center;          /* centra verticalmente si hay otros elementos */
    gap: 8px;  
    padding: 10px 0;
    width: 100%;
    margin-bottom: 15px;
}

/* Estilo principal del select */
#category-select {
    padding: 4px 15px;
    font-size: 1rem;
    font-weight: bold;
    color: var(--color-primario);
    background-color: #fff;
    border: 2px solid var(--color-primario);
    border-radius: 8px;
    cursor: pointer;
    appearance: none; /* Oculta el icono de flecha nativo */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23243746%22%20d%3D%22M287%2069.9L146.2%20210.7%205.4%2069.9z%22%2F%3E%3C%2Fsvg%3E'); /* Flecha personalizada */
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 12px;
    min-width: 265px; /* Ancho mínimo para que se vea bien */
}

/* Estado al pasar el mouse (opcional) */
#category-select:hover {
    border-color: var(--color-secundario);
    color: var(--color-secundario);
}

/* Asegura que el contenedor y los controles acepten eventos de puntero */
.modal { pointer-events: auto !important; }
.modal-content { position: relative; z-index: 2; }

/* Botón cerrar y flechas SIEMPRE clicables y por encima del contenido del modal */
.close-button,
.modal-nav-arrow {
  pointer-events: auto !important;
  z-index: 2147482000 !important; /* debajo del .modal (2147483647), pero sobre cualquier overlay interno */
}

/* Por si algún estilo global anuló clics accidentalmente */
.close-button * ,
.modal-nav-arrow * {
  pointer-events: none; /* el botón capta el clic, no sus hijos decorativos */
}
	
/* 🔧 FIX: Asegurar que los controles del modal sean clicables