/* ============================================================
   qph-blog.css — Blog QuePlanHacer
   Ruta: wp-content/themes/tu-tema/assets/css/qph-blog.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&display=swap');

/* ── Variables ── */
:root {
    --qb-red:          #e63946;
    --qb-red-dark:     #c1121f;
    --qb-red-light:    #fff0f1;
    --qb-red-glow:     rgba(230, 57, 70, 0.18);
    --qb-surface:      #ffffff;
    --qb-surface-2:    #f8fafc;
    --qb-text:         #0d1117;
    --qb-text-mid:     #374151;
    --qb-text-light:   #6b7280;
    --qb-border:       #e5e7eb;
    --qb-radius-sm:    8px;
    --qb-radius:       12px;
    --qb-radius-lg:    14px;

    --qb-shadow-sm:    0 2px 8px rgba(0,0,0,0.06);
    --qb-shadow:       0 4px 20px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
    --qb-shadow-hover: 0 16px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    --qb-shadow-card:  0 2px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);

    --qb-ease:         cubic-bezier(0.4, 0, 0.2, 1);
    --qb-transition:   all 0.25s var(--qb-ease);
}

/* ── Base ── */
.qph-blog {
    font-family: 'Outfit', system-ui, sans-serif;
    padding: 48px 24px 100px;
    color: var(--qb-text);
    -webkit-font-smoothing: antialiased;
}

/* ── TOPBAR ── */
.qph-blog-topbar {
    max-width: 1360px;
    margin: 0 auto 36px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.qph-blog-search-wrap {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 520px;
}
.qph-blog-search-input {
    width: 100%;
    padding: 13px 44px 13px 18px;
    font-family: inherit;
    font-size: 0.93rem;
    font-weight: 500;
    background: var(--qb-surface);
    border: 1.5px solid var(--qb-border);
    border-radius: var(--qb-radius);
    color: var(--qb-text);
    outline: none;
    box-shadow: var(--qb-shadow-sm);
    transition: var(--qb-transition);
}
.qph-blog-search-input:focus {
    border-color: var(--qb-red);
    box-shadow: 0 0 0 3px var(--qb-red-glow);
}
.qph-blog-search-input::placeholder { color: var(--qb-text-light); font-weight: 400; }
.qph-blog-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--qb-radius-sm);
    background: var(--qb-surface-2);
    border: none;
    cursor: pointer;
    color: var(--qb-text-light);
    transition: var(--qb-transition);
}
.qph-blog-search-clear svg { width: 14px; height: 14px; stroke-width: 2.5; }
.qph-blog-search-clear.visible { display: flex; }
.qph-blog-search-clear:hover { background: var(--qb-red-light); color: var(--qb-red); }
.qph-blog-total {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--qb-text-light);
    white-space: nowrap;
}
.qph-blog-total strong { color: var(--qb-text); font-weight: 800; }

/* ── FILTROS DE CATEGORÍA ── */
.qph-blog-cats-wrap {
    max-width: 1360px;
    margin: 0 auto 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.qph-blog-cat {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: var(--qb-surface);
    border: 1.5px solid var(--qb-border);
    border-radius: var(--qb-radius);
    font-family: inherit;
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--qb-text-mid);
    cursor: pointer;
    transition: var(--qb-transition);
    box-shadow: var(--qb-shadow-sm);
    white-space: nowrap;
}
.qph-blog-cat:hover {
    border-color: var(--qb-red);
    color: var(--qb-red);
    background: var(--qb-red-light);
}
.qph-blog-cat.active {
    background: var(--qb-red);
    border-color: var(--qb-red);
    color: #fff;
    box-shadow: 0 3px 12px var(--qb-red-glow);
}
.qph-blog-cat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
    flex-shrink: 0;
}
.qph-blog-cat.active .qph-blog-cat-dot { opacity: 1; background: rgba(255,255,255,0.8); }
.qph-blog-cat-count {
    font-size: 0.72rem;
    font-weight: 800;
    background: rgba(0,0,0,0.07);
    padding: 1px 6px;
    border-radius: 6px;
    line-height: 1.6;
}
.qph-blog-cat.active .qph-blog-cat-count { background: rgba(255,255,255,0.25); }

