/* AV Product Categories Widget */
.av-product-categories-wrapper {
    display: grid;
    gap: 20px;
    width: 100%;
    align-items: stretch;
}

.av-category-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Elegant micro-interaction on hover */
.av-category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: transparent;
}

.av-category-image-wrap {
    position: relative;
    width: 100%;
    /* Default aspect ratio 1:1, can be overridden by controls */
    padding-bottom: 100%;
    overflow: hidden;
}

.av-category-image-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.av-category-card:hover .av-category-image-wrap img {
    transform: scale(1.06);
}

.av-category-content-wrap {
    display: flex;
    flex-direction: column;
    padding: 15px;
    z-index: 2;
    flex-grow: 1;
}

.av-category-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a3c40; /* Dark teal */
    margin: 0 0 10px 0;
    
    /* Strict 2-line clamping */
    line-height: 1.3;
    min-height: calc(1.3em * 2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: break-word;
}

.av-category-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto; /* Pushes to the bottom */
}

.av-category-count {
    font-size: 13px;
    color: #777777;
    line-height: 1;
}

.av-category-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #51858a; /* Teal */
    transition: transform 0.3s ease, color 0.3s ease;
    margin-left: 10px;
}

.av-category-card:hover .av-category-arrow {
    transform: scale(1.3) translateX(2px);
    color: #1a3c40;
}

/* Mobile Carousel (under 768px typically for Elementor tablet/mobile) */
@media (max-width: 767px) {
    .av-product-categories-wrapper {
        display: flex !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
        
        /* Edge spacing logic: let the wrapper touch edges, pad inside */
        scrollbar-width: none;
    }
    
    .av-product-categories-wrapper::-webkit-scrollbar {
        display: none;
    }
    
    /* Trailing right padding to ensure last item can scroll into view fully */
    .av-product-categories-wrapper::after {
        content: "";
        flex: 0 0 1px;
    }
    
    .av-category-card {
        flex: 0 0 clamp(250px, 82vw, 320px);
        scroll-snap-align: start;
        /* Height reset in flex container context might be needed, but flex items stretch by default */
    }
}
