/* ==================== GLOBAL & RESET ==================== */
@import url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css");

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #2d6a4f;
    --primary-hover: #1b4332;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #2b2b2b;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --footer-bg: #1f2427;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    direction: rtl;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ==================== HEADER ==================== */
.site-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 20px;
    color: var(--primary-color);
}

.logo-brand .badge {
    background: var(--primary-color);
    color: #fff;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 14px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #f1f3f5;
    border-radius: 20px;
    padding: 6px 16px;
    width: 450px;
}

.search-bar select {
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 13px;
    color: #495057;
    outline: none;
    padding-left: 10px;
    border-left: 1px solid #ced4da;
    cursor: pointer;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    padding: 0 10px;
    font-family: inherit;
    font-size: 13px;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #495057;
}

.user-actions .cart-btn {
    position: relative;
}

.user-actions .cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #e63946;
    color: #fff;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    border-top: 1px solid #f1f3f5;
    padding-top: 12px;
}

.nav-bar a {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    transition: color 0.2s;
}

.nav-bar a:hover,
.nav-bar a.active {
    color: var(--primary-color);
}

/* ==================== MAIN CONTENT ==================== */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ==================== BREADCRUMB ==================== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin: 2rem auto;
    max-width: var(--container-width);
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--text-main);
}

.blog-header {
    max-width: var(--container-width);
    margin: 0 auto;
    text-align: center;
    margin-bottom: 32px;
}

.blog-header h1 {
    font-size: 24px;
    font-weight: 800;
    color: #212529;
    margin-bottom: 6px;
}

.blog-header p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Toolbar: Search & Sort */
.blog-toolbar {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.blog-search {
    position: relative;
    flex: 1 1 220px;
    min-width: 220px;
    max-width: 320px;
}

.blog-search input {
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 36px 8px 12px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.blog-search svg {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
}

.sort-select-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-select {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

/* Toolbar actions group (sort + clear) */
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-clear-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-clear-filter svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.btn-clear-filter:hover {
    background: #fdf1f1;
    border-color: #f3c9c9;
    color: #c0392b;
}

/* Articles Grid */
.articles-grid {
    max-width: var(--container-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.article-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.article-card > a {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.card-image {
    position: relative;
    width: 100%;
    height: 160px;
    background-color: #e9ecef;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

.card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: #212529;
    margin-bottom: 8px;
    line-height: 1.4;
}

.card-excerpt {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px dashed black;
    padding-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.read-more {
    color: var(--primary-color);
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 40px;
}

.page-link {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #495057;
    transition: all 0.2s;
}

.page-link.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.page-link:hover:not(.active) {
    background: #e9ecef;
}

/* Newsletter Banner */
.newsletter-banner {
    max-width: var(--container-width);
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
}

.newsletter-text h3 {
    font-size: 15px;
    font-weight: 700;
    color: #212529;
    margin-bottom: 4px;
}

.newsletter-text p {
    font-size: 12px;
    color: var(--text-muted);
}

.newsletter-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
    width: 380px;
}

.newsletter-form input {
    border: none;
    background: transparent;
    padding: 6px 12px;
    width: 100%;
    font-family: inherit;
    font-size: 12px;
    outline: none;
}

.newsletter-form button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

/* ==================== FOOTER ==================== */
.site-footer {
    background-color: var(--footer-bg);
    color: #adb5bd;
    padding-top: 40px;
    font-size: 12px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid #2c3237;
}

.footer-col h4 {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
}

.footer-col p {
    line-height: 1.8;
    margin-bottom: 12px;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col ul li a:hover {
    color: #fff;
}

.footer-subscribe input {
    width: 100%;
    background: #2c3237;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    margin-bottom: 8px;
    outline: none;
}

.footer-features {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 20px 0;
    border-bottom: 1px solid #2c3237;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 12px;
}

.footer-bottom {
    text-align: center;
    padding: 16px 0;
    color: #6c757d;
    font-size: 11px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .articles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .search-bar {
        width: 250px;
    }
    .newsletter-banner {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    .newsletter-form {
        width: 100%;
    }
    .footer-top {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .articles-grid {
        grid-template-columns: 1fr;
    }
    .footer-top {
        grid-template-columns: 1fr;
    }
    .blog-toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    .blog-search {
        width: 100%;
    }
    .toolbar-actions {
        width: 100%;
    }
    .sort-select-wrapper {
        flex: 1;
    }
    .sort-select {
        width: 100%;
    }
    .breadcrumb {
        font-size: 12px;
        margin: 16px;
    }
}
