/*
Theme Name: GeneratePress Child Special
Theme URI: https://marco-jaram.dev/
Description: Child theme de  GeneratePress theme para programas sociales
Author: Marco Jaramillo
Author URI: https://marco-jaram.dev/
Template: generatepress
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: generatepress-child
*/
body {
    padding: 0px 10px;
}

/* Estilos generales para títulos */
h1, h2, h3, h4, h5, h6 {
    font-weight: bold !important;
}

/* Texto justificado por defecto, pero respetando las clases de alineación del editor */
.entry-content p,
.entry-summary p,
.single-programa-article .entry-content p,
.page-content p,
.post-content p {
    text-align: justify !important;
}

/* El editor tiene prioridad: estas clases sobrescriben el justify anterior */
.has-text-align-center {
    text-align: center !important;
}

.has-text-align-right {
    text-align: right !important;
}

.has-text-align-left {
    text-align: left !important;
}

.creds {
    display: none;
}

/* Estilos para el archivo de Programas Sociales (Diseño Horizontal) */

.programas-grid {
    display: grid;
    grid-template-columns: 1fr; /* Una sola columna */
    gap: 25px;
    margin-top: 2em;
}

.programa-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition:
        box-shadow 0.3s ease-in-out,
        transform 0.3s ease-in-out;
}

.programa-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.programa-card .card-link-wrapper {
    display: flex;
    flex-direction: row;
    text-decoration: none;
    color: inherit;
}

.programa-card .card-image {
    flex: 0 0 250px; /* Ancho fijo para la imagen */
    line-height: 0;
}

.programa-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.programa-card .card-content {
    padding: 20px 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.programa-card .entry-title {
    font-size: 1.4em;
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.programa-card .card-link-wrapper:hover .entry-title {
    color: #0073aa;
}

.programa-card .entry-meta {
    margin-bottom: 15px;
    order: -1; /* Mover el estado arriba del título */
}

.programa-card .estado-label {
    background-color: #f0f0f0;
    color: #555;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
    display: inline-block;
}

.programa-card .entry-summary {
    flex-grow: 1;
    margin-bottom: 0;
    font-size: 0.95em;
}

/* Responsive para el diseño horizontal */
@media (max-width: 768px) {
    .programa-card .card-link-wrapper {
        flex-direction: column;
    }
    .programa-card .card-image {
        flex-basis: 200px; /* Altura fija en móvil */
    }
}

/* Estilos para la página individual del Programa */

.single-programa-article {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-top: 2em;
}

.single-programa-article .entry-header {
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 20px;
}

.single-programa-article .entry-title {
    font-size: 2.5em;
    color: #222;
}

.single-programa-article .entry-content img.size-large {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 20px;
}

.programa-detalles-simple {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #e9e9e9;
    border-radius: 8px;
}

.programa-detalles-simple h2 {
    font-size: 1.5em;
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.programa-detalles-simple .detalles-lista {
    list-style: none;
    padding: 0;
    margin: 0;
}

.programa-detalles-simple .detalles-lista li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 15px;
}

.programa-detalles-simple .detalles-lista li:last-child {
    border-bottom: none;
}

.programa-detalles-simple .detalles-lista li strong {
    font-weight: bold;
    color: #555;
}

.programa-detalles-simple .detalles-lista li a {
    word-break: break-all;
}

.programa-detalles-simple .detalles-lista li div {
    white-space: pre-wrap; /* Respetar saltos de línea en requisitos */
}

/* Estilos de home */
/* Estilos de home */
/* Estilos de home */
/* Estilos de home */
/* ==========================================================================
   ESTILOS PARA LA PÁGINA DE INICIO PERSONALIZADA
   ========================================================================== */

/* --- 1. Contenedor Principal --- */
/* Le damos un ancho máximo y lo centramos para que no ocupe toda la pantalla en monitores grandes */
.page-template-home-personalizado .entry-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* --- 2. Título principal y párrafo (opcional, para ocultarlos si no los necesitas) --- */
.custom-home-title,
.page-template-home-personalizado .entry-content > p {
    /* Descomenta la siguiente línea si quieres ocultar el H1 y el párrafo de tu template */
    /* display: none; */
    margin-bottom: 2em;
}

/* --- 3. Formulario de Filtro y Búsqueda --- */
.programas-filter-form {
    background-color: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 40px;
    border: 1px solid #e0e0e0;
}

.programas-filter-form .filter-controls {
    display: flex;
    flex-wrap: wrap; /* Permite que los elementos pasen a la siguiente línea en pantallas pequeñas */
    gap: 20px; /* Espacio entre los grupos de filtros */
    align-items: flex-end; /* Alinea los elementos en la parte inferior */
}

.programas-filter-form .filter-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Permite que los grupos crezcan y ocupen el espacio */
}

.programas-filter-form label {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #333;
}

.programas-filter-form input[type="search"],
.programas-filter-form select {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    width: 100%;
}

/* Estilos para los botones de búsqueda */
.filter-buttons {
    display: flex;
    gap: 10px; /* Espacio entre botones */
    align-items: center;
}

.programas-filter-form .search-submit,
.programas-filter-form .clear-search-btn {
    background-color: #0055a4; /* Un azul similar al de PBS */
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
    flex-shrink: 0; /* Evita que el botón se encoja */
}

.programas-filter-form .clear-search-btn {
    background-color: #6c757d; /* Color gris para el botón limpiar */
}

.programas-filter-form .search-submit:hover {
    background-color: #003366;
}

.programas-filter-form .clear-search-btn:hover {
    background-color: #5a6268;
}

/* --- 4. El Grid de Posts (La magia principal) --- */
.custom-posts-grid {
    display: grid;
    /* Creamos un grid de 4 columnas */
    grid-template-columns: repeat(4, 1fr);
    /* Definimos filas automáticas para que el contenido se ajuste */
    grid-auto-rows: auto;
    gap: 24px; /* Espacio entre las tarjetas */
}

/* --- 5. Tarjeta Destacada (Hero Post) --- */
/* Seleccionamos SÓLO EL PRIMER artículo dentro del grid */
.custom-posts-grid .custom-post-card:first-child {
    /* Hacemos que ocupe las primeras 2 columnas */
    grid-column: 1 / 3;
    /* Hacemos que ocupe las primeras 2 filas */
    grid-row: 1 / 3;

    /* Estilos específicos para la tarjeta grande */
    flex-direction: column; /* La imagen arriba, el texto abajo */
}

.custom-posts-grid .custom-post-card:first-child .custom-card-image {
    height: 60%; /* La imagen ocupa más espacio en la tarjeta destacada */
}

.custom-posts-grid .custom-post-card:first-child .custom-entry-title a {
    font-size: 2.2rem; /* Título mucho más grande */
    line-height: 1.1;
}

.custom-posts-grid .custom-post-card:first-child .custom-entry-summary {
    font-size: 1rem; /* Resumen ligeramente más grande */
    margin-top: 15px;
}

/* --- 6. Estilo General de las Tarjetas (para todas) --- */
.custom-post-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column; /* Apila imagen y contenido verticalmente */
    overflow: hidden; /* Asegura que el contenido no se salga de los bordes */
    text-decoration: none;
    transition:
        transform 0.2s ease-in-out,
        box-shadow 0.2s ease-in-out;
}

