/**
 * Categories Section Styles - Synchronized with Featured Products
 */

.opsim-categories-section {
    padding-top: 20px;
    padding-bottom: 30px; /* Less bottom padding because products section follows */
    background-color: var(--opsim-bg-primary);
}

.categories-header {
    text-align: center;
    margin-bottom: 15px; /* Matched to featured-products */
}

.categories-subtitle {
    display: block;
    font-size: 13px; /* Matched */
    color: var(--opsim-brand);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 5px;
}

.categories-main-title {
    font-family: 'MuseoModerno', var(--opsim-font-secondary);
    font-size: var(--cats-title-size, 32px);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    color: var(--opsim-brand);
    display: inline-block;
    position: relative;
    padding: 0 80px;
}

.categories-main-title::before,
.categories-main-title::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 60px;
    height: 1px;
    background: var(--opsim-brand);
}

.categories-main-title::before { left: 0; }
.categories-main-title::after { right: 0; }

/* Carousel Grid Layout */
.categories-carousel-wrapper {
    position: relative;
    width: 100%;
    padding: 0 10px;
}

.categories-grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 15px;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding: 10px 5px 20px 5px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categories-grid::-webkit-scrollbar {
    display: none;
}

.opsim-categories-section .category-card {
    flex: 0 0 140px;
    display: block;
    text-decoration: none;
    border: 1px solid var(--opsim-border, rgba(0, 0, 0, 0.08));
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    scroll-snap-align: start;
}

@media (min-width: 1024px) {
    /* Cards sizing to fit exactly 5 items on desktop with 30px gaps */
    .opsim-categories-section:not(.style-type2) .category-card {
        flex: 0 0 calc((100% - 4 * 30px) / 5) !important;
        width: calc((100% - 4 * 30px) / 5) !important;
        flex-shrink: 0 !important;
        max-width: calc((100% - 4 * 30px) / 5) !important;
    }
}

/* Carousel Navigation Arrows */
.categories-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.categories-carousel-btn svg {
    width: 28px;
    height: 28px;
    fill: var(--opsim-brand);
    display: block;
}

.categories-carousel-prev {
    left: 0;
}

.categories-carousel-next {
    right: 0;
}

.categories-carousel-btn.is-disabled {
    cursor: default;
    pointer-events: none;
}

.categories-carousel-btn.is-disabled svg {
    opacity: 1; /* Keep full opacity always as requested by the user */
}

@media (max-width: 1023px) {
    .categories-carousel-btn {
        display: none;
    }
}

@media (min-width: 1024px) {
    /* For has-carousel state (more than 5 categories): */
    .opsim-categories-section.has-carousel .categories-carousel-wrapper {
        padding: 0 80px; /* room for arrows on left and right, placing them completely outside cards */
    }

    .opsim-categories-section.has-carousel .categories-grid {
        gap: 30px;
        padding: 10px 0 20px 0;
        overflow: hidden;
        justify-content: flex-start;
    }

    .opsim-categories-section.has-carousel .categories-carousel-btn {
        display: flex;
        opacity: 1;
        visibility: visible;
    }

    /* For no-carousel state (5 or fewer categories): */
    .opsim-categories-section.no-carousel .categories-carousel-wrapper {
        padding: 0;
    }

    .opsim-categories-section.no-carousel .categories-grid {
        gap: 30px;
        padding: 10px 0 20px 0;
        overflow: visible;
        justify-content: center; /* center the cards neatly */
    }

    .opsim-categories-section.no-carousel .categories-carousel-btn {
        display: none !important;
    }

    .opsim-categories-section.style-type2 .categories-carousel-btn {
        display: none !important;
    }

    .categories-carousel-prev {
        left: 20px;
    }

    .categories-carousel-next {
        right: 20px;
    }
}

.category-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #fdfdfd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    padding: 0;
}

.category-title-box {
    background-color: var(--opsim-brand);
    color: #fff;
    padding: 0 6px;
    text-align: center;
    height: 28px;
}

.category-title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 15px;
    font-weight: 500;
    margin: 0;
    text-transform: none;
    letter-spacing: 0.01em;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
}

@media (min-width: 1024px) {
    .category-title {
        font-size: 20px;
    }
}

