/* Contenedor Principal */
.cdb-events-container {
    color: #444;
    margin: 0 auto;
}
.cdb-events-body{
    margin:16px auto;
}
.cdb-events-nav, .cdb-mobile-controls, .cdb-active-filters-bar, .cdb-events-search{
    margin-bottom:12px;
}

/* 1. BUSCADOR SUPERIOR */
.cdb-events-search input {
    width: 100%;
    padding: 12px 24px;
    border: 1px solid #ccc;
    border-radius: 50px; /* Estilo píldora */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
    background-repeat: no-repeat;
    background-position: calc(100% - 20px) center;
    outline: none;
    font-family:inherit;
}

/* 2. NAVEGACIÓN SUPERIOR (BOTONES) */
.cdb-events-nav-bg{
    background-color:#EBEBEB;
}

.cdb-events-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 6px;
    justify-content: center;
}

.cdb-events-nav button {
    background: #fff;
    border: 1px solid #638c56; /* Verde de la imagen */
    color: #444;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.cdb-events-nav button.active, 
.cdb-events-nav button:hover {
    background: #638c56;
    color: #fff;
}


/* 3. LAYOUT CUERPO (Sidebar + Grid) */
.cdb-events-body.has-sidebar {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 40px;
}

/* 4. SIDEBAR DE FILTROS */
.cdb-events-sidebar {
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.cdb-sidebar-title {
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.cdb-sidebar-title svg{
    width:32px;
}
.cdb-sidebar-title span{
    text-transform:uppercase;
}

.cdb-filter-section {
    margin-bottom: 30px;
}

.cdb-filter-section h5 {
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 15px;
    color: #333;
    text-transform: uppercase;
}

/* Inputs de fecha con el botón lupa */
.cdb-filter-section input[type="date"] {
    border: 1px solid #638c56;
    border-radius: 20px;
    padding: 8px 15px;
    width: 100%;
    outline: none;
}

/* Listado de filtros (Tema, Tipo de Evento) */
.cdb-tax-filter {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cdb-tax-filter li {
    font-size: 14px;
    padding: 5px 0;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.cdb-tax-filter li:hover,
.cdb-tax-filter li.active {
    color: #638c56;
    font-weight: 600;
}

/* 5. TARJETAS DE LA REJILLA (CARDS) */
.cdb-post-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.cdb-noticias-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
}


.cdb-post-card {
    position: relative;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    padding-left:8px;
    padding-right:8px;
    padding-top:8px;
}
.cdb-noticias-results .cdb-post-card .cdb-post-category{
    display:none;
}
.cdb-post-title-container{
    flex-grow:1;
}
.cdb-post-title, .cdb-post-title a{
    text-decoration:none;
}

/* Etiqueta flotante (EVENTO) */

/* Estilizamos el nuevo elemento dinámico */
.category-badge {
    background-color: #638c56; /* El verde que estás usando */
    color: #ffffff;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 999px;
    display: inline-block;
    margin-bottom: 10px;
}

.cdb-post-image img {
    width: 100%;
    height: 100%;
    aspect-ratio:4/3;
    object-fit: cover;
    margin-bottom: 15px;
}
.cdb-post-results .cdb-post-card .cdb-post-image img
{
    aspect-ratio:1/1.4!important;
}
.cdb-post-category {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #444;
    margin-bottom: 10px;
}

.cdb-post-category::before {
    content: "";
    width: 12px;
    height: 12px;
    background: #638c56;
    border-radius: 50%;
}
.cdb-post-content{
    display:flex;
    flex-direction: column;
}
.cdb-post-content h3 {
    font-size: 16px;
    line-height: 1.2;
    font-weight: 700;
    overflow: hidden;
}

.cdb-post-date {
    display: flex;
    align-items: flex-start;
    gap: 8px; /* Espacio entre icono y texto */
    color: #638c56;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 10px;
    line-height:1.2;
}

.cdb-post-calendar-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    /* Si el SVG es negro y lo quieres verde via CSS, puedes usar: */
    /* filter: sepia(100%) hue-rotate(60deg) saturate(500%); */
}

.cdb-post-read-more {
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
    text-transform: uppercase;
}

@media (min-width:1024px){
    .cdb-post-results .cdb-post-container{
        display:flex;
        gap:16px;
        margin-top:16px;
    }
    .cdb-post-results .cdb-post-image, .cdb-post-results .cdb-post-content{
        width:50%;
    }
}

/* BOTONES DE CONTROL MÓVIL */
.cdb-mobile-controls {
    display: none;
    gap: 10px;
}

.cdb-btn-outline {
    background: #fff;
    border: 1px solid #5E8A57;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform:uppercase;
}

.cdb-btn-reset {
    display:flex;
    align-items: center;
    background: #638c56;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    cursor: pointer;
}

/* RESET LINK ESCRITORIO */
.cdb-reset-link {
    background: none;
    border: none;
    color: #638c56;
    text-decoration: underline;
    font-size: 12px;
    margin-left: auto;
    cursor: pointer;
}

.cdb-sidebar-header-mobile { display: none; } /* Oculto en PC */


@media (max-width: 768px) {
    .cdb-sidebar-header-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 20px;
        margin-bottom: 20px;
        font-weight: 900;
        font-size: 20px;

        border-bottom: 1px solid #eee;
    }

    .cdb-sidebar-header-mobile span {
        font-weight: 800;
        font-size: 1.2rem;
        color: #333;
    }

    /* El botón de la X */
    #cdb-close-filters {
        background: #f5f5f5;
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        font-size: 24px;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: #666;
        transition: background 0.2s;
    }

    #cdb-close-filters:hover {
        background: #e0e0e0;
        color: #000;
    }

}


