.kz-product-carousel {
    margin: 34px 0;
    direction: rtl;
    /* --- کل سکشن برود داخل کادر --- */
    background: #F7F7F7;
    border: 1px solid #e0e0e2; /* کادر دور کل کاروسل */
    border-radius: 16px;       /* گردی لبه کادر */
    padding: 20px 0;           /* فاصله داخلی */
    /* -------------------------- */
}

.kz-carousel-title {
    position: relative;
    margin: 0 20px 24px 0; /* اضافه کردن 20px مارجین راست برای فاصله از کادر */
    padding-right: 14px;
    font-size: 22px;
    font-weight: 900;
    color: #111827;
    line-height: 1.5;
}

.kz-carousel-viewport {
    overflow: hidden;
    position: relative;
    background: transparent !important; /* این خط را اضافه یا اصلاح کن */
    border: none !important;           /* اگر بوردر دارد حذف کن */
}

.kz-carousel-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    cursor: grab;
    user-select: none;
    background: transparent !important; /* مطمئن شو که رنگ ندارد */
    padding: 4px 9.5px 0px; 
    /*padding-left: 0px;*/
}

.kz-carousel-track::-webkit-scrollbar {
    display: none;
}

.kz-carousel-track.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.kz-product-card {
    flex: 0 0 230px;
    width: 230px;
    min-height: auto;
    background: #fff;
    /* تغییر مهم: حذف سایه سنگین و جایگزینی با بوردر ظریف */
    border: 1px solid #f0f0f1; 
    border-radius: 10px; /* دیجی‌کالا معمولاً لبه‌های تیز یا خیلی کم‌گرد دارد، اگر گرد دوست داری بگذار 12px باشد */
    padding: 14px;
    padding-bottom: 0px;
    box-shadow: none; /* حذف سایه که باعث ایجاد آن باکس خاکستری می‌شد */
    transition: all 0.2s ease;
    display: flex !important;
    flex-direction: column !important;
}

/* حالت هوور برای جذابیت */
.kz-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* یک سایه بسیار بسیار نرم فقط موقع هوور */
    border-color: #e0e0e2;
}

.kz-product-carousel a,
.kz-product-carousel a:hover,
.kz-product-carousel a:focus,
.kz-product-carousel a:active {
    text-decoration: none !important;
}

/* حذف فوکوس دور لینک تصاویر در کاروسل */
.kz-product-carousel a:focus,
.kz-product-carousel a:active{
    outline: none !important;
    box-shadow: none !important;
}

.kz-product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px !important;
}

.kz-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.25s ease;
}

.kz-product-card:hover .kz-product-image img {
    transform: scale(1.04);
}

.kz-product-title {
   font-size: 15px;
   text-align: center;
   color: #3f4064;
   text-decoration: none;
   font-weight: normal;">
   padding: 0 12px !important; /* ایجاد فاصله از لبه‌ها به جای پدینگ کل کارت */
   min-height: 40px !important;
   height: 60px !important;
   overflow: hidden;
   text-align: right !important; /* دیجی‌کالا راست‌چین است */
   margin-bottom: 0px !important;
   margin-top: 7px !important;
   margin-right: auto !important;
   margin-left: auto !important;
   line-height: 1.8 !important;
}

.kz-product-title a {
    color: #1f2937;
}

.kz-product-title a:hover {
    color: #2563eb;
}

/* کانتینر اصلی قیمت و دکمه */
.kz-product-price-container {
    display: flex;
    justify-content: space-between;
    flex-direction: row; /* برای اینکه قیمت‌ها برن سمت چپ و دکمه سمت راست بمونه */
    align-items: flex-end; /* تراز شدن با پایین */
    padding: 0 12px 12px 12px;
    padding-top 5px !important;
    margin-top: 0 !important;
    margin-bottom: 5px !important;
}

/* ستون سمت راست (تخفیف و دکمه +) */
.kz-product-actions-right {
    display: flex;
    flex-direction: column-reverse;
    /* تراز کردن محتوا به سمت چپ */
    align-items: flex-end; 
    gap: 8px;
    order: 2; /* اولویت دوم در سمت چپ (در حالت RTL) */
    margin-top: -18.5px;
}

/* استایل بخش قیمت (ستون سمت چپ) */
.kz-price-wrapper {
    align-items: flex-start;
    display: flex;
    flex-direction: column; /* چیدمان عمودی قیمت‌ها */
    align-items: flex-start; /* تراز کردن محتوا به سمت چپ */
    text-align: left;
    order: 1; /* اولویت اول در سمت راست (در حالت RTL) */
    margin-top: 0px;
}

