/**
 * =====================================================================================
 * SMART FILTER STYLES - MODERN HORIZONTAL BAR
 * =====================================================================================
 * استایل‌های کامپوننت فیلتر هوشمند با طراحی مدرن (شبیه Airbnb/Google)
 * 
 * @version 2.0.0
 * @date 2025-12-15
 * =====================================================================================
 */

/* =====================================================================================
   MAIN CONTAINER
   ===================================================================================== */
.smart-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    background: transparent;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 100;
    flex-wrap: wrap;
    overflow: visible;
    flex-direction: row-reverse; /* RTL: برای چیدمان صحیح از راست به چپ */
    justify-content: flex-start; /* شروع از سمت راست */
    max-width: 100%;
}

/* =====================================================================================
   FILTER PILLS (BUTTONS)
   ===================================================================================== */
.filter-pill {
    position: relative;
    flex-shrink: 0;
    overflow: visible; /* اطمینان از عدم کلیپ شدن فرزندان */
    --filter-dropdown-width: clamp(280px, 30vw, 340px);
    max-width: 100%;
    min-width: 0;
}

/* مرتب‌سازی در انتهای سمت چپ */
.filter-pill--sort {
    margin-left: auto; /* در row-reverse این آیتم را به سمت چپ هل می‌دهد */
}

/* دکمه پاک کردن همه - جای ثابت با min-width برای جلوگیری از جابجایی */
.filter-pill-clear {
    /* کنار مرتب‌سازی */
}

