/**
 * Blog Archive & Category Styles
 */

:root {
    --blog-gold: #ffc31d;
    --blog-gold-hover: #e5ab00;
    --blog-brand: #111;
    --blog-white: #fff;
    --blog-gray: #f1f1f1;
    --blog-border: #e0e0e0;
    --blog-text: #111;
    --blog-text-light: #666;
    --blog-transition: all 0.3s ease;
}

/* ==========================================
   WRAPPER
   ========================================== */
.blog-archive-wrapper {
    padding: 40px 0 80px;
    background: #fafafa;
    min-height: 60vh;
}

.blog-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================
   BREADCRUMB
   ========================================== */
.blog-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--blog-text-light);
    margin-bottom: 20px;
}

.blog-breadcrumb a {
    color: var(--blog-text-light);
    text-decoration: none;
    transition: var(--blog-transition);
}

.blog-breadcrumb a:hover {
    color: var(--blog-brand);
}

.blog-breadcrumb .sep {
    color: var(--blog-border);
}

/* ==========================================
   PAGE HEADER
   ========================================== */
.blog-page-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--blog-border);
}

.blog-page-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--blog-brand);
    margin-bottom: 8px;
}

.blog-page-desc {
    font-size: 15px;
    color: var(--blog-text-light);
    line-height: 1.7;
    margin: 0;
}

/* ==========================================
   LAYOUT: دو ستون
   ========================================== */
.blog-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    align-items: start;
}

/* ==========================================
   POSTS GRID: سه ستون
   ========================================== */
.blog-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

/* ==========================================
   BLOG CARD
   ========================================== */
.blog-card {
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    display: flex;
    flex-direction: column;
    transition: var(--blog-transition);
}

.blog-card:hover {
    border-color: #ccc;
}

/* تصویر */
.blog-card-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--blog-gray);
}

.blog-card-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.04);
}

.blog-card-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--blog-border);
}

/* دسته‌بندی روی تصویر */
.blog-card-cat {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 4px 10px;
    background: var(--blog-gold);
    color: var(--blog-text);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--blog-transition);
    z-index: 2;
}

.blog-card-cat:hover {
    background: var(--blog-gold-hover);
}

/* محتوا */
.blog-card-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.blog-card-meta-cat {
    display: inline-block;
    padding: 3px 10px;
    background: var(--blog-gray);
    border: 1px solid var(--blog-border);
    font-size: 12px;
    font-weight: 700;
    color: var(--blog-brand);
    text-decoration: none;
    transition: var(--blog-transition);
}

.blog-card-meta-cat:hover {
    background: var(--blog-brand);
    color: var(--blog-white);
    border-color: var(--blog-brand);
}

.blog-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--blog-text);
    margin-bottom: 10px;
    line-height: 1.6;
}

.blog-card-title a {
    color: inherit;
    text-decoration: none;
    transition: var(--blog-transition);
}

.blog-card-title a:hover {
    color: var(--blog-brand);
}

.blog-card-excerpt {
    font-size: 13px;
    color: var(--blog-text-light);
    line-height: 1.8;
    margin-bottom: 16px;
    flex: 1;
}

/* footer کارت */
.blog-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--blog-border);
}

.blog-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--blog-brand);
    text-decoration: none;
    transition: var(--blog-gold);
}

.blog-read-more:hover {
    color: var(--blog-gold-hover);
}

.blog-read-more svg {
    transition: transform 0.3s ease;
}

.blog-read-more:hover svg {
    transform: translateX(-4px);
}

/* ==========================================
   SHARE
   ========================================== */
.blog-share {
    position: relative;
}

.share-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--blog-gray);
    border: 1px solid var(--blog-border);
    color: var(--blog-text-light);
    cursor: pointer;
    transition: var(--blog-transition);
}

.share-toggle:hover {
    background: var(--blog-brand);
    color: var(--blog-white);
    border-color: var(--blog-brand);
}

.share-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    display: flex;
    gap: 6px;
    padding: 10px;
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: var(--blog-transition);
    z-index: 100;
    white-space: nowrap;
}

.blog-share.open .share-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.share-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    cursor: pointer;
    transition: var(--blog-transition);
    text-decoration: none;
    color: var(--blog-white);
}

