:root {
    --bg-dark: #13171a;
    --bg-dark-secondary: #1a1f24;
    --accent-green: #1d3b2a;
    --accent-green-hover: #142a1e;
    --text-main: #222222;
    --text-muted: #666666;
    --border-color: #e5e5e5;
    --card-bg: #f5f5f7;
    --font-family: "ray", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
}

body {
    background-color: #fcfcfc;
    color: var(--text-main);
    direction: rtl;
}

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

/* ================= MAIN CONTAINER ================= */

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

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

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

.page-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 5px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 25px;
}

.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 25px;
}

/* ================= SIDEBAR (RIGHT) ================= */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* روی موبایل sticky غیرفعاله؛ فقط تو مدیا-کوئری پایین برای دسکتاپ فعال می‌شه */
}

@media (min-width: 993px) {
    .sidebar {
        position: sticky;
        /* هدر خودش sticky و top:0 هست؛ پس سایدبار باید دقیقاً زیر هدر بشینه،
           نه top:0 (که باعث می‌شد زیر هدر قایم بشه و انگار اصلاً sticky نیست).
           --header-height رو یه اسکریپت کوچیک تو base.html ست می‌کنه. */
        top: calc(var(--header-height, 132px) + 20px);
        /* align-self: start لازمه چون .layout یه grid با align-items پیش‌فرض
           (stretch) هست. اگه اینو ست نکنیم، خودِ باکس .sidebar به اندازه‌ی کل
           ارتفاع main-content کش میاد و دیگه هیچ فضایی برای بالا/پایین رفتن و
           چسبیدن نداره (بالا و پایینش همزمان با مرز container یکی می‌شه، پس
           انگار position: sticky اصلاً اثر نداره). با align-self: start، سلول
           گرید همچنان بلند می‌مونه ولی خودِ .sidebar فقط به اندازه‌ی محتوای
           واقعیش (کارت‌های فیلتر) ارتفاع می‌گیره و جا برای چسبیدن پیدا می‌کنه. */
        align-self: start;
    }
}

.filter-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 15px;
}

.price-input-group {
    margin-bottom: 12px;
}

.price-input-group label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.price-input-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fafafa;
    font-size: 12px;
}

.btn-filter {
    width: 100%;
    background-color: var(--accent-green);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 5px;
}

/* Filter actions (Apply / Clear) */
.filter-actions {
    display: flex;
    gap: 8px;
}

.filter-actions .btn-filter {
    flex: 1;
}

.btn-clear-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fafafa;
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font-family);
    cursor: pointer;
    white-space: nowrap;
    margin-top: 5px;
    transition: 0.2s;
}

.btn-clear-filter:hover {
    background: #fdeaea;
    border-color: #f3c6c6;
    color: #c0392b;
}

.btn-clear-filter i {
    font-size: 10px;
}

/* Category List */
.category-list {
    list-style: none;
    max-height: 396px;
    overflow-y: auto;
    padding-right: 4px;
    direction: ltr;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.category-list::-webkit-scrollbar {
    width: 5px;
}

.category-list::-webkit-scrollbar-track {
    background: transparent;
}

.category-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

.category-list::-webkit-scrollbar-thumb:hover {
    background-color: #ccc;
}

.category-group {
    direction: rtl;
}

.category-group:not(:last-child) {
    margin-bottom: 6px;
}

.category-group-title {
    font-size: 11px;
    font-weight: bold;
    color: var(--text-muted);
    background: #f5f5f7;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 2px;
}

.category-group-list {
    list-style: none;
}

.category-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #444;
    cursor: pointer;
    direction: rtl;
}

.category-list li:last-child {
    border-bottom: none;
}
.page-subtitle
/* Promo Card */
.promo-card {
    background-color: #f3eee7;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.promo-icon {
    font-size: 40px;
    color: #8c7355;
    margin-bottom: 10px;
}

.promo-title {
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 5px;
}

