/* ==========================================================================
   BANDERAS / TERRITORIOS
   ========================================================================== */

.td-bandera {
    width: 20px;
    height: 13px;
    vertical-align: middle;
    margin-right: 4px;
    object-fit: fill;
}

/* ==========================================================================
   NOTICIAS AJAX - FILTROS, TARJETAS Y PAGINACIÓN
   ========================================================================== */
/* Contenedor de noticias/proyectos con paginación tradicional */
.td-noticias-container {
    scroll-margin-top: 100px;
    margin-bottom: 40px;
}
.td-noticias-ajax-container {
    scroll-margin-top: 100px;
    margin-bottom: 40px;
}

.td-filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    align-items: center;
}

.td-filtro-grupo {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.td-filtro-grupo label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.td-filtro-grupo select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 180px;
    background: #fff;
}

.td-filtro-limpiar {
    padding: 8px 16px;
    background: #888;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    align-self: flex-end;
}

.td-filtro-limpiar:hover {
    background: #666;
}

.td-filtros-contador {
    margin-left: auto;
    font-size: 14px;
    color: #666;
}

.td-noticias-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    margin-bottom: 30px !important;
    min-height: 200px;
}

.td-noticia-card {
    background: #ffffff !important;
    border-radius: 8px !important;
    padding: 20px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    display: flex !important;
    flex-direction: column !important;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s;
}

.td-noticia-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

.td-noticia-content {
    flex: 1;
}

.td-noticia-fecha {
    display: block !important;
    font-size: 12px !important;
    color: #666 !important;
    margin-bottom: 8px !important;
}

.td-noticia-title {
    font-size: 16px !important;
    line-height: 1.4 !important;
    margin: 0 0 10px 0 !important;
}

.td-noticia-title a {
    color: #2c5530 !important;
    text-decoration: none !important;
}

.td-noticia-title a:hover {
    text-decoration: underline !important;
}

.td-noticia-descripcion {
    font-size: 14px !important;
    color: #555 !important;
    line-height: 1.5 !important;
    margin: 0 0 15px 0 !important;
}

.td-noticia-footer {
    border-top: 1px solid #eee !important;
    padding-top: 10px !important;
    margin-top: auto !important;
}

.td-noticia-fuente {
    font-size: 12px !important;
    color: #888 !important;
}

.td-paginacion-ajax,
.td-paginacion {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 10px !important;
    margin-top: 20px !important;
    padding: 20px 0 !important;
    flex-wrap: wrap !important;
}

.td-pag-btn {
    padding: 8px 16px !important;
    background: #2c5530 !important;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    cursor: pointer;
    border: none;
}

.td-pag-btn:hover {
    background: #1e3d22 !important;
}

.td-pag-disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
}

.td-pag-numbers {
    display: flex !important;
    gap: 5px !important;
    align-items: center !important;
}

.td-pag-num {
    padding: 8px 12px !important;
    background: #f0f0f0 !important;
    color: #333 !important;
    text-decoration: none !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    cursor: pointer;
}

.td-pag-num:hover {
    background: #e0e0e0 !important;
}

.td-pag-current {
    background: #2c5530 !important;
    color: #fff !important;
}

.td-pag-dots {
    padding: 8px 4px !important;
    color: #666 !important;
}

.td-cargando {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.td-cargando.activo {
    display: flex;
}

.td-cargando-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2c5530;
    border-radius: 50%;
    animation: td-spin 1s linear infinite;
}

@keyframes td-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.td-noticias-wrapper {
    position: relative;
}

.td-no-noticias {
    padding: 40px;
    text-align: center;
    color: #666;
    grid-column: 1 / -1;
}

@media (max-width: 1024px) {
    .td-noticias-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 600px) {
    .td-noticias-grid {
        grid-template-columns: 1fr !important;
    }

    .td-filtros {
        flex-direction: column;
        align-items: stretch;
    }

    .td-filtro-grupo select {
        width: 100%;
    }
}
html {
    scroll-behavior: smooth;
}

/* ==========================================================================
   HOME - ÚLTIMAS NOTICIAS POR TEMÁTICA
   ========================================================================== */

.td-home-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.td-home-selector {
    margin-bottom: 30px;
    text-align: center;
}

.td-home-selector select {
    padding: 10px 16px;
    font-size: 12px;
    border: 2px solid #2d5016;
    border-radius: 8px;
    background: #fff;
    color: #2d5016;
    cursor: pointer;
    min-width: 300px;
}

.td-home-selector select:focus {
    outline: none;
    border-color: #4a7c23;
}

.td-home-noticias {
    display: none;
}

.td-home-noticias.active {
    display: block;
}

.td-home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.td-home-noticia {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid #2d5016;
}

.td-home-noticia:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.td-home-noticia-titulo {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.4;
}

.td-home-noticia-titulo a {
    color: inherit;
    text-decoration: none;
}

.td-home-noticia-titulo a:hover {
    color: #2d5016;
}

.td-home-noticia-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #666;
}

.td-home-noticia-fuente {
    display: flex;
    align-items: center;
    gap: 6px;
}

.td-home-noticia-fecha {
    color: #888;
}

.td-home-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.td-home-sin-noticias {
    text-align: center;
    padding: 40px;
    color: #888;
    font-style: italic;
}

@media (max-width: 768px) {
    .td-home-selector select {
        min-width: 100%;
    }

    .td-home-grid {
        grid-template-columns: 1fr;
    }
}
/* ==========================================================================
   IMÁGENES DE NOTICIAS Y PROYECTOS
   ========================================================================== */

.td-noticia-imagen {
    margin: -20px -20px 16px -20px;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    aspect-ratio: 16 / 9;
    background: #f3f3f3;
}

.td-noticia-imagen a {
    display: block;
    width: 100%;
    height: 100%;
}

.td-noticia-imagen img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.td-noticia-card:hover .td-noticia-imagen img {
    transform: scale(1.025);
}

/* ==========================================================================
   INTRODUCCIÓN TEMÁTICA
   ========================================================================== */

.td-tematica-intro {
    max-width: 1100px;
    margin: 0 auto 28px;
}

.td-tematica-intro p {
    margin: 0;
    line-height: 1.7;
    font-size: 1.05rem;
}