@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
}

:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #14b8a6;
    --primary-bg: #f0fdfa;
    --primary-bg-alt: #ccfbf1;
    --text: #333;
    --text-light: #666;
    --bg: #fff;
    --bg-alt: #f5f5f5;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
    --sidebar-width: 225px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Vazirmatn', Tahoma, sans-serif; color: var(--text); background: var(--bg-alt); line-height: 1.8; direction: rtl; }
body.sidebar-open { overflow: hidden; }
body.reader-mode .site-header, body.reader-mode .sidebar, body.reader-mode .sidebar-overlay, body.reader-mode .pagination, body.reader-mode .site-footer, body.reader-mode .post-toolbar, body.reader-mode .back-to-home, body.reader-mode .post-meta, body.reader-mode .tags, body.reader-mode .hamburger { display: none !important; }
body.reader-mode .main-container { display: block !important; margin: 0 !important; padding: 0 !important; max-width: 100% !important; }
body.reader-mode .content-area { max-width: 800px !important; margin: 0 auto !important; padding: 20px 15px !important; box-shadow: none !important; background: #faf8f5 !important; border-radius: 0 !important; min-height: 100vh !important; }
body.reader-mode .full-post .post-content { font-family: 'Vazirmatn', Tahoma, sans-serif !important; font-size: 1rem !important; line-height: 2.2 !important; text-align: justify !important; }
body.reader-mode .container { max-width: 100% !important; padding: 0 !important; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 10px; }

.site-header { background: var(--bg); box-shadow: var(--shadow); position: relative; z-index: 1000; overflow: hidden; }
.header-background { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-image: url('../images/back.jpg'); background-size: cover; background-position: center; background-repeat: no-repeat; opacity: 0.15; z-index: 0; }
.header-background::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, rgba(13,148,136,0.1) 0%, rgba(255,255,255,0.3) 100%); }
.site-header .container { position: relative; z-index: 1; padding-top: 15px; }
.header-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; padding-bottom: 50px; }
.header-titles { display: flex; flex-direction: column; gap: 0; flex: 1; }
.site-title { font-size: 1.875rem; margin: 0; padding: 5px 0 0 0; line-height: 1.3; }
.site-title a { color: var(--primary-dark); text-decoration: none; transition: var(--transition); text-shadow: 0 1px 3px rgba(255,255,255,0.8); }
.site-title a:hover { color: var(--primary); }
.site-subtitle { font-size: 1.125rem; margin: 0; padding: 0 0 8px 0; color: var(--text-light); font-weight: 400; opacity: 0.8; }
.site-subtitle a { color: var(--text-light); text-decoration: none; transition: var(--transition); text-shadow: 0 1px 2px rgba(255,255,255,0.8); }
.site-subtitle a:hover { color: var(--primary); }

.hamburger { display: none; flex-direction: column; cursor: pointer; background: none; border: none; padding: 8px; z-index: 1001; border-radius: var(--radius); transition: var(--transition); flex-shrink: 0; margin-right: 15px; margin-top: 5px; }
.hamburger:hover { background-color: var(--bg-alt); }
.hamburger span { width: 25px; height: 3px; background: var(--text); margin: 3px 0; transition: var(--transition); border-radius: 2px; }
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(7px,-7px); }

.horizontal-menu { background-color: rgba(248,249,250,0.95); border-top: 1px solid var(--border); border-bottom: 2px solid var(--primary); padding: 0; width: 100%; z-index: 1; backdrop-filter: blur(5px); display: block; }
.horizontal-menu ul { list-style: none; display: flex; gap: 0; margin: 0; padding: 0; flex-wrap: wrap; }
.horizontal-menu ul li { margin: 0; padding: 0; }
.horizontal-menu ul li a { text-decoration: none; color: var(--text); font-weight: 500; transition: var(--transition); padding: 12px 20px; display: block; position: relative; border-bottom: none; white-space: nowrap; }
.horizontal-menu ul li a:hover { color: var(--primary); background-color: rgba(240,253,250,0.8); }
.horizontal-menu ul li a.active { color: var(--primary-dark); background-color: rgba(204,251,241,0.9); font-weight: 700; }
.horizontal-menu ul li a.active::after { content: ''; position: absolute; bottom: -2px; right: 0; left: 0; height: 3px; background-color: var(--primary); }

.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 998; opacity: 0; transition: opacity 0.3s ease; }
.sidebar-overlay.active { display: block; opacity: 1; }