/* ── LAYOUT PRINCIPAL ── */
.qph-blog-layout {
    max-width: 1360px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
}

/* ── LISTA DE CARDS (vertical, cards horizontales) ── */
.qph-blog-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── CARD HORIZONTAL ── */
.qph-blog-card {
    background: var(--qb-surface);
    border-radius: var(--qb-radius-lg);
    overflow: hidden;
    border: 1px solid var(--qb-border);
    display: flex;
    flex-direction: row;
    box-shadow: var(--qb-shadow-card);
    transition: transform 0.25s var(--qb-ease),
                box-shadow 0.25s var(--qb-ease);
    animation: qb-card-in 0.35s var(--qb-ease) both;
    animation-delay: var(--delay, 0s);
}
.qph-blog-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--qb-shadow-hover);
}
@keyframes qb-card-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Imagen: cuadrada a la izquierda */
.qph-blog-card-img-wrap {
    display: block;
    position: relative;
    overflow: hidden;
    width: 210px;
    min-width: 210px;
    height: 200px;
    background: #f3f4f6;
    text-decoration: none;
    flex-shrink: 0;
    border-radius: 0;
    padding-top: 0;
}
.qph-blog-card-img-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--qb-ease);
}
.qph-blog-card:hover .qph-blog-card-img-wrap img { transform: scale(1.06); }
.qph-blog-card-img-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent 60%, rgba(0,0,0,0.18) 100%);
    opacity: 0;
    transition: opacity 0.25s;
}
.qph-blog-card:hover .qph-blog-card-img-overlay { opacity: 1; }
.qph-blog-card-featured-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--qb-red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(230,57,70,0.4);
    letter-spacing: 0.01em;
    z-index: 2;
}

/* Cuerpo de la card */
.qph-blog-card-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.qph-blog-card-cat {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--qb-red);
    text-decoration: none;
    padding: 3px 8px;
    background: var(--qb-red-light);
    border-radius: 5px;
    width: fit-content;
    transition: var(--qb-transition);
}
.qph-blog-card-cat:hover { background: var(--qb-red); color: #fff; }
.qph-blog-card-title {
    font-size: 1rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.qph-blog-card-title a { color: var(--qb-text); text-decoration: none; }
.qph-blog-card-title a:hover { color: var(--qb-red); }
.qph-blog-card-excerpt {
    font-size: 0.84rem;
    color: var(--qb-text-light);
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}
.qph-blog-card-meta {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 4px;
}
.qph-blog-card-date,
.qph-blog-card-read {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--qb-text-light);
}
.qph-blog-card-date svg,
.qph-blog-card-read svg {
    width: 12px;
    height: 12px;
    stroke-width: 2;
    flex-shrink: 0;
}
.qph-blog-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    align-self: flex-start;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--qb-text-mid);
    text-decoration: none;
    padding: 8px 14px;
    background: var(--qb-surface-2);
    border: 1.5px solid var(--qb-border);
    border-radius: var(--qb-radius-sm);
    transition: var(--qb-transition);
    font-family: inherit;
    margin-top: 2px;
}
.qph-blog-card-btn svg { width: 13px; height: 13px; stroke-width: 2.5; transition: transform 0.2s; }
.qph-blog-card:hover .qph-blog-card-btn {
    background: var(--qb-red);
    border-color: var(--qb-red);
    color: #fff;
    box-shadow: 0 3px 12px var(--qb-red-glow);
}
.qph-blog-card:hover .qph-blog-card-btn svg { transform: translateX(3px); }

/* Card destacada: primera del listado, acento rojo izquierdo */
.qph-blog-card--featured {
    border-left: 3px solid var(--qb-red);
}
.qph-blog-card--featured .qph-blog-card-img-wrap {
    width: 260px;
    min-width: 260px;
    height: 220px;
}
.qph-blog-card--featured .qph-blog-card-body {
    padding: 22px 28px;
}
.qph-blog-card--featured .qph-blog-card-title {
    font-size: 1.15rem;
    -webkit-line-clamp: 3;
}
.qph-blog-card--featured .qph-blog-card-excerpt {
    -webkit-line-clamp: 3;
}