.share-telegram  { background: #2ca5e0; }
.share-bale      { background: #1a73e8; }
.share-eitaa     { background: #cc3333; }
.share-whatsapp  { background: #25d366; }
.share-copy      { background: var(--blog-gray); color: var(--blog-text); border: 1px solid var(--blog-border); }

.share-item:hover {
    opacity: 0.85;
}

.share-copy.copied {
    background: #27ae60;
    color: var(--blog-white);
    border-color: #27ae60;
}

/* ==========================================
   PAGINATION
   ========================================== */
.blog-pagination {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.blog-pagination .page-numbers {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.blog-pagination .page-numbers li {
    margin: 0;
}

.blog-pagination .page-numbers a,
.blog-pagination .page-numbers span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    color: var(--blog-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--blog-transition);
}

.blog-pagination .page-numbers a:hover {
    background: var(--blog-brand);
    color: var(--blog-white);
    border-color: var(--blog-brand);
}

.blog-pagination .page-numbers .current {
    background: var(--blog-brand);
    color: var(--blog-white);
    border-color: var(--blog-brand);
}

.blog-pagination .page-numbers .dots {
    border: none;
    background: transparent;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.blog-sidebar {
    position: sticky;
    top: 20px;
}

.sidebar-inner {
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
}

.sidebar-widget {
    padding: 20px;
}

.sidebar-widget + .sidebar-widget {
    border-top: 1px solid var(--blog-border);
}

.sidebar-widget-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--blog-brand);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--blog-border);
}

.sidebar-categories {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-categories li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--blog-text);
    text-decoration: none;
    transition: var(--blog-transition);
    border: 1px solid transparent;
}

.sidebar-categories li a:hover {
    background: var(--blog-gray);
    border-color: var(--blog-border);
}

.sidebar-categories li.active a {
    background: var(--blog-brand);
    color: var(--blog-white);
    border-color: var(--blog-brand);
}

.sidebar-categories li.active a .cat-count {
    background: rgba(255,255,255,0.2);
    color: var(--blog-white);
}

.cat-name {
    flex: 1;
}

.cat-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 6px;
    background: var(--blog-gray);
    color: var(--blog-text-light);
    font-size: 11px;
    font-weight: 700;
}

/* ==========================================
   NO POSTS
   ========================================== */
.blog-no-posts {
    text-align: center;
    padding: 60px 20px;
    background: var(--blog-white);
    border: 1px solid var(--blog-border);
    color: var(--blog-text-light);
    font-size: 16px;
}

/* ==========================================
   MOBILE SIDEBAR BUTTON (ثابت پایین)
   ========================================== */
.mobile-sidebar-btn {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--blog-brand);
    color: var(--blog-white);
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--blog-transition);
    box-shadow: 0 4px 20px rgba(48,51,107,0.3);
}

.mobile-sidebar-btn:hover {
    background: #252953;
}

/* ==========================================
   MOBILE SIDEBAR SHEET (bottom sheet)
   ========================================== */
.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.mobile-sidebar-overlay.active {
    display: block;
}

.mobile-sidebar-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: var(--blog-white);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-sidebar-sheet.active {
    transform: translateY(0);
}

.mobile-sidebar-handle {
    width: 40px;
    height: 4px;
    background: var(--blog-border);
    margin: 12px auto 0;
    flex-shrink: 0;
}

.mobile-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--blog-border);
    flex-shrink: 0;
}

.mobile-sidebar-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--blog-brand);
    margin: 0;
}

.mobile-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--blog-gray);
    border: none;
    color: var(--blog-text);
    cursor: pointer;
    transition: var(--blog-transition);
}

.mobile-sidebar-close:hover {
    background: var(--blog-brand);
    color: var(--blog-white);
}

.mobile-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    -webkit-overflow-scrolling: touch;
}

.mobile-sidebar-body .sidebar-categories li a {
    padding: 12px 14px;
    font-size: 15px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1100px) {
    .blog-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        display: none;
    }

    .mobile-sidebar-btn {
        display: flex;
    }
}

@media (max-width: 600px) {
    .blog-posts-grid {
        grid-template-columns: 1fr;
    }

    .blog-page-title {
        font-size: 22px;
    }

    .blog-archive-wrapper {
        padding: 24px 0 100px;
    }
}
