.loom-woo-categories-section {
    padding: 30px 0;
    max-width: 100%;
    margin-bottom: 30px;
    overflow-x: hidden;
}

/* Remove custom fluid width and use standard boxed container */
.loom-cat-layout-wrapper {
    /* Standard theme container properties inherited from .container */
    margin: 0 auto;
}

.loom-woo-categories-section .section-header {
    text-align: center;
    margin-bottom: 40px;
}

.loom-woo-categories-section .section-title {
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 700;
    color: #111;
}

.loom-woo-categories-section .section-subtitle {
    font-size: 14px;
    color: #666;
    font-weight: 400;
}

.loom-cat-grid {
    display: grid;
    grid-template-columns: repeat(var(--cat-per-row-desktop, 6), 1fr);
    gap: 15px; 
    justify-items: center;
    align-items: start;
    width: 100%;
}

.loom-cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
}

.loom-cat-card:hover {
    filter: brightness(0.95);
}

.loom-cat-card .cat-image-wrapper {
    width: 100%; 
    max-width: var(--cat-size-desktop, 220px); 
    aspect-ratio: 1 / 1;
    height: auto;
    overflow: hidden;
    margin-bottom: 15px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-sizing: border-box;
    position: relative;
}

.loom-cat-card .cat-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Styles & Inherited Border Radius */
.loom-cat-grid.style-circle .cat-image-wrapper,
.loom-cat-grid.style-circle .cat-image-wrapper img {
    border-radius: 50% !important;
}

.loom-cat-grid.style-rounded-square .cat-image-wrapper,
.loom-cat-grid.style-rounded-square .cat-image-wrapper img {
    border-radius: 12px !important;
}

.loom-cat-grid.style-square .cat-image-wrapper,
.loom-cat-grid.style-square .cat-image-wrapper img {
    border-radius: 0 !important;
}

/* Red Border - 1px */
.loom-cat-grid.has-red-border .cat-image-wrapper {
    border: 1px solid var(--brand-primary) !important;
}

.loom-cat-card .cat-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: #111;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    max-height: 2.4em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Responsive & Carousel */
@media (max-width: 767px) {
    .loom-woo-categories-section {
        padding: 20px 0;
    }

    .loom-cat-layout-wrapper {
        padding: 0 10px;
    }

    .loom-woo-categories-section .section-title {
        font-size: 20px;
    }

    .loom-woo-categories-section .section-subtitle {
        font-size: 11px;
    }

    .loom-cat-grid {
        grid-template-columns: repeat(var(--cat-per-row-mobile, 2), 1fr);
        gap: 15px;
    }

    .loom-cat-grid.mobile-carousel {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start !important;
        scrollbar-width: none;
        padding: 5px 0;
        gap: 15px;
    }

    .loom-cat-grid.mobile-carousel .loom-cat-card {
        flex: 0 0 calc((100% / var(--cat-per-row-mobile, 2)) - 15px) !important;
        scroll-snap-align: center;
    }

    .loom-cat-card .cat-image-wrapper {
        max-width: var(--cat-size-mobile, 160px);
    }

    .loom-cat-card .cat-name {
        font-size: 11px;
    }
}

/* Style 4: Modern Overlay */
.loom-cat-grid.style-modern-card {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px;
    justify-items: stretch;
}

.loom-cat-grid.style-modern-card.has-red-border .loom-cat-card {
    border: 1px solid var(--brand-primary) !important;
    box-sizing: border-box;
}

.loom-cat-grid.style-modern-card.has-red-border .cat-image-wrapper {
    border: none !important;
}

.loom-cat-grid.style-modern-card .loom-cat-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 4 / 5.5; 
    background: #000;
    transition: none !important;
    transform: none !important;
}

.loom-cat-grid.style-modern-card .cat-image-wrapper {
    max-width: none;
    margin-bottom: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.loom-cat-grid.style-modern-card .cat-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    transition: none !important;
    display: block;
}

.loom-cat-grid.style-modern-card .loom-cat-card:hover .cat-image-wrapper img {
    opacity: 0.9;
}

.loom-cat-grid.style-modern-card .cat-overlay-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 40px 20px 30px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0) 100%);
    color: #fff;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 70%;
    z-index: 2;
}

.loom-cat-grid.style-modern-card .cat-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 6px 0;
    line-height: 1.1;
    color: #fff;
}

.loom-cat-grid.style-modern-card .cat-desc {
    font-size: 11px;
    opacity: 0.85;
    line-height: 1.4;
    margin-bottom: 15px;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loom-cat-grid.style-modern-card .cat-desc p {
    margin: 0;
}

.loom-cat-grid.style-modern-card .cat-shop-now {
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.3s ease;
    color: #fff;
    width: 100%;
}

.loom-cat-grid.style-modern-card .cat-shop-now svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.loom-cat-grid.style-modern-card .loom-cat-card:hover .cat-shop-now svg {
    transform: translateX(4px);
}

@media (max-width: 767px) {
    .loom-cat-grid.style-modern-card.mobile-carousel .loom-cat-card {
        flex: 0 0 calc(75% - 15px) !important;
        scroll-snap-align: start;
        aspect-ratio: 4 / 6;
        transition: none !important;
    }
    
    .loom-cat-grid.style-modern-card .cat-overlay-content {
        padding: 25px 12px 15px;
    }

    .loom-cat-grid.style-modern-card .cat-title {
        font-size: 16px;
    }
    
    .loom-cat-grid.style-modern-card .cat-desc {
        font-size: 9px;
        margin-bottom: 10px;
    }
    
    .loom-cat-grid.style-modern-card .cat-shop-now {
        font-size: 10px;
    }
}