.filter-pill__trigger {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 56px;
    padding: 0.7rem 1.15rem;
    background: var(--bg-white, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 18px;
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 0;
    max-width: min(100%, 240px);
    box-shadow: none;
}

.filter-pill__trigger span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-pill__trigger:hover {
    border-color: var(--text-secondary, #64748b);
    background: #fafafa;
    box-shadow: none;
}

.filter-pill.is-active .filter-pill__trigger {
    background: var(--bg-secondary, #f1f5f9);
    border-color: var(--primary-color, #6366f1);
}

.filter-pill.is-open .filter-pill__trigger {
    background: #fff;
    border-color: var(--primary-color, #6366f1);
    box-shadow: none;
}

.filter-pill.has-value .filter-pill__trigger {
    background: var(--primary-color, #6366f1);
    color: #fff;
    border-color: var(--primary-color, #6366f1);
    box-shadow: none;
}

.filter-pill.has-value .filter-pill__trigger:hover {
    background: var(--primary-dark, #4f46e5);
    border-color: var(--primary-dark, #4f46e5);
    box-shadow: none;
}

.filter-pill__icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.filter-pill.is-open .filter-pill__icon {
    transform: rotate(180deg);
}

/* =====================================================================================
   DROPDOWNS (POPOVERS)
   ===================================================================================== */
.filter-pill__dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    left: auto;
    min-width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18), 0 6px 20px rgba(15, 23, 42, 0.08);
    padding: 0;
    display: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px) scale(0.985);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 10001;
    flex-direction: column;
    gap: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.filter-pill.dropdown-align-start .filter-pill__dropdown {
    left: 0;
    right: auto;
}

.filter-pill.dropdown-align-end .filter-pill__dropdown {
    right: 0;
    left: auto;
}

/* حذف Arrow pointer برای ظاهر تمیزتر */
.filter-pill__dropdown::before {
    display: none;
}

.filter-pill--sort {
    --filter-dropdown-width: clamp(250px, 24vw, 300px);
}

.filter-pill--sort .filter-pill__trigger {
    max-width: min(100%, 280px);
}

.filter-pill--price {
    --filter-dropdown-width: clamp(340px, 36vw, 430px);
}

.filter-pill[data-key="sizes"] {
    --filter-dropdown-width: clamp(300px, 32vw, 390px);
}

.filter-pill[data-key="colors"] {
    --filter-dropdown-width: clamp(290px, 30vw, 360px);
}

.filter-pill--price .filter-pill__dropdown {
    padding: 0;
}

.filter-pill--price .filter-dropdown__content {
    overflow: visible;
    max-height: none;
    padding-right: 1rem;
}

/* تراز کردن دراپ‌دان‌ها - حذف شد چون در بالا تعریف شده */

.filter-pill.is-open .filter-pill__dropdown {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateY(0) scale(1) !important;
}

/* هدر دراپ‌دان (موبایل) */
.filter-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.82rem 0.85rem 0.72rem;
    border-bottom: 1px solid #eef2f7;
    margin-bottom: 0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.filter-dropdown__title {
    font-weight: 800;
    font-size: 0.92rem;
    color: #0f172a;
}

.filter-dropdown__close {
    width: 34px;
    height: 34px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #ffffff;
    color: #64748b;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.filter-dropdown__close:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}

/* محتوای اسکرول‌خور */
.filter-dropdown__content {
    max-height: min(50vh, 320px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.65rem 0.85rem;
    margin-right: 0;
    min-width: 0;
}

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

.filter-dropdown__content::-webkit-scrollbar-track {
    background: transparent;
}

.filter-dropdown__content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.filter-dropdown__content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* فوتر دراپ‌دان (دکمه‌های اعمال/پاک کردن) */
.filter-dropdown__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.78rem 0.85rem 0.85rem;
    border-top: 1px solid #eef2f7;
    margin-top: auto;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-secondary, #64748b);
    font-size: 0.83rem;
    cursor: pointer;
    text-decoration: none;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
}

.btn-link:hover {
    background: var(--bg-light, #f1f5f9);
    color: var(--text-primary, #1a1a1a);
}

.btn-primary {
    background: var(--primary-color, #6366f1);
    color: #fff;
    border: none;
    padding: 0.55rem 0.95rem;
    border-radius: 11px;
    font-weight: 600;
    font-size: 0.83rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
    min-height: 40px;
}

.btn-primary:hover {
    background: var(--primary-dark, #4f46e5);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

/* =====================================================================================
   SPECIFIC FILTERS
   ===================================================================================== */

/* Sort */
.sort-options {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
}

.sort-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 46px;
    padding: 0.68rem 0.78rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
    border: 1px solid #edf2f7;
    background: #fff;
}

.sort-option:hover {
    background: var(--bg-light, #f8fafc);
    border-color: #d8e1ee;
}

@supports selector(.sort-option:has(input:checked)) {
    .sort-option:has(input:checked) {
        background: #eef2ff;
        border-color: #c7d2fe;
    }
}

.sort-option.is-selected {
    background: rgba(99, 102, 241, 0.08);
}

.sort-option input[type="radio"] {
    accent-color: var(--primary-color, #6366f1);
    width: 18px;
    height: 18px;
}

/* Checkboxes (Brand, etc) */
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
    width: 100%;
    min-width: 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.86rem;
    min-height: 46px;
    padding: 0.64rem 0.78rem;
    margin: 0;
    border-radius: 12px;
    transition: all 0.2s ease;
    min-width: 0;
    border: 1px solid #edf2f7;
    background: #fff;
}

.checkbox-item > span {
    flex: 1;
    min-width: 0;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.35;
}

.checkbox-item:hover {
    background: var(--bg-light, #f8fafc);
    border-color: #d8e1ee;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

@supports selector(.checkbox-item:has(input:checked)) {
    .checkbox-item:has(input:checked) {
        background: #eef2ff;
        border-color: #c7d2fe;
        box-shadow: none;
    }

    .checkbox-item:has(input:checked) > span {
        color: #312e81;
        font-weight: 600;
    }
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid var(--border-color, #cbd5e1);
    appearance: none;
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-item input[type="checkbox"]:hover {
    border-color: var(--primary-color, #6366f1);
}

.checkbox-item input[type="checkbox"]:checked {
    background: var(--primary-color, #6366f1);
    border-color: var(--primary-color, #6366f1);
}

.checkbox-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Colors */
.color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    min-height: 58px;
    padding: 0.62rem 0.68rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    border: 1px solid #edf2f7;
    background: #fff;
}

.color-option:hover {
    background: var(--bg-light, #f8fafc);
    border-color: #d8e1ee;
}

@supports selector(.color-option:has(input:checked)) {
    .color-option:has(input:checked) {
        background: #eef2ff;
        border-color: #c7d2fe;
    }
}

.color-swatch {
    width: 31px;
    height: 31px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.08);
    position: relative;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.color-option:hover .color-swatch {
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.color-option input:checked + .color-swatch {
    transform: scale(1.1);
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--primary-color, #6366f1);
    border-color: transparent;
}

.color-name {
    font-size: 0.72rem;
    color: var(--text-secondary, #64748b);
    font-weight: 500;
}

/* Price Range */
.price-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.price-input-group {
    flex: 1;
    position: relative;
    min-width: 120px;
}

.price-currency {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #94a3b8);
    font-size: 0.75rem;
    pointer-events: none;
}

.price-field {
    width: 100%;
    min-width: 120px;
    padding: 0.85rem 3.5rem 0.85rem 1rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    text-align: left;
    direction: ltr;
    transition: all 0.2s ease;
    background: var(--bg-white, #fff);
}

.price-field:hover {
    border-color: var(--text-secondary, #94a3b8);
}

.price-field:focus {
    outline: none;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.price-separator {
    color: var(--text-muted, #94a3b8);
    font-weight: 500;
}

.price-slider-container {
    padding: 0 0.5rem;
}

/* =====================================================================================
   MOBILE RESPONSIVE
   ===================================================================================== */
@media (max-width: 768px) {
    .smart-filter {
        padding: 0.5rem 1rem;
        margin: 0 -1rem 1rem; /* Full width on mobile */
        gap: 0.5rem;
    }

    .filter-pill__trigger {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    /* تبدیل دراپ‌دان به Bottom Sheet در موبایل */
    .filter-pill__dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        border-radius: 20px 20px 0 0;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s ease;
        z-index: 1000;
        max-height: 85vh;
        padding: 1.5rem;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    }

    .filter-pill.is-open .filter-pill__dropdown {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: translateY(0);
    }

    .filter-dropdown__header {
        display: flex;
    }

    /* Overlay */
    .filter-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s;
        backdrop-filter: blur(2px);
    }

    .filter-overlay.is-visible {
        opacity: 1;
        visibility: visible;
    }
}

/* =====================================================================================
   CHECKBOX FILTER (Brands, Attributes)
   ===================================================================================== */
.filter-group--checkbox {
    min-width: 200px;
    flex: 1;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    cursor: pointer;
    transition: background-color 0.15s;
}

.filter-checkbox:hover {
    background-color: var(--bg-hover, #f1f5f9);
    margin: 0 -0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
}

.filter-checkbox input {
    display: none;
}

.filter-checkbox__box {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color, #cbd5e1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.filter-checkbox input:checked + .filter-checkbox__box {
    background-color: var(--primary-color, #6366f1);
    border-color: var(--primary-color, #6366f1);
}

.filter-checkbox input:checked + .filter-checkbox__box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
    margin-top: -2px;
}

.filter-checkbox__label {
    font-size: 0.85rem;
    color: var(--text-primary, #1a1a1a);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.filter-checkbox__count {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.8rem;
}

/* =====================================================================================
   COLOR FILTER
   ===================================================================================== */
.filter-group--color {
    min-width: 180px;
}

.filter-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-color {
    position: relative;
    cursor: pointer;
}

.filter-color input {
    display: none;
}

.filter-color__swatch {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.15s;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.filter-color:hover .filter-color__swatch {
    transform: scale(1.1);
}

.filter-color.is-selected .filter-color__swatch,
.filter-color input:checked + .filter-color__swatch {
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.filter-color__count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-color, #6366f1);
    color: #fff;
    font-size: 0.65rem;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.filter-color:hover .filter-color__count {
    opacity: 1;
}

/* =====================================================================================
   SIZE FILTER
   ===================================================================================== */
.filter-group--size {
    min-width: 200px;
}

.filter-sizes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.filter-size {
    cursor: pointer;
    min-width: 0;
}

.filter-size input {
    display: none;
}

.filter-size__box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-width: 0;
    min-height: 44px;
    padding: 0.62rem 0.74rem;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    font-size: 0.81rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    background: #fff;
    transition: all 0.15s;
    text-align: center;
    line-height: 1.35;
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.filter-size:hover .filter-size__box {
    border-color: #d8e1ee;
    background: #f8fafc;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.filter-size.is-selected .filter-size__box,
.filter-size input:checked + .filter-size__box {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #312e81;
    box-shadow: none;
}

/* =====================================================================================
   DESKTOP UX REWRITE (OPTION LAYOUT)
   ===================================================================================== */
@media (min-width: 769px) {
    .filter-pill__dropdown {
        min-width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
        width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
        max-width: calc(100vw - 2rem);
    }

    .filter-pill--sort .filter-pill__dropdown {
        min-width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
        width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
        max-width: calc(100vw - 2rem);
    }

    .filter-pill--price .filter-pill__dropdown {
        min-width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
        width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
        max-width: calc(100vw - 2rem);
    }

    .filter-pill[data-key="sizes"] .filter-pill__dropdown {
        min-width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
        width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
        max-width: calc(100vw - 2rem);
    }

    .filter-pill[data-key="colors"] .filter-pill__dropdown {
        min-width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
        width: min(var(--filter-dropdown-width), calc(100vw - 2rem));
        max-width: calc(100vw - 2rem);
    }

    .filter-dropdown__content {
        max-height: min(52vh, 340px);
    }

    .checkbox-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 0.42rem;
    }

    .color-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 0.42rem;
    }

    .color-option {
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.6rem;
        min-width: 0;
        min-height: 52px;
        padding: 0.62rem 0.72rem;
    }

    .color-name {
        flex: 1;
        min-width: 0;
        font-size: 0.78rem;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: right;
    }

    .checkbox-item {
        padding: 0.62rem 0.74rem;
    }

    .checkbox-item > span {
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.35;
        max-height: 2.7em;
    }

    .filter-sizes {
        grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
        gap: 0.42rem;
    }

    .filter-size__box {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        text-align: right;
        min-height: 42px;
        padding: 0.6rem 0.7rem;
        white-space: normal;
        overflow-wrap: normal;
        word-break: normal;
    }

    .filter-size__box > span:first-child {
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 600;
        line-height: 1.3;
    }
}

/* =====================================================================================
   PRODUCTS GRID
   ===================================================================================== */
#products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    transition: opacity 0.2s;
}

#products-grid.is-loading {
    pointer-events: none;
}

#products-grid.is-loading:not(.has-skeleton) {
    opacity: 0.5;
}

#products-grid.has-skeleton {
    opacity: 1;
}

/* Skeleton cards for grid loading (phase 1: Smart Filter high-priority path) */
.product-card--skeleton {
    pointer-events: none;
}

.product-card--skeleton .product-card__image,
.product-card--skeleton .sf-skeleton-line {
    background: linear-gradient(90deg, #eef2f7 20%, #e4e9f1 38%, #eef2f7 62%);
    background-size: 300% 100%;
    animation: sf-skeleton-shimmer 1.25s linear infinite;
}

.product-card--skeleton .product-card__image::before,
.product-card--skeleton:hover .product-card__image::before {
    display: none;
}

.product-card--skeleton .product-card__info {
    display: grid;
    gap: 0.5rem;
}

.product-card--skeleton .sf-skeleton-line {
    display: block;
    width: 100%;
    border-radius: 8px;
}

.product-card--skeleton .sf-skeleton-line--brand {
    width: 36%;
    height: 12px;
}

.product-card--skeleton .sf-skeleton-line--title {
    width: 88%;
    height: 14px;
}

.product-card--skeleton .sf-skeleton-line--title-short {
    width: 64%;
    height: 14px;
}

.product-card--skeleton .product-card__price {
    margin-top: 0.2rem;
}

.product-card--skeleton .sf-skeleton-line--price {
    width: 46%;
    height: 16px;
}

@keyframes sf-skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-card--skeleton .product-card__image,
    .product-card--skeleton .sf-skeleton-line {
        animation: none;
        background: #e8edf4;
    }
}

/* No Products Message */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary, #666);
}

.no-products svg {
    margin-bottom: 1rem;
    opacity: 0.3;
}

.no-products p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Product Card */
.product-card {
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    /* بدون افکت hover برای تجربه کاربری بهتر */
}

.product-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-card__image {
    position: relative;
    padding-top: 100%;
    background: var(--bg-secondary, #f8f9fa);
    overflow: hidden;
}

.product-card__image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.product-card:hover .product-card__image::before {
    background: rgba(83, 83, 83, 0.25);
}

.product-card__image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card__badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #ef4444;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    animation: none;
}

/* Responsive badge size for mobile */
@media (max-width: 768px) {
    .product-card__badge {
        width: 3rem;
        height: 3rem;
        font-size: 0.75rem;
    }
}

/* Bottom banners for Smart Filter */
.product-card__badge--sold,
.product-card__badge--sale {
    position: absolute;
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: auto;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: none;
    border-radius: 0;
    padding: 0.6rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    box-shadow: none;
    animation: none;
}

/* Out of stock: dark semi-transparent */
.product-card__badge--sold {
    background: rgba(0, 0, 0, 0.75);
}

/* Sale: red semi-transparent */
.product-card__badge--sale {
    background: rgba(220, 38, 38, 0.82);
}

@keyframes slideUpBadge {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.product-card__badge--sold::before {
    content: 'ناموجود';
}

.product-card__badge--sale::before {
    content: 'تخفیف خورده';
}

/* Dark overlay on image when out of stock (same as hover) */
.product-card__image.is-out-of-stock::after,
.product-card__image:has(.product-card__badge--sold)::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(83, 83, 83, 0.25);
    z-index: 2;
    pointer-events: none;
}

/* Slightly dim sold products but keep visible */
.product-card__image.is-out-of-stock img,
.product-card__image:has(.product-card__badge--sold) img {
    opacity: 0.7 !important;
    filter: grayscale(15%) !important;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .product-card__badge--sold,
    .product-card__badge--sale {
        font-size: 0.7rem;
        padding: 0.5rem 0.4rem;
    }
}

.product-card__info {
    padding: 1rem;
}

.product-card__brand {
    font-size: 0.75rem;
    color: var(--text-secondary, #666);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.product-card__name {
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0.25rem 0 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__price {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.product-card__price--original {
    font-size: 0.95rem;
    font-weight: 500;
    color: #64748b;
    text-decoration: line-through;
}

.product-card__price--current {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary-color, #e74c3c);
}

/* =====================================================================================
   PAGINATION
   ===================================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.pagination__btn {
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: var(--bg-primary, #fff);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}

.pagination__btn:hover:not(.is-active) {
    border-color: var(--primary-color, #6366f1);
    color: var(--primary-color, #6366f1);
}

.pagination__btn.is-active {
    background: var(--primary-color, #6366f1);
    border-color: var(--primary-color, #6366f1);
    color: #fff;
}

.pagination__ellipsis {
    color: var(--text-secondary, #94a3b8);
    padding: 0 0.25rem;
}

/* =====================================================================================
   RESPONSIVE
   ===================================================================================== */
@media (max-width: 768px) {
    .smart-filter {
        flex-direction: column;
    }
    
    .smart-filter__left {
        flex: none;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .smart-filter__right {
        min-width: 100%;
    }
    
    .filter-group--sort,
    .filter-group--price {
        flex: 1;
        min-width: 150px;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    #products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .product-card__info {
        padding: 0.75rem;
    }
    
    .product-card__name {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    #products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .product-card {
        border-radius: 8px;
    }
    
    .product-card__info {
        padding: 0.5rem;
    }
    
    .product-card__price--current {
        font-size: 0.85rem;
        color: var(--secondary-color, #e74c3c);
    }

    .product-card__price--original {
        font-size: 0.8rem;
    }

    .pagination__btn {
        min-width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
}

/* =====================================================================================
   MOBILE FILTER TOGGLE (Optional Enhancement)
   ===================================================================================== */
.mobile-filter-toggle {
    display: none;
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color, #6366f1);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

@media (max-width: 768px) {
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .smart-filter {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        overflow-y: auto;
        min-width: 0;
        padding: 1rem;
        padding-top: 4rem;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

        .filter-dropdown__content {
            padding-right: 0;
            margin-right: 0;
        }

        .filter-sizes {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    
    .smart-filter.is-open {
        transform: translateY(0);
    }
    
    .smart-filter__close {
        position: absolute;
        top: 1rem;
        left: 1rem;
        width: 36px;
        height: 36px;
        border: none;
        background: var(--bg-secondary, #f1f5f9);
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
