: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;
}

/* ================= GLOBAL ================= */

* {
    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;
}

/* ================= BREADCRUMB ================= */

.breadcrumbs {
    min-height: 20px;

    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 ================= */

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

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

.products-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 15px;
}

/* ================= MAIN LAYOUT ================= */

.layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 25px;
}

/* ================= SIDEBAR ================= */

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 993px) {
    .sidebar {
        position: sticky;
        top: calc(var(--header-height, 132px) + 20px);
        align-self: start;
    }
}

/* ================= FILTER CARD ================= */

.filter-card {
    background: #ffffff;

    border: 1px solid var(--border-color);
    border-radius: 8px;

    padding: 15px;
}

.category-filtered {
    margin-bottom: 2rem;
}

.p {
    margin-bottom: 6rem;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    font-size: 13px;
    font-weight: bold;

    margin-bottom: 15px;
}

/* ================= PRICE FILTER ================= */

.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%;
    height: 34px;

    padding: 0 8px;

    border: 1px solid var(--border-color);
    border-radius: 4px;

    background: #fafafa;

    font-size: 12px;

    box-sizing: border-box;
}

/* ================= FILTER BUTTONS ================= */

.btn-filter {
    width: 100%;
    height: 34px;

    background-color: var(--accent-green);
    color: #ffffff;

    border: none;
    border-radius: 4px;

    padding: 0 8px;

    cursor: pointer;

    font-size: 12px;

    margin-top: 5px;
}

.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;

    height: 34px;

    padding: 0 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;
}

/* ================= PRODUCTS AREA ================= */

.products-header {
    min-height: 56px;

    display: flex;
    align-items: center;

    width: 100%;

    background: #ffffff;

    border: 1px solid var(--border-color);
    border-radius: 8px;

    padding: 10px 15px;

    margin-bottom: 20px;
}

.sort-search {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;
}

/* ================= SEARCH ================= */

.inline-search {
    position: relative;

    flex-shrink: 0;
}

.inline-search input {
    width: 260px;
    height: 34px;

    padding: 6px 30px 6px 10px;

    border: 1px solid var(--border-color);
    border-radius: 4px;

    font-size: 12px;

    background: #fafafa;

    box-sizing: border-box;
}

.inline-search button {
    position: absolute;

    top: 0;
    right: 0;

    width: 30px;
    height: 34px;

    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 ================= */

.sort-dropdown {
    display: flex;
    align-items: center;

    gap: 5px;

    font-size: 12px;

    white-space: nowrap;
}

.sort-dropdown select {
    height: 34px;

    border: 1px solid var(--border-color);
    border-radius: 4px;

    padding: 0 10px;

    background: #fafafa;

    font-size: 12px;

    outline: none;

    box-sizing: border-box;
}

/* ================= PRODUCTS GRID ================= */

.products-grid {
    display: grid;

    grid-template-columns: repeat(5, minmax(0, 1fr));

    gap: 20px;

    margin-bottom: 1.5rem;
}

/* ================= PRODUCT CARD ================= */

.product-card {
    min-width: 0;

    background: #ffffff;

    border: 1px solid var(--border-color);
    border-radius: 8px;

    padding: 15px;

    display: flex;
    flex-direction: column;

    position: relative;

    height: 100%;
    box-sizing: border-box;
}

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

/* ================= PRODUCT IMAGE ================= */

.product-img {
    position: relative;

    width: 100%;
    height: 180px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 6px;

    overflow: hidden;

    margin-bottom: 12px;

    /*
     * فقط برای مشخص کردن نسبت تصویر.
     * ارتفاع اصلی توسط height کنترل می‌شود.
     */
    aspect-ratio: 575 / 378;
}

.product-img img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
}

/* ================= PRODUCT TITLE ================= */

.product-title {
    min-height: calc(14px * 1.4 * 2);

    font-size: 14px;
    font-weight: bold;

    text-align: center;

    margin-bottom: 8px;

    line-height: 1.4;

    display: -webkit-box;

    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;

    overflow: hidden;
}

/* ================= PRICE ================= */

.price-line {
    min-height: 30px;

    display: flex;

    align-items: center;
    justify-content: center;

    gap: 8px;

    flex-wrap: wrap;

    margin-bottom: 10px;
}

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

.product-price {
    font-size: 13px;
    font-weight: bold;

    text-align: center;

    color: #111;

    margin-bottom: 12px;
}

.product-price-old {
    font-size: 11px;

    color: #e11d48;

    text-decoration: line-through;
}

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

/* ================= VARIANT NOTE ================= */

.price-variant-note {
    width: 100%;
    height: 14px;

    line-height: 14px;

    font-size: 10px;

    color: var(--text-muted);

    text-align: center;

    margin-top: -6px;
    margin-bottom: 10px;

    overflow: hidden;
}

/* ================= 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;
}

/* ================= ADD TO CART ================= */

.btn-add-cart {
    width: 100%;
    height: 36px;
    min-height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    background-color: var(--bg-dark);

    color: #ffffff;

    border: none;
    border-radius: 4px;

    padding: 0 12px;

    font-size: 11px;

    cursor: pointer;

    transition: 0.2s;

    font-family: var(--font-family);

    font-weight: normal;

    line-height: 1.4;

    box-sizing: border-box;

    text-decoration: none;

    text-align: center;

    margin-top: auto; /* این خط را اضافه کن */
}

.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;
}

/* ================= OUT OF STOCK ================= */

.product-card.is-sold-out .product-img img {
    opacity: 0.88;
}

.product-card.is-sold-out .product-title {
    opacity: 0.55;
}

.product-price.price-unavailable {
    color: #dc2626;
}

.btn-add-cart.is-disabled,
.btn-add-cart.is-disabled:hover,
.btn-add-cart:disabled,
.btn-add-cart:disabled:hover {
    background-color: var(--card-bg);

    color: var(--text-muted);

    border: 1px solid var(--border-color);

    cursor: not-allowed;
}

/* ================= SOLD OUT BADGE ================= */

.sold-out-badge {
    position: absolute;

    top: 12px;
    right: 12px;

    background-color: #dc2626;

    color: #ffffff;

    font-size: 11px;
    font-weight: bold;

    padding: 4px 9px;

    border-radius: 20px;

    z-index: 2;
}

/* ================= 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: #ffffff;
}

.social-icons {
    display: flex;

    gap: 12px;

    margin-bottom: 20px;
}

.social-icons a {
    color: #ffffff;

    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;
}
