/* =========================================
   اسلایدر بنر تبلیغاتی
   ========================================= */

.banner-slider {
    width: 100%;
    max-width: 720px;
    margin: 18px auto 0;
}

.banner-slider[hidden] { display: none; }

.bs-viewport {
    position: relative;
    width: 100%;
    /* نسبت ابعاد از روی خود تصویر بنر تنظیم می‌شود (banner-slider.js)؛ پیش‌فرض ۱۲۰۰×۴۰۰ */
    aspect-ratio: var(--bs-ratio, 3 / 1);
    overflow: hidden;
    border-radius: 18px;
    background: #ecebf3;
    box-shadow: 0 8px 25px rgba(35, 39, 80, .10);
    direction: ltr;              /* جابه‌جایی با transform محاسبه می‌شود */
    touch-action: pan-y;         /* اسکرول عمودی آزاد، افقی برای درگ */
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
    outline: none;
    isolation: isolate;
}

    .bs-viewport:focus-visible {
        box-shadow: 0 0 0 3px #c9a3d4, 0 8px 25px rgba(35, 39, 80, .10);
    }

.banner-slider.is-dragging .bs-viewport { cursor: grabbing; }

/* اسکلت درخشان تا اولین تصویر بالا بیاید */
.bs-viewport::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(90deg, #ecebf3 25%, #f6f5fa 40%, #ecebf3 60%);
    background-size: 300% 100%;
    animation: bs-shimmer 1.3s ease-in-out infinite;
    transition: opacity .3s ease;
}

.bs-viewport.ready::before {
    opacity: 0;
    animation: none;
    pointer-events: none;
}

@keyframes bs-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.bs-slide {
    position: absolute;
    inset: 0;
    z-index: 1;
    visibility: hidden;
    will-change: transform;
    backface-visibility: hidden;
}

    .bs-slide.bs-anim {
        transition: transform .5s cubic-bezier(.22, .8, .26, 1);
    }

.bs-link {
    display: block;
    width: 100%;
    height: 100%;
    -webkit-user-drag: none;
}

.bs-slide picture,
.bs-slide img {
    display: block;
    width: 100%;
    height: 100%;
}

.bs-slide img {
    /* contain: هیچ بخشی از بنر (مثل متن کناره‌ها) در هیچ اندازه‌ای بریده نمی‌شود */
    object-fit: contain;
    opacity: 0;
    transition: opacity .35s ease;
    -webkit-user-drag: none;
    pointer-events: none;
}

.bs-slide.loaded img { opacity: 1; }

/* برچسب «تبلیغ» */
.bs-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(20, 20, 35, .42);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 10.5px;
    line-height: 1.8;
    direction: rtl;
    pointer-events: none;
}

/* فلش‌ها (فقط دستگاه‌های با ماوس) */
.bs-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 34px;
    height: 34px;
    margin-top: -17px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .88);
    color: #5b2f75;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    cursor: pointer;
    opacity: 0;
    transform: scale(.9);
    transition: opacity .2s ease, transform .2s ease, background-color .2s ease;
}

    .bs-arrow i {
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        font-size: 12px;
    }

    .bs-arrow:hover { background: #fff; }
    .bs-prev { right: 10px; }
    .bs-next { left: 10px; }

@media (hover: hover) and (pointer: fine) {
    .bs-viewport:hover .bs-arrow,
    .bs-viewport:focus-within .bs-arrow {
        opacity: 1;
        transform: none;
    }
}

@media (hover: none) {
    .bs-arrow { display: none; }
}

/* نقطه‌ها با نوار پیشرفت */
.bs-dots {
    position: absolute;
    left: 50%;
    bottom: 9px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(20, 20, 35, .30);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    direction: rtl;
}

.bs-dot {
    position: relative;
    width: 7px;
    height: 7px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .55);
    cursor: pointer;
    overflow: hidden;
    transition: width .3s ease, background-color .3s ease;
}

    .bs-dot span {
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: #fff;
        transform: scaleX(0);
        transform-origin: right center;   /* پر شدن از راست به چپ */
    }

    .bs-dot.active { width: 26px; }

    .bs-dot.active span {
        animation: bs-fill var(--bs-interval, 4.5s) linear forwards;
    }

    .bs-dot:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.banner-slider.is-paused .bs-dot.active span { animation-play-state: paused; }

.banner-slider.is-single .bs-dots,
.banner-slider.is-single .bs-arrow { display: none; }

@keyframes bs-fill {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@media (max-width: 576px) {
    .banner-slider { margin-top: 14px; }

    .bs-viewport { border-radius: 12px; }

    /* در گوشی ارتفاع بنر کم است؛ برچسب و نقطه‌ها کوچک‌تر تا روی محتوای بنر را نپوشانند */
    .bs-badge { top: 6px; right: 6px; padding: 0 7px; font-size: 9.5px; }
    .bs-dots { bottom: 5px; gap: 4px; padding: 3px 6px; }
    .bs-dot { width: 5px; height: 5px; }
    .bs-dot.active { width: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .bs-viewport::before,
    .bs-dot.active span { animation: none; }
    .bs-dot.active span { transform: scaleX(1); }
    .bs-slide.bs-anim { transition: none; }
}
