/* ============================================
   Eshgh Product Slider - Complete Stylesheet
   Version: 2.2.8
   سازگار با تمام قالب‌ها، RTL و ویرایشگر المنتور
   ============================================ */

/* ============================================
   ۱) استایل‌های پایه Swiper (محدود به ویجت)
   ============================================ */
.eshgh-product-slider-container .swiper {
    position: relative;
    overflow: hidden;
    list-style: none;
    padding: 0;
    z-index: 1;
    display: block;
    width: 100%;
}

.eshgh-product-slider-container .swiper-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: flex;
    align-items: stretch;
    transition-property: transform;
    box-sizing: content-box;
}

.eshgh-product-slider-container .swiper-slide {
    flex-shrink: 0;
    position: relative;
    transition-property: transform;
    display: flex;
    height: auto;
    box-sizing: border-box;
}

/* ============================================
   ۲) کانتینر اصلی — هم‌تراز با ستون کناری
   ============================================ */
.eshgh-product-slider-container {
    --eshgh-slides: 4;
    --eshgh-gap: 16px;
    --eshgh-sidebar-w: 220px;
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 8px 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: var(--eshgh-gap);
    box-sizing: border-box;
}

.eshgh-product-slider-container *,
.eshgh-product-slider-container *::before,
.eshgh-product-slider-container *::after {
    box-sizing: border-box;
}

.eshgh-product-slider-container ul,
.eshgh-product-slider-container ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.eshgh-product-slider-container p {
    margin: 0 0 8px;
}

.eshgh-product-slider-container a {
    box-shadow: none;
}

/* ============================================
   ۳) ستون کناری — اندازه استاندارد
   ============================================ */
.eshgh-sidebar-column {
    flex: 0 0 var(--eshgh-sidebar-w);
    width: var(--eshgh-sidebar-w);
    max-width: var(--eshgh-sidebar-w);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    align-self: stretch;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.eshgh-sidebar-column.eshgh-sidebar-right {
    order: 1;
}

.eshgh-sidebar-image {
    width: 100%;
    margin-bottom: 12px;
}

.eshgh-sidebar-image img {
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.eshgh-sidebar-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    color: inherit;
    line-height: 1.3;
}

.eshgh-sidebar-description {
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 12px;
    opacity: 0.95;
}

.eshgh-sidebar-button {
    display: inline-block;
    padding: 8px 18px;
    background: #fff;
    color: #333 !important;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    font-size: 13px;
    transition: all 0.3s ease;
}

.eshgh-sidebar-button:hover {
    background: transparent;
    color: #fff !important;
    border-color: #fff;
}

/* ============================================
   ۴) اسلایدر اصلی
   ============================================ */
.eshgh-slider-main {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

.eshgh-product-slider {
    overflow: hidden;
    padding: 4px 0 8px;
    width: 100%;
    height: 100%;
}

/* ============================================
   ۵) کارت محصول — اندازه استاندارد و یکنواخت
   ============================================ */
.eshgh-product-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.07);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    border: 1px solid #eee;
}

.eshgh-product-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.eshgh-product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #f5f6f8;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px 10px 0 0;
}

.eshgh-product-image a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
}

.eshgh-product-image img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center center;
    transition: transform 0.4s ease;
    display: block;
    /* رندر نرم و باکیفیت برای عکس محصول */
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* در حالت hover کمی بزرگ‌نمایی نرم بدون برش */
.eshgh-product-card:hover .eshgh-product-image img {
    transform: scale(1.04) translateZ(0);
}

.eshgh-product-content {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 4px;
}

