/* =======================================================
   SG Popular Posts – Frontend CSS v2.0
   Diseño fiel al tema del sitio (hereda fuentes y colores
   del tema). Variables --sgpp-* inyectadas desde el admin.
   ======================================================= */

.sgpp-section {
    /* Fallbacks — sobreescritos por el admin vía <style> inline */
    --sgpp-accent:      #e8232a;
    --sgpp-title:       #e8232a;
    --sgpp-badge-bg:    #7c3aed;
    --sgpp-badge-text:  #ffffff;
    --sgpp-card-border: #e8e8e8;
    --sgpp-meta:        #888888;
    --sgpp-title-hover: #e8232a;
    --sgpp-transition:  .2s ease;

    font-family: inherit;   /* hereda del tema */
    color: inherit;
    margin: 0 0 2rem;
}

/* ── ENCABEZADO DE SECCIÓN ────────────────────────────── */
.sgpp-header {
    margin-bottom: 1.2rem;
    padding-bottom: .6rem;
    border-bottom: 3px solid var(--sgpp-accent);
}

.sgpp-title {
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: inherit;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sgpp-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.15em;
    background: var(--sgpp-accent);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── VACÍO ────────────────────────────────────────────── */
.sgpp-empty {
    color: var(--sgpp-meta);
    font-style: italic;
    padding: 20px;
    text-align: center;
    border: 2px dashed var(--sgpp-card-border);
    border-radius: 6px;
}

/* ── BADGE DE CATEGORÍA (texto inline) ───────────────── */
.sgpp-cat {
    display: inline-block;
    background: var(--sgpp-badge-bg);
    color: var(--sgpp-badge-text) !important;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 2px 8px;
    border-radius: 2px;
    margin-bottom: 5px;
    text-decoration: none !important;
    line-height: 1.6;
}

/* ── TÍTULO DE NOTICIA ───────────────────────────────── */
.sgpp-post-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 4px 0 6px;
}

.sgpp-post-title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--sgpp-transition);
}

.sgpp-post-title a:hover {
    color: var(--sgpp-title-hover);
}

/* ── META (fecha / autor / vistas) ───────────────────── */
.sgpp-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: .8rem;
    color: var(--sgpp-meta);
    margin-top: 4px;
}

.sgpp-sep  { opacity: .5; }
.sgpp-date, .sgpp-author, .sgpp-views { }

/* ── EXTRACTO ────────────────────────────────────────── */
.sgpp-excerpt {
    font-size: .87rem;
    line-height: 1.55;
    color: var(--sgpp-meta);
    margin: 4px 0 6px;
}

/* =======================================================
   ESTILO A — NEWSLIST
   (thumbnail pequeño izq. + texto derecha, 2 columnas)
   ======================================================= */
.sgpp-style-newslist .sgpp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.sgpp-style-newslist .sgpp-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 12px;
    border-bottom: 1px solid var(--sgpp-card-border);
}

/* Línea separadora vertical entre las dos columnas */
.sgpp-style-newslist .sgpp-card:nth-child(odd) {
    border-right: 1px solid var(--sgpp-card-border);
    padding-right: 20px;
}
.sgpp-style-newslist .sgpp-card:nth-child(even) {
    padding-left: 20px;
}

/* Último par: sin borde inferior */
.sgpp-style-newslist .sgpp-card:nth-last-child(-n+2) {
    border-bottom: none;
}

.sgpp-style-newslist .sgpp-thumb-wrap {
    flex-shrink: 0;
    display: block;
    width: 110px;
    height: 80px;
    overflow: hidden;
    border-radius: 3px;
    background: #eee;
}

.sgpp-style-newslist .sgpp-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}

.sgpp-style-newslist .sgpp-card:hover .sgpp-thumb-img {
    transform: scale(1.06);
}

.sgpp-style-newslist .sgpp-card-body {
    flex: 1;
    min-width: 0;
}

.sgpp-style-newslist .sgpp-post-title {
    font-size: 1rem;
    line-height: 1.3;
}

/* =======================================================
   ESTILO B — CARDS GRANDES
   (imagen full-width + badge overlay + texto abajo)
   ======================================================= */
.sgpp-style-cards .sgpp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.sgpp-style-cards .sgpp-card {
    display: flex;
    flex-direction: column;
}

.sgpp-style-cards .sgpp-img-wrap {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 4px;
    background: #ddd;
    text-decoration: none;
}

.sgpp-style-cards .sgpp-big-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}

.sgpp-style-cards .sgpp-card:hover .sgpp-big-img {
    transform: scale(1.04);
}

.sgpp-style-cards .sgpp-img-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e0e0, #c8c8c8);
}

/* Badge superpuesto en esquina inferior izquierda de la imagen */
.sgpp-style-cards .sgpp-cat-overlay {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: var(--sgpp-badge-bg);
    color: var(--sgpp-badge-text) !important;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 3px 10px;
    border-radius: 2px;
    text-decoration: none !important;
    line-height: 1.6;
    z-index: 2;
}

.sgpp-style-cards .sgpp-card-body {
    padding: 10px 0 0;
}

.sgpp-style-cards .sgpp-post-title {
    font-size: 1.05rem;
    line-height: 1.3;
    margin-top: 0;
}

/* =======================================================
   ESTILO C — COMPACT (lista simple 1 columna)
   ======================================================= */
.sgpp-style-compact .sgpp-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sgpp-style-compact .sgpp-card {
    padding: 10px 0;
    border-bottom: 1px solid var(--sgpp-card-border);
}

.sgpp-style-compact .sgpp-card:last-child {
    border-bottom: none;
}

.sgpp-style-compact .sgpp-post-title {
    font-size: .93rem;
    margin: 3px 0 4px;
}

/* =======================================================
   RESPONSIVE
   ======================================================= */
@media ( max-width: 640px ) {
    .sgpp-style-newslist .sgpp-grid,
    .sgpp-style-cards .sgpp-grid {
        grid-template-columns: 1fr;
    }

    .sgpp-style-newslist .sgpp-card:nth-child(odd) {
        border-right: none;
        padding-right: 12px;
    }
    .sgpp-style-newslist .sgpp-card:nth-child(even) {
        padding-left: 12px;
    }
    .sgpp-style-newslist .sgpp-card:nth-last-child(-n+2) {
        border-bottom: 1px solid var(--sgpp-card-border);
    }
    .sgpp-style-newslist .sgpp-card:last-child {
        border-bottom: none;
    }
    .sgpp-style-newslist .sgpp-thumb-wrap {
        width: 80px;
        height: 60px;
    }
}

/* ── FALLBACK cuando no hay imagen ── */
.sgpp-img-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    min-height: 160px;
}

.sgpp-style-newslist .sgpp-no-img .sgpp-card-body {
    /* Si no hay imagen, el texto ocupa todo el ancho */
    grid-column: 1 / -1;
}
