/* ═══════════════════════════════════════════════════════════ */
/* Custom Carousel - RTL Slider (From Scratch)               */
/* ═══════════════════════════════════════════════════════════ */

.custom-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.custom-slider-viewport {
    overflow: hidden;
    width: 100%;
}

.custom-slider-track {
    display: flex;
    flex-direction: row;
    direction: rtl; /* LTR برای transform درست */
    flex-wrap: nowrap;
    transition: transform 0.5s ease;
}

.custom-slider-item {
    flex: 0 0 100%;
    direction: rtl; /* محتوای RTL */
    padding: 0 10px;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .custom-slider-item {
        flex: 0 0 33.333%;
    }
}

@media (min-width: 992px) {
    .custom-slider-item {
        flex: 0 0 25%;
    }
}

.custom-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1.5rem;
}

.custom-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(186, 104, 200, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-slider-dot:hover {
    background-color: rgba(186, 104, 200, 0.6);
}

.custom-slider-dot.active {
    background-color: #ba68c8;
    width: 30px;
    border-radius: 5px;
}

/* ═══════════════════════════════════════════════════════════ */
/* Custom Carousel - Performance Optimized                   */
/* ═══════════════════════════════════════════════════════════ */

.custom-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    min-height: 380px; /* موبایل: 1 محصول 1:1 */
    contain: layout style paint; /* جلوگیری از CLS */
}

.custom-slider-viewport {
    overflow: hidden;
    width: 100%;
    position: relative;
}

.custom-slider-track {
    display: flex;
    flex-direction: row;
    direction: rtl;
    flex-wrap: nowrap;
    will-change: transform;
    transform: translateZ(0); /* hardware acceleration */
    backface-visibility: hidden;
    /* transition حذف شد برای جلوگیری از CLS */
}

.custom-slider-item {
    flex: 0 0 100%;
    direction: rtl;
    padding: 0 10px;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .custom-slider-item {
        flex: 0 0 33.333%;
    }
    
    .custom-slider {
        min-height: 280px; /* تبلت: 3 محصول 1:1 */
    }
}

@media (min-width: 992px) {
    .custom-slider-item {
        flex: 0 0 25%;
    }
    
    .custom-slider {
        min-height: 320px; /* دسکتاپ: 4 محصول 1:1 */
    }
}

.custom-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1.5rem;
}

.custom-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(186, 104, 200, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-slider-dot:hover {
    background-color: rgba(186, 104, 200, 0.6);
}

.custom-slider-dot.active {
    background-color: #ba68c8;
    width: 30px;
    border-radius: 5px;
}


/* ═══════════════════════════════════════════════════════════ */
/* Custom Carousel - CLS Final Fix                           */
/* ═══════════════════════════════════════════════════════════ */

.custom-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    min-height: 380px;
    contain: strict; /* خیلی قوی‌تر از layout style paint */
    isolation: isolate; /* جلوگیری از shift */
    content-visibility: auto; /* بهینه‌سازی */
}

.custom-slider-viewport {
    overflow: hidden;
    width: 100%;
    position: relative;
    contain: layout style paint;
}

.custom-slider-track {
    display: flex;
    flex-direction: row;
    direction: rtl;
    flex-wrap: nowrap;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    /* will-change حذف شد - خودش باعث shift میشه */
}

.custom-slider-item {
    flex: 0 0 100%;
    direction: rtl;
    padding: 0 10px;
    box-sizing: border-box;
    contain: layout style;
}

@media (min-width: 768px) {
    .custom-slider-item {
        flex: 0 0 33.333%;
    }
    
    .custom-slider {
        min-height: 280px;
    }
}

@media (min-width: 992px) {
    .custom-slider-item {
        flex: 0 0 25%;
    }
    
    .custom-slider {
        min-height: 320px;
    }
}

.custom-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1.5rem;
    contain: layout style paint;
}

.custom-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(186, 104, 200, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-slider-dot:hover {
    background-color: rgba(186, 104, 200, 0.6);
}

.custom-slider-dot.active {
    background-color: #ba68c8;
    width: 30px;
    border-radius: 5px;
}


/* ═══════════════════════════════════════════════════════════ */
/* Custom Carousel - Height Fix                              */
/* ═══════════════════════════════════════════════════════════ */

.custom-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    /* min-height حذف شد - ارتفاع بر اساس محتوا */
    contain: layout style; /* ملایم‌تر از strict */
}

.custom-slider-viewport {
    overflow: hidden;
    width: 100%;
    position: relative;
}

.custom-slider-track {
    display: flex;
    flex-direction: row;
    direction: rtl;
    flex-wrap: nowrap;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.custom-slider-item {
    flex: 0 0 100%;
    direction: rtl;
    padding: 0 10px;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .custom-slider-item {
        flex: 0 0 33.333%;
    }
}

@media (min-width: 992px) {
    .custom-slider-item {
        flex: 0 0 25%;
    }
}

.custom-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1.5rem;
}

.custom-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(186, 104, 200, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-slider-dot:hover {
    background-color: rgba(186, 104, 200, 0.6);
}

.custom-slider-dot.active {
    background-color: #ba68c8;
    width: 30px;
    border-radius: 5px;
}


/* ═══════════════════════════════════════════════════════════ */
/* Custom Carousel - Final Version                           */
/* ═══════════════════════════════════════════════════════════ */

.custom-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.custom-slider-viewport {
    overflow: hidden;
    width: 100%;
}

.custom-slider-track {
    display: flex;
    flex-direction: row;
    direction: rtl;
    flex-wrap: nowrap;
    transform: translateZ(0);
}

.custom-slider-item {
    flex: 0 0 100%;
    direction: rtl;
    padding: 0 10px;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .custom-slider-item {
        flex: 0 0 33.333%;
    }
}

@media (min-width: 992px) {
    .custom-slider-item {
        flex: 0 0 25%;
    }
}

.custom-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1.5rem;
}

.custom-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(186, 104, 200, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-slider-dot:hover {
    background-color: rgba(186, 104, 200, 0.6);
}

.custom-slider-dot.active {
    background-color: #ba68c8;
    width: 30px;
    border-radius: 5px;
}

