@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

* {
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif !important;
    background-color: #f4f6f9 !important;
    color: #1e293b !important;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    direction: rtl;
}

/* هدر سایت */
header.site-header {
    background-color: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 15px 0 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02) !important;
}

header.site-header .header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    width: 100%;
    position: relative;
}

header.site-header .logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    text-decoration: none;
}

header.site-header nav ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    gap: 25px !important;
    align-items: center !important;
}

header.site-header nav ul li a {
    text-decoration: none !important;
    color: #64748b !important;
    font-weight: 500 !important;
    font-size: 0.95rem;
    transition: color 0.2s;
}

header.site-header nav ul li a:hover {
    color: #0f172a !important;
}

header.site-header .admin-btn {
    background-color: #0f172a !important;
    color: #ffffff !important;
    padding: 8px 18px !important;
    border-radius: 50px !important;
    text-decoration: none !important;
    font-size: 0.85rem;
    font-weight: 600;
}

/* بدنه اصلی و گرید */
main.main-content {
    max-width: 1280px;
    width: 100%;
    margin: 40px auto;
    padding: 0 20px;
    flex: 1;
    box-sizing: border-box;
}

.layout-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
    align-items: start;
    width: 100%;
}

.layout-grid.sidebar-collapsed {
    grid-template-columns: 1fr !important;
}

.layout-grid.sidebar-collapsed aside {
    display: none !important;
}

.layout-grid.full-width-admin {
    display: block !important;
}

aside {
    transition: all 0.3s ease;
}

.sidebar-toggle-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 10px;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #334155;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    transition: background 0.2s;
}

.sidebar-toggle-btn:hover {
    background: #f1f5f9;
}

/* اسکرولبار سایدبار */
.sidebar-scroll-container {
    max-height: 550px;
    overflow-y: auto;
    direction: ltr;
    padding-left: 8px;
}

.sidebar-scroll-container > * {
    direction: rtl;
}

.sidebar-scroll-container::-webkit-scrollbar {
    width: 5px;
}

.sidebar-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    transition: background 0.2s;
}

.sidebar-scroll-container:hover::-webkit-scrollbar-thumb {
    background: #94a3b8;
}

/* کارت‌ها */
.card, .sidebar-box {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    padding: 30px !important;
    margin-bottom: 25px !important;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02) !important;
}

.sidebar-post-item {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none !important;
    color: #334155 !important;
}

.sidebar-post-item:hover {
    color: #2563eb !important;
}

.archive-pill {
    display: inline-block;
    background: #f1f5f9 !important;
    color: #475569 !important;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none !important;
    font-size: 0.85rem;
    margin: 4px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.archive-pill:hover, .archive-pill.active {
    background: #0f172a !important;
    color: #ffffff !important;
    border-color: #0f172a;
}

/* تب‌های ادمین */
.admin-tabs {
    display: flex;
    gap: 10px;
    background: #f8fafc;
    padding: 8px;
    border-radius: 12px;
    margin-bottom: 25px;
    list-style: none;
    border: 1px solid #e2e8f0;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 600;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #0f172a !important;
    color: #ffffff !important;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.form-control {
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    padding: 12px 16px !important;
    font-family: 'Vazirmatn', sans-serif !important;
}

.btn-dark-custom {
    background-color: #0f172a !important;
    color: #fff !important;
    border-radius: 10px !important;
    padding: 12px 20px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

/* استایل تخصصی ویرایشگر زنده (WYSIWYG) با خطوط استاندارد */
.live-wysiwyg-editor {
    display: none;
    width: 100%;
    height: 400px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #cbd5e1;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    padding: 20px;
    background: #fff;
    color: #1e293b;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    line-height: 2.2;
    text-align: right;
    outline: none;
    white-space: pre-line;
    word-break: break-word;
}

/* فوتر */
footer.site-footer {
    background-color: #0f172a !important;
    color: #94a3b8 !important;
    padding: 60px 0 30px 0 !important;
    margin-top: auto;
}

footer.site-footer .footer-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    box-sizing: border-box;
    width: 100%;
}

footer.site-footer h4 {
    color: #ffffff !important;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

footer.site-footer ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

footer.site-footer ul li {
    margin-bottom: 10px;
}

footer.site-footer ul li a {
    color: #94a3b8 !important;
    text-decoration: none !important;
}

footer.site-footer .copyright {
    max-width: 1280px;
    margin: 40px auto 0 auto;
    padding: 20px 20px 0 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
    box-sizing: border-box;
    width: 100%;
}

/* مهار کردن تصاویر و فیگورهای داخل متن پست */
.post-body-content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
}

.post-body-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 20px auto !important;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.post-body-content figure,
.post-body-content .wp-caption {
    max-width: 100% !important;
    width: auto !important;
    margin: 25px auto !important;
    text-align: center;
}

.post-body-content figure img,
.post-body-content .wp-caption img {
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto !important;
}

.post-body-content figcaption,
.post-body-content .wp-caption-text {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 8px;
    text-align: center;
}

/* ===================================================
   واکنش‌گرایی موبایل و منوی همبرگری (Responsive CSS)
   =================================================== */

.menu-toggle-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.menu-toggle-btn span {
    width: 100%;
    height: 3px;
    background: #0f172a;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.menu-toggle-btn.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.menu-toggle-btn.is-active span:nth-child(2) {
    opacity: 0;
}
.menu-toggle-btn.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.admin-mobile-item {
    display: none;
}

@media screen and (max-width: 768px) {
    .menu-toggle-btn {
        display: flex;
    }

    .header-admin-desktop {
        display: none !important;
    }

    .admin-mobile-item {
        display: block;
        margin-top: 8px;
    }

    header.site-header nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        border-bottom: 2px solid #e2e8f0;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
        padding: 20px;
        z-index: 999;
    }

    header.site-header nav.nav-open {
        display: block;
    }

    header.site-header nav ul {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    header.site-header nav ul li {
        width: 100%;
        text-align: right;
    }

    header.site-header nav ul li a {
        display: block;
        padding: 10px 14px;
        border-radius: 8px;
        font-size: 1rem;
    }

    header.site-header nav ul li a:hover {
        background: #f1f5f9;
    }

    main.main-content {
        margin: 20px auto;
        padding: 0 15px;
    }

    /* سایدبار در موبایل در بالا و قبل از پست‌ها قرار می‌گیرد */
    .layout-grid {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 20px;
    }

    aside {
        width: 100% !important;
    }

    .sidebar-toggle-btn {
        width: 100%;
        justify-content: center;
    }

    .card, .sidebar-box {
        padding: 20px !important;
    }

    footer.site-footer {
        padding: 40px 0 20px 0 !important;
    }

    footer.site-footer .footer-container {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
}