.main-container { display: flex; gap: 4px; margin: 4px auto; flex-direction: row; align-items: flex-start; }
.content-area { flex: 1; background: var(--bg); padding: 8px; border-radius: var(--radius); box-shadow: var(--shadow); order: 1; min-width: 0; }

.sidebar { width: var(--sidebar-width); min-width: var(--sidebar-width); align-self: flex-start; order: 0; max-height: none; overflow: visible; }
.sidebar-header { display: none; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid var(--primary-light); }
.sidebar-header h3 { margin: 0; padding: 0; border: none; font-size: 1.2rem; color: var(--primary-dark); }
.sidebar-close { display: none; background: none; border: none; font-size: 1.8rem; cursor: pointer; color: var(--text); padding: 0 5px; line-height: 1; transition: var(--transition); }
.sidebar-close:hover { color: var(--primary); }
.sidebar-widget { background: var(--bg); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 5px; }
.sidebar-widget h3 { margin-bottom: 15px; color: var(--primary-dark); font-size: 1.2rem; border-bottom: 2px solid var(--primary-light); padding-bottom: 8px; }

.search-box { display: flex; gap: 5px; position: relative; width: 100%; }
.search-box input { flex: 1; width: 100%; padding: 10px 12px; border: 2px solid var(--border); border-radius: var(--radius); font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 0.9rem; transition: var(--transition); outline: none; }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,0.1); }
.search-box button { background: var(--primary); color: white; border: none; padding: 10px 15px; border-radius: var(--radius); cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.search-box button:hover { background: var(--primary-dark); }
.search-results { margin-top: 15px; border-top: 1px solid var(--border); padding-top: 15px; max-height: 400px; overflow-y: auto; }
.search-results .search-result-item { padding: 10px; margin-bottom: 8px; border-radius: var(--radius); transition: var(--transition); border: 1px solid transparent; }
.search-results .search-result-item:hover { background-color: var(--primary-bg); border-color: var(--primary-light); }
.search-results .search-result-item a { text-decoration: none; color: var(--text); display: block; }
.search-results .search-result-item .result-title { font-weight: 700; color: var(--primary-dark); margin-bottom: 4px; font-size: 0.9rem; }
.search-results .search-result-item .result-type { font-size: 0.75rem; color: var(--text-light); display: inline-block; background: var(--bg-alt); padding: 2px 8px; border-radius: 12px; margin-right: 5px; }
.search-results .search-result-item .result-excerpt { font-size: 0.8rem; color: var(--text-light); margin-top: 5px; line-height: 1.6; }
.search-results .no-results { text-align: center; color: var(--text-light); padding: 20px; font-size: 0.9rem; }
.search-results .search-loading { text-align: center; color: var(--text-light); padding: 15px; font-size: 0.9rem; }
.search-highlight { background-color: #fef3c7; padding: 2px 4px; border-radius: 3px; font-weight: 700; }
.search-results-main { padding: 20px; }
.search-results-main .search-header { margin-bottom: 20px; padding-bottom: 15px; border-bottom: 2px solid var(--primary-light); }
.search-results-main .search-header h2 { color: var(--primary-dark); font-size: 1.5rem; }
.search-results-main .search-header .search-query { color: var(--primary); font-weight: 700; }
.search-results-main .search-result-card { background: var(--bg); padding: 20px; margin-bottom: 15px; border-radius: var(--radius); box-shadow: 0 1px 4px rgba(0,0,0,0.05); border: 1px solid var(--border); transition: var(--transition); }
.search-results-main .search-result-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.search-results-main .result-type-badge { display: inline-block; padding: 4px 10px; border-radius: 15px; font-size: 0.75rem; font-weight: 700; margin-bottom: 10px; }
.search-results-main .result-type-badge.post { background: var(--primary-bg); color: var(--primary-dark); }
.search-results-main .result-type-badge.page { background: #ecfdf5; color: #065f46; }
.search-results-main .result-type-badge.tag { background: #fef2f2; color: #991b1b; }

.vertical-menu ul { list-style: none; padding: 0; margin: 0; }
.vertical-menu li { margin-bottom: 2px; padding: 0; border-bottom: none; transition: var(--transition); }
.vertical-menu li:last-child { border-bottom: none; margin-bottom: 0; }
.vertical-menu li:hover { background-color: var(--primary-bg); }
.vertical-menu a { text-decoration: none; color: var(--text); font-size: 0.855rem; font-weight: 400; transition: var(--transition); display: block; padding: 6px 10px; border-radius: 4px; line-height: 1.28; }
.vertical-menu a:hover { color: var(--primary-dark); padding-right: 12px; background-color: var(--primary-bg-alt); }
.vertical-menu .fixed-post a { font-weight: 700; color: var(--text); border-right: 3px solid var(--primary); padding-right: 12px; background-color: var(--primary-bg); }
.vertical-menu .fixed-post a:hover { color: var(--primary-dark); background-color: var(--primary-bg-alt); border-right-color: var(--primary-dark); }
.vertical-menu .fixed-post a::before { content: '📌 '; font-size: 0.75rem; margin-left: 5px; }
.vertical-menu .favorite-post a::before { content: '⭐ '; font-size: 0.75rem; margin-left: 5px; }
.all-posts-link { display: inline-block; margin-top: 10px; color: var(--primary); text-decoration: none; font-size: 0.85rem; font-weight: 500; transition: var(--transition); padding: 6px 0; width: 100%; }
.all-posts-link:hover { color: var(--primary-dark); padding-right: 8px; }

.post-toolbar { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.post-toolbar button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--border); background: var(--bg); color: var(--text-light); border-radius: 4px; cursor: pointer; transition: var(--transition); font-size: 0.85rem; font-family: 'Vazirmatn', Tahoma, sans-serif; padding: 0; position: relative; }
.post-toolbar button:hover { background: var(--primary-bg); color: var(--primary-dark); border-color: var(--primary-light); }
.post-toolbar button.font-increase { font-weight: 700; font-size: 0.9rem; }
.post-toolbar button.font-decrease { font-weight: 700; font-size: 0.75rem; }
.post-toolbar button.font-reset { font-weight: 400; font-size: 0.75rem; }
.post-toolbar button::after { content: attr(title); position: absolute; top: -30px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 0.7rem; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.2s; font-family: 'Vazirmatn', Tahoma, sans-serif; }
.post-toolbar button:hover::after { opacity: 1; }

.post-card { background: var(--bg); padding: 12px; margin-bottom: 15px; border-radius: var(--radius); box-shadow: 0 1px 4px rgba(0,0,0,0.05); transition: var(--transition); border: 1px solid var(--border); cursor: default; }
.post-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.post-card.fixed-post { border-right: 4px solid var(--primary); }
.post-card .post-meta { color: var(--text-light); font-size: 0.85rem; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.post-meta-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post-card .post-title { font-size: 1.1rem; }
.post-card .post-title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.post-card .post-title-row .post-title { margin-bottom: 0; flex: 1; }
.post-title-link { color: var(--primary-dark); text-decoration: none; transition: var(--transition); cursor: pointer; font-weight: 700; }
.post-title-link:hover { color: var(--primary); text-decoration: underline; }
.fixed-badge { background: var(--primary); color: white; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; display: inline-block; }
.post-card .post-image { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius); margin-bottom: 10px; }
.post-card .post-excerpt { color: var(--text-light); line-height: 1.8; margin-bottom: 10px; font-size: 1rem; }
.post-card .read-more { display: inline-block; background: var(--primary); color: white; padding: 6px 16px; border-radius: var(--radius); text-decoration: none; transition: var(--transition); cursor: pointer; font-size: 0.9rem; }
.post-card .read-more:hover { background: var(--primary-dark); transform: translateX(-3px); }

.tags { margin-top: 8px; }
.tag { display: inline-block; background: var(--primary-bg); color: var(--primary-dark); padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; margin-left: 5px; text-decoration: none; transition: var(--transition); border: 1px solid var(--primary-bg-alt); }
.tag:hover { background: var(--primary); color: white; border-color: var(--primary); }
.tags-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

.pagination { display: flex; justify-content: center; align-items: center; margin: 30px 0; padding: 15px; direction: rtl; }
.pagination-inner { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: nowrap; background: var(--bg); padding: 8px 16px; border-radius: var(--radius); box-shadow: var(--shadow); }
.page-numbers { display: flex; align-items: center; gap: 5px; margin: 0 10px; }
.pagination-btn { padding: 8px 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: var(--radius); cursor: pointer; transition: var(--transition); font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 0.85rem; white-space: nowrap; min-width: 70px; }
.pagination-btn:hover:not(:disabled) { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(13,148,136,0.2); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; background: var(--bg-alt); }
.page-number { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: var(--radius); cursor: pointer; transition: var(--transition); font-family: 'Vazirmatn', Tahoma, sans-serif; font-size: 0.85rem; font-weight: 500; user-select: none; }
.page-number:hover { background: var(--primary-bg); color: var(--primary-dark); border-color: var(--primary-light); }
.page-number.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: 700; transform: scale(1.1); box-shadow: 0 4px 12px rgba(13,148,136,0.3); }
.page-dots { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; color: var(--text-light); font-weight: 700; letter-spacing: 2px; }

.site-footer { background: var(--bg); box-shadow: 0 -2px 8px rgba(0,0,0,0.05); padding: 15px 0; text-align: center; margin-top: 40px; color: var(--text-light); font-size: 0.85rem; }
.loading { text-align: center; padding: 30px; color: var(--text-light); position: relative; }
.loading::after { content: ''; display: block; width: 35px; height: 35px; margin: 15px auto; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.full-post .post-title { font-size: 1.5rem; color: var(--primary-dark); margin-bottom: 15px; }
.full-post .post-title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 15px; }
.full-post .post-title-row .post-title { margin-bottom: 0; flex: 1; }
.full-post .post-content { font-size: 1rem; line-height: 2; }
.full-post .post-meta { color: var(--text-light); font-size: 0.85rem; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.back-to-home { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border); }
.back-link { color: var(--primary); text-decoration: none; transition: var(--transition); font-size: 0.9rem; }
.back-link:hover { color: var(--primary-dark); padding-right: 5px; }
.no-posts { text-align: center; padding: 30px; color: var(--text-light); font-size: 1rem; }

.reader-mode-exit { display: none; position: fixed; top: 15px; left: 15px; z-index: 9999; background: rgba(0,0,0,0.6); color: white; border: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; line-height: 1; align-items: center; justify-content: center; transition: var(--transition); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
body.reader-mode .reader-mode-exit { display: flex; }
.reader-mode-exit:hover { background: rgba(0,0,0,0.8); transform: scale(1.1); }

@media (max-width: 768px) {
    .main-container { flex-direction: column; align-items: stretch; gap: 4px; margin: 2px auto; }
    .content-area { order: 0; padding: 6px; }
    .hamburger { display: flex; order: -1; margin-right: 0; margin-left: 15px; margin-top: 5px; }
    .header-top { flex-direction: row; align-items: flex-start; padding-bottom: 15px; }
    .header-titles { flex: 1; }
    .horizontal-menu { display: block; }
    .horizontal-menu ul { flex-wrap: wrap; justify-content: flex-start; }
    .horizontal-menu ul li a { padding: 8px 12px; font-size: 0.85rem; }
    .horizontal-menu ul li a.active::after { display: none; }
    .sidebar { position: fixed; top: 0; right: -100%; width: 85%; max-width: 350px; min-width: 280px; height: 100vh; z-index: 999; background: var(--bg); overflow-y: auto; padding: 20px; box-shadow: -4px 0 20px rgba(0,0,0,0.2); transition: right 0.3s ease; border-radius: 0; }
    .sidebar.active { right: 0; }
    .sidebar-header { display: flex; }
    .sidebar-close { display: block; }
    .sidebar-widget:first-of-type { margin-top: 0; }
    .sidebar-widget { margin-bottom: 5px; }
    .post-card { padding: 10px; margin-bottom: 10px; }
    .post-card .post-image { max-height: 200px; }
    .search-results { max-height: 200px; }
    .pagination-inner { flex-wrap: wrap; gap: 4px; padding: 6px; }
    .pagination-btn { padding: 6px 10px; font-size: 0.8rem; min-width: 50px; }
    .page-number { width: 30px; height: 30px; font-size: 0.8rem; }
    .page-dots { width: 25px; height: 30px; }
    .site-subtitle { font-size: 0.9rem; }
    body.reader-mode .content-area { padding: 15px 10px !important; }
}

@media (max-width: 480px) {
    .site-title { font-size: 1.5rem; }
    .site-subtitle { font-size: 0.8rem; }
    .horizontal-menu ul li a { padding: 6px 10px; font-size: 0.8rem; }
    .container { padding: 0 5px; }
    .content-area { padding: 4px; }
    .post-card { padding: 8px; margin-bottom: 8px; }
    .post-card .post-title { font-size: 1rem; }
    .post-card .post-excerpt { font-size: 0.95rem; line-height: 1.7; }
    .pagination-inner { gap: 3px; padding: 5px; }
    .pagination-btn { padding: 5px 8px; font-size: 0.75rem; min-width: 45px; }
    .page-number { width: 28px; height: 28px; font-size: 0.75rem; }
    .page-numbers { gap: 2px; margin: 0 5px; }
    .full-post .post-title { font-size: 1.3rem; }
    .full-post .post-content { font-size: 0.95rem; }
}