/* SIDEBAR MÓVIL (MODAL) */
@media (max-width: 768px) {
    .cdb-mobile-controls { display: flex; }
    
    .cdb-events-body.has-sidebar {
        grid-template-columns: 1fr; /* Una sola columna en móvil */
    }

    .cdb-events-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #fff;
        z-index: 9999;
        padding: 30px;
        transform: translateY(100%); /* Escondido abajo */
        transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        overflow-y: auto;
    }

    .cdb-events-sidebar.open {
        transform: translateY(0);
    }

}

.cdb-active-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-tag {
    background: rgba(99, 140, 86, 0.1); /* Verde muy suave */
    border: 1px solid rgba(99, 140, 86, 0.3);
    color: #444;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.filter-tag b {
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #638c56;
    display: inline-block;
    transition: transform 0.2s;
}

.filter-tag b:hover {
    transform: scale(1.3);
    color: #d9534f; /* Rojo al pasar el mouse para indicar borrar */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Contenedor del grupo */
.cdb-date-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cdb-input-container {
    position: relative;
    flex: 1;
}

/* Estilizado del Input */
#cdb-date-filter {
    width: 100%;
    padding: 8px 45px 8px 20px; /* Espacio a la derecha para el icono */
    border: 1px solid #638c56;
    border-radius: 30px;
    font-size: 14px;
    color: #444;
    outline: none;
    appearance: none;
    font-family:inherit;
    background-color: transparent;
    /* Icono de Calendario SVG personalizado */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23638c56"><path d="M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zM9 14H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8 4H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2z"/></svg>');
    background-repeat: no-repeat;
    background-position: calc(100% - 15px) center;
    background-size: 20px;
}

/* Ocultar el icono nativo de Chrome/Safari */
#cdb-date-filter::-webkit-calendar-picker-indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    cursor: pointer;
    opacity: 0; /* Lo hacemos invisible pero sigue ahí para que abra el selector al clickear */
}

/* Botón de Búsqueda (Lupa) */
.cdb-date-btn {
    background: #638c56;
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
    flex-shrink: 0;
}

.cdb-date-btn svg {
    width: 18px;
    height: 18px;
}

.cdb-date-btn:hover {
    background: #5E8A57;
    transform: scale(1.05);
}

.cdb-pagination-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
    flex-wrap:wrap;
    padding-bottom: 20px;
}

.cdb-pagination-container .page-numbers {
    background: #fff;
    border: 1px solid #638c56;
    color: #638c56;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
}

.cdb-pagination-container .page-numbers:hover,
.cdb-pagination-container .page-numbers.current {
    background: #638c56;
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 140, 86, 0.3);
}
.cdb-pagination-container .pagination-dots{
    line-height:2.5;
}
.cdb-actions-header {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.cdb-dropdown-btn {
    background-color: #638c56; /* El verde de tu imagen */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
}

.cdb-dropdown {
    position: relative;
    display: inline-block;
}

.cdb-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
    z-index: 100;
    list-style: none;
    padding: 0;
    margin: 0;
}

.cdb-dropdown:hover .cdb-dropdown-content {
    display: block;
}

.cdb-dropdown-content li {
    padding: 12px 16px;
    cursor: pointer;
    color: #333;
}

