/* =======================
 *  FILTER SIDEBAR
 * ======================= */
.filter-sidebar {
    position: sticky;
    top: 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 0;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track {
    background: #f9fafb;
}

.filter-sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.filter-section {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1f2937;
    margin-bottom: 0;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-options .form-check {
    margin: 0;
    padding-right: 0;
}

.filter-options .form-check-input {
    margin-left: 8px;
    cursor: pointer;
}

.filter-options .form-check-label {
    cursor: pointer;
    font-size: 0.9rem;
    color: #4b5563;
    user-select: none;
}

.filter-options .form-check-input:checked ~ .form-check-label {
    color: #7e1975;
    font-weight: 500;
}

/* =======================
 *  COLLAPSE TOGGLE
 * ======================= */
.collapse-toggle {
    color: #6b7280;
    font-size: 1.1rem;
    transition: all 0.3s;
    text-decoration: none;
}

.collapse-toggle:hover {
    color: #7e1975;
}

.collapse-toggle i {
    transition: transform 0.3s;
}

/* =======================
 *  PRICE SLIDER (FIXED)
 * ======================= */
.price-slider-wrapper {
    padding: 10px 0;
}

.price-slider {
    position: relative;
    height: 40px;
    margin-bottom: 20px;
}

.price-slider input[type=range] {
    position: absolute;
    width: 100%;
    height: 40px;
    pointer-events: none;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    outline: none;
    z-index: 5;
}

.price-slider input[type=range]::-webkit-slider-thumb {
    pointer-events: all;
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #7e1975;
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.price-slider input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(126, 25, 117, 0.3);
}

.price-slider input[type=range]::-moz-range-thumb {
    pointer-events: all;
    width: 20px;
    height: 20px;
    background: #7e1975;
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.slider-track {
    position: absolute;
    height: 6px;
    background: #e5e7eb;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 3px;
}

.slider-range {
    position: absolute;
    height: 6px;
    background: linear-gradient(90deg, #7e1975 0%, #ed6df4 100%);
    top: 50%;
    transform: translateY(-50%);
    border-radius: 3px;
}

.price-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.price-label {
    font-size: 0.85rem;
    color: #6b7280;
}

.price-label strong {
    color: #1f2937;
    font-weight: 600;
}

/* =======================
 *  PRODUCTS TOOLBAR
 * ======================= */
.products-toolbar {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.products-toolbar h5 {
    color: #1f2937;
    font-weight: 600;
}

.sort-options {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.sort-btn {
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;        /* ← متن دکمه‌ها شکسته نشه */
    flex-shrink: 0;             /* ← دکمه‌ها کوچیک نشن */
}

.sort-btn i {
    font-size: 0.9rem;
}

.sort-btn:hover {
    background: #f9fafb;
    border-color: #7e1975;
    color: #7e1975;
}

.sort-btn.active {
    background: #7e1975;
    border-color: #7e1975;
    color: #fff;
}

/* =======================
 *  PRODUCT CARDS - COMPACT
 * ======================= */
.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.product-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card-link:hover .product-card {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-3px);
    border-color: #7e1975;
}

.product-image {
    position: relative;
    overflow: hidden;
    background: #f9fafb;
    aspect-ratio: 1 / 1;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    transform: scale(0.92);
}

.product-card-link:hover .product-image img {
    transform: scale(1.0);
}

.product-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}

.product-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: #7e1975;
    margin-top: auto;
}

/* =======================
 *  PAGINATION
 * ======================= */
.pagination {
    margin-top: 30px;
}

.page-link {
    border-radius: 8px;
    margin: 0 4px;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    padding: 8px 14px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.page-link:hover {
    background: #f3f4f6;
    border-color: #7e1975;
    color: #7e1975;
}

.page-item.active .page-link {
    background: #7e1975;
    border-color: #7e1975;
    font-weight: 600;
}

.page-item.disabled .page-link {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #9ca3af;
}

/* =======================
 *  MOBILE FILTER DRAWER
 * ======================= */

/* دکمه فیلتر که فقط در موبایل نمایش داده می‌شه */
.filter-mobile-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.filter-mobile-btn:hover {
    border-color: #7e1975;
    color: #7e1975;
}

.filter-mobile-btn .filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #7e1975;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    font-weight: 700;
    display: none;
}

.filter-mobile-btn.has-filters .filter-badge {
    display: inline-flex;
}

.filter-mobile-btn.has-filters {
    border-color: #7e1975;
    color: #7e1975;
    background: #fdf4fd;
}

/* Overlay تاریک پشت drawer */
.filter-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filter-drawer-overlay.active {
    display: block;
}

.filter-drawer-overlay.visible {
    opacity: 1;
}

/* خود Drawer */
.filter-drawer {
    position: fixed;
    top: 0;
    right: -100%;          /* RTL: از راست */
    width: min(360px, 90vw);
    height: 100dvh;
    background: #fff;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.filter-drawer.open {
    right: 0;
}

.filter-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.filter-drawer-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.filter-drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 1.3rem;
    transition: all 0.2s;
    padding: 0;
}

.filter-drawer-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.filter-drawer-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.filter-drawer-body::-webkit-scrollbar {
    width: 4px;
}

.filter-drawer-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.filter-drawer-footer {
    padding: 14px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.filter-drawer-footer .btn-apply {
    flex: 1;
    background: #7e1975;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.filter-drawer-footer .btn-apply:hover {
    background: #6a1562;
}

.filter-drawer-footer .btn-reset {
    background: #fff;
    color: #dc2626;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.filter-drawer-footer .btn-reset:hover {
    background: #fef2f2;
}

/* prevent body scroll when drawer open */
body.drawer-open {
    overflow: hidden;
}

/* =======================
 *  RESPONSIVE
 * ======================= */
@media (max-width: 991px) {
    /* سایدبار دسکتاپ مخفی بشه */
    .filter-sidebar-desktop {
        display: none !important;
    }

    /* دکمه فیلتر موبایل نمایش داده بشه */
    .filter-mobile-btn {
        display: inline-flex;
    }

    .sort-options {
        justify-content: flex-start;
    }
}

@media (min-width: 992px) {
    /* drawer و overlay روی دسکتاپ اصلاً رندر نشن */
    .filter-drawer,
    .filter-drawer-overlay,
    .filter-mobile-btn {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .sort-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .sort-btn i {
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .product-image {
        aspect-ratio: 4 / 3;
    }

    .price-labels {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .sort-options {
        gap: 6px;
    }

    .sort-btn {
        font-size: 0.75rem;
        padding: 6px 10px;
        gap: 4px;
    }
}

.chevron::after {
    margin: 0 5px -.15rem 0 !important;
    width: .4rem;
    height: .4rem;
    transform: rotate(45deg);
    border: 0.094rem none rgb(57, 46, 64);
    border-right: .094rem solid #392e40;
    border-bottom: .094rem solid #392e40;
    opacity: 1;
}
