/**
 * 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: var(--opsim-font-secondary);
    font-size: 22px; /* Matched */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    color: var(--opsim-text-primary);
    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; }

/* Grid Layout - Professional Fluid Design */
.categories-grid-wrapper {
    width: 100%;
    padding: 0 10px;
}

.categories-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

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

@media (min-width: 1024px) {
    .categories-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
    }
    
    .opsim-categories-section .category-card {
        flex: 0 0 var(--cats-size-desktop);
        width: var(--cats-size-desktop);
    }
}

.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-size: 10px;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 28px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
}

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

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

    /* Carousel on Mobile */
    .categories-grid {
        display: flex;
        flex-wrap: nowrap; /* Force horizontal layout */
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling for iOS */
        scroll-snap-type: x mandatory;
        gap: 10px;
        padding: 10px 15px 20px 15px; /* Added side padding for items */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .categories-grid::-webkit-scrollbar {
        display: none;
    }

    .opsim-categories-section .category-card {
        flex: 0 0 var(--cats-size-mobile); /* Dynamic size on mobile */
        scroll-snap-align: start;
    }
}

/* ==========================================================================
   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-size: 11px;
    font-weight: 600;
    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 {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 30px;
        padding: 20px 0;
    }
    
    .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: 12px;
    }
}

@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: 10px;
    }
    
    .opsim-categories-section.style-type2 .category-image-wrapper {
        margin-bottom: 8px;
    }
}