/* Responsive & Mobile tweaks */
@media (max-width: 768px) {
    .opsim-categories-section {
        padding-top: 10px;
        padding-bottom: 20px;
    }
    
    .categories-main-title {
        font-size: var(--cats-title-size-mobile, 16px);
        padding: 0 50px;
    }
    .categories-main-title::before,
    .categories-main-title::after {
        width: 40px;
    }

    .categories-carousel-wrapper {
        padding: 0; /* Full width for carousel */
    }

    .categories-grid {
        padding: 10px 15px 20px 15px;
    }

    .opsim-categories-section .category-card {
        flex: 0 0 var(--cats-size-mobile);
    }
}

/* ==========================================================================
   Style Type 2: Modern Circles
   ========================================================================== */

.opsim-categories-section.style-type2 .categories-grid {
    gap: 15px;
    padding-top: 10px;
}

.opsim-categories-section.style-type2 .category-card {
    flex: 0 0 110px;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
    text-align: center;
}

.opsim-categories-section.style-type2 .category-image-wrapper {
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.05);
    padding: 3px; /* Gap between border and image */
    background: #fff;
    margin-bottom: 12px;
}

.opsim-categories-section.style-type2 .category-image-wrapper img {
    border-radius: 50%;
}


.opsim-categories-section.style-type2 .category-title-box {
    background: transparent;
    color: var(--opsim-text-primary);
    height: auto;
    padding: 0;
    margin: 0;
}

.opsim-categories-section.style-type2 .category-title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--opsim-text-primary);
    line-height: 1.3;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-transform: none;
    letter-spacing: 0;
}

@media (min-width: 1024px) {
    .opsim-categories-section.style-type2 .categories-grid {
        flex-wrap: wrap;
        justify-content: center;
        gap: 30px;
        padding: 20px 0;
        overflow-x: visible;
        scroll-snap-type: none;
    }
    
    .opsim-categories-section.style-type2 .category-card {
        flex: 0 0 var(--cats-size-desktop);
        width: var(--cats-size-desktop);
    }

    .opsim-categories-section.style-type2 .category-title {
        font-size: 20px;
    }
    
}

@media (max-width: 768px) {
    .opsim-categories-section.style-type2 .categories-grid {
        padding: 10px 20px 25px 20px;
        gap: 15px;
    }

    .opsim-categories-section.style-type2 .category-card {
        flex: 0 0 var(--cats-size-mobile);
    }

    .opsim-categories-section.style-type2 .category-title {
        font-size: 14px;
    }
    
    .opsim-categories-section.style-type2 .category-image-wrapper {
        margin-bottom: 8px;
    }
}

/* ==========================================================================
   Style Hybrid: Raw Image + Title (No borders, no shapes, no cropping)
   ========================================================================== */

.opsim-categories-section.style-hybrid .category-card {
    flex: 0 0 var(--cats-size-desktop, 200px);
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    scroll-snap-align: start;
}

.opsim-categories-section.style-hybrid .category-image-wrapper {
    display: block;
    width: 100%;
    aspect-ratio: auto;
    overflow: visible;
    background: transparent;
    padding: 0;
    margin-bottom: 10px;
    border: none;
    border-radius: 0;
}

.opsim-categories-section.style-hybrid .category-image-wrapper img {
    object-fit: contain;
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
}

.opsim-categories-section.style-hybrid .category-title-box {
    background: transparent;
    color: var(--opsim-text-primary);
    height: auto;
    padding: 0;
}

.opsim-categories-section.style-hybrid .category-title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--opsim-text-primary);
    line-height: 1.3;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: block;
    text-transform: none;
    letter-spacing: 0;
    text-align: center;
}

@media (min-width: 1024px) {
    .opsim-categories-section.style-hybrid .category-card {
        flex: 0 0 calc((100% - 4 * 30px) / 5) !important;
        width: calc((100% - 4 * 30px) / 5) !important;
        flex-shrink: 0 !important;
        max-width: calc((100% - 4 * 30px) / 5) !important;
    }

    .opsim-categories-section.style-hybrid .category-title {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .opsim-categories-section.style-hybrid .category-card {
        flex: 0 0 var(--cats-size-mobile, 160px);
    }

    .opsim-categories-section.style-hybrid .category-image-wrapper {
        margin-bottom: 8px;
    }

    .opsim-categories-section.style-hybrid .category-title {
        font-size: 14px;
    }
}