.eshgh-product-title {
    font-size: 13.5px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.eshgh-product-title a {
    color: #2c2c2c;
    text-decoration: none;
    transition: color 0.25s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.eshgh-product-title a:hover {
    color: #2271b1;
}

.eshgh-product-price {
    font-size: 14px;
    font-weight: 700;
    color: #2271b1;
    margin: 2px 0 4px;
}

.eshgh-product-price del {
    color: #999;
    font-size: 12px;
    font-weight: 400;
}

.eshgh-product-price ins {
    text-decoration: none;
}

.eshgh-product-button-wrap {
    margin-top: auto;
    padding-top: 4px;
}

.eshgh-product-button {
    display: block;
    padding: 7px 12px;
    background: #2271b1;
    color: #fff !important;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 12.5px;
    text-align: center;
    transition: background 0.25s ease;
    border: none;
    cursor: pointer;
}

.eshgh-product-button:hover {
    background: #135e96;
}

/* ============================================
   ۶) دکمه‌های ناوبری
   ============================================ */
.eshgh-swiper-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    transition: all 0.25s ease;
    color: #333;
    border: none;
}

.eshgh-swiper-nav:hover {
    background: #2271b1;
    color: #fff;
}

.eshgh-swiper-prev {
    left: 4px;
}

.eshgh-swiper-next {
    right: 4px;
}

.eshgh-swiper-nav svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* ============================================
   ۷) نقطه‌نما (Pagination)
   ============================================ */
.eshgh-product-slider-container .swiper-pagination {
    bottom: 0 !important;
    position: relative;
    text-align: center;
    z-index: 10;
    width: 100%;
    margin-top: 10px;
    line-height: 1;
}

.eshgh-product-slider-container .swiper-pagination-bullet {
    width: 7px;
    height: 7px;
    display: inline-block;
    border-radius: 50%;
    background: #ccc;
    opacity: 0.55;
    margin: 0 3px;
}

.eshgh-product-slider-container .swiper-pagination-bullet-active {
    background: #2271b1;
    opacity: 1;
}

/* ============================================
   ۸) پیام بدون محصول
   ============================================ */
.eshgh-no-products {
    padding: 28px 18px;
    text-align: center;
    color: #666;
    background: #f8f8f8;
    border-radius: 10px;
    font-size: 14px;
}

/* ============================================
   ۹) پشتیبانی RTL
   ============================================ */
[dir="rtl"] .eshgh-swiper-prev,
.rtl .eshgh-swiper-prev {
    left: auto;
    right: 4px;
}

[dir="rtl"] .eshgh-swiper-next,
.rtl .eshgh-swiper-next {
    right: auto;
    left: 4px;
}

[dir="rtl"] .eshgh-swiper-nav svg,
.rtl .eshgh-swiper-nav svg {
    transform: rotate(180deg);
}

/* ============================================
   ۱۰) ریسپانسیو — تبلت و موبایل
   ============================================ */
@media (max-width: 991px) {
    .eshgh-product-slider-container {
        flex-direction: column;
        flex-wrap: wrap;
        --eshgh-sidebar-w: 100%;
    }

    .eshgh-sidebar-column {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        min-height: 160px;
        order: 0 !important;
        padding: 16px;
    }

    .eshgh-sidebar-image img {
        max-height: 120px;
    }

    .eshgh-swiper-prev {
        left: 6px;
    }

    .eshgh-swiper-next {
        right: 6px;
    }
}

@media (max-width: 767px) {
    .eshgh-product-title {
        font-size: 12.5px;
    }

    .eshgh-product-price {
        font-size: 13px;
    }

    .eshgh-product-content {
        padding: 8px 10px 10px;
    }

    .eshgh-product-button {
        padding: 6px 10px;
        font-size: 12px;
    }

    .eshgh-swiper-nav {
        width: 32px;
        height: 32px;
    }

    .eshgh-swiper-nav svg {
        width: 14px;
        height: 14px;
    }
}

/* ============================================
   ۱۱) ویرایشگر و پیش‌نمایش المنتور
   استاندارد: دسکتاپ ۴ | تبلت ۲ | موبایل ۱ + دکمه‌های ناوبری
   ============================================ */