.cdb-dropdown-content li:hover {
    background-color: #638c56;
    color: white;
}
.cdb-avisos-card{
    padding:16px 0px;
    border-bottom:1px solid #4A4C4C;
}
.cdb-avisos-title{
    display:flex;
    align-items:flex-start;
    flex-wrap:wrap;
    gap:6px;
    
    margin:8px 0px;
}
.cdb-avisos-title h3{
    font-size:18px;
    margin:0;
    color:#4A4C4C;
    font-weight:600;
    flex:1;
    line-height: 1.2;
}
.cdb-avisos-arrow-icon{
    width:20px;
    height:20px;
}
.cdb-avisos-read-more{
    color:#4A4C4C;
    text-transform: uppercase;
    font-weight:600;
}
.cdb-filter-text, .cdb-dropdown-btn{
    text-transform: uppercase;
}

.cdb-avisos-title a{
    text-decoration:none;
    flex:1;
}

.cdb-attachments-list{
    padding-left:26px;
}
.cdb-avisos-read-more{
    padding-left:26px;
}
.cdb-modifications-list{
    padding-left:10px;
}
.cdb-attachments-list, .cdb-modifications-list{
    list-style-type:none;
}
.cdb-attachments-list li a, .cdb-modifications-list li a{
    color:#5E8A57;
    text-decoration:none;
    font-weight:bold;
}

@media (max-width:640px){
    .cdb-avisos-arrow-icon{
        width:18px;
        height:18px;
    }
    .cdb-avisos-title a, .cdb-avisos-title h3{
        font-size:16px;
    }
    .cdb-attachments-list li a, .cdb-attachments-list li, .cdb-modifications-list li a, .cdb-modifications-list li, .cdb-avisos-read-more{
        font-size:12px;
        line-height:1.2;
    }
}


.cdb-link-more {
    background: none;
    border: none;
    color: #5E8A57;
    font-weight:700;
    cursor: pointer;
    padding: 5px 0;
    font-family:inherit;
    text-transform:lowercase;
}
.cdb-year-filter li{
    cursor: pointer;
}
.cdb-year-filter li:hover {
    font-weight:bold;
    color:#5E8A57;
}
.cdb-year-filter{
    list-style-type:none;
    padding:0;
}
.filter-years-section{
    margin-bottom:24px;
}
#cdb-year-list li.active {
    font-weight: bold;
    color:#5E8A57;
}









/* Contenedor en modo selección */
.cdb-events-container.selection-mode .cdb-post-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    user-select: none; /* Evita seleccionar texto al hacer clic rápido */
}

/* Efecto Hover en las cards durante selección */
.cdb-events-container.selection-mode .cdb-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Overlay de selección (el checkbox virtual) */
.cdb-events-container.selection-mode .cdb-post-card::before {
    content: '';
    position: absolute;
    top: 15px;
    right: 15px;
    width: 25px;
    height: 25px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ccc;
    border-radius: 50%;
    z-index: 10;
    transition: all 0.3s ease;
}

/* Estado de Card Seleccionada */
.cdb-events-container.selection-mode .cdb-post-card.selected {
    outline: 3px solid #007cba; /* Color corporativo o azul */
    background-color: #f0f8ff;
}

.cdb-events-container.selection-mode .cdb-post-card.selected::before {
    content: '✓';
    background: #007cba;
    border-color: #007cba;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

/* Deshabilitar clics en enlaces internos durante la selección */
.cdb-events-container.selection-mode .cdb-post-card a {
    pointer-events: none;
}






/* Cuando el modo selección está activo */
.cdb-events-container.selection-mode .cdb-post-card {
    cursor: pointer;
    position: relative;

}

/* IMPORTANTE: Esto evita el bug de "varios clics" */
.cdb-events-container.selection-mode .cdb-post-card * {
    pointer-events: none; /* Los hijos no reciben el clic, lo recibe el padre (article) */
}

/* Overlay para asegurar que el área clicable sea total */
.cdb-events-container.selection-mode .cdb-post-card::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 5; /* Por debajo del checkbox pero por encima del contenido */
}

/* El checkbox lo mantenemos visible */
.cdb-events-container.selection-mode .cdb-post-card::before {
    z-index: 10; /* Siempre arriba para que se vea el check */
}



.cdb-events-container.selection-mode img {
    -webkit-user-drag: none;
    user-select: none;
}




