: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 {
    padding-top: 5px;
    border: 1px solid #eee;
    transition: all 0.3s ease;
    border-radius: 10px;
    background: white;
    height: 100%;
    position: relative;
    overflow: visible;
    margin-bottom: 0 !important;
}

.product-card:hover {
    box-shadow: 0 5px 15px rgba(169, 169, 169, 0.2);
    transform: translateY(-5px);
    /* 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;
    padding-bottom: 0;
    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;
    padding: 5px 5px 5px 0;
}

.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: #8ed55724;
    border-color: transparent;
    color: var(--primary-color);
}

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

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

.filter-list {
    padding-right: 5px;
    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 {
    margin: 25px 0;
    padding: 0 !important;
    gap: 10px;
}

.pagination li a {
    padding: 0;
    width: 38px;
    height: 38px;
    display: flex;
    border-radius: 8px;
    border-color: transparent;
    justify-content: center;
    align-items: center;
    background-color: #e9efea9d;
    color: #6a6a6a;
}

.pagination li a:focus {
    border-radius: 8px;
    border-color: var(--primary-color);
}

.pagination li span {
    background-color: #e9efea9d;
    color: #6a6a6a;
    padding: 0;
    width: 38px;
    height: 38px;
    display: flex;
    border-radius: 8px;
    border-color: transparent;
    justify-content: center;
    align-items: center;
}
.page-item.disabled:first-child>.page-link, .page-link.disabled{
    display: none !important;
}
.page-item.disabled:last-child>.page-link, .page-link.disabled{
    display: none !important;
}
.page-link:focus{
    color: var(--primary-color);
    border-color: #327942 !important;
    box-shadow: 0 0 0 0.25rem #8ed55724;
}

.page-item:last-child .page-link,
.page-item:first-child .page-link {
    border-radius: 8px !important;
    border-color: #dee2e6 !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;
    }
}


.custom-check-rtl {
    direction: ltr;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 0;
    /* خنثی کردن بوت‌استرپ */
    padding-right: 0;
}

.custom-check-rtl .form-check-input {
    margin-left: 0;
    margin-right: 0;
    order: 2;
    /* چک‌باکس سمت راست */
}

.custom-check-rtl .form-check-label {
    order: 1;
    /* لیبل سمت چپ */
    margin-right: 8px;
    cursor: pointer;
    text-align: right;
    flex: 1;
}

.input_label_toman {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.autocomplete .clear-btn {
    left: 55px !important;
}

.add-to-cart {
    background-color: #52AC661F;
    color: var(--primary-color) !important;
    padding: 0;
    border: 1px solid transparent;
    width: 35px;
    height: 35px;
    box-shadow: none !important;
}

.footer_row {
    transform: translateY(145px);
    transition: all 0.3s ease;
    position: absolute;
    width: 100%;
    opacity: 0;
}

.product-card:hover .footer_row {
    transform: translateY(88px);
    opacity: 1;
}

.product-card:hover .cell-div {
    background-color: #fff;
}
/* .product-card:hover .price-flex-col {
    border: none !important;
} */

.cell-div {
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 5px;
    width: 60px;
    height: 60px;
}