/* ── LOAD MORE ── */
.qph-blog-loadmore-wrap {
    text-align: center;
    margin-top: 36px;
}
.qph-blog-loadmore-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--qb-surface);
    border: 1.5px solid var(--qb-border);
    border-radius: var(--qb-radius);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--qb-text-mid);
    cursor: pointer;
    transition: var(--qb-transition);
    box-shadow: var(--qb-shadow-sm);
}
.qph-blog-loadmore-btn:hover {
    background: var(--qb-red);
    border-color: var(--qb-red);
    color: #fff;
    box-shadow: 0 4px 16px var(--qb-red-glow);
    transform: translateY(-2px);
}
.qph-blog-loadmore-btn .qb-spinner {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: qb-spin 0.7s linear infinite;
}
.qph-blog-loadmore-btn.loading .qb-spinner { display: inline-block; }
@keyframes qb-spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ── */
.qph-blog-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--qb-surface);
    border-radius: var(--qb-radius-lg);
    border: 2px dashed var(--qb-border);
}
.qph-blog-empty-icon { font-size: 2.6rem; margin-bottom: 12px; }
.qph-blog-empty h3 { font-size: 1.05rem; font-weight: 800; margin: 0 0 8px; }
.qph-blog-empty p { color: var(--qb-text-light); font-size: 0.86rem; margin: 0; }
.qph-blog-empty-small { font-size: 0.82rem; color: var(--qb-text-light); padding: 10px 0; }

/* ── SIDEBAR ── */
.qph-blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 24px;
}
.qph-blog-widget {
    background: var(--qb-surface);
    border-radius: var(--qb-radius-lg);
    border: 1px solid var(--qb-border);
    overflow: hidden;
    box-shadow: var(--qb-shadow);
}
.qph-blog-widget-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--qb-border);
}
.qph-blog-widget-icon {
    font-size: 1rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--qb-red-light);
    border-radius: var(--qb-radius-sm);
}
.qph-blog-widget-header h3 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--qb-text);
}

/* Trending */
.qph-blog-trending-list {
    padding: 10px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.qph-blog-trending-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--qb-radius-sm);
    text-decoration: none;
    color: var(--qb-text);
    transition: var(--qb-transition);
}
.qph-blog-trending-item:hover {
    background: var(--qb-surface-2);
    transform: translateX(3px);
}
.qph-blog-trending-num {
    font-size: 0.72rem;
    font-weight: 900;
    color: var(--qb-red);
    width: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}
.qph-blog-trending-item img {
    width: 44px;
    height: 44px;
    border-radius: var(--qb-radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--qb-border);
}
.qph-blog-trending-title {
    font-size: 0.79rem;
    font-weight: 700;
    line-height: 1.35;
    flex-grow: 1;
}

/* Categorías sidebar */
.qph-blog-cat-list {
    padding: 10px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.qph-blog-cat-sidebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 10px;
    background: none;
    border: none;
    border-radius: var(--qb-radius-sm);
    font-family: inherit;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--qb-text-mid);
    cursor: pointer;
    transition: var(--qb-transition);
    text-align: left;
}
.qph-blog-cat-sidebar:hover {
    background: var(--qb-red-light);
    color: var(--qb-red);
}
.qph-blog-cat-sidebar.active {
    background: var(--qb-red);
    color: #fff;
}
.qph-blog-cat-sidebar span {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 5px;
}
.qph-blog-cat-sidebar.active span { background: rgba(255,255,255,0.25); }

/* ── SKELETON ── */
@keyframes qb-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}
.qph-sk-block,
.qph-sk-line {
    background: linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: qb-shimmer 1.5s infinite;
    border-radius: 5px;
}
.qph-blog-skeleton .qph-blog-card-img-wrap { padding-top: 0; }
.qph-blog-skeleton .qph-sk-block { position: absolute; inset: 0; border-radius: 0; }
.qph-blog-skeleton .qph-blog-card-body { gap: 10px; }
.qph-sk-line { height: 11px; }
.qph-sk-short  { width: 40%; }
.qph-sk-wide   { width: 80%; height: 14px; }
.qph-sk-full   { width: 100%; }
.qph-sk-mid    { width: 60%; }

/* ── RESPONSIVE ── */