.custom-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.custom-post-card .custom-card-image {
    width: 100%;
    height: 180px; /* Altura fija para la imagen para alinear las tarjetas */
    overflow: hidden;
}

.custom-post-card .custom-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* La imagen cubre el contenedor sin deformarse */
    transition: transform 0.3s ease;
}

.custom-post-card:hover .custom-card-image img {
    transform: scale(1.05); /* Sutil efecto de zoom al pasar el mouse */
}

.custom-post-card .custom-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Hace que el contenido ocupe el espacio sobrante */
}

.custom-post-card .custom-entry-title {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    line-height: 1.3;
}

.custom-post-card .custom-entry-title a {
    text-decoration: none;
    color: #1a1a1a;
}

.custom-post-card .custom-entry-title a:hover {
    text-decoration: underline;
}

.custom-post-card .custom-entry-summary {
    font-size: 0.95rem;
    color: #555;
    flex-grow: 1; /* Empuja el botón "Leer más" hacia abajo */
}

.custom-post-card .custom-read-more {
    margin-top: 15px; /* Espacio sobre el botón */
    font-weight: bold;
    color: #0055a4;
    text-decoration: none;
    align-self: flex-start; /* Alinea el botón a la izquierda */
}

.custom-post-card .custom-read-more:hover {
    text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE - Media Queries
   ========================================================================== */

/* --- Para Tablets (hasta 992px) --- */
@media (max-width: 992px) {
    .custom-posts-grid {
        /* Cambiamos a un grid de 2 columnas */
        grid-template-columns: repeat(2, 1fr);
    }

    /* La tarjeta destacada ahora ocupa todo el ancho de la primera fila */
    .custom-posts-grid .custom-post-card:first-child {
        grid-column: 1 / -1; /* Ocupa desde la primera a la última columna */
        grid-row: auto; /* La fila se ajusta automáticamente */
    }

    .custom-posts-grid .custom-post-card:first-child .custom-entry-title a {
        font-size: 1.8rem; /* Reducimos un poco el título */
    }

    /* En pantallas medianas, los botones se ponen uno al lado del otro */
    .filter-buttons {
        flex-direction: row;
        justify-content: center;
    }
}

/* --- Para Móviles (hasta 768px) --- */
@media (max-width: 768px) {
    /* El formulario de filtros se apila verticalmente */
    .programas-filter-form .filter-controls {
        flex-direction: column;
        align-items: stretch; /* Los elementos ocupan todo el ancho */
    }

    /* En móviles, los botones se ponen uno debajo del otro */
    .filter-buttons {
        flex-direction: column;
        width: 100%;
    }

    .programas-filter-form .search-submit,
    .programas-filter-form .clear-search-btn {
        width: 100%;
    }
}

    .custom-posts-grid {
        /* Cambiamos a un grid de 1 sola columna */
        grid-template-columns: 1fr;
    }

    /* Reseteamos los estilos de la tarjeta destacada, ya que ahora todas son iguales */
    .custom-posts-grid .custom-post-card:first-child {
        grid-column: auto;
        grid-row: auto;
    }

    /* Hacemos que todos los títulos tengan el mismo tamaño en móvil para consistencia */
    .custom-post-card .custom-entry-title a,
    .custom-posts-grid .custom-post-card:first-child .custom-entry-title a {
        font-size: 1.5rem;
    }
}

