/**
 * Estilos del Calendario de Eventos
 * Compatible con WordPress 5.1
 *
 * @package Mi_Calendario_Eventos
 * @since 1.0.0
 */

/* ==========================================================================
   Contenedor principal del calendario
   ========================================================================== */

.mce-calendario-completo {
    max-width: 1200px;
    margin: 0 auto 30px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Buscador y filtros
   ========================================================================== */

.mce-buscador-wrapper {
    margin-bottom: 25px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.mce-form-busqueda {
    display: block;
}

.mce-busqueda-campos {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.mce-campo-busqueda,
.mce-campo-categoria {
    flex: 1;
    min-width: 200px;
}

.mce-campo-busqueda label,
.mce-campo-categoria label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.mce-input-busqueda,
.mce-select-categoria {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.mce-input-busqueda:focus,
.mce-select-categoria:focus {
    outline: none;
    border-color: #0073aa;
}

.mce-campo-botones {
    display: flex;
    gap: 10px;
}

.mce-btn-buscar,
.mce-btn-limpiar {
    padding: 8px 20px;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.mce-btn-buscar {
    background-color: #0073aa;
    color: #ffffff;
}

.mce-btn-buscar:hover {
    background-color: #005177;
}

.mce-btn-limpiar {
    background-color: #666;
    color: #ffffff;
}

.mce-btn-limpiar:hover {
    background-color: #444;
}

/* ==========================================================================
   Encabezado del calendario
   ========================================================================== */

.mce-calendario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #0073aa;
    color: #ffffff;
    border-radius: 4px;
}

.mce-mes-titulo {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

.mce-nav-mes {
    color: #ffffff;
    text-decoration: none;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    transition: background 0.3s;
    font-weight: 500;
}

.mce-nav-mes:hover {
    background: rgba(255, 255, 255, 0.3);
    text-decoration: none;
}

/* ==========================================================================
   Tabla del calendario
   ========================================================================== */

.mce-calendario {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #ffffff;
}

.mce-calendario thead th {
    padding: 12px 5px;
    text-align: center;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.mce-calendario tbody td {
    padding: 0;
    border: 1px solid #e0e0e0;
    vertical-align: top;
    height: 100px;
    min-height: 100px;
    position: relative;
    background: #ffffff;
}

.mce-dia-vacio {
    background: #fafafa !important;
}

.mce-dia-numero {
    padding: 5px 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.mce-dia-hoy {
    background: #fff9e6;
}

.mce-dia-hoy .mce-dia-numero {
    color: #0073aa;
    font-weight: 700;
}

.mce-dia-con-eventos {
    background: #f0f8ff;
}

/* ==========================================================================
   Eventos en el calendario
   ========================================================================== */

.mce-eventos-dia {
    padding: 0 5px 5px;
    max-height: 70px;
    overflow-y: auto;
}

.mce-evento-item {
    margin-bottom: 3px;
    font-size: 11px;
    line-height: 1.3;
}

.mce-evento-item a {
    display: block;
    padding: 3px 5px;
    background: #0073aa;
    color: #ffffff;
    text-decoration: none;
    border-radius: 2px;
    transition: background 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mce-evento-item a:hover {
    opacity: 0.85;
}

.mce-evento-hora {
    font-weight: 600;
    margin-right: 3px;
}

.mce-evento-titulo {
    font-weight: normal;
}

/* Los colores ahora se aplican dinámicamente vía JavaScript */

/* ==========================================================================
   Loader (spinner de carga)
   ========================================================================== */

.mce-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.mce-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: mce-spin 1s linear infinite;
}

@keyframes mce-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mce-calendario-contenido {
    position: relative;
    min-height: 400px;
}

.mce-calendario-contenido.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ==========================================================================
   Lista de próximos eventos (shortcode alternativo)
   ========================================================================== */

.mce-proximos-eventos {
    margin: 20px 0;
}

.mce-lista-eventos {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mce-lista-eventos .mce-evento-item {
    display: flex;
    margin-bottom: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-left: 4px solid #0073aa;
    border-radius: 3px;
}

.mce-evento-fecha {
    flex: 0 0 80px;
    text-align: center;
    padding: 10px;
    background: #0073aa;
    color: #ffffff;
    border-radius: 3px;
    margin-right: 15px;
}

.mce-evento-fecha .mce-fecha {
    display: block;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
}

.mce-evento-info {
    flex: 1;
}

.mce-evento-info h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.mce-evento-info a {
    color: #333;
    text-decoration: none;
}

.mce-evento-info a:hover {
    color: #0073aa;
}

.mce-evento-hora,
.mce-evento-ubicacion {
    display: inline-block;
    margin-right: 15px;
    color: #666;
    font-size: 14px;
}

/* ==========================================================================
   Templates: Single Evento
   ========================================================================== */

.mce-evento-detalle {
    max-width: 800px;
    margin: 0 auto;
}

.mce-evento-imagen {
    margin: 20px 0;
}

.mce-evento-imagen img {
    width: 100%;
    height: auto;
    border-radius: 5px;
}

.mce-evento-meta {
    margin: 25px 0;
    padding: 20px;
    background: #f9f9f9;
    border-left: 4px solid #0073aa;
    border-radius: 3px;
}

.mce-meta-item {
    margin-bottom: 12px;
    font-size: 15px;
}

.mce-meta-item:last-child {
    margin-bottom: 0;
}

.mce-meta-label {
    display: inline-block;
    min-width: 100px;
    font-weight: 600;
    color: #333;
}

.mce-meta-valor {
    color: #666;
}

.mce-volver {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    background: #0073aa;
    color: #ffffff;
    text-decoration: none;
    border-radius: 3px;
    transition: background 0.3s;
}

.mce-volver:hover {
    background: #005177;
    text-decoration: none;
}

/* ==========================================================================
   Templates: Archive Eventos
   ========================================================================== */

.mce-eventos-lista {
    margin: 20px 0;
}

.mce-eventos-lista .mce-evento-item {
    display: flex;
    margin-bottom: 30px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mce-evento-thumbnail {
    flex: 0 0 200px;
    margin-right: 20px;
}

.mce-evento-thumbnail img {
    width: 100%;
    height: auto;
    border-radius: 3px;
}

.mce-evento-contenido {
    flex: 1;
}

.mce-evento-contenido .entry-title {
    margin: 0 0 12px;
    font-size: 22px;
}

.mce-evento-contenido .entry-title a {
    color: #333;
    text-decoration: none;
}

.mce-evento-contenido .entry-title a:hover {
    color: #0073aa;
}

.mce-evento-info-breve {
    margin-bottom: 15px;
    padding: 10px 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.mce-evento-info-breve span {
    display: inline-block;
    margin-right: 20px;
    color: #666;
    font-size: 14px;
}

.mce-evento-info-breve strong {
    color: #333;
}

.mce-ver-mas {
    display: inline-block;
    margin-top: 10px;
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}

.mce-ver-mas:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Responsive: Tablets y móviles
   ========================================================================== */

@media (max-width: 768px) {
    .mce-busqueda-campos {
        flex-direction: column;
    }

    .mce-campo-busqueda,
    .mce-campo-categoria {
        min-width: 100%;
    }

    .mce-calendario-header {
        flex-direction: column;
        gap: 10px;
    }

    .mce-mes-titulo {
        font-size: 20px;
    }

    .mce-calendario tbody td {
        height: 80px;
        min-height: 80px;
    }

    .mce-dia-numero {
        font-size: 12px;
        padding: 3px 5px;
    }

    .mce-eventos-dia {
        max-height: 55px;
    }

    .mce-evento-item {
        font-size: 10px;
    }

    .mce-eventos-lista .mce-evento-item {
        flex-direction: column;
    }

    .mce-evento-thumbnail {
        flex: 0 0 auto;
        margin: 0 0 15px 0;
        width: 100%;
    }

    .mce-lista-eventos .mce-evento-item {
        flex-direction: column;
    }

    .mce-evento-fecha {
        flex: 0 0 auto;
        margin: 0 0 10px 0;
        width: 80px;
    }
}

@media (max-width: 480px) {
    .mce-calendario-completo {
        padding: 10px;
    }

    .mce-calendario thead th {
        padding: 8px 2px;
        font-size: 12px;
    }

    .mce-calendario tbody td {
        height: 60px;
        min-height: 60px;
    }

    .mce-eventos-dia {
        max-height: 40px;
    }

    .mce-evento-item a {
        padding: 2px 3px;
        font-size: 9px;
    }

    .mce-mes-titulo {
        font-size: 18px;
    }

    .mce-nav-mes {
        padding: 6px 10px;
        font-size: 13px;
    }

    .mce-modal-contenido {
        width: 95%;
        max-width: 95%;
        padding: 15px;
    }

    .mce-modal-body {
        flex-direction: column;
    }

    .mce-modal-imagen-container {
        margin-bottom: 20px;
    }
}

/* ==========================================================================
   Modal de Evento
   ========================================================================== */

.mce-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mce-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.mce-modal-contenido {
    position: relative;
    z-index: 2;
    background: #ffffff;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    padding: 30px;
}

.mce-modal-cerrar {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #e74c3c;
    color: #ffffff;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.3s;
    z-index: 3;
}

.mce-modal-cerrar:hover {
    background: #c0392b;
}

.mce-modal-body {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.mce-modal-imagen-container {
    flex: 0 0 250px;
}

.mce-modal-imagen {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid #0073aa;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.mce-modal-info {
    flex: 1;
}

.mce-modal-titulo {
    margin: 0 0 20px;
    font-size: 26px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 3px solid #0073aa;
}

.mce-modal-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
}

.mce-modal-meta-item {
    font-size: 15px;
}

.mce-modal-meta-item strong {
    display: block;
    color: #0073aa;
    font-weight: 600;
    margin-bottom: 5px;
}

.mce-modal-meta-item span {
    color: #555;
}

.mce-modal-descripcion {
    margin-top: 20px;
}

.mce-modal-descripcion h3 {
    margin: 0 0 15px;
    font-size: 20px;
    color: #333;
}

.mce-modal-descripcion #mce-modal-descripcion-texto {
    color: #666;
    line-height: 1.6;
    font-size: 15px;
}

/* Ocultar elementos del modal si están vacíos */
.mce-modal-meta-item.hidden {
    display: none;
}

/* Animación de entrada del modal */
@keyframes mce-modal-fade-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.mce-modal-contenido {
    animation: mce-modal-fade-in 0.3s ease-out;
}

/* Responsive para el modal */
@media (max-width: 768px) {
    .mce-modal-body {
        flex-direction: column;
        align-items: center;
    }

    .mce-modal-imagen-container {
        flex: 0 0 auto;
        margin-bottom: 20px;
    }

    .mce-modal-imagen {
        width: 200px;
        height: 200px;
    }

    .mce-modal-meta {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 15px;
    }

    .mce-modal-titulo {
        font-size: 22px;
    }
}