/* Desktop mediano */
@media (max-width: 1200px) {
    .qph-blog { padding: 40px 20px 80px; }
    .qph-blog-layout { grid-template-columns: 1fr 270px; gap: 28px; }
}

/* Tablet: sidebar abajo */
@media (max-width: 900px) {
    .qph-blog-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .qph-blog-sidebar {
        position: static;
        order: 10;
        margin-top: 48px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Mobile: cards se apilan verticalmente */
@media (max-width: 640px) {
    .qph-blog { padding: 28px 14px 64px; }
    .qph-blog-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 20px;
    }
    .qph-blog-search-wrap { max-width: 100%; }
    .qph-blog-cats-wrap {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 6px;
        margin-bottom: 20px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .qph-blog-cats-wrap::-webkit-scrollbar { display: none; }
    .qph-blog-grid { gap: 14px; }
    .qph-blog-card-img-wrap {
        width: 130px;
        min-width: 130px;
        height: 130px;
    }
    .qph-blog-card--featured .qph-blog-card-img-wrap {
        width: 150px;
        min-width: 150px;
        height: 150px;
    }
    .qph-blog-card-body { padding: 14px 16px; gap: 6px; }
    .qph-blog-card--featured .qph-blog-card-body { padding: 14px 16px; }
    .qph-blog-card-title { font-size: 0.9rem; }
    .qph-blog-card--featured .qph-blog-card-title { font-size: 0.95rem; -webkit-line-clamp: 2; line-clamp: 2; }
    .qph-blog-card-excerpt { display: none; }
    .qph-blog-card-btn { display: none; }
    .qph-blog-sidebar {
        margin-top: 36px;
        grid-template-columns: 1fr;
    }
}

/* Mobile muy pequeño */
@media (max-width: 380px) {
    .qph-blog-card-img-wrap {
        width: 110px;
        min-width: 110px;
        height: 110px;
    }
    .qph-blog-card--featured .qph-blog-card-img-wrap {
        width: 120px;
        min-width: 120px;
        height: 120px;
    }
}

/* ============================================================
   QPH Blog — Addon de estilos para filtros jerárquicos
   Añadir al final de qph-blog.css
   ============================================================ */

/* ── Categoría PADRE en la barra de filtros ── */
/* Separador visual sutil antes del primer hijo */
.qph-blog-cat--parent {
    position: relative;
    font-weight: 800;
}
/* Pequeña línea divisora antes de cada bloque padre (excepto el primero) */
.qph-blog-cat--parent:not(:nth-of-type(2))::before {
    content: '';
    display: inline-block;
    width: 1px;
    height: 16px;
    background: var(--qph-border, #e5e7eb);
    margin-right: 8px;
    vertical-align: middle;
    opacity: 0.7;
}

/* ── Categoría HIJA en la barra de filtros ── */
/* Indentación y tamaño ligeramente menor para jerarquía visual */
.qph-blog-cat--child {
    font-size: 0.78rem;
    padding-left: 14px;
    color: var(--qph-text-light, #6b7280);
    border-style: dashed; /* diferencia visual sutil del padre */
}
.qph-blog-cat--child .qph-blog-cat-dot {
    width: 5px;
    height: 5px;
    opacity: 0.7;
}
.qph-blog-cat--child.active,
.qph-blog-cat--child:hover {
    border-style: solid;
    color: inherit;
}

/* ── Separador de grupo en el SIDEBAR ── */
.qph-blog-cat-group-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--qph-text-light, #6b7280);
    padding: 14px 0 6px;
    border-top: 1px solid var(--qph-border, #e5e7eb);
    margin-top: 4px;
}
.qph-blog-cat-group-label:first-child {
    border-top: none;
    padding-top: 4px;
}

/* ── Categoría hija en el SIDEBAR ── */
.qph-blog-cat-sidebar--child {
    padding-left: 20px;
    font-size: 0.82rem;
    color: var(--qph-text-light, #6b7280);
}
.qph-blog-cat-sidebar--child::before {
    content: '↳';
    margin-right: 6px;
    opacity: 0.4;
    font-size: 0.75rem;
}
.qph-blog-cat-sidebar--child:hover,
.qph-blog-cat-sidebar--child.active {
    color: var(--qph-primary, #e63946);
}