/* پایه ادیتور — همیشه افقی و بدون ترنسفورم */
.elementor-editor-active .eshgh-product-slider-container,
.elementor-editor-preview .eshgh-product-slider-container {
    overflow: hidden;
    align-items: stretch;
}

.elementor-editor-active .eshgh-product-slider-container .swiper,
.elementor-editor-preview .eshgh-product-slider-container .swiper {
    overflow: hidden !important;
    position: relative !important;
    width: 100% !important;
}

.elementor-editor-active .eshgh-product-slider,
.elementor-editor-preview .eshgh-product-slider {
    overflow: hidden !important;
    width: 100% !important;
}

.elementor-editor-active .eshgh-product-slider-container .swiper-wrapper,
.elementor-editor-preview .eshgh-product-slider-container .swiper-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
    transform: none !important;
    width: 100% !important;
    gap: var(--eshgh-gap, 16px) !important;
    overflow: hidden !important;
    transition: none !important;
}

.elementor-editor-active .eshgh-product-slider-container .swiper-slide .eshgh-product-card,
.elementor-editor-preview .eshgh-product-slider-container .swiper-slide .eshgh-product-card {
    height: 100% !important;
    width: 100% !important;
}

/* نمایش دکمه‌های ناوبری در ادیتور */
.elementor-editor-active .eshgh-swiper-nav,
.elementor-editor-preview .eshgh-swiper-nav {
    display: flex !important;
    pointer-events: none;
    opacity: 0.9;
    z-index: 20;
}
.elementor-editor-active .swiper-pagination,
.elementor-editor-preview .swiper-pagination {
    display: none !important;
}

/* ---------- دسکتاپ ادیتور: ۴ اسلاید ---------- */
.elementor-editor-active .eshgh-product-slider-container .swiper-slide,
.elementor-editor-preview .eshgh-product-slider-container .swiper-slide {
    flex: 0 0 calc((100% - (var(--eshgh-slides, 4) - 1) * var(--eshgh-gap, 16px)) / var(--eshgh-slides, 4)) !important;
    max-width: calc((100% - (var(--eshgh-slides, 4) - 1) * var(--eshgh-gap, 16px)) / var(--eshgh-slides, 4)) !important;
    width: calc((100% - (var(--eshgh-slides, 4) - 1) * var(--eshgh-gap, 16px)) / var(--eshgh-slides, 4)) !important;
    margin: 0 !important;
    height: auto !important;
    display: none !important;
}

.elementor-editor-active .eshgh-product-slider-container .swiper-slide:nth-child(-n+4),
.elementor-editor-preview .eshgh-product-slider-container .swiper-slide:nth-child(-n+4) {
    display: flex !important;
}

/* احترام به data-slides دسکتاپ */
.elementor-editor-active .eshgh-product-slider-container[data-slides="1"] .swiper-slide:nth-child(n+2),
.elementor-editor-preview .eshgh-product-slider-container[data-slides="1"] .swiper-slide:nth-child(n+2) {
    display: none !important;
}
.elementor-editor-active .eshgh-product-slider-container[data-slides="2"] .swiper-slide:nth-child(n+3),
.elementor-editor-preview .eshgh-product-slider-container[data-slides="2"] .swiper-slide:nth-child(n+3) {
    display: none !important;
}
.elementor-editor-active .eshgh-product-slider-container[data-slides="3"] .swiper-slide:nth-child(n+4),
.elementor-editor-preview .eshgh-product-slider-container[data-slides="3"] .swiper-slide:nth-child(n+4) {
    display: none !important;
}

/* =========================================================
   تبلت (عرض iframe حدود ۷۶۸–۱۰۲۴) + کلاس دستگاه المنتور
   دقیقاً ۲ اسلاید
   ========================================================= */
