.catalog-container {
    transition: all 0.5s ease;
}

.catalog-banner-wrapper {
    display: flex;
    flex-direction: column;
    position: relative;
}

.catalog-banner-wrapper .banner {
    /* width: 100%; */
    padding: 0 6.25rem;
    display: flex;
}

.catalog-banner-wrapper .banner img {
    width: 100%;
    height: auto;
    object-fit: cover;
    height: 37.375rem;
}

.catalog-banner-wrapper  .catalog-categories-container {
    display: flex;
    /* width: 100%; */
    background-color: rgba(255, 255, 255, 0.77);
    padding: 0 6.5rem 0 6.5rem;
    height: 19.375rem;
    margin-top: auto;
    align-items: center;
    text-align: right;
    background: #F7F4F1;
    overflow: hidden;
}

.catalog-categories-container .categories-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.catalog-categories-container .categories {
    display: flex;
    padding: 0;
    margin: 35px 0 0 0;
    width: max-content;
    gap: 2rem;
    animation: scroll-categories 30s linear infinite;
}

.catalog-categories-container .categories.paused {
    animation-play-state: paused;
}

@keyframes scroll-categories {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-100% / 3));
    }
}

.catalog-categories-container .categories .category {
    height: 14.625rem;
    width: 14.625rem;
    position: relative;
    cursor: pointer;
}

.catalog-categories-container .categories .category img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.catalog-categories-container .categories .category .category-name {
    position: absolute;
    bottom: 0;
    background-color: white;
    width: 100%;
    text-align: center;
    font-size: 16px;
    color: black;
    padding: 6px 0;
    cursor: pointer;
    transition: all 0.7s ease;
}

.catalog-categories-container .categories .category.current {
    pointer-events: none;
    cursor: default;
}

.catalog-categories-container .categories .category.current .category-name {
    bottom: 40%;
    transform: translateY(-50%);
    background-color: black;
    color: white;
    cursor: default;
    text-align: center;
    pointer-events: none;
    transition: all 0.7s ease;
}

.catalog-categories-container .categories .category:hover .category-name {
    bottom: 40%;
    transform: translateY(-50%);
    background-color: black;
    color: white;
    cursor: pointer;
    text-align: center;
    transition: all 0.7s ease;
}

.catalog-categories-container h2 {
    font-size: 36px;
    font-weight: 200;
    color: #2A2A2A;
}

.catalog-products-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 6.5rem;
    direction: rtl;
    position: relative;
}

/* For larger screens, limit max columns */
@media (min-width: 1400px) {
    .catalog-products-table {
        grid-template-columns: repeat(4, 3fr);
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .catalog-products-table {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .catalog-products-table {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        padding: 1rem 0.75rem;
    }
}

.catalog-products-table .row {
    display: flex;
    margin-bottom: 2rem;
    gap: 2rem;
}

.catalog-products-table .product {
    height: auto;
    cursor: pointer;
    aspect-ratio: 1 / 1; 
    overflow: hidden;
    transition: transform 0.6s ease;
}

.catalog-products-table .product:hover {
    transform: scale(1.05);
    transition: transform 0.6s ease;
}

.catalog-products-table .product img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.catalog-products-table .preview {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    transition: opacity 0.5s ease;
    background-color: rgba(135, 115, 95, 0.74);
    justify-content: center;
    align-items: center;
    pointer-events: unset;
    cursor: default;
    z-index: 99999;
}

/* Square, scales with the viewport (was a fixed 35rem x 33rem) */
.catalog-products-table .preview > img {
    position: relative;
    width: min(75vw, 85vh);
    height: min(75vw, 85vh);
    object-fit: cover;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    cursor: default;
}

/* Navigation arrows - same look as the single-item lightbox arrows */
.catalog-products-table .preview .preview-arrows {
    position: absolute;
    top: 50%;
    left: 30px;
    right: 30px;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    direction: ltr;
    pointer-events: none;
    z-index: 100000;
}

.catalog-products-table .preview .preview-arrow-btn {
    background: none;
    border: none;
    padding: 15px;
    cursor: pointer;
    pointer-events: auto;
}

.catalog-products-table .preview .preview-arrow-btn img {
    position: static;
    width: 30px;
    height: auto;
    display: block;
    box-shadow: none;
    cursor: pointer;
}

@media (max-width: 768px) {
    .catalog-products-table .preview {
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        z-index: 99999;
        overflow: hidden;
    }

    .catalog-products-table .preview > img {
        position: absolute !important;
        width: min(85vw, 70vh) !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }

    .catalog-products-table .preview .preview-arrows {
        top: calc(50% + min(42.5vw, 35vh) + 1.25rem);
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        justify-content: center;
        gap: 3rem;
    }

    .catalog-products-table .preview .preview-arrow-btn {
        padding: 10px;
    }

    .catalog-products-table .preview .preview-arrow-btn img {
        width: 20px;
    }
}


/* Mobile Styles */
@media (max-width: 768px) {
    .catalog-container .catalog-banner-wrapper .banner {
        flex-direction: column;
        padding: 0;
    }
    
    .catalog-container .catalog-banner-wrapper .banner img {
        width: 100%;
        height: auto;
        object-fit: cover;
    }

    .catalog-container .catalog-banner-wrapper .catalog-categories-container {
        display: block;
        padding: 0 0.75rem;
        height: auto;
        overflow: hidden;
        width: 100%;
        box-sizing: border-box;
        margin-top: 2rem;
    }

    .catalog-categories-container .categories-wrapper {
        overflow: hidden;
        width: 100%;
    }

    /* Single-line auto-scrolling slider, same as desktop */
    .catalog-categories-container .categories {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.75rem;
        width: max-content;
        margin: 0;
        padding: 0 0 0.75rem 0;
        box-sizing: border-box;
        animation: scroll-categories 30s linear infinite;
    }

    .catalog-categories-container .categories .category {
        flex: 0 0 auto;
        width: 9.5rem;
        height: 9.5rem;
        position: relative;
        cursor: pointer;
        overflow: hidden;
    }

    .catalog-categories-container .categories .category .category-name {
        font-size: 14px;
    }

    .catalog-categories-container .categories .category.current .category-name {
        
    }
}
