/* ============================================
   Swiper Custom Styles - نسخه نهایی پایدار v2.0
   ============================================ */

/* ============================================
   BASE STYLES - SWIPER SLIDER
   ============================================ */
.swiper-custom {
    width: 100%;
    position: relative;
    overflow: hidden;
}

.swiper-custom .swiper-slide {
    overflow: hidden;
}

.swiper-custom .slider-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.swiper-custom a {
    display: block;
    width: 100%;
    height: 100%;
}

/* ============================================
   MOBILE STYLES - SWIPER SLIDER
   ============================================ */
@media (max-width: 767px) {
    .swiper-custom .swiper-slide {
        border-radius: 16px;
        width: 100% !important;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .swiper-custom .slider-img {
        border-radius: 16px;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        object-position: center;
        width: 100%;
    }
    
    /* مخفی کردن دکمه‌ها در موبایل */
    .swiper-custom .swiper-button-prev,
    .swiper-custom .swiper-button-next {
        display: none !important;
    }
    
    /* مخفی کردن pagination در موبایل */
    .swiper-custom .swiper-pagination {
        display: none !important;
    }
}

/* ============================================
   DESKTOP STYLES - SWIPER SLIDER
   ============================================ */
@media (min-width: 768px) {
    .swiper-custom .swiper-slide {
        border-radius: 20px;
        overflow: hidden;
    }
    
    .swiper-custom .slider-img {
        border-radius: 20px;
        width: 100%;
        height: auto;
        object-fit: cover;
    }
    
    /* دکمه‌ها - مخفی در حالت عادی، نمایش با hover */
    .swiper-custom .swiper-button-prev,
    .swiper-custom .swiper-button-next {
        position: absolute;
        bottom: 20px !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
        transform: none !important;
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(8px);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        cursor: pointer;
        z-index: 10;
        transition: all 0.3s ease;
        opacity: 0;
        visibility: hidden;
        margin: 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    /* نمایش دکمه‌ها با انیمیشن هنگام hover روی اسلایدر */
    .swiper-custom:hover .swiper-button-prev,
    .swiper-custom:hover .swiper-button-next {
        opacity: 0.8;
        visibility: visible;
    }
    
    /* دکمه Next (بعدی) - سمت راست */
    .swiper-custom .swiper-button-next {
        right: 20px !important;
    }
    
    /* دکمه Prev (قبلی) - سمت چپ دکمه Next */
    .swiper-custom .swiper-button-prev {
        right: 74px !important;
    }
    
    .swiper-custom .swiper-button-prev:hover,
    .swiper-custom .swiper-button-next:hover {
        opacity: 1;
        background: rgba(0, 0, 0, 0.85);
        transform: scale(1.05) !important;
    }
    
    .swiper-custom .swiper-button-prev:after,
    .swiper-custom .swiper-button-next:after {
        font-size: 18px;
        font-weight: bold;
    }
    
    /* Pagination - پایین وسط */
    .swiper-custom .swiper-pagination {
        position: absolute;
        bottom: 20px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: auto;
        display: flex;
        gap: 8px;
        z-index: 10;
    }
    
    .swiper-custom .swiper-pagination-bullet {
        width: 32px;
        height: 4px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 4px;
        transition: all 0.3s ease;
        opacity: 1;
        margin: 0 !important;
        cursor: pointer;
    }
    
    .swiper-custom .swiper-pagination-bullet-active {
        width: 48px;
        background: white;
    }
}

/* ============================================
   RTL SUPPORT - SWIPER SLIDER
   ============================================ */
@media (min-width: 768px) {
    html[dir="rtl"] .swiper-custom .swiper-button-next,
    body[dir="rtl"] .swiper-custom .swiper-button-next,
    body.rtl .swiper-custom .swiper-button-next {
        right: 20px !important;
        left: auto !important;
    }
    
    html[dir="rtl"] .swiper-custom .swiper-button-prev,
    body[dir="rtl"] .swiper-custom .swiper-button-prev,
    body.rtl .swiper-custom .swiper-button-prev {
        right: 74px !important;
        left: auto !important;
    }
}

/* Mousewheel hint */
.swiper-custom .mousewheel-scroll-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 10;
    pointer-events: none;
    opacity: 0.7;
    white-space: nowrap;
}

@media (max-width: 767px) {
    .swiper-custom .mousewheel-scroll-hint {
        display: none;
    }
}

/* ============================================
   TOP BANNER STYLES - سراسری برای همه صفحات
   ============================================ */

.top-banner-container {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 10001;
    background: #fff;
    margin: 0;
    padding: 0;
    line-height: 0;
    box-shadow: none;
    display: block;
}

.top-banner-container.sticky-banner {
    position: sticky;
    top: 0;
}

.top-banner {
    display: block;
    line-height: 0;
}

.top-banner-img {
    display: block;
    border: 0;
}

/* ============================================
   TOP BANNER - DESKTOP (min-width: 768px)
   عرض 100% و ارتفاع خودکار
   ============================================ */
@media (min-width: 768px) {
    .top-banner-container {
        width: 100% !important;
        max-width: 100% !important;
        position: sticky !important;
        top: 0 !important;
    }
    
    .top-banner {
        width: 100% !important;
    }
    
    .top-banner-img {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
    }
}

/* ============================================
   TOP BANNER - MOBILE (max-width: 767px)
   عرض اتوماتیک و ارتفاع ثابت 27px
   ============================================ */
@media (max-width: 767px) {
    .top-banner-container {
        width: auto !important;
        max-width: none !important;
        position: sticky !important;
        top: 0 !important;
        text-align: center !important;
        background: transparent !important;
    }
    
    .top-banner {
        width: auto !important;
        display: inline-block !important;
    }
    
    .top-banner-img {
        width: auto !important;
        height: 27px !important;
        min-height: 27px !important;
        max-height: 27px !important;
        object-fit: cover;
    }
}

/* ============================================
   TOP BANNER - RTL SUPPORT
   ============================================ */
html[dir="rtl"] .top-banner-container,
body[dir="rtl"] .top-banner-container {
    direction: rtl;
}

/* جلوگیری از فضای خالی */
.top-banner-container:empty {
    display: none;
}

/* ============================================
   اضافی - ریست و اطمینان از صحت عملکرد
   ============================================ */

/* حذف هرگونه استایل مزاحم در موبایل */
@media (max-width: 767px) {
    .top-banner-container .top-banner,
    .top-banner-container .top-banner a {
        display: inline-block !important;
        width: auto !important;
    }
    
    .top-banner-container .top-banner-img {
        display: inline-block !important;
        vertical-align: middle !important;
    }
}

/* پشتیبانی از صفحه‌گردی RTL در بنر */
html[dir="rtl"] .top-banner-container .top-banner {
    direction: rtl;
}