/* اصلاح ستون سمت چپ برای دکمه */
.kz-product-actions-left {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* تراز کردن قیمت خط خورده و نشان تخفیف در یک خط */
.kz-old-price-row {
    width: 100%; /* اشغال کل عرض برای تراز شدن */
    text-align: left !important;
    display: flex !important;
    justify-content: flex-start !important;
    margin-top: 2px;
}

/* استایل دکمه مثبت (+) */
.kz-add-to-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #e0e0e2;
    border-radius: 8px;
    color: #ef4056; /* رنگ قرمز دیجی‌کالایی یا هر رنگی که دوست داری */
    transition: all 0.2s ease;
    background: #fff;
    text-decoration: none !important;
}

/* مخفی کردن نوشته به سبد خرید افزوده شده */
.kz-product-carousel a.added_to_cart {
    display: none !important;
}

/* ----- */

/* ناپدید شدن + و چرخیدن (در بخش انجام عملیات) */

/* ۱. ناپدید شدن آنی و بدون تاخیر آیکون مثبت هنگام لودینگ */
.kz-product-carousel a.add_to_cart_button.loading svg {
    display: none !important;
}

/* ۲. تنظیم موقعیت دکمه در حالت لودینگ */
.kz-product-carousel a.add_to_cart_button.loading {
    position: relative;
    pointer-events: none; /* غیرفعال کردن کلیک مجدد در حین لود */
}

/* ۳. ساخت لودر چرخشی با افکت انیمیشن */
.kz-product-carousel a.add_to_cart_button.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: calc(50% - 8px);
    left: calc(50% - 8px);
    
    /* لبه‌های لودر چرخشی */
    border: 2px solid #ef4056; /* رنگ قرمز دکمه تو */
    border-top-color: transparent; /* یکی از لبه‌ها خالی باشد تا چرخش مشخص شود */
    border-radius: 50%;
    
    /* اجرای انیمیشن چرخش */
    animation: kz-spin 0.6s linear infinite;
}

/* ۴. تعریف انیمیشن چرخش ۳۶۰ درجه */
@keyframes kz-spin {
    to {
        transform: rotate(360deg);
    }
}

/* حذف کادر فوکوس (آبی یا تیره) دور دکمه هنگام کلیک */
.kz-product-carousel a.add_to_cart_button:focus,
.kz-product-carousel a.add_to_cart_button:active {
    outline: none !important;
    box-shadow: none !important;
    border-color: #ef4056 !important; /* ثابت ماندن رنگ مرز خودت */
}

/* برای اطمینان بیشتر در کروم و سافاری */
.kz-product-carousel a.add_to_cart_button::-moz-focus-inner {
    border: 0;
}

/* ----- */

/* استایل متن ناموجود */
.kz-out-of-stock{
    font-size:14px;
    font-weight:600;
    color:#ef4056;
    opacity:0.85;
}

/* هاور دکمه مثبت */
.kz-add-to-cart-btn:hover {
    background-color: #ef4056;
    color: #fff;
    border-color: #ef4056;
}

/* استایل نشان تخفیف */
.kz-product-carousel .kz-discount-badge {
    background:#e5e7eb;   /* طوسی ملایم ولی قابل دیدن */
    color:#374151;        /* طوسی تیره برای خوانایی */
    
    font-size:13px;
    font-weight:700;
    
    padding:4px 8px;
    height:18px;
    border-radius:10px;
    
    display:inline-flex;
    align-items:center;
    justify-content:center;
}

/* ۱. حذف فاصله زیر عنوان محصول */
.kz-product-carousel-item h2, 
.kz-product-carousel-item .woocommerce-loop-product__title {
    margin-bottom: 5px !important;
    padding-bottom: 0 !important;
}

/* ۲. حذف فاصله بالای کانتینر قیمت و دکمه */
.kz-product-price-container {
    margin-top: 0 !important;
    padding-top: 5px !important; /* مقدار کمی برای نچسبیدن به متن */
}

/* ۳. اگر فاصله بین عکس و عنوان هم زیاد است */
.kz-product-carousel-item img {
    margin-bottom: 10px !important;
}


    /* اگر می‌خواهی عدد و علامت درصد کمی چسبیده‌تر باشند */
.kz-discount-badge::after {
    margin-right: 1px;
}

/* قیمت اصلی (جدید) - حالا می‌آوریمش بالا */
.kz-current-price {
    order: 1; /* اولویت اول نمایش */
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    line-height: 1;
    text-align: left;
    flex-direction: row;
}

/* ۳. اطمینان از تراز بودن ردیف قیمت اصلی و تخفیف */
.kz-current-price-row {
    width: 100%;
    display: flex;
    justify-content: flex-start !important;
    align-items: center;
    gap: 8px;
}