@media (max-width: 1024px) {
    .elementor-editor-active .eshgh-product-slider-container,
    .elementor-editor-preview .eshgh-product-slider-container {
        flex-direction: column !important;
        --eshgh-slides: 2 !important;
        --eshgh-gap: 14px !important;
    }

    .elementor-editor-active .eshgh-sidebar-column,
    .elementor-editor-preview .eshgh-sidebar-column {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 auto !important;
    }

    .elementor-editor-active .eshgh-product-slider-container .swiper-wrapper,
    .elementor-editor-preview .eshgh-product-slider-container .swiper-wrapper {
        gap: 14px !important;
    }

    .elementor-editor-active .eshgh-product-slider-container .swiper-slide,
    .elementor-editor-preview .eshgh-product-slider-container .swiper-slide {
        flex: 0 0 calc((100% - 14px) / 2) !important;
        max-width: calc((100% - 14px) / 2) !important;
        width: calc((100% - 14px) / 2) !important;
        min-width: 0 !important;
        display: none !important;
    }

    .elementor-editor-active .eshgh-product-slider-container .swiper-slide:nth-child(-n+2),
    .elementor-editor-preview .eshgh-product-slider-container .swiper-slide:nth-child(-n+2) {
        display: flex !important;
    }

    .elementor-editor-active .eshgh-product-slider-container .swiper-slide:nth-child(n+3),
    .elementor-editor-preview .eshgh-product-slider-container .swiper-slide:nth-child(n+3) {
        display: none !important;
    }
}

/* کلاس دستگاه تبلت (پشتیبان) */
body.elementor-device-tablet .eshgh-product-slider-container,
html.elementor-device-tablet .eshgh-product-slider-container,
.elementor-device-tablet .eshgh-product-slider-container {
    flex-direction: column !important;
    --eshgh-slides: 2 !important;
    --eshgh-gap: 14px !important;
}
body.elementor-device-tablet .eshgh-product-slider-container .swiper-slide,
html.elementor-device-tablet .eshgh-product-slider-container .swiper-slide,
.elementor-device-tablet .eshgh-product-slider-container .swiper-slide {
    flex: 0 0 calc((100% - 14px) / 2) !important;
    max-width: calc((100% - 14px) / 2) !important;
    width: calc((100% - 14px) / 2) !important;
    display: none !important;
}
body.elementor-device-tablet .eshgh-product-slider-container .swiper-slide:nth-child(-n+2),
html.elementor-device-tablet .eshgh-product-slider-container .swiper-slide:nth-child(-n+2),
.elementor-device-tablet .eshgh-product-slider-container .swiper-slide:nth-child(-n+2) {
    display: flex !important;
}
body.elementor-device-tablet .eshgh-product-slider-container .swiper-slide:nth-child(n+3),
html.elementor-device-tablet .eshgh-product-slider-container .swiper-slide:nth-child(n+3),
.elementor-device-tablet .eshgh-product-slider-container .swiper-slide:nth-child(n+3) {
    display: none !important;
}

/* =========================================================
   موبایل (عرض iframe کمتر از ۷۶۸) + کلاس دستگاه المنتور
   دقیقاً ۱ اسلاید + دکمه‌های ناوبری
   ========================================================= */
@media (max-width: 767px) {
    .elementor-editor-active .eshgh-product-slider-container,
    .elementor-editor-preview .eshgh-product-slider-container {
        flex-direction: column !important;
        --eshgh-slides: 1 !important;
        --eshgh-gap: 10px !important;
    }

    .elementor-editor-active .eshgh-sidebar-column,
    .elementor-editor-preview .eshgh-sidebar-column {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 auto !important;
    }

    .elementor-editor-active .eshgh-product-slider-container .swiper-wrapper,
    .elementor-editor-preview .eshgh-product-slider-container .swiper-wrapper {
        gap: 10px !important;
        width: 100% !important;
    }

    .elementor-editor-active .eshgh-product-slider-container .swiper-slide,
    .elementor-editor-preview .eshgh-product-slider-container .swiper-slide {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        min-width: 100% !important;
        display: none !important;
        margin: 0 !important;
    }

    .elementor-editor-active .eshgh-product-slider-container .swiper-slide:first-child,
    .elementor-editor-preview .eshgh-product-slider-container .swiper-slide:first-child,
    .elementor-editor-active .eshgh-product-slider-container .swiper-slide:nth-child(1),
    .elementor-editor-preview .eshgh-product-slider-container .swiper-slide:nth-child(1) {
        display: flex !important;
    }

    .elementor-editor-active .eshgh-product-slider-container .swiper-slide:nth-child(n+2),
    .elementor-editor-preview .eshgh-product-slider-container .swiper-slide:nth-child(n+2) {
        display: none !important;
    }

    .elementor-editor-active .eshgh-swiper-nav,
    .elementor-editor-preview .eshgh-swiper-nav {
        display: flex !important;
        opacity: 0.95;
    }
}

