/*
Theme Name: Katen (قالب کاتن)
Author: (نام شما)
Version: 2.3
Text Domain: katen
*/

/* --- فایل استایل برای قالب وبلاگ شخصی --- */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700&display=swap');

/* --- تنظیمات اولیه و ساختار اصلی صفحه --- */
html { height: 100%; }

/* --- اصلاح قطعی و نهایی: روش "دیوار آتش نهایی" --- */
html, body {
    overflow-x: hidden !important; /* این کد حیاتی، جلوی هرگونه سرریز افقی در کل سایت را می‌گیرد */
}

a, a:link, a:visited { color: inherit; text-decoration: none; }
:root {
    --primary-gradient: linear-gradient(to left, #0077b6, #00b4d8, #48cae4);
    --primary-color: #00b4d8;
    --bg-color: #ffffff;
    --card-bg-color: #ffffff;
    --header-bg-color: #ffffff;
    --text-color-dark: #1d3557;
    --text-color-light: #6c757d;
    --border-color: #dee2e6;
    --footer-bg-color: #ffffff;
    --footer-text-color: #6c757d;
}

.dark-mode {
    --bg-color: #122133;
    --card-bg-color: #1e2f45;
    --header-bg-color: #1b263b;
    --text-color-dark: #e0e1e9;
    --text-color-light: #adb5bd;
    --border-color: #415a77;
    --footer-bg-color: #1b263b;
    --footer-text-color: #adb5bd;
}

/* --- اصلاح فوتر چسبان و عرض هدر --- */
body, h1, h2, h3, h4, h5, h6, button, input, textarea, select { 
    font-family: 'Vazirmatn', sans-serif;
}
body { direction: rtl; margin: 0; background-color: var(--bg-color); color: var(--text-color-dark); transition: background-color 0.3s, color 0.3s; display: flex; flex-direction: column; min-height: 100vh; }
body.offcanvas-active, body.search-active { overflow: hidden; }
.site-header, .site-footer { flex-shrink: 0; }
.site-content { flex-grow: 1; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }
.dark-mode-toggle { position: fixed; bottom: 20px; left: 20px; width: 50px; height: 50px; background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; z-index: 998; font-size: 22px; color: var(--text-color-dark); box-shadow: 0 4px 10px rgba(0,0,0,0.1); transition: background-color 0.3s, color 0.3s, border-color 0.3s; }
.search-overlay { position: fixed; inset: 0; z-index: 1005; display: flex; align-items: center; justify-content: center; background-color: rgba(248, 249, 250, 0.5); backdrop-filter: blur(10px); opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.dark-mode .search-overlay { background-color: rgba(13, 27, 42, 0.5); }
.search-overlay.active { opacity: 1; visibility: visible; }
.search-close-btn { position: absolute; top: 30px; right: 30px; background: none; border: none; font-size: 40px; color: var(--text-color-dark); cursor: pointer; }
.search-form { position: relative; width: 90%; max-width: 600px; }
.search-form .search-input { width: 100%; background: transparent; border: none; border-bottom: 2px solid var(--text-color-dark); font-size: 2rem; padding: 10px 0; color: var(--text-color-dark); font-family: 'Vazirmatn', sans-serif; }
.search-form .search-input:focus { outline: none; }
.search-form button { position: absolute; left: 0; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 1.8rem; color: var(--text-color-dark); cursor: pointer; }
.site-header { position: sticky; top: 0; z-index: 999; width: 100%; background-color: transparent; padding: 15px 0; border-bottom: 1px solid transparent; transition: all 0.4s ease; }
.site-header.scrolled-header { padding: 10px 0; background-color: var(--header-bg-color); border-color: var(--border-color); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); }

/* --- اصلاح نهایی: ثابت کردن هدر در صفحه ادامه مطلب --- */
body.single .site-header,
body.page .site-header {
    position: static !important;
}

.header-container { display: flex; justify-content: space-between; align-items: center; }
.header-right, .header-left { flex-shrink: 0; }
.header-center { flex-grow: 1; display: flex; justify-content: center; }
.header-right .site-title a { text-decoration: none; color: var(--text-color-dark); font-size: 32px; font-weight: 700; }
.header-right .site-title a .dot { color: var(--primary-color); }
.main-navigation ul { margin: 0; padding: 0; list-style: none; display: flex; align-items: center; gap: 25px; position: relative; }
.main-navigation ul a { text-decoration: none; color: var(--text-color-light); font-size: 16px; transition: color 0.3s; padding: 10px 0; }
.main-navigation ul a:hover { color: var(--primary-color); }
.main-navigation li.cta-button a { background: var(--primary-gradient); color: #fff; padding: 10px 25px; border-radius: 50px; }
.main-navigation li.cta-button a:hover { color: #fff; }
.main-navigation ul li { position: relative; }
.header-left { display: flex; align-items: center; gap: 30px; }
.header-icon-buttons { display: flex; gap: 10px; }
.header-icon-buttons a { display: flex; justify-content: center; align-items: center; width: 38px; height: 38px; background: var(--primary-gradient); color: white; border-radius: 50%; text-decoration: none; font-size: 16px; box-shadow: 0 4px 10px rgba(0, 180, 216, 0.3); }
.social-icons { display: flex; align-items: center; gap: 15px; }
.social-icons a { color: var(--text-color-dark); text-decoration: none; font-size: 20px; transition: color 0.3s; }
.social-icons a:hover { color: var(--primary-color); }
.main-navigation .sub-menu { display: none; position: absolute; top: 100%; right: 0; background-color: var(--card-bg-color); min-width: 200px; list-style: none; padding: 10px 0; margin-top: 10px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1); border: 1px solid var(--border-color); z-index: 1001; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s ease; }
.main-navigation li.menu-item-has-children:hover > .sub-menu { display: block; opacity: 1; visibility: visible; transform: translateY(0); }
.sub-menu li { width: 100%; }
.sub-menu li a { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; width: auto; color: var(--text-color-light); white-space: nowrap; border-radius: 0; }
.sub-menu li a:hover { background-color: var(--bg-color); color: var(--primary-color); }
.main-navigation .sub-menu .sub-menu { top: -12px; right: 100%; }
.main-navigation .fa-angle-down, .main-navigation .fa-angle-left { font-size: 12px; margin-right: 8px; }

/* --- اصلاح قطعی منوی کناری برای نمایش از چپ --- */
.offcanvas-menu { 
    position: fixed; 
    top: 0; 
    left: 0;
    right: auto;
    width: 350px; 
    height: 100%; 
    background-color: var(--card-bg-color); 
    z-index: 1001; 
    transform: translateX(-100%);
    transition: transform 0.4s ease-in-out, background-color 0.3s; 
    display: flex; 
    flex-direction: column; 
}
.offcanvas-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.4s ease; }
body.offcanvas-active .offcanvas-menu { transform: translateX(0) !important; }
body.offcanvas-active .offcanvas-overlay { opacity: 1 !important; visibility: visible !important; }

.offcanvas-header { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid var(--border-color); }
.offcanvas-logo a { text-decoration: none; color: var(--text-color-dark); font-size: 28px; font-weight: 700; }
.offcanvas-logo .dot { color: var(--primary-color); }
.offcanvas-close-btn { background: none; border: none; font-size: 30px; cursor: pointer; color: var(--text-color-light); }
.offcanvas-body { flex-grow: 1; overflow-y: auto; padding: 20px; }
.offcanvas-footer { flex-shrink: 0; padding: 20px; border-top: 1px solid var(--border-color); text-align: center; }
.offcanvas-footer .social-icons { justify-content: center; }
.widget { padding-bottom: 25px; margin-bottom: 25px; }
.widget:last-child { margin-bottom: 0; }
.widget-title { display: flex; align-items: center; gap: 15px; font-size: 18px; font-weight: 700; color: var(--text-color-dark); margin: 0 0 20px 0; }
.widget-title::after { content: ''; flex-grow: 1; height: 2px; background-color: var(--primary-color); }
.widget-list { list-style: none; padding: 0; margin: 0; }
.widget-list li a { display: flex; justify-content: space-between; text-decoration: none; color: var(--text-color-light); padding: 8px 0; transition: color 0.2s; }
.widget-list li a:hover { color: var(--primary-color); }
.widget-list li a span:last-child { font-size: 13px; }
.newsletter-description { font-size: 14px; color: var(--text-color-light); line-height: 1.7; margin-top: 0; }
.newsletter-form input { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 5px; background-color: var(--bg-color); color: var(--text-color-dark); margin-bottom: 10px; box-sizing: border-box; }
.newsletter-form button { width: 100%; padding: 12px; border: none; border-radius: 5px; background: var(--primary-gradient); color: #fff; font-weight: 700; cursor: pointer; }
.widget-popular-posts { list-style: none; padding: 0; margin: 0; }
.widget-popular-posts li { display: flex; align-items: center; margin-bottom: 15px; }
.widget-popular-posts li:last-child { margin-bottom: 0; }
.widget-popular-posts .post-image img { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; margin-left: 15px; }
.widget-popular-posts .post-info .post-title { font-size: 15px; font-weight: 500; text-decoration: none; color: var(--text-color-dark); display: block; margin-bottom: 5px; }
.widget-popular-posts .post-info .post-date { font-size: 12px; color: var(--text-color-light); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-cloud a { text-decoration: none; background-color: var(--bg-color); color: var(--text-color-light); padding: 5px 12px; border-radius: 5px; font-size: 13px; transition: all 0.2s; }
.tag-cloud a:hover { background-color: var(--primary-color); color: #fff; }
.site-content { padding-top: 40px; padding-bottom: 40px; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; }
.post-card { background-color: var(--card-bg-color); border-radius: 10px; overflow: hidden; box-shadow: 0 4px 25px rgba(0,0,0,0.05); display: flex; flex-direction: column; transition: background-color 0.3s; height: 100%; }
.post-card-image { position: relative; }
.post-card-image img { width: 100%; height: 200px; object-fit: cover; display: block; }
.post-card-content { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }
.post-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-color-light); margin-bottom: 10px; }
.post-author { display: flex; align-items: center; gap: 5px; }
.post-author img { width: 20px; height: 20px; border-radius: 50%; }
.post-title { font-size: 16px; margin: 0 0 10px 0; line-height: 1.6; }
.post-title a { text-decoration: none; color: var(--text-color-dark); }
.post-excerpt { font-size: 13px; color: var(--text-color-light); line-height: 1.7; margin-bottom: 15px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.post-tags a { display: inline-block; background-color: var(--bg-color); border: 1px solid var(--border-color); color: var(--text-color-light); padding: 4px 12px; border-radius: 5px; font-size: 12px; text-decoration: none; transition: all 0.3s ease; }
.post-tags a:hover { background-color: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.post-tags .hashtag { color: var(--primary-color); margin-left: 4px; }
.post-tags a:hover .hashtag { color: #fff; }
.post-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 15px; border-top: 1px solid var(--border-color); }
.post-card-footer button, .post-card-footer a { background: none; border: none; cursor: pointer; color: var(--text-color-light); font-size: 16px; }
.load-more-container { text-align: center; margin-top: 40px; }
.load-more-btn { background-color: var(--card-bg-color); color: var(--text-color-light); border: 1px solid var(--border-color); padding: 12px 30px; border-radius: 50px; font-family: 'Vazirmatn', sans-serif; font-size: 15px; cursor: pointer; transition: all 0.3s ease; }
.load-more-btn:hover, .load-more-btn:disabled { background-color: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.site-footer { background-color: var(--footer-bg-color); color: var(--footer-text-color); padding: 25px 0; border-top: 1px solid var(--border-color); transition: background-color 0.3s, color 0.3s, border-color 0.3s; }
.footer-container { display: flex; justify-content: space-between; align-items: center; }
.footer-right, .footer-center, .footer-left { flex: 1; padding: 0 15px; }
.footer-center { text-align: center; }
.footer-left { text-align: left; }
.footer-right p { margin: 0; font-size: 14px; }
.footer-center .social-icons a { color: var(--text-color-light); }
.footer-center .social-icons a:hover { color: var(--primary-color); }
.back-to-top-btn { background-color: var(--bg-color); color: var(--text-color-light); border: 1px solid var(--border-color); padding: 8px 20px; border-radius: 50px; font-size: 14px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; transition: all 0.3s ease; }
.back-to-top-btn:hover { background-color: var(--primary-color); color: #fff; border-color: var(--primary-color); }
@media (max-width: 992px) { .post-grid { grid-template-columns: repeat(2, 1fr); } .header-center { justify-content: flex-start; } }
@media (max-width: 768px) { .main-navigation { display: none; } .header-left .social-icons { display: none; } .post-grid { grid-template-columns: 1fr; } .header-container { padding: 0 10px; } .footer-container { flex-direction: column; gap: 20px; text-align: center; } .footer-left { text-align: center; } }