/* =============================================
   Blog Page Styles
   ============================================= */
.blog-hero {
    background: linear-gradient(135deg, #4f46e5 0%, #6a5ce2 100%);
    padding: 60px 0 50px;
    color: #fff;
}

.blog-hero h1 { font-size: 2.5rem; font-weight: 900; margin-bottom: 12px; }
.blog-hero p { font-size: 1.05rem; opacity: 0.85; }

.blog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 40px;
    align-items: start;
}

@media (max-width: 991px) { .blog-layout { grid-template-columns: 1fr; } .blog-sidebar { order: -1; } }

/* Featured Post */
.blog-featured {
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    margin-bottom: 32px;
    transition: var(--transition);
}

.blog-featured:hover { box-shadow: 0 20px 40px rgba(0,0,0,0.08); }

@media (max-width: 768px) { .blog-featured { grid-template-columns: 1fr; } }

.featured-thumb {
    min-height: 280px;
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 20px;
}

.featured-thumb-gradient-1 { background: linear-gradient(135deg, #6a5ce2 0%, #3730a3 100%); }

.featured-body { padding: 30px 24px; display: flex; flex-direction: column; justify-content: center; }
.featured-body h2 { font-size: 1.4rem; font-weight: 800; margin: 12px 0; color: var(--text-heading); }
.featured-body h2 a { color: inherit; text-decoration: none; }
.featured-body h2 a:hover { color: var(--brand-purple); }
.featured-body p { font-size: 0.95rem; color: #64748b; line-height: 1.7; margin-bottom: 20px; }

.post-meta { display: flex; gap: 16px; font-size: 0.85rem; color: #94a3b8; margin-bottom: 8px; }
.post-category {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
}

.cat-ai { background: #ede9fe; color: #7c3aed; }
.cat-automation { background: #dbeafe; color: #1d4ed8; }
.cat-telegram { background: #e0f2fe; color: #0369a1; }
.cat-sales { background: #fef3c7; color: #d97706; }

.btn-read-more {
    color: var(--brand-purple);
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.3s;
}

.btn-read-more:hover { gap: 10px; }

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

@media (max-width: 600px) { .posts-grid { grid-template-columns: 1fr; } }

.post-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    transition: var(--transition);
}

.post-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,0.07); }

.post-thumb {
    height: 160px;
    background-size: cover;
    background-position: center;
}

.post-thumb-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.post-thumb-green  { background: linear-gradient(135deg, #10b981, #047857); }
.post-thumb-orange { background: linear-gradient(135deg, #f97316, #c2410c); }
.post-thumb-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.post-thumb-dark   { background: linear-gradient(135deg, #334155, #0f172a); }

.post-body { padding: 20px; }
.post-body h3 { font-size: 1rem; font-weight: 700; margin: 10px 0 8px; color: var(--text-heading); }
.post-body h3 a { color: inherit; text-decoration: none; }
.post-body h3 a:hover { color: var(--brand-purple); }
.post-body p { font-size: 0.88rem; color: #64748b; line-height: 1.6; margin-bottom: 14px; }
.post-footer { display: flex; justify-content: space-between; font-size: 0.8rem; color: #94a3b8; }

/* Pagination */
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
.page-btn {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; border: 1px solid #e2e8f0;
    color: var(--text-main); text-decoration: none; font-weight: 600;
    transition: var(--transition);
}
.page-btn.active, .page-btn:hover { background: var(--brand-purple); color: #fff; border-color: var(--brand-purple); }
.page-dots { color: #94a3b8; }
.page-next {
    padding: 0 16px; height: 40px; border-radius: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    color: var(--text-main); text-decoration: none; display: flex; align-items: center;
    font-weight: 600; transition: var(--transition);
}
.page-next:hover { background: var(--brand-purple); color: #fff; border-color: var(--brand-purple); }

/* Sidebar */
.sidebar-widget {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
}

.widget-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}

.sidebar-search { display: flex; gap: 8px; }
.sidebar-search input {
    flex: 1; padding: 10px 14px; border: 1px solid #e2e8f0;
    border-radius: 10px; font-family: inherit; font-size: 0.9rem; outline: none;
}
.sidebar-search input:focus { border-color: var(--brand-purple); }
.sidebar-search button {
    padding: 10px 14px; background: var(--brand-purple); color: #fff;
    border: none; border-radius: 10px; cursor: pointer;
}

.cat-list { list-style: none; }
.cat-list li { border-bottom: 1px solid #f1f5f9; }
.cat-list a {
    display: flex; justify-content: space-between;
    padding: 10px 0; color: var(--text-main); text-decoration: none;
    font-size: 0.9rem; transition: 0.2s;
}
.cat-list a:hover { color: var(--brand-purple); }
.cat-list span { background: #f1f5f9; padding: 2px 8px; border-radius: 20px; font-size: 0.8rem; }

.popular-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.popular-list a {
    display: flex; align-items: flex-start; gap: 10px;
    color: var(--text-main); text-decoration: none; font-size: 0.9rem;
    line-height: 1.5; transition: 0.2s;
}
.popular-list a:hover { color: var(--brand-purple); }
.pop-num {
    width: 24px; height: 24px; background: var(--brand-purple); color: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}

.sidebar-cta {
    background: linear-gradient(135deg, #4f46e5, #6a5ce2) !important;
    border: none !important;
    color: #fff;
}
.sidebar-cta h4, .sidebar-cta p { color: #fff; }
.sidebar-cta h4 { font-size: 1.2rem; font-weight: 800; }
.sidebar-cta p { opacity: 0.85; font-size: 0.9rem; }


/* =============================================
   Additions (CMS): تصویر واقعی، رنگ دسته‌ها، صفحه‌بندی، جستجو
   ============================================= */
.blog-hero .text-purple { color: #fde68a; }
.blog-hero .hero-crumbs { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: .9rem; margin-bottom: 14px; opacity: .85; }
.blog-hero .hero-crumbs a { color: #fff; text-decoration: none; }
.blog-hero .hero-crumbs a:hover { text-decoration: underline; }
.blog-main { min-width: 0; }

/* تصویر شاخص */
.featured-thumb { overflow: hidden; }
.featured-thumb > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.featured-thumb .post-category { position: relative; z-index: 1; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.post-thumb { overflow: hidden; display: block; }
.post-thumb > img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.post-card:hover .post-thumb > img { transform: scale(1.04); }
.post-thumb-c1 { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.post-thumb-c2 { background: linear-gradient(135deg, #10b981, #047857); }
.post-thumb-c3 { background: linear-gradient(135deg, #f97316, #c2410c); }
.post-thumb-c4 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.post-thumb-c5 { background: linear-gradient(135deg, #334155, #0f172a); }
.featured-thumb.post-thumb-c1, .featured-thumb.post-thumb-c2, .featured-thumb.post-thumb-c3,
.featured-thumb.post-thumb-c4, .featured-thumb.post-thumb-c5 { position: relative; }

/* رنگ دسته‌ها (بر اساس شناسه‌ی دسته، خودکار) */
.cat-c1 { background: #ede9fe; color: #7c3aed; }
.cat-c2 { background: #dbeafe; color: #1d4ed8; }
.cat-c3 { background: #e0f2fe; color: #0369a1; }
.cat-c4 { background: #fef3c7; color: #b45309; }
.cat-c5 { background: #d1fae5; color: #047857; }
.cat-c6 { background: #fce7f3; color: #be185d; }
a.post-category { text-decoration: none; }
a.post-category:hover { filter: brightness(.95); }
.card-cats { display: flex; gap: 6px; flex-wrap: wrap; }

.post-card { display: flex; flex-direction: column; }
.post-body { display: flex; flex-direction: column; flex: 1; }
.post-body .post-footer { margin-top: auto; }
.featured-body .post-meta span + span::before, .post-footer span + span::before { content: none; }

/* خالی و نتیجه جستجو */
.blog-empty { text-align: center; padding: 60px 20px; background: #fff; border: 1px dashed #cbd5e1; border-radius: 20px; color: #64748b; }
.blog-empty h2 { color: var(--text-heading); font-size: 1.2rem; margin-bottom: 8px; }
.search-note { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 12px 18px; margin-bottom: 24px; font-size: .95rem; }

/* صفحه‌بندی */
.pagination { flex-wrap: wrap; }
.page-btn { cursor: pointer; }
span.page-btn.active { cursor: default; }

/* سایدبار */
.cat-list .cat-sub { list-style: none; padding-right: 14px; border-right: 2px solid #f1f5f9; margin: 0 0 6px; }
.cat-list .cat-sub a { font-size: .85rem; padding: 7px 0; }
.cat-list a.is-active { color: var(--brand-purple); font-weight: 700; }
.sidebar-search input { min-width: 0; }
.sidebar-search button { font-family: inherit; font-weight: 700; }
.sidebar-search button:hover { background: var(--brand-purple-dark); }
.sidebar-cta .btn { margin-top: 12px; width: 100%; text-align: center; }
.blog-sidebar { min-width: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand-purple); outline-offset: 2px; }


/* =============================================
   Video posts: فیلتر، نشان پخش، مدت
   ============================================= */
.blog-filter { display: inline-flex; gap: 6px; background: rgba(255, 255, 255, .14); padding: 5px; border-radius: 14px; margin-top: 22px; }
.blog-filter a { color: #fff; text-decoration: none; padding: 8px 22px; border-radius: 10px; font-weight: 700; font-size: .95rem; transition: var(--transition); }
.blog-filter a:hover { background: rgba(255, 255, 255, .15); }
.blog-filter a[aria-current="page"] { background: #fff; color: var(--brand-purple-dark, #4f46e5); }

.post-thumb, .featured-thumb { position: relative; }
.play-badge { position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; background: rgba(15, 23, 42, .62); backdrop-filter: blur(2px); pointer-events: none; transition: var(--transition); }
.play-badge::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-35%, -50%); border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff; }
.play-badge-lg { width: 72px; height: 72px; z-index: 1; }
.post-card:hover .play-badge, .blog-featured:hover .play-badge { background: var(--brand-purple); }
.duration-chip { position: absolute; bottom: 10px; left: 10px; background: rgba(15, 23, 42, .78); color: #fff; font-size: .78rem; padding: 2px 10px; border-radius: 8px; direction: ltr; line-height: 1.7; }
.post-category.type-video { background: #fee2e2; color: #b91c1c; }