/* ردیف قیمت قدیمی و تخفیف - می آوریمش پایین */
.kz-old-price-row {
    order: 2; /* اولویت دوم (پایین قیمت اصلی) */
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

/* استایل قیمت خط خورده */
.kz-old-price-row del {
    color: #bbb;
    font-size: 0.85rem;
    text-decoration: line-through;
}

/* خط قیمت خط خورده */
.kz-price-wrapper del {
    font-size: 12px !important;
}

/* فونت قیمت خط خورده */
.kz-price-wrapper del .woocommerce-Price-amount,
.kz-price-wrapper del .woocommerce-Price-currencySymbol {
    font-size: 12px !important;
}

/* برای محصولاتی که تخفیف ندارند */
.kz-price-wrapper > .amount {
    font-size: 10px;
    font-weight: 800;
    color: #111827;
}

/* کوچک کردن واحد تومان */
.kz-product-carousel .woocommerce-Price-currencySymbol {
    font-size: 12px;
    font-weight: 400;
    margin-right: 2px;
}

/* ===== کد مخصوص کارت مشاهده همه ===== */

/* خودِ کارت */
.kz-view-all-card {
    background: #ffffff !important;
    border-left: none !important; /* حذف خط جداکننده برای آخرین آیتم */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* لینک داخلی کارت */
.kz-view-all-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
    transition: all 0.3s ease;
}

/* دایره آیکون - مدرن و جذاب */
/* ۱. تنظیمات اولیه آیکون */
.kz-view-all-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f0f0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    border: 1px solid #e0e0e2;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.kz-view-all-icon svg {
    width: 26px;
    height: 26px;
    stroke: #4b5563; /* رنگ خاکستری تیره در حالت عادی */
    stroke-width: 2.5;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* تغییر رنگ کارت در هوور */
.kz-view-all-card:hover {
    background: #f3f4f6 !important;
}

/* دایره آیکون */
.kz-view-all-card:hover .kz-view-all-icon {
    background: #6b7280;
    border-color: #6b7280;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

/* رنگ فلش */
.kz-view-all-card:hover .kz-view-all-icon svg {
    stroke: #ffffff;
}

/* رنگ متن */
.kz-view-all-card:hover strong {
    color: #6b7280;
}

@keyframes arrowSlide {
    0% { transform: translateX(0); opacity: 1; }
    40% { transform: translateX(-30px); opacity: 0; }
    41% { transform: translateX(30px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@media (max-width: 768px) {
    .kz-product-card {
        flex-basis: 190px;
        width: 190px;
    }

    .kz-carousel-title {
        font-size: 18px;
    }

    .kz-carousel-btn {
        width: 38px;
        height: 38px;
    }
}

/* ===== کد مخصوص متن مشاهده همه ===== */

.kz-header-view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;

    color: #3f3f46; /* خاکستری تیره */
    font-size: 14px;
    font-weight: 600;
    position: relative;

    transition: color 0.25s ease;
}

/* underline مخفی */
.kz-header-view-all::after {
    content: "";
    position: absolute;
    bottom: -3px;
    right: 0;
    width: 0;
    height: 2px;
    background: #3f3f46;
    border-radius: 2px;

    transition: width 0.25s ease;
}

/* فلش */
.kz-header-view-all-arrow {
    width: 18px;
    height: 18px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

    transition: transform 0.25s ease;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E");
}

/* hover */
.kz-header-view-all:hover {
    color: #111827;
}

.kz-header-view-all:hover::after {
    width: 100%;
}

.kz-header-view-all:hover .kz-header-view-all-arrow {
    transform: translateX(-4px);
}

/* ===== کد مخصوص دکمه ها ===== */
.kz-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50% !important; /* اجبار به دایره بودن */
    border: 1px solid #f0f0f1 !important;
    background-color: #ffffff !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
    cursor: pointer;
    z-index: 99;
    padding: 0 !important;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;

    /* --- حذف کامل رنگ آبی و هاله در تمام مرورگرها --- */
    outline: none !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08) !important; /* سایه جایگزین هاله */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    -webkit-tap-highlight-color: transparent !important; /* حذف رنگ آبی موقع لمس در موبایل */
    user-select: none !important;
}

/* فلش‌ها با رنگ خاکستری ثابت */
.kz-carousel-left {
    left: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2381858b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

.kz-carousel-right {
    right: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2381858b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

/* حالت هوور (بدون تغییر رنگ، فقط سایه) */
.kz-carousel-btn:hover {
    background-color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16) !important;
    transform: translateY(-50%) scale(1.05) !important;
}

/* حالت کلیک (Active) و فوکوس - تیر خلاص به رنگ آبی */
.kz-carousel-btn:active, 
.kz-carousel-btn:focus, 
.kz-carousel-btn:focus-visible {
    background-color: #f7f7f7 !important; /* تغییر رنگ خیلی ملایم به جای آبی */
    outline: none !important;
    border: 1px solid #e0e0e2 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
    color: inherit !important; /* اگر متنی باشد آبی نشود */
}

/* حذف هرگونه افکت Before و After که شاید قالب اضافه کرده باشد */
.kz-carousel-btn::before, 
.kz-carousel-btn::after {
    display: none !important;
}

.kz-carousel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* کمی فاصله گرفتن از کارت های محصول وقتی از دکمه استفاده میشه */
.kz-product-card,
.kz-view-all-card {
    /*scroll-margin-inline: -4px;*/
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    /* ۱. چسباندن کانتینر اصلی به کناره‌های صفحه */
    .kz-product-carousel {
        margin: 20px 0 !important; /* حذف مارجین‌های جانبی و حفظ فاصله بالا و پایین */
        border-left: none !important;  /* حذف خط دور در سمت چپ */
        border-right: none !important; /* حذف خط دور در سمت راست */
        border-radius: 0 !important;   /* صاف کردن لبه‌ها (تیز شدن) */
        width: 100vw !important;       /* اجبار به اشغال تمام عرض دریچه نمایش */
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw !important;
        margin-right: -50vw !important;
        padding: 15px 0 !important;
    }

    /* ۲. تنظیم فاصله داخلی تایتل برای اینکه به لبه نچسبد */
    .kz-carousel-title {
        margin-right: 15px !important;
        margin-left: 15px !important;
    }

    /* ۳. تنظیم کارت‌ها برای نمایش بهتر در حالت لبه‌به‌لبه */
    .kz-product-card {
        flex: 0 0 170px; /* یا همان ۱۹۰ که داشتی، بسته به سلیقه */
        width: 170px;
        border-radius: 8px !important; /* لبه کارت‌ها کمی گرد باشد قشنگ‌تر است، ولی اگر کاملاً تیز می‌خواهی 0 بگذار */
    }

    /* ۴. حذف دکمه‌های چپ و راست در موبایل (چون با دست اسکرول می‌شود) */
    .kz-carousel-btn {
        display: none !important;
    }

    /* ۵. ایجاد یک فاصله کوچک در انتهای اسکرول برای اینکه آخرین کارت نچسبد */
    .kz-carousel-track {
        padding-right: 0px !important;
        padding-left: 0px !important;
        gap: 1px !important;
        border-radius: 17px !important;
    }

    /* ۶. کوچک کردن عکس های محصولات */
    .kz-product-card {
        /* هر کارت ۶۰ درصد عرض صفحه را بگیرد */
        /* این یعنی کارت اول کامل دیده می‌شود و کارت دوم ۴۰ درصدش دیده می‌شود */
        flex: 0 0 60% !important;
        width: 60% !important;
        max-width: 150px; /* برای تبلت‌های کوچک که خیلی پهن نشود */
        border-radius: 8px !important;
    }
    
    /* ۷. بزرگتر کردن تصویر نسبت به بدنه کارت در موبایل */
    .kz-product-image {
        padding: 0px !important; /* کاهش پدینگ دور عکس */
        border-radius: 0px !important;
    }
    .kz-product-card {
        padding: 0px !important; /* کاهش پدینگ کل کارت */
        border-radius: 0px !important;
    }
    .kz-product-info {
        gap: 2px !important;
    }
    .kz-product-carousel {
        padding-right: 13px !important;
        padding-left: 13px !important;
    }
    
    /* کوچک کردن عنوان کاروسل */
    .kz-carousel-title {
        font-size: 15px !important;
        margin-right: -22px !important;
        margin-bottom: -7px !important;
    }
    
    /* تنظیم فاصله مشاهده همه */
    .kz-header-view-all {
        margin-bottom: -7px !important;
    }
    
    /* کوچک کردن عنوان محصولات */
    .kz-product-title {
        font-size: 13.5px !important;
        margin-bottom: 0px !important;
        min-height: auto !important;
        height: 50px !important;
    }
    
    /* کوچک کردن قیمت */
    .kz-product-carousel .woocommerce-Price-amount {
        font-size: 12px !important;
    }
    
    /* کوچک کردن نشان تخفیف */
    .kz-product-carousel .kz-discount-badge {
        font-size: 10px !important;
    }
    
    /* حذف تومان */
    .kz-product-carousel .woocommerce-Price-currencySymbol {
        display: none;
    }
}