.promo-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.btn-promo {
    background-color: var(--accent-green);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

/* ================= PRODUCTS AREA (LEFT) ================= */
.products-header {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 20px;
}

.sort-search {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.inline-search {
    position: relative;
}

.inline-search input {
    padding: 6px 30px 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    background: #fafafa;
}

.inline-search button {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: #999;
}

.inline-search svg {
    display: block;
}

.sort-dropdown {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sort-dropdown select {
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 4px;
    background: #fafafa;
    font-size: 12px;
    outline: none;
}

.view-options {
    display: flex;
    gap: 5px;
    color: #777;
}

.view-btn {
    border: 1px solid var(--border-color);
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    background: white;
}

.view-btn.active {
    background: #eee;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 1.5rem;
}

.product-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.product-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.wishlist-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
}

.product-img {
    height: 180px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
}

.product-img img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.product-category {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 4px;
}

.product-title {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.4;
}

.product-price {
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    color: #111;
    margin-bottom: 12px;
}

/* ================= DISCOUNT ================= */
.discount-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: #16a34a;
    color: #ffffff;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 9px;
    border-radius: 20px;
    z-index: 2;
}

.price-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.price-line .product-price {
    margin-bottom: 0;
}

.price-variant-note {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    margin-top: -6px;
    margin-bottom: 10px;
}

.product-price-old {
    font-size: 11px;
    color: #e11d48;
    text-decoration: line-through;
}

.product-price.price-discounted {
    color: #16a34a;
}

/* ================= BUTTON ADD TO CART (FIXED) ================= */
.btn-add-cart {
    width: 100%;
    background-color: var(--bg-dark);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: 0.2s;
    font-family: var(--font-family);
    font-weight: normal;
    line-height: 1.4;
    min-height: 36px;
    box-sizing: border-box;
    text-decoration: none;
    text-align: center;
}

.btn-add-cart:hover {
    background-color: var(--accent-green);
}

/* حذف استایل پیش‌فرض دکمه و لینک */
button.btn-add-cart {
    appearance: none;
    -webkit-appearance: none;
}

a.btn-add-cart {
    text-decoration: none;
}

/* اطمینان از یکسان بودن اندازه آیکون */
.btn-add-cart i {
    font-size: 11px;
    line-height: 1;
}

/* ================= PAGINATION ================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 30px 0;
    direction: ltr;
}

.page-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-main, #222);
    background: #ffffff;
    cursor: pointer;
    transition: 0.2s;
}

.page-item:hover {
    background: var(--card-bg, #f8f8f8);
}

.page-item.active {
    background: var(--accent-green, #1d3b2a);
    border-color: var(--accent-green, #1d3b2a);
    color: #ffffff;
    font-weight: bold;
    cursor: default;
}

.page-item-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
    padding: 0 14px;
}

.page-item-arrow {
    font-size: 12px;
    line-height: 1;
}

.page-item-label {
    font-size: 12px;
}

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

.footer-top {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px 40px 20px;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
    gap: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-col h4 {
    color: #ffffff;
    font-size: 13px;
    margin-bottom: 15px;
}

.footer-col p {
    line-height: 1.8;
    font-size: 11px;
    margin-bottom: 15px;
}

.footer-links {
    list-style: none;
}

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

.footer-links li a:hover {
    color: white;
}

.social-icons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.social-icons a {
    color: white;
    font-size: 16px;
}

.newsletter-form {
    display: flex;
    background: #ffffff;
    border-radius: 4px;
    overflow: hidden;
}

.newsletter-form input {
    border: none;
    padding: 8px 10px;
    width: 100%;
    font-size: 11px;
    outline: none;
}

.newsletter-form button {
    background: #e5e5e5;
    border: none;
    padding: 0 12px;
    cursor: pointer;
    color: #333;
}

.footer-features {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.feature-item i {
    font-size: 20px;
    color: #ffffff;
}

.feature-text div:first-child {
    color: #ffffff;
    font-weight: bold;
    font-size: 11px;
}

.feature-text div:last-child {
    font-size: 10px;
    color: #777;
}

.footer-bottom {
    max-width: 1300px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #666;
}