/* ----------------------------------------------------------------
    [Table of contents]

    1.  Base Widget Structure
    2.  Main Category Bar
    3.  AJAX Content Area
    4.  Sub-Categories (Level 1)
    5.  Sub-Sub-Categories (Level 2)
    6.  Products Grid
    7.  Helpers (Loader, Sticky)
    8.  Swipe Navigation Animations
-----------------------------------------------------------------*/

/* 1. Base Widget Structure */
.ccb-widget-wrapper {
    position: relative;
}

/* 2. Main Category Bar */
.elementor-widget-custom-category-bar .ccb-category-bar {
    width: 100%;
    overflow: hidden;
    cursor: grab;
    display: flex;
    align-items: center;
    transition: box-shadow 0.3s ease;
}
.elementor-widget-custom-category-bar ul.ccb-category-list {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    padding: 0 15px !important;
    margin: 0 !important;
    list-style: none !important;
    -ms-overflow-style: none;
    scrollbar-width: none;
    width: 100%;
}
.elementor-widget-custom-category-bar ul.ccb-category-list::-webkit-scrollbar { 
    display: none;
}
.elementor-widget-custom-category-bar li.ccb-category-item {
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}
.elementor-widget-custom-category-bar li.ccb-category-item a {
    display: block;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    /* NEW: Add transition for smooth active box animation */
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}
.elementor-widget-custom-category-bar li.ccb-category-item a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background-color: #000;
    transition: width 0.3s ease;
}
.elementor-widget-custom-category-bar .ccb-active-style-underline .ccb-category-item.is-active a::after {
    width: 50%;
}
/* Hide underline if box style is active */
.elementor-widget-custom-category-bar.ccb-active-style-box .ccb-category-item.is-active a::after {
    display: none;
}


/* 3. AJAX Content Area */
.elementor-widget-custom-category-bar #ccb-ajax-content-container {
    display: none;
    position: relative;
    overflow: hidden;
}
.elementor-widget-custom-category-bar #ccb-ajax-content-container.is-visible {
    display: block;
}

/* 4. Sub-Categories (Level 1) */
.elementor-widget-custom-category-bar .ccb-subcategories-wrapper { 
    overflow: hidden; 
}
.elementor-widget-custom-category-bar .ccb-subcategories-list { 
    display: flex; 
    overflow-x: auto; 
    padding: 5px 15px; 
    margin: 0; 
    -ms-overflow-style: none; 
    scrollbar-width: none; 
}
.elementor-widget-custom-category-bar .ccb-subcategories-list::-webkit-scrollbar { 
    display: none; 
}
.elementor-widget-custom-category-bar .ccb-subcategory-item { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    text-decoration: none; 
    flex-shrink: 0; 
    gap: 8px; 
    transition: background-color 0.3s, border-color 0.3s;
}
.elementor-widget-custom-category-bar .ccb-subcategory-image { 
    background-color: #eee;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}
.elementor-widget-custom-category-bar .ccb-subcategory-image img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.3s ease;
    display: block;
}
.elementor-widget-custom-category-bar .ccb-subcategory-item:hover .ccb-subcategory-image img {
    transform: scale(1.05);
}
.elementor-widget-custom-category-bar .ccb-subcategory-name { 
    text-align: center; 
    transition: color 0.3s;
}

/* 5. Sub-Sub-Categories (Level 2) */
.elementor-widget-custom-category-bar .ccb-sub-subcategories-wrapper { 
    margin: 15px 0;
}
.elementor-widget-custom-category-bar .ccb-sub-subcategories-list { 
    display: flex; 
    overflow-x: auto; 
    padding: 5px 15px; 
    margin: 0; 
    -ms-overflow-style: none; 
    scrollbar-width: none; 
}
.elementor-widget-custom-category-bar .ccb-sub-subcategories-list::-webkit-scrollbar { display: none; }
.elementor-widget-custom-category-bar .ccb-sub-subcategory-item { 
    text-decoration: none; 
    white-space: nowrap; 
    transition: all 0.3s; 
}

/* 6. Products Grid */
.elementor-widget-custom-category-bar ul.ccb-products-grid.products { 
    display: grid; 
    padding: 0; 
    margin: 0; 
    list-style: none; 
}
.elementor-widget-custom-category-bar li.ccb-product-item.product { 
    margin: 0 !important; 
    transition: all 0.3s ease;
}
.elementor-widget-custom-category-bar li.ccb-product-item.product a { 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    text-decoration: none; 
    color: inherit; 
}
.elementor-widget-custom-category-bar li.ccb-product-item.product .woocommerce-loop-product__title { 
    flex-grow: 1; 
    padding: 8px 10px; 
    margin: 0; 
}
.elementor-widget-custom-category-bar li.ccb-product-item.product .price { 
    padding: 0 10px 10px; 
}
.elementor-widget-custom-category-bar li.ccb-product-item.product img { 
    width: 100%; 
    height: auto; 
    margin-bottom: 0;
}
.elementor-widget-custom-category-bar .ccb-no-products, 
.elementor-widget-custom-category-bar .ccb-error { 
    text-align: center; 
    padding: 40px; 
    color: #777; 
}

/* 7. Helpers (Loader, Sticky) */
.elementor-widget-custom-category-bar .ccb-loader { 
    border: 4px solid #f3f3f3; 
    border-top: 4px solid #3498db; 
    border-radius: 50%; 
    width: 40px; 
    height: 40px; 
    animation: ccb-spin 1s linear infinite; 
    margin: 40px auto; 
}
@keyframes ccb-spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}
.elementor-widget-custom-category-bar .ccb-category-bar.is-sticky { 
    position: fixed; 
    left: 0; 
    right: 0; 
    z-index: 999; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    animation: ccbSlideDown 0.3s ease-out; 
}
@keyframes ccbSlideDown { 
    from { transform: translateY(-100%); } 
    to { transform: translateY(0); } 
}
.elementor-widget-custom-category-bar .ccb-sticky-wrapper { 
    min-height: 20px; 
}

/* 8. Swipe Navigation Animations */
.ccb-content-slider {
    width: 100%;
}
.ccb-content-slider.is-sliding-out-left {
    animation: slideOutLeft 0.3s ease-in-out forwards;
}
.ccb-content-slider.is-sliding-out-right {
    animation: slideOutRight 0.3s ease-in-out forwards;
}
@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-50px); opacity: 0; }
}
@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(50px); opacity: 0; }
}
