/* ========================================================
   صفحه بلاگ وب‌داران
   ======================================================== */

.wbd-blog-page {
    --wbd-card-bg: #ffffff;
    --wbd-badge-bg: #eef2ff;
    padding: 48px 0 96px;
}

body.dark-mode .wbd-blog-page {
    --wbd-card-bg: #1f2937;
    --wbd-badge-bg: #374151;
}

.wbd-blog-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- سربرگ ---------- */
.wbd-blog-hero { text-align: center; margin-bottom: 36px; }

.wbd-blog-title {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 800;
    color: var(--text-color, #1f2937);
}

.wbd-blog-desc {
    max-width: 720px;
    margin: 12px auto 0;
    color: var(--text-light, #4b5563);
    font-size: .95rem;
    line-height: 1.9;
}
.wbd-blog-desc p { margin: 0; }

/* ---------- نوار فیلتر ---------- */
.wbd-blog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 32px;
}

.wbd-cat-filters { display: flex; flex-wrap: wrap; gap: 10px; }

.wbd-cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 9999px;
    border: 1px solid var(--border-color, #e5e7eb);
    background: var(--wbd-card-bg);
    color: var(--text-color, #1f2937);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition, all .3s ease);
}

.wbd-cat-btn:hover {
    border-color: var(--primary-color, #2563eb);
    color: var(--primary-color, #2563eb);
}

.wbd-cat-btn.is-active {
    background: var(--primary-color, #2563eb);
    border-color: var(--primary-color, #2563eb);
    color: #fff;
    box-shadow: 0 6px 14px -6px rgba(37, 99, 235, .5);
}

.wbd-cat-count {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 9999px;
    background: var(--wbd-badge-bg);
    color: var(--primary-color, #2563eb);
}
.wbd-cat-btn.is-active .wbd-cat-count {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.wbd-blog-count {
    margin: 0;
    font-size: 13px;
    color: var(--text-light, #4b5563);
}

/* ---------- گرید: موبایل ۱ / تبلت ۲ / دسکتاپ ۴ ---------- */
.wbd-blog-grid-wrap { position: relative; }

.wbd-blog-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr;
}
@media (min-width: 640px)  { .wbd-blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .wbd-blog-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- کارت ---------- */
@keyframes wbd-card-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modern-post-card {
    background: var(--wbd-card-bg);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
    animation: wbd-card-in .5s ease both;
}

.modern-post-card:hover {
    transform: translateY(-6px);
    border-color: rgba(37, 99, 235, .35);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body.dark-mode .modern-post-card:hover { border-color: rgba(96, 165, 250, .5); }

/* رسانه کارت — aspect-ratio از شیفت چیدمان (CLS) جلوگیری می‌کند */
.card-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f3f4f6;
}
body.dark-mode .card-media { background: #111827; }

.card-media a { display: block; width: 100%; height: 100%; }

.post-picture-wrapper { display: block; width: 100%; height: 100%; }

.post-thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
}
.modern-post-card:hover .post-thumbnail-img { transform: scale(1.05); }

.wbd-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9ca3af;
}
body.dark-mode .wbd-card-placeholder { color: #4b5563; }

/* ---------- بدنه کارت ---------- */
.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-light, #4b5563);
}

.meta-date { display: inline-flex; align-items: center; gap: 5px; }
.meta-date svg { flex-shrink: 0; }

.card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a {
    color: var(--text-color, #1f2937);
    transition: color .25s ease;
}
.card-title a:hover { color: var(--primary-color, #2563eb); }

.card-excerpt {
    margin-top: 10px;
    font-size: 13.5px;
    line-height: 1.9;
    color: var(--text-light, #4b5563);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-excerpt p { margin: 0; }

.card-footer { margin-top: auto; padding-top: 16px; }

.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color, #2563eb);
}
.read-more-btn svg { transition: transform .25s ease; }
.read-more-btn:hover svg { transform: translateX(-4px); } /* حرکت فلش به چپ در RTL */

/* ---------- حالت لودینگ ---------- */
.wbd-blog-loader {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249, 250, 251, .6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border-radius: 16px;
}
body.dark-mode .wbd-blog-loader { background: rgba(17, 24, 39, .65); }
.wbd-blog-loader[hidden] { display: none; }

.wbd-blog-loader span {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 4px solid #dbeafe;
    border-top-color: var(--primary-color, #2563eb);
    animation: wbd-spin .8s linear infinite;
}
body.dark-mode .wbd-blog-loader span {
    border-color: #374151;
    border-top-color: #60a5fa;
}
@keyframes wbd-spin { to { transform: rotate(360deg); } }

.wbd-blog-grid.is-loading { pointer-events: none; }
.wbd-blog-grid.is-loading .modern-post-card { opacity: .35; }

/* ---------- حالت خالی / خطا ---------- */
.wbd-blog-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 70px 20px;
    margin: 0;
    color: var(--text-light, #4b5563);
}
.wbd-blog-error { color: #dc2626; }

/* ---------- موبایل ---------- */
@media (max-width: 640px) {
    .wbd-blog-page { padding: 32px 0 64px; }
    .wbd-blog-container { padding: 0 16px; }
    .card-body { padding: 16px; }
    .wbd-cat-btn { padding: 8px 14px; font-size: 13px; }
}

/* ---------- احترام به کاهش انیمیشن ---------- */
@media (prefers-reduced-motion: reduce) {
    .modern-post-card { animation: none; transition: none; }
    .post-thumbnail-img, .read-more-btn svg, .wbd-cat-btn { transition: none; }
}






/* ---------- ✅ جدید: پگینیشن ---------- */
.wbd-pagination {
    margin-top: 48px;
    display: flex;
    justify-content: center;
}

.wbd-pagination ul.page-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wbd-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;   /* حداقل اندازه استاندارد لمس در موبایل */
    height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    background: #f4f5f7;
    color: #2c3e50;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background .25s ease, color .25s ease, transform .25s ease, box-shadow .25s ease;
}

.wbd-pagination a.page-numbers:hover,
.wbd-pagination a.page-numbers:focus-visible {
    background: #4f6bff;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(79, 107, 255, .30);
    outline: none;
}

.wbd-pagination .page-numbers.current {
    background: #4f6bff;
    color: #fff;
    cursor: default;
    box-shadow: 0 6px 16px rgba(79, 107, 255, .25);
}

.wbd-pagination .screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
}



/* ✅ دکمه‌های فیلتر حالا لینک هستند */
a.wbd-cat-btn {
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* مطمئن‌شدن کارکرد hidden روی پگینیشن */
.wbd-pagination[hidden] { display: none !important; }