/* کلاس دستگاه موبایل (پشتیبان قوی) */
body.elementor-device-mobile .eshgh-product-slider-container,
html.elementor-device-mobile .eshgh-product-slider-container,
.elementor-device-mobile .eshgh-product-slider-container,
body.elementor-editor-active.elementor-device-mobile .eshgh-product-slider-container {
    flex-direction: column !important;
    --eshgh-slides: 1 !important;
    --eshgh-gap: 10px !important;
}

body.elementor-device-mobile .eshgh-product-slider-container .swiper-wrapper,
html.elementor-device-mobile .eshgh-product-slider-container .swiper-wrapper,
.elementor-device-mobile .eshgh-product-slider-container .swiper-wrapper {
    gap: 10px !important;
    width: 100% !important;
}

body.elementor-device-mobile .eshgh-product-slider-container .swiper-slide,
html.elementor-device-mobile .eshgh-product-slider-container .swiper-slide,
.elementor-device-mobile .eshgh-product-slider-container .swiper-slide,
body.elementor-editor-active.elementor-device-mobile .eshgh-product-slider-container .swiper-slide {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    display: none !important;
    margin: 0 !important;
}

body.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:first-child,
html.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:first-child,
.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:first-child,
body.elementor-editor-active.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:first-child,
body.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:nth-child(1),
html.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:nth-child(1),
.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:nth-child(1) {
    display: flex !important;
}

body.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:nth-child(n+2),
html.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:nth-child(n+2),
.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:nth-child(n+2),
body.elementor-editor-active.elementor-device-mobile .eshgh-product-slider-container .swiper-slide:nth-child(n+2) {
    display: none !important;
}

body.elementor-device-mobile .eshgh-swiper-nav,
html.elementor-device-mobile .eshgh-swiper-nav,
.elementor-device-mobile .eshgh-swiper-nav {
    display: flex !important;
    opacity: 0.95;
}

/* موقعیت دکمه‌ها در موبایل/تبلت */
@media (max-width: 1024px) {
    .elementor-editor-active .eshgh-swiper-prev,
    .elementor-editor-preview .eshgh-swiper-prev {
        left: 6px !important;
        right: auto !important;
    }
    .elementor-editor-active .eshgh-swiper-next,
    .elementor-editor-preview .eshgh-swiper-next {
        right: 6px !important;
        left: auto !important;
    }
}

body.elementor-device-mobile .eshgh-swiper-prev,
body.elementor-device-tablet .eshgh-swiper-prev {
    left: 6px !important;
    right: auto !important;
}
body.elementor-device-mobile .eshgh-swiper-next,
body.elementor-device-tablet .eshgh-swiper-next {
    right: 6px !important;
    left: auto !important;
}

[dir="rtl"] body.elementor-device-mobile .eshgh-swiper-prev,
[dir="rtl"] body.elementor-device-tablet .eshgh-swiper-prev {
    left: auto !important;
    right: 6px !important;
}
[dir="rtl"] body.elementor-device-mobile .eshgh-swiper-next,
[dir="rtl"] body.elementor-device-tablet .eshgh-swiper-next {
    right: auto !important;
    left: 6px !important;
}
