:root {
    --primary-color: #4FBA6C;
    --dark-green: #327942;
    --bg-light: #f8f9fa;
}

/* --- استایل‌های عمومی --- */
.filter-card {
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.filter-header {
    font-weight: bold;
    color: var(--dark-green);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* --- استایل کارت محصول (Grid View) --- */
.product-card {
    border: 1px solid #eee;
    transition: all 0.3s ease;
    border-radius: 10px;
    background: white;
    height: 100%;
    position: relative;
    overflow: hidden;
    margin-bottom: 0 !important;
}

.product-card:hover {
    box-shadow: 0 5px 15px rgba(79, 186, 108, 0.2);
    border-color: var(--primary-color);
}

/* بخش تصویر */
.product-img-wrapper {
    height: 220px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.product-img-wrapper img {
    max-width: 100%;
    max-height: 100%;
}

/* لیبل ناموجود */
.out-of-stock-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 53, 69, 0.9);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    z-index: 2;
}

/* تار کردن تصویر محصول ناموجود */
.product-card.out-of-stock .product-img-wrapper img {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* بدنه کارت */
.card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: #333;
}

.breadcrumb {
    background-color: transparent;
    padding: 15px 0;
    margin-bottom: 0;
}

.breadcrumb-item+.breadcrumb-item::before {
    content: "/";
    /* یا "»" */
    float: right;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    color: #6c757d;
}

/* برای راست‌چین کردن کامل */
.breadcrumb {
    direction: rtl;
}

.breadcrumb-item {
    float: right;
}

.breadcrumb-item.active {
    font-weight: 500;
}

/* حذف فاصله اضافی */
.breadcrumb::after {
    content: "";
    display: table;
    clear: both;
}

.stars {
    color: #ffc107;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.product-price {
    color: var(--dark-green);
    font-size: 1.1rem;
    font-weight: bold;
    /* margin-top: auto; */
}

/* --- استایل لیست افقی (List View) --- */
/* وقتی کلاس list-view به نگهدارنده اضافه شود */
.products-container.list-view .col-item {
    width: 100%;
    /* تمام عرض */
    flex: 0 0 100%;
}

.products-container.list-view .product-card {
    display: flex;
    flex-direction: row;
    /* چیدمان افقی */
    height: auto;
    align-items: center;
}

.products-container.list-view .product-img-wrapper {
    width: 200px;
    height: 180px;
    flex-shrink: 0;
}

.products-container.list-view .card-body {
    align-items: flex-start;
    text-align: right;
    width: 100%;
}

.products-container.list-view .product-action {
    margin-top: 0;
    margin-right: auto;
    /* دکمه برود سمت چپ */
}

/* --- جستجوی دسته‌بندی --- */
.cat-search-wrapper {
    position: relative;
    margin-bottom: 10px;
}

.cat-search-input {
    width: 100%;
    padding: 5px 30px 5px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
}

.cat-search-clear {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    display: none;
    /* پیش‌فرض مخفی */
}

.cat-search-clear:hover {
    color: #dc3545;
}

/* --- مرتب‌سازی جدید --- */
.sort-options {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.sort-item {
    cursor: pointer;
    color: #666;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 20px;
    transition: 0.3s;
    font-size: 0.95rem;
}

.sort-item:hover {
    color: var(--primary-color);
    background: #e9f7ec;
}

.sort-item.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

/* دکمه‌های ویو */
.view-btn {
    border: 1px solid #ddd;
    background: white;
    color: #666;
    width: 35px;
    height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}

.view-btn.active {
    background-color: var(--dark-green);
    color: white;
    border-color: var(--dark-green);
}

.btn-custom {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.btn-custom:hover {
    background-color: var(--dark-green);
    color: white;
}

.btn-custom:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

@media (max-width: 576px) {
    .products-container.list-view .product-card {
        flex-direction: column;
    }

    .products-container.list-view .product-img-wrapper {
        width: 100%;
        height: 200px;
    }

    .sort-options {
        gap: 5px;
        font-size: 0.8rem;
    }
}

/* چک‌باکس و رنج */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 .25rem #4fba6c85;
}

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

.page-link {
    color: var(--primary-color);
}

.page-link:hover {
    color: var(--primary-color);
}

.filter-list {
    padding-left: 10px;
    max-height: 300px;
    overflow-y: scroll;
}

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

.filter-list::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 5px;
}

.page-item:last-child .page-link {
    border-top-left-radius: var(--bs-pagination-border-radius) !important;
    border-bottom-left-radius: var(--bs-pagination-border-radius) !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.page-item:first-child .page-link {
    border-top-right-radius: var(--bs-pagination-border-radius);
    border-bottom-right-radius: var(--bs-pagination-border-radius);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-left: calc(var(--bs-border-width) * -1);
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
}

.input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),
.input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,
.input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select,
.input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating) {
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

.pagination {
    padding: 0 !important;
}

@media (max-width: 576px) {

    .pagination li a,
    .pagination li span {
        padding: .35rem .55rem;
        font-size: .8rem;
    }

    .pagination li:not(.active):not(:first-child):not(:last-child) {
        display: none;
    }
}
