/*
 * Post List Compact — paginación
 *
 * El listado (.plc-block__list) y los items (.pge-card*)
 * heredan TODO el estilo visual del grid del repositorio
 * (plugins/post_grid_extended/style.css).
 *
 * Solo estilamos:
 *   - .plc-block container
 *   - .plc-block__title
 *   - .plc-block__list
 *   - .plc-block__item
 *   - .plc-block__pagination
 *   - .plc-block--empty
 */

.plc-block {
    margin-top: 32px;
    margin-bottom: 32px;
}

.plc-block__title {
    font-family: 'Lato', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #12102E;
    margin: 0 0 16px 0;
    padding: 0;
    line-height: 1.3;
}

.plc-block__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.plc-block__item {
    margin: 0;
    padding: 0;
}

/* Cuando el block está dentro de un single editorial,
   los cards deben verse IGUAL que en el grid del repo.
   El CSS de pge-card ya está cargado por post_grid_extended cuando
   se enqueue en otras páginas. Aquí forzamos su carga por si acaso. */
.plc-block .pge-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 16px;
    /* !important para matchear el specificity del grid del repo
       (.pge-block .pge-card usa !important para sobrescribir la regla
       global '* { border: 0 }'). Sin esto, el divider no aparece. */
    border-bottom: 1px solid #E5E7EB !important;
    background: transparent;
}

/* NO se quita border-bottom del último card (igual al grid del repo).
   El grid del repo deja border-bottom en TODAS las cards (incluido el último).
   Solo el plc-block tenía esta regla :last-child que rompía el divider.
   Si querés divider solo entre cards (no debajo del último), se podría agregar
   un box-shadow inset o un divider via padding-bottom — pero eso sería
   duplicación de estilos. Por ahora, igualamos al repo: todas con border. */

.plc-block .pge-card__thumb {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 10px;
    overflow: hidden;
    display: block;
}

.plc-block .pge-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.plc-block .pge-card__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.plc-block .pge-card__pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 2px;
}

/* chips cats/tags con border + bg gris claro + hover violeta.
   Patrón canónico del theme: .pge-block .pge-card__pill de
   post_grid_extended/style.css (L1194-1232):
   - bg #F9FAFB gris claro
   - border 1px solid #D1D5DB
   - hover border-color #564FFF violeta + color #564FFF
   - active border-color #12102E dark navy + color #12102E
   El * { border: 0 } global sobrescribe border + bg default, uso !important. */
.plc-block .pge-card__pill {
    display: inline-block !important;
    padding: 4px 10px !important;
    border: 1px solid #D1D5DB !important;
    border-radius: 9999px !important;
    color: #6B7494 !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    background: #F9FAFB !important;
    text-decoration: none !important;
    transition: border-color 0.15s ease, color 0.15s ease;
    width: fit-content;
    text-transform: capitalize;
    /* El chip navega al repositorio con filtro (ver script.js click handler).
       Forzar apariencia + cursor de link para que sea visualmente clickeable. */
    appearance: button !important;
    cursor: pointer !important;
}
.plc-block .pge-card__pill:hover {
    border-color: #564FFF !important;
    color: #564FFF !important;
}
.plc-block .pge-card__pill:active {
    border-color: #12102E !important;
    color: #12102E !important;
}

.plc-block .pge-card__title {
    font-family: 'Lato', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #12102E;
    margin: 0;
    padding: 0;
    line-height: 1.35;
}

.plc-block .pge-card__title a {
    color: inherit;
    text-decoration: none;
}

.plc-block .pge-card__title a:hover {
    color: #564FFF;
}

.plc-block .pge-card__year {
    /* Limit width to match /repositorio/ grid (pge-block .pge-card__year).
       Sin este width restrictivo, la regla global del theme
       'article > :not(.entry-content) { width: 100% }' fuerza el año a
       expandirse y colapsa el .pge-card__content a 0px. Reuso del
       patrón de grid normal — sin duplicar otras reglas. */
    flex: 0 0 auto;
    width: 48px;
    max-width: 48px;
    min-width: 48px;
    align-self: center;
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #6B7494;
    margin-left: 16px;
    padding-top: 0;
}

/* Paginación: reusa las clases .pge-pagination__btn* del post_grid_extended
   pero las reglas oficiales (.pge-block .pge-pagination__btn) requieren padre
   .pge-block. Como el plc está en .plc-block (no .pge-block), duplico las reglas
   con scope .plc-block__pagination para que matcheen.
   Source: post_grid_extended/style.css L1653-1723. */
.plc-block__pagination {
    margin-top: 32px;
    margin-bottom: 16px;
    padding: 8px 0;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    font-family: 'Lato', sans-serif;
}

/* Btn base */
.plc-block__pagination .pge-pagination__btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* Botones de paginación: 34×34 exactos */
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 8px !important;
    border-radius: 8px !important;
    border: 1px solid #D1D5DB !important;
    background: #FFFFFF !important;
    color: #1F2937 !important;
    font-size: 14px !important;
    font-family: inherit !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    line-height: 1 !important;
}

/* Btn hover */
.plc-block__pagination .pge-pagination__btn:hover {
    border-color: #564FFF !important;
    color: #564FFF !important;
    background: #F5F4FF !important;
}

/* Btn active/click */
.plc-block__pagination .pge-pagination__btn:active {
    border-color: #12102E !important;
    color: #12102E !important;
}

/* Active/current (numero seleccionado) */
.plc-block__pagination .pge-pagination__btn--active {
    background: #FFFFFF !important;
    color: #564FFF !important;
    border-color: #564FFF !important;
    border-width: 2px !important;
    font-weight: 700 !important;
}

/* Active click tambien dark navy (overrides el de arriba) */
.plc-block__pagination .pge-pagination__btn--active:active {
    border-color: #12102E !important;
    color: #12102E !important;
}

/* Arrow (chevron, NO texto, 34x34) */
.plc-block__pagination .pge-pagination__btn--arrow {
    font-size: 20px !important;
    font-weight: 400 !important;
    color: #6B7280 !important;
    padding: 0 !important;
}

.plc-block__pagination .pge-pagination__btn--arrow:hover {
    color: #564FFF !important;
}

.plc-block__pagination .pge-pagination__btn--arrow[disabled] {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* SVG dentro de arrow */
.plc-block__pagination .pge-pagination__btn--arrow svg {
    width: 10px !important;
    height: 14px !important;
    display: block !important;
}

/* loading state durante el fetch REST */
.plc-block__pagination.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Empty state */
.plc-block--empty .plc-block__empty {
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    color: #6B7494;
    margin: 0;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 600px) {
    .plc-block .pge-card {
        flex-wrap: wrap;
    }
    .plc-block .pge-card__year {
        width: 100%;
        margin-left: 96px;
        margin-top: -8px;
    }
}
