/* dont show in desktop */
@media (min-width: 600px) {
    .kz-category-carousel {
        display: none !important;
    }
}

/* =========================
    Editor
========================= */

/* ظرف اصلی کاروسل در ادیتور */
.kz-category-carousel-editor {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--item-gap, 20px); /* خواندن مقدار زنده از استایل inline */
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    scrollbar-width: thick;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
}

/* کارت هر آیتم در ادیتور */
.kz-category-item {
    flex: 0 0 240px; /* عرض بهینه جهت جلوگیری از فشرده شدن المان‌ها */
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    background: #fff;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* دکمه تغییر تصویر */
.kz-category-item .components-button.is-secondary {
    font-size: 12px;
    margin-top: 5px;
    border-radius: 6px !important;
    background-color: #f3f4f6 !important;
    color: #222222 !important;
    border-color: #222222 !important;
}

.components-circular-option-picker__custom-clear-wrapper {
    margin-top: -17px !important;
}

/* =========================
    Frontend
========================= */
.kz-category-carousel {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    align-items: flex-start;
    scrollbar-width: none;
    
    /* استفاده از فاصله داینامیک که از سایدبار می‌آید */
    gap: var(--item-gap, 15px); 
    padding: 10px 0;
    margin: 0 !important;
}

@media (max-width: 768px) {
    .kz-category-carousel {
        margin-bottom: -10px !important;
    }
}

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

/* کارت هر آیتم */
.kz-category-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none !important;
    
    /* همگام‌سازی عرض ظرف با سایز آیکون داینامیک جهت حذف فاصله کاذب متن‌های طولانی */
    flex: 0 0 var(--icon-size, 80px); 
    width: var(--icon-size, 80px);
    max-width: var(--icon-size, 80px);
    
    -webkit-tap-highlight-color: transparent;
    outline: none;
    box-sizing: border-box;
}

/* تصویر دایره‌ای */
.kz-category-icon img {
    display: block;
    max-width: 100%;
    height: auto;
    /* سایز و Border-radius به صورت inline از سایدبار اعمال می‌شود */
    pointer-events: none; 
    margin-bottom: 8px;
}

/* متن زیر تصویر */
.kz-category-text {
    width: 100%;
    max-width: 100%;
    line-height: 1.3;
    text-align: center;
    box-sizing: border-box;
    /* رنگ و سایز فونت به صورت inline از سایدبار اعمال می‌شود */
    
    /* شکستن ایمن متن در صورت طولانی بودن */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* =========================
   Mobile Full Width Carousel
========================= */
@media (max-width: 599px) {
    
    .kz-category-carousel {
        margin-left: -20px !important;
        margin-right: -20px !important;
    }
    
    .kz-category-icon:first-child {
        margin-right: 12px !important;
    }
}

/* =========================
    Both
========================= */
/* حالت درگ فعال */
.kz-category-carousel.is-dragging,
.kz-category-carousel-editor.is-dragging {
    scroll-behavior: auto !important;
    cursor: grabbing !important;
}

/* غیرفعال کردن انتخاب متن و درگ مرورگر روی تصاویر */
.kz-category-carousel img,
.kz-category-carousel a,
.kz-category-carousel-editor img,
.kz-category-carousel-editor a {
    -webkit-user-drag: none;
    user-drag: none;
    user-select: none;
}

.kz-category-icon:last-child {
    margin-left: 5px !important;
}