#cdb-selection-bar {
    position: fixed;
    bottom: -100px; /* Oculta por defecto */
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 320px;
    background: #1a1a1a; /* Fondo oscuro elegante */
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    z-index: 9999;
    transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#cdb-selection-bar.active {
    bottom: 30px; /* Sube a su posición */
}

#cdb-selection-bar .bar-content {
    display: flex;
    align-items: center;
    width: 100%;
    gap:12px;
    justify-content: space-between;
}

#selected-count {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}



.cdb-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #ff4d4d; /* Un rojo suave para indicar cancelación */
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin-right: 10px;
}

.cdb-btn-cancel:hover {
    background: #ff4d4d;
    color: white;
    transform: rotate(90deg); /* Efecto visual al pasar el ratón */
}

/* Ajuste para que la barra no se vea apretada */
.bar-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

#selected-count {
    flex-grow: 1; /* Empuja el botón de descarga a la derecha */
    font-size: 14px;
    white-space: nowrap;
}



.cdb-btn-primary {
    background: #5E8A57;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.cdb-btn-primary:hover {
    background: #00669b;
}

/* Animación de carga para el botón */
#cdb-execute-download:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#cdb-download-btn.active-mode {
    background-color: #e2e2e2;
    color: #cc0000;
    border-color: #cc0000;
}


/* Reutilizamos tu overlay y contenido */
#cdb-download-modal { 
    display: none; 
    /* ... Tus estilos de .cdb-modal-overlay ... */
    justify-content: center;
    align-items: center;
}

/* Contenedor de la lista de archivos */
.cdb-files-container {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

.cdb-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.cdb-file-info {
    display: flex;
    flex-direction: column;
}
.cdb-btn-download-single{
    text-decoration: none;
}

.cdb-file-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.cdb-file-source {
    font-size: 11px;
    color: #888;
}

.cdb-btn-download-single {
    background: #f0f0f0;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.cdb-btn-download-single:hover {
    background: #5E8A57F0;
    color: white;
}

/* Scrollbar estética para la lista */
.cdb-files-container::-webkit-scrollbar { width: 6px; }
.cdb-files-container::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }





/* Ajustes para Móvil */
@media (max-width: 640px) {
    #cdb-selection-bar {
        width: 95%; /* Ocupa casi todo el ancho */
        padding: 10px 15px;
        min-width: unset; /* Quitamos el mínimo para que no desborde */
    }

    .bar-content {
        gap: 10px; /* Reducimos el espacio entre elementos */
    }

    #selected-count {
        font-size: 12px; /* Texto un poco más pequeño */
        letter-spacing: 0;
    }

    .cdb-btn-primary {
        padding: 8px 12px;
        font-size: 13px; /* Botón más compacto */
        white-space: nowrap;
    }

    .cdb-btn-cancel {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
}




@media (max-width:768px){

    .cdb-events-nav {
        display: flex;               /* Alinea los botones en fila */
        overflow-x: auto;            /* Habilita el scroll horizontal */
        white-space: nowrap;         /* Evita que los botones bajen a la siguiente línea */
        gap: 10px;                   /* Espacio entre botones */
        flex-wrap:nowrap;
        justify-content:flex-start;
        padding: 10px 6px;   
        
        /* Opcional: Para que el scroll sea fluido en móviles */
        -webkit-overflow-scrolling: touch;
        
        /* Opcional: Ocultar la barra de scroll estética (si prefieres un look limpio) */
        scrollbar-width: none;       /* Firefox */
    }

    .cdb-events-nav::-webkit-scrollbar {
        display: none;               /* Chrome, Safari, Opera */
    }

    .cdb-events-nav button {
        flex: 0 0 auto;              /* Crucial: evita que los botones se encojan */
    }
    .cdb-actions-header{
        gap:8px;
    }
    .cdb-dropdown-btn, .cdb-events-nav button, .cdb-btn-outline, .cdb-events-search input{
        font-size:12px;
    }
    .cdb-events-nav, .cdb-mobile-controls, .cdb-active-filters-bar, .cdb-events-search{
        margin-bottom:8px;
    }
    .cdb-post-card .category-badge{
        font-size:12px;
    }
    .cdb-events-search input{
        padding: 8px 16px;
    }    
    .cdb-events-nav button, .cdb-dropdown-btn, .cdb-btn-outline {
        padding: 4px 12px;
    }
    .cdb-btn-reset{
        width:28px;
        height:28px;
    }
    .cdb-btn-reset svg{
        width:16px;
        height:14px;
    }

}
