/* ============================================================
   1. تنظیمات پایه و متغیرها (Base & Variables)
   ============================================================ */
@font-face { font-family: 'IRANSansX'; src: url('../Font/IRANSansX-Regular.woff') format('woff'); font-weight: 400; }
@font-face { font-family: 'IRANSansX'; src: url('../Font/IRANSansX-Bold.woff') format('woff'); font-weight: 700; }

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary: #64748b;
    --accent: #f59e0b;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    
    --text-main: #0f172a;
    --text-body: #334155;
    --text-muted: #94a3b8;
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'IRANSansX', sans-serif; text-decoration: none; list-style: none; outline: none; -webkit-tap-highlight-color: transparent; }

body { 
    background-color: var(--bg-body); 
    color: var(--text-body); 
    overflow-x: hidden; 
    padding-bottom: 90px;
    line-height: 1.6;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ============================================================
   2. نوبار دسکتاپ (Desktop Navbar)
   ============================================================ */
.desktop-header { position: fixed; top: 25px; left: 0; right: 0; display: flex; justify-content: center; z-index: 1000; pointer-events: none; }
.nav-container { 
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(12px); 
    width: 100%; max-width: 1100px; height: 75px; 
    border-radius: 50px; box-shadow: 0 8px 30px -5px rgba(14, 165, 233, 0.15); 
    display: flex; align-items: center; justify-content: space-between; 
    padding: 0 35px; border: 1px solid rgba(255, 255, 255, 0.8); pointer-events: auto; 
}

.logo { display: flex; align-items: center; gap: 12px; color: var(--primary); font-weight: 800; font-size: 1.2rem; }
.desktop-menu { display: flex; gap: 30px; }
.desktop-menu a { color: var(--text-main); font-weight: 500; font-size: 0.95rem; transition: 0.3s; position: relative; }
.desktop-menu a:hover, .desktop-menu a.active { color: var(--primary); }
.desktop-menu a.active::after { content: ''; position: absolute; bottom: -5px; left: 0; width: 100%; height: 2px; background: var(--primary); border-radius: 2px; }

.desktop-actions { display: flex; align-items: center; gap: 15px; }
.btn-icon { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-main); position: relative; transition: 0.3s; }
.btn-icon:hover { background: #f1f5f9; color: var(--primary); transform: translateY(-2px); }
.badge-count { position: absolute; top: 4px; right: 4px; background: #ef4444; color: white; font-size: 0.65rem; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid white; }
.btn-login { background: var(--primary); color: white; padding: 10px 24px; border-radius: 30px; font-weight: 700; font-size: 0.9rem; transition: 0.3s; box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3); }
.btn-login:hover { background: var(--primary-dark); transform: translateY(-2px); }

/* جستجو */
.search-wrapper { position: relative; }
.search-dropdown { position: absolute; top: 150%; left: -10px; width: 260px; background: white; padding: 10px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); opacity: 0; visibility: hidden; transform: translateY(-10px); transition: 0.3s; z-index: 1100; border: 1px solid var(--border); }
.search-dropdown.active { opacity: 1; visibility: visible; transform: translateY(0); }
.search-form { display: flex; align-items: center; background: #f8fafc; border-radius: 8px; padding: 5px; border: 1px solid var(--border); }
.search-input-small { border: none; background: transparent; width: 100%; padding: 8px; font-size: 0.85rem; outline: none; font-family: 'IRANSansX'; }
.search-submit { background: var(--primary); color: white; border: none; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ============================================================
   3. هدر صفحه وبلاگ (Page Header)
   ============================================================ */
.blog-wrapper { padding-top: 130px; }

.blog-header-section {
    background: radial-gradient(circle at 50% 0%, #e0f2fe 0%, transparent 70%);
    padding: 0 0 60px; margin-bottom: 40px; text-align: center;
}

.blog-header-content h1 { font-size: 2rem; font-weight: 900; color: var(--text-main); margin-bottom: 15px; }
.breadcrumb { font-size: 0.9rem; color: var(--text-muted); display: flex; justify-content: center; align-items: center; gap: 8px; }
.breadcrumb a { color: var(--secondary); transition: 0.2s; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--primary); font-weight: 700; }
.breadcrumb i { font-size: 0.7rem; }

/* ============================================================
   4. لی‌اوت اصلی (Main Layout - Right Sidebar)
   ============================================================ */
.blog-container {
    display: grid;
    /* تعریف نواحی: سایدبار راست، محتوا چپ */
    grid-template-areas: "sidebar content";
    grid-template-columns: 320px 1fr; /* عرض سایدبار | عرض محتوا */
    gap: 40px;
    align-items: start;
}

/* ترتیب‌دهی صریح (Desktop) */
.blog-sidebar-col {
    grid-column: 1; /* سایدبار ستون اول */
    position: sticky;
    top: 120px; /* چسبیدن هنگام اسکرول */
}

.blog-posts-col {
    grid-area: content; /* قرارگیری در ناحیه محتوا (چپ) */
    min-width: 0; /* جلوگیری از سرریز شدن محتوا */
}

/* مخفی کردن المان‌های موبایل در دسکتاپ */
.mobile-filter-btn, .sidebar-overlay, .sidebar-mobile-header { display: none; }

/* ============================================================
   5. کارت‌های مقاله (Blog Posts)
   ============================================================ */
.blog-card {
    background: white; border: 1px solid var(--border); border-radius: 20px; overflow: hidden;
    margin-bottom: 30px; transition: 0.3s;
}
.blog-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: transparent; }

.blog-thumb { position: relative; height: 260px; overflow: hidden; }
.cat-badge {
    position: absolute; top: 20px; right: 20px; background: var(--primary); color: white;
    padding: 6px 15px; border-radius: 30px; font-size: 0.8rem; font-weight: 700; z-index: 2;
}
.cat-badge.green { background: #10b981; }
.cat-badge.orange { background: #f59e0b; }

.thumb-placeholder {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    font-size: 4rem; color: white; transition: 0.5s;
}
.bg-gradient-1 { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.bg-gradient-2 { background: linear-gradient(135deg, #10b981, #059669); }
.bg-gradient-3 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.blog-card:hover .thumb-placeholder { transform: scale(1.05); }

.blog-content { padding: 30px; }
.blog-meta { display: flex; gap: 20px; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 15px; }
.blog-meta span { display: flex; align-items: center; gap: 5px; }

.blog-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 15px; line-height: 1.5; }
.blog-title a { color: var(--text-main); transition: 0.2s; }
.blog-title a:hover { color: var(--primary); }

.blog-excerpt { color: var(--text-body); font-size: 0.95rem; line-height: 1.8; margin-bottom: 25px; }

.btn-read-more {
    display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 700; font-size: 0.9rem; transition: 0.3s;
}
.btn-read-more:hover { gap: 12px; }

/* صفحه‌بندی */
.pagination { display: flex; justify-content: center; gap: 10px; margin-top: 50px; margin-bottom: 50px; }
.page-link {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 12px; background: white; border: 1px solid var(--border); color: var(--text-main);
    transition: 0.3s; font-weight: 700;
}
.page-link:hover, .page-link.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ============================================================
   6. سایدبار وبلاگ (Sidebar Widgets)
   ============================================================ */
.sidebar-widget {
    background: white; border: 1px solid var(--border); border-radius: 16px; padding: 25px; margin-bottom: 30px;
}

.widget-title { font-size: 1.1rem; font-weight: 800; color: var(--text-main); margin-bottom: 20px; position: relative; padding-bottom: 10px; }
.widget-title::after { content: ''; position: absolute; bottom: 0; right: 0; width: 40px; height: 3px; background: var(--primary); border-radius: 2px; }

/* ویجت جستجو */
.search-widget form { position: relative; }
.search-widget input {
    width: 100%; padding: 12px 15px 12px 40px; border: 1px solid var(--border); border-radius: 10px;
    font-family: 'IRANSansX'; font-size: 0.9rem; outline: none; transition: 0.3s; background: #f8fafc;
}
.search-widget input:focus { border-color: var(--primary); background: white; }
.search-widget button {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted); cursor: pointer;
}

/* لیست دسته‌بندی */
.cat-list li { border-bottom: 1px solid #f1f5f9; }
.cat-list li:last-child { border-bottom: none; }
.cat-list a {
    display: flex; justify-content: space-between; padding: 12px 0; color: var(--text-body); font-size: 0.95rem; transition: 0.2s;
}
.cat-list a:hover { color: var(--primary); padding-right: 5px; }
.cat-list span { background: #f1f5f9; padding: 2px 8px; border-radius: 6px; font-size: 0.8rem; color: var(--text-muted); }

/* پست‌های محبوب */
.popular-posts { display: flex; flex-direction: column; gap: 15px; }
.pp-item { display: flex; align-items: center; gap: 15px; }
.pp-img {
    width: 60px; height: 60px; border-radius: 10px; background: #e0f2fe; color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0;
}
.pp-info h4 { font-size: 0.9rem; font-weight: 700; color: var(--text-main); margin-bottom: 5px; line-height: 1.4; transition: 0.2s; }
.pp-item:hover h4 { color: var(--primary); }
.pp-info span { font-size: 0.75rem; color: var(--text-muted); }

/* برچسب‌ها */
.tags-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tags-cloud a {
    background: #f8fafc; border: 1px solid var(--border); padding: 6px 12px; border-radius: 8px;
    font-size: 0.85rem; color: var(--secondary); transition: 0.3s;
}
.tags-cloud a:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ============================================================
   7. فوتر و نوبار موبایل (مشترک)
   ============================================================ */
.site-footer { background: white; border-top: 1px solid var(--border); padding: 50px 0 20px; margin-top: auto; }
.footer-top-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; color: var(--text-main); margin-bottom: 15px; }
.footer-desc { font-size: 0.9rem; color: var(--secondary); line-height: 1.8; margin-bottom: 20px; }
.social-links { display: flex; gap: 10px; }
.social-btn { width: 35px; height: 35px; background: #f1f5f9; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--secondary); transition: 0.3s; }
.social-btn:hover { background: var(--primary); color: white; }
.footer-title { font-size: 1rem; font-weight: 800; margin-bottom: 20px; color: var(--text-main); }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: var(--secondary); font-size: 0.9rem; transition: 0.2s; }
.footer-links a:hover { color: var(--primary); padding-right: 5px; }
.badge-box { display: inline-flex; align-items: center; gap: 5px; background: #f8fafc; padding: 10px 15px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-muted); font-size: 0.8rem; }
.footer-bottom { text-align: center; border-top: 1px solid #f1f5f9; padding-top: 20px; font-size: 0.85rem; color: var(--text-muted); }

/* نوبار موبایل */
.mobile-bottom-nav { display: none; }

/* ============================================================
   8. ریسپانسیو و حالت موبایل (Mobile Filter Logic)
   ============================================================ */
@media (max-width: 900px) {
    .desktop-header { display: none; }
    .blog-wrapper { padding-top: 20px; }
    
    .blog-header-section { padding: 40px 0 30px; text-align: center; }
    .blog-header-content h1 { font-size: 1.5rem; }

    /* 1. تک‌ستونه شدن */
    .blog-container {
        display: block; /* گرید حذف می‌شود */
    }

    /* 2. مخفی کردن سایدبار به صورت پیش‌فرض */
    .blog-sidebar-col {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        z-index: 9999;
        background: white;
        border-radius: 25px 25px 0 0;
        padding: 0 25px 25px 25px;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
        
        /* حالت پیش‌فرض: مخفی پایین صفحه */
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
        
        max-height: 80vh;
        overflow-y: auto;
        width: 100%; /* تمام عرض */
    }

    /* کلاس فعال برای باز شدن منو */
    .blog-sidebar-col.active {
        transform: translateY(0);
    }

    /* 3. نمایش هدر موبایل سایدبار */
    .sidebar-mobile-header {
        display: flex; justify-content: space-between; align-items: center;
        padding: 20px 0; border-bottom: 1px solid var(--border); margin-bottom: 20px;
        position: sticky; top: 0; background: white; z-index: 10;
    }
    .sidebar-mobile-header h3 { font-size: 1.1rem; font-weight: 800; color: var(--text-main); }
    
    .close-sidebar-btn {
        width: 35px; height: 35px; background: #f1f5f9; border-radius: 50%;
        border: none; color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
    }

    /* 4. دکمه فیلتر شناور (Sticky Button) */
    .mobile-filter-btn {
        display: flex; align-items: center; justify-content: center; gap: 10px;
        position: fixed; bottom: 115px; /* بالای نوبار پایین */
        left: 50%; transform: translateX(-50%);
        background: var(--primary); color: white;
        padding: 12px 30px; border-radius: 50px;
        font-family: 'IRANSansX'; font-weight: 700; font-size: 0.95rem;
        border: none; box-shadow: 0 10px 25px rgba(0,0,0,0.3);
        z-index: 90; cursor: pointer; transition: 0.3s;
        width: auto; white-space: nowrap;
    }
    .mobile-filter-btn:active { transform: translateX(-50%) scale(0.95); }
    .mobile-filter-btn i { color: var(--bg-body ); }

    /* 5. لایه تاریک پشت */
    .sidebar-overlay {
        display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
        z-index: 9998; opacity: 0; visibility: hidden; transition: 0.3s;
    }
    .sidebar-overlay.active { opacity: 1; visibility: visible; }

    /* اصلاح ویجت‌ها در حالت موبایل */
    .sidebar-widget { border: none; padding: 0; margin-bottom: 30px; border-radius: 0; }

    /* نوبار پایین */
    .mobile-bottom-nav { display: flex; justify-content: space-between; align-items: flex-end; position: fixed; bottom: 0; left: 0; right: 0; height: 70px; background: white; z-index: 9990; padding: 0 15px 15px 15px; box-shadow: 0 -5px 20px rgba(0,0,0,0.05); border-radius: 20px 20px 0 0; }
    .nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #94a3b8; font-size: 0.65rem; font-weight: 700; flex: 1; height: 50px; }
    .nav-item.active { color: var(--primary); }
    .nav-item svg { width: 24px; height: 24px; margin-bottom: 4px; stroke-width: 2px; }
    .cart-item-mobile { position: relative; top: -10px; height: auto; overflow: visible; z-index: 10; }
    .floating-circle { width: 55px; height: 55px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4); border: 5px solid #f8fafc; }
    .mobile-badge { position: absolute; top: -3px; right: -3px; background: #ef4444; color: white; font-size: 10px; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid white; }

    /* فوتر موبایل */
    .footer-top-grid { grid-template-columns: 1fr; text-align: center; gap: 30px; }
    .footer-logo, .social-links, .trust-badges { justify-content: center; }
}

/* ============================================================
   9. استایل‌های سبد خرید کشویی (Mini Cart Sidebar)
   ============================================================ */
/* اگر فایل Services.css لود شده باشد، این بخش لازم نیست. اگر نه، این را اضافه کنید: */
.cart-sidebar { position: fixed; top: 0; left: 0; width: 380px; height: 100%; background: white; z-index: 9999; box-shadow: 5px 0 30px rgba(0,0,0,0.1); transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1); display: flex; flex-direction: column; }
.cart-sidebar.active { transform: translateX(0); }
.cart-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(3px); z-index: 9998; opacity: 0; visibility: hidden; transition: 0.3s; }
.cart-overlay.active { opacity: 1; visibility: visible; }