/* === Pills over Swiper === */

.hsa-cat-pills { margin: 12px 0 12px; }
.hsa-swiper.swiper { position: relative; }

.swiper-wrapper { align-items: stretch; }
.swiper-slide { width: auto; } /* برای SlidesPerView:auto */

.hsa-pill {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    padding: 8px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    line-height: 1.6;
    color: #111827;
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
    user-select: none;
}
.hsa-pill:hover { border-color: #d1d5db; }
.hsa-pill.is-active {
    background: #1c398e !important;
    color: #fff;
    border-color: #1c398e !important;
}

/* دکمه‌های پیش‌فرض سوایپر را کمی جمع‌وجور کنیم */
.swiper-button-prev, .swiper-button-next {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #111827;
}
.swiper-button-prev:after, .swiper-button-next:after {
    font-size: 16px;
}
@media (max-width: 640px) {
    .swiper-button-prev, .swiper-button-next { display: none; }
}
/* === HSA: Pill — full text, better vertical rhythm === */
#hsa-archive .hsa-cat-pills .swiper-wrapper {
    align-items: center;
}

#hsa-archive .hsa-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--hsa-border-soft,rgba(0,0,0,.12));
    background: white;
    font-size: 12px;
    white-space: nowrap;
    max-width: none;
    vertical-align: middle;
}

/* متن داخل قرص: هیچ برشی/ellipsis اعمال نشود */
#hsa-archive .hsa-pill__text {
    display: block;
    overflow: visible;           /* مهم: دیگر بریده نشود */
    text-overflow: clip;         /* سه‌نقطه غیرفعال */
    direction: rtl;              /* فارسی در محیط RTL/LTR یکسان رندر شود */
}

/* هر اسلاید به اندازهٔ محتوا */
#hsa-archive .hsa-cat-pills .swiper-slide {
    width: auto !important;
    margin-inline: .30rem;
}
/* والد سوایپر: کانتکست مکان‌یابی برای دکمه‌ها */
#hsa-archive .hsa-swiper,
#hsa-archive .hsa-cats-swiper,
#hsa-archive .hsa-brands-swiper,
#hsa-archive .hsa-brandcats-swiper {
    position: relative;
}

/* دکمه‌های اختصاصی HSA */
#hsa-archive .hsa-swiper-button-prev,
#hsa-archive .hsa-swiper-button-next,
#hsa-archive .swiper-button-prev.hsa-only,   /* fallback اگر هنوز کلاس عمومی دارید */
#hsa-archive .swiper-button-next.hsa-only {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0,0,0,.12);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    z-index: 5;
    cursor: pointer;
    opacity: .96;
}

/* جای دقیق: یکی چپ، یکی راست — با ریست صریح تا قوانین قبلی اثر نگذارند */
#hsa-archive .hsa-swiper-button-prev { left: .35rem; right: auto; }
#hsa-archive .hsa-swiper-button-next { right: .35rem; left:  auto; }

/* آیکن با SVG سبک (بدون فونت‌آیکن) */
#hsa-archive .hsa-swiper-button-prev::before,
#hsa-archive .hsa-swiper-button-next::before {
    content: "";
    width: 18px;
    height: 18px;
    display: block;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
    filter: contrast(0.9);
}

/* فلش‌ها در حالت RTL */
#hsa-archive [dir="rtl"] .hsa-swiper-button-prev::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='15 18 9 12 15 6'/></svg>");
}
#hsa-archive [dir="rtl"] .hsa-swiper-button-next::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 15 12 9 6'/></svg>");
}

/* اگر صفحه LTR بود (نادر)، جهت فلش‌ها معکوس شود */
#hsa-archive :not([dir="rtl"]) .hsa-swiper-button-prev::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='15 18 9 12 15 6'/></svg>");
}
#hsa-archive :not([dir="rtl"]) .hsa-swiper-button-next::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 15 12 9 6'/></svg>");
}

/* حالت hover/focus */
#hsa-archive .hsa-swiper-button-prev:hover,
#hsa-archive .hsa-swiper-button-next:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

/* موبایل: پنهان یا سبک‌تر */
@media (max-width: 640px){
    #hsa-archive .hsa-swiper-button-prev,
    #hsa-archive .hsa-swiper-button-next { display: none !important; }
}

/* --- Fallback اگر مجبورید فعلاً از کلاس‌های عمومی استفاده کنید: آن‌ها را به HSA محدود کنید --- */
#hsa-archive .swiper-button-prev:not(.hsa-swiper-button-prev),
#hsa-archive .swiper-button-next:not(.hsa-swiper-button-next) {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px; height: 34px; z-index:5;
    left: auto; right: auto;             /* ریست */
}
#hsa-archive .swiper-button-prev:not(.hsa-swiper-button-prev) { left: .35rem; }
#hsa-archive .swiper-button-next:not(.hsa-swiper-button-next) { right: .35rem; }
