/* Contenedor del calendario */
.calendario-container {
    width: 100%;
    margin: 0 auto;
    overflow-x: auto;
}

/* Encabezado */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mes-anio {
    font-size: 18px;
    font-weight: bold;
    color: #009AD8;
}

.nav-buttons {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #555;
}

#prev-mes:hover {
    background-color: #dcdcdc;
    z-index: 10;
}
#next-mes:hover {
    background-color: #dcdcdc;
    z-index: 10;
}

/* Estilos para los encabezados de los días */
.encabezados-dias {
    display: grid;
    grid-template-columns: repeat(31, minmax(35px, 1fr));
    gap: 5px;
    width: 100%;
    margin-bottom: 5px;
}

/* Estilos de la grilla del calendario */
.calendario {
    display: grid;
    grid-template-columns: repeat(31, minmax(35px, 1fr));
    gap: 5px;
    width: 100%;
}

/* Encabezado de los días de la semana */
.dia-header {
    text-align: center;
    padding: 5px 2px;
    font-weight: bold;
    color: #009AD8;
    font-size: 12px;
}

/* Estilos de cada celda del día */
.celda-dia {
    position: relative;
    text-align: center;
    padding: 10px 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border-radius: 4px;
}

.celda-dia:hover {
    background-color: #dcdcdc;
    z-index: 10;
}

.numero-dia {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 15px;
}

.indicador-evento {
    width: 8px;
    height: 8px;
    background-color: #009AD8;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
    display: block;
    transition: all 0.3s ease;
}

.celda-dia:hover .indicador-evento {
    width: 16px;
}

.celda-dia.dia-seleccionado {
    background-color: #009AD8;
    color: white;
}

.dia-seleccionado .indicador-evento {
    background-color: white;
}

/* Popup de eventos */
.popup-eventos {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
    width: 270px;
    z-index: 100;
    text-align: left;
    padding: 0;
    margin-bottom: 15px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

/* Popup activo con transición */
.popup-active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}



/* Flecha que apunta hacia abajo */
.popup-eventos:after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
    border-bottom: none;
}

/* Estilo de los eventos */
.evento-item {
    padding: 10px 15px;
    background-color: #f8f8f8;
    margin-bottom: 1px;
    display: flex;
    flex-direction: column;
}

.evento-fecha {
    background-color: #eee;
    color: #333;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
}

.evento-lugar {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.evento-titulo {
    font-size: 14px;
    margin-bottom: 8px;
    color: #555;
}

/* Botón de Tickets */
.evento-accion {
    display: flex;
    justify-content: flex-end;
}

.btn-tickets {
    background-color: #009AD8 !important; 
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    z-index: 1002; /* ASEGURAR que esté por encima */
    transition: background-color 0.2s;
}

.btn-tickets:hover {
    background-color: #0074a2 !important;
}

.celda-dia.vacia {
    background-color: rgba(222, 222, 222, 0.457);
    pointer-events: none;
}

/* Media Queries */
@media (max-width: 1200px) {
    .calendario, .encabezados-dias {
        grid-template-columns: repeat(7, minmax(30px, 1fr));
    }
    .popup-eventos {
        width: 280px;
    }
}

@media (max-width: 992px) {
    .calendario, .encabezados-dias {
        grid-template-columns: repeat(7, minmax(25px, 1fr));
    }
}

/* Ajustar el grid en móviles */
@media (max-width: 768px) {
    .calendario-container {
        overflow-x: auto;
    }

    .calendario, .encabezados-dias {
        grid-template-columns: repeat(7, 1fr); /* 7 columnas en móviles */
        min-width: 100%;
    }
    
    .popup-eventos {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 300px;
        bottom: auto; /* Importante para anular el 'bottom' de la versión desktop */
        margin-bottom: 0;
        z-index: 1000;
    }

    /* Popup activo con transición */
    .popup-active {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, -50%);
        pointer-events: auto;
    }

    /* Ocultar la flecha en móviles */
    .popup-eventos:after {
        display: none;
    }

    /* Corregir el overlay de fondo en móviles */
    .popup-eventos.popup-active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 999;
    }
}

@media (max-width: 576px) {
    .calendario, .encabezados-dias {
        min-width: 380px;
        max-width: 380px;
    }
    
    /* Popup más pequeño en móviles pequeños */
    .popup-eventos {
        width: 85%;
        max-width: 280px;
    }
    
    /* Reducir padding y tamaños de fuente en móviles */
    .evento-item {
        padding: 8px 12px;
    }
    
    .evento-fecha {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .evento-lugar {
        font-size: 13px;
    }
    
    .evento-titulo {
        font-size: 13px;
    }
    
    .btn-tickets {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* Estilo para días que ya han pasado */
.celda-dia.dia-pasado {
    opacity: 0.5;
    color: #999999;
}

/* Estilo para botón de navegación deshabilitado */
.nav-buttons.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}