/*
--- Estilos para Tarjetas de Noticias ---
*/

/* --- Estilos Genéricos para Tarjeta de Noticia --- */
.noticia-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition:
        box-shadow 0.3s ease-in-out,
        transform 0.3s ease-in-out;
    display: flex; /* Contenedor flex principal */
}

.noticia-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.noticia-card .card-link-wrapper {
    display: flex;
    text-decoration: none;
    color: inherit;
    height: 100%;
    width: 100%;
    flex-direction: inherit; /* Hereda la dirección del padre .noticia-card */
}

.noticia-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.noticia-card:hover .card-image img {
    transform: scale(1.05);
}

.noticia-card .card-content {
    padding: 20px 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.noticia-card .entry-title {
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    line-height: 1.3;
}

.noticia-card .card-link-wrapper:hover .entry-title {
    color: #0073aa;
}

.noticia-card .entry-meta {
    margin-bottom: 15px;
    font-size: 0.8em;
    color: #777;
    text-transform: uppercase;
}

.noticia-card .entry-summary {
    margin-bottom: 0;
    font-size: 0.9em;
    line-height: 1.6;
    flex-grow: 1;
}

/* --- Layout Horizontal para Noticias (en listados de 1 columna como /noticias) --- */
.programas-grid .noticia-card {
    flex-direction: row;
}

.programas-grid .noticia-card .card-image {
    flex: 0 0 250px;
    line-height: 0;
}

/* --- Layout Vertical para Noticias (en grids de varias columnas como en el Home) --- */
.noticias-vertical-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.noticias-vertical-grid .noticia-card {
    flex-direction: column;
}

.noticias-vertical-grid .noticia-card .card-image {
    height: 200px;
    line-height: 0;
}

.home-noticias-section {
    margin-top: 4em;
    padding-top: 2em;
    border-top: 2px solid #f0f0f0;
}

.home-noticias-section .section-title {
    font-size: 2.2em;
    margin-bottom: 1.5em;
    color: #333;
}

/* Estilos para el Spinner de carga AJAX */
.grid-container {
    position: relative;
    min-height: 200px; /* Evita que el contenedor colapse mientras carga */
}

.pss-spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.3s;
}

.pss-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #0073aa; /* Color azul de WordPress */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* TABLET Y MÓVIL */
@media (max-width: 768px) {
    /* Quita espacio arriba del contenido */
    .site-content {
        padding-top: 0 !important;
    }

    /* Reduce espacio del artículo */
    .inside-article {
        padding-top: 10px !important;
    }

    /* Reduce espacio del título */
    .entry-header {
        margin-top: 0 !important;
        margin-bottom: 10px !important;
    }

    /* Título más compacto */
    .entry-title {
        margin-top: 0 !important;
        margin-bottom: 10px !important;
        line-height: 1.2;
    }
}

/* Ajuste para reducir el espacio en móvil/tablet, según hallazgo del usuario */
@media (max-width: 1024px) {
    .grid-container {
        min-height: 20px;
    }
}


/* Forzar diseño vertical para tarjetas de noticia en móvil/tablet */
@media (max-width: 1024px) {
    .programas-grid .noticia-card {
        flex-direction: column;
    }
}

