/* استایل‌های بخش محصولات تخفیف‌دار و هدر آن */
.home-products-section {
    position: relative;
}

.home-products-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.home-products-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* استایل دکمه مشاهده همه */
.btn-view-all-discounts {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background-color: #fef2f2; /* قرمز خیلی ملایم */
    color: #dc2626; /* قرمز استاندارد */
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 9999px;
    transition: all 0.25s ease;
    border: 1px solid #fee2e2;
}

.btn-view-all-discounts:hover {
    background-color: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

.btn-view-all-discounts svg {
    transition: transform 0.2s ease;
}

.btn-view-all-discounts:hover svg {
    transform: rotate(180deg) translateX(-3px); /* حرکت رو به جلو هنگام هاور */
}

/* اسکرول افقی ترکینگ محصولات */
.home-products-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 12px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.home-products-track::-webkit-scrollbar {
    height: 6px;
}

.home-products-track::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.home-products-track::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.home-products-track::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* جست‌وجوی صفحهٔ اصلی */
.home-search-box {
    border: 1px solid #e2e8f0;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.home-search-box:focus-within {
    border-color: #0284c7;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.15) !important;
}

.home-search-box input:focus {
    box-shadow: none;
}

/* اسلایدر بنرهای صفحهٔ اصلی */
.home-banner-carousel {
    position: relative;
    min-width: 0;
}

.home-banner-track {
    display: flex;
    flex-wrap: nowrap;
    direction: rtl;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    border-radius: 20px;
}

.home-banner-track::-webkit-scrollbar {
    display: none;
}

.home-banner-track:focus-visible {
    outline: 3px solid var(--sky-600, #087cb5);
    outline-offset: 4px;
}

.home-banner-slide {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    scroll-snap-align: start;
}

.home-banner-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

/*
 * کادر بر اساس نسبت عکس ساخته می‌شود تا تصویر کامل دیده شود
 * و فضای خالی ناشی از ارتفاع ثابت ایجاد نشود.
 */
.home-banner-visual {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 7;
    overflow: hidden;
    border-radius: 20px;
    isolation: isolate;
    background: #eef2f5;
}

.home-banner-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.5s ease;
}

.home-banner-link:hover .home-banner-image {
    transform: scale(1.015);
}

.home-banner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: clamp(18px, 4vw, 48px);
    background: linear-gradient(
            270deg,
            rgba(8, 20, 32, 0.72) 0%,
            rgba(8, 20, 32, 0.25) 38%,
            rgba(8, 20, 32, 0) 75%
    );
}

.home-banner-copy {
    max-width: min(62%, 620px);
    color: #fff;
    text-align: right;
    direction: rtl;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}

.home-banner-copy h2 {
    margin: 0 0 8px;
    font-size: clamp(1.25rem, 3vw, 2.5rem);
    font-weight: 800;
    line-height: 1.45;
}

.home-banner-copy p {
    margin: 0;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    line-height: 1.8;
}

.home-banner-arrow {
    position: absolute;
    z-index: 2;
    top: 50%;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    color: #17324a;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.home-banner-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.06);
}

.home-banner-arrow svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.home-banner-prev {
    right: 14px;
}

.home-banner-next {
    left: 14px;
}

.home-banner-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 13px;
}

.home-banner-dots button {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #cbd5df;
    cursor: pointer;
    transition: width 0.2s ease, background-color 0.2s ease;
}

.home-banner-dots button[aria-current="true"] {
    width: 24px;
    background: var(--sky-600, #087cb5);
}

/* عنوان هر بخش محصولات */
.home-products-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.home-products-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.home-products-title-wrap .badge {
    flex: 0 0 auto;
}

.home-products-title-wrap h2 {
    color: var(--ink, #17324a);
    line-height: 1.5;
}

.home-products-all-link {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* ردیف اسکرول محصولات */
.home-products-track {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 16px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 4px 3px 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 3px;
    scrollbar-width: thin;
    scrollbar-color: #b9c9d7 #eef4f8;
    -webkit-overflow-scrolling: touch;
}

.home-products-track > :not(.home-products-empty) {
    flex: 0 0 265px !important;
    width: 265px !important;
    min-width: 0;
    max-width: 265px !important;
    margin: 0;
    padding: 0;
    scroll-snap-align: start;
}

.home-products-empty {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
}

.home-products-track:focus-visible {
    outline: 2px solid var(--sky-600, #087cb5);
    outline-offset: 2px;
    border-radius: 8px;
}

.home-products-track::-webkit-scrollbar {
    height: 7px;
}

.home-products-track::-webkit-scrollbar-track {
    border-radius: 10px;
    background: #eef4f8;
}

.home-products-track::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #b9c9d7;
}

.home-products-track::-webkit-scrollbar-thumb:hover {
    background: var(--sky-600, #087cb5);
}

/* تبلت */
@media (max-width: 991.98px) {
    .home-products-track > :not(.home-products-empty) {
        flex-basis: 245px !important;
        width: 245px !important;
        max-width: 245px !important;
    }

    .home-banner-visual {
        aspect-ratio: 3 / 2;
    }
}

/* موبایل */
@media (max-width: 575.98px) {
    .home-banner-track,
    .home-banner-visual {
        border-radius: 15px;
    }

    .home-banner-visual {
        aspect-ratio: 4 / 3;
    }

    .home-banner-image {
        object-fit: contain;
        background: #eef2f5;
    }

    .home-banner-overlay {
        align-items: flex-end;
        padding: 18px 16px;
        background: linear-gradient(
                0deg,
                rgba(8, 20, 32, 0.82) 0%,
                rgba(8, 20, 32, 0.35) 48%,
                rgba(8, 20, 32, 0) 100%
        );
    }

    .home-banner-copy {
        max-width: 92%;
    }

    .home-banner-copy h2 {
        font-size: 1.2rem;
    }

    .home-banner-copy p {
        font-size: 0.84rem;
    }

    .home-banner-arrow {
        width: 36px;
        height: 36px;
    }

    .home-banner-prev {
        right: 8px;
    }

    .home-banner-next {
        left: 8px;
    }

    .home-products-heading {
        align-items: flex-start;
    }

    .home-products-title-wrap h2 {
        font-size: 1rem;
    }

    .home-products-all-link {
        padding-inline: 10px;
        font-size: 0.75rem;
    }

    .home-products-track {
        gap: 12px;
        padding-bottom: 12px;
    }

    .home-products-track > :not(.home-products-empty) {
        flex-basis: min(72vw, 250px) !important;
        width: min(72vw, 250px) !important;
        max-width: min(72vw, 250px) !important;
    }
}

@media (max-width: 380px) {
    .home-products-title-wrap h2 {
        font-size: 0.9rem;
    }

    .home-products-track > :not(.home-products-empty) {
        flex-basis: min(76vw, 240px) !important;
        width: min(76vw, 240px) !important;
        max-width: min(76vw, 240px) !important;
    }
}
