/**
 * EcomTrix Pro — Carousel / Slider
 *
 * Pure CSS scroll-snap carousel with JS navigation arrows.
 * No external dependencies. WP.org compliant.
 */

/* ─────────────── Carousel Container ─────────────── */
.ecomtrix-carousel {
    position: relative;
    overflow: hidden;
}

/* ─────────────── Carousel Track (scroll-snap) ─────────────── */
.ecomtrix-carousel-track {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 20px;
    padding-bottom: 8px;
    scrollbar-width: none; /* Firefox */
}

.ecomtrix-carousel-track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* ─────────────── Carousel Slides ─────────────── */
.ecomtrix-carousel-slide {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

/* Category carousel cards — fixed sizes */
.ecomtrix-category-carousel .ecomtrix-carousel-slide {
    width: 240px;
    min-width: 240px;
}

/* Category card image — fixed height */
.ecomtrix-category-card-img img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.ecomtrix-category-card-img {
    margin-bottom: 0 !important;
    overflow: hidden;
}

/* Testimonial carousel cards — fixed sizes */
.ecomtrix-testimonial-carousel .ecomtrix-carousel-slide {
    width: 360px;
    min-width: 320px;
}

/* Blog carousel cards — fixed sizes */
.ecomtrix-blog-carousel .wp-block-post-template {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 20px;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.ecomtrix-blog-carousel .wp-block-post-template::-webkit-scrollbar {
    display: none;
}

.ecomtrix-blog-carousel .wp-block-post {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 340px;
    min-width: 300px;
}

/* Blog card image — fixed height */
.ecomtrix-blog-card-img img,
.ecomtrix-blog-card .wp-block-post-featured-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.ecomtrix-blog-card .wp-block-post-featured-image {
    margin-bottom: 0 !important;
    overflow: hidden;
}

/* Blog card content — fixed height for consistency */
.ecomtrix-blog-card-content {
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.ecomtrix-blog-card-content .wp-block-post-excerpt {
    flex: 1;
}

/* Product carousel — make WooCommerce product collection scroll */
.ecomtrix-carousel .wp-block-woocommerce-product-collection .wp-block-post-template,
.ecomtrix-carousel .wc-block-product-template {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 20px;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.ecomtrix-carousel .wp-block-woocommerce-product-collection .wp-block-post-template::-webkit-scrollbar,
.ecomtrix-carousel .wc-block-product-template::-webkit-scrollbar {
    display: none;
}

.ecomtrix-carousel .wp-block-woocommerce-product-collection .wp-block-post,
.ecomtrix-carousel .wc-block-product-template > li {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 220px;
    min-width: 200px;
}

/* Product card image — fixed height */
.ecomtrix-product-card .wc-block-components-product-image img,
.ecomtrix-product-card .wp-block-woocommerce-product-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

/* ─────────────── Carousel Navigation Arrows ─────────────── */
.ecomtrix-carousel-nav {
    display: flex;
    gap: 8px;
}

.ecomtrix-carousel-prev,
.ecomtrix-carousel-next {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--wp--preset--color--surface, #f9fafb);
    border: 1px solid var(--wp--preset--color--border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1;
    margin: 0;
}

.ecomtrix-carousel-prev:hover,
.ecomtrix-carousel-next:hover {
    background: var(--wp--preset--color--primary, #111827);
    color: #fff;
    border-color: var(--wp--preset--color--primary, #111827);
}

/* ─────────────── Overlay Arrows (--arrows modifier) ─────────────── */
.ecomtrix-carousel--arrows {
    position: relative;
}

.ecomtrix-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--wp--preset--color--border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 0;
    line-height: 1;
    color: var(--wp--preset--color--primary, #111827);
}

.ecomtrix-carousel-arrow--prev {
    left: -6px;
}

.ecomtrix-carousel-arrow--next {
    right: -6px;
}

.ecomtrix-carousel-arrow:hover {
    background: var(--wp--preset--color--primary, #111827);
    color: #fff;
    border-color: var(--wp--preset--color--primary, #111827);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.ecomtrix-carousel-arrow svg {
    display: block;
}


/* ─────────────── Hero Row: Category Sidebar + Banners ─────────────── */
.ecomtrix-hero-row {
    min-height: 520px;
}

.ecomtrix-category-sidebar {
    border-right: 1px solid var(--wp--preset--color--border-light, #f3f4f6);
}

/* Category nav items in sidebar */
.ecomtrix-category-nav .wp-block-navigation-item {
    width: 100%;
}

.ecomtrix-category-nav .wp-block-navigation-item__content {
    display: block;
    padding: 8px 16px;
    color: var(--wp--preset--color--text-light, #6b7280);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    font-size: 0.8125rem;
}

.ecomtrix-category-nav .wp-block-navigation-item__content:hover {
    background: var(--wp--preset--color--surface, #f9fafb);
    color: var(--wp--preset--color--primary, #111827);
    border-left-color: var(--wp--preset--color--primary, #111827);
}

/* Banner hover effects */
.ecomtrix-main-banner,
.ecomtrix-sub-banner {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.ecomtrix-main-banner:hover,
.ecomtrix-sub-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* Category block hover */
.ecomtrix-category-block {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.ecomtrix-category-block:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
}


/* ─────────────── RESPONSIVE ─────────────── */

/* Tablet */
@media (max-width: 1024px) {
    /* Hero row: stack on tablet */
    .ecomtrix-hero-row {
        flex-direction: column !important;
        min-height: auto;
    }

    .ecomtrix-category-sidebar {
        flex-basis: auto !important;
        border-right: none;
        border-bottom: 1px solid var(--wp--preset--color--border-light, #f3f4f6);
    }

    .ecomtrix-category-nav {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0;
    }

    .ecomtrix-category-nav .wp-block-navigation__container {
        display: flex !important;
        flex-wrap: wrap !important;
        flex-direction: row !important;
    }

    .ecomtrix-category-nav .wp-block-navigation-item__content {
        padding: 8px 16px;
        border-bottom: none;
        border-right: 1px solid var(--wp--preset--color--border-light, #f3f4f6);
        font-size: 0.85rem;
    }

    .ecomtrix-category-nav .wp-block-navigation-item__content:hover {
        padding-left: 16px;
    }

    /* Carousel slide sizes on tablet */
    .ecomtrix-category-carousel .ecomtrix-carousel-slide {
        width: 200px;
        min-width: 200px;
    }

    .ecomtrix-testimonial-carousel .ecomtrix-carousel-slide {
        width: 320px;
        min-width: 280px;
    }

    .ecomtrix-blog-carousel .wp-block-post {
        width: 300px;
        min-width: 270px;
    }

    .ecomtrix-carousel .wp-block-woocommerce-product-collection .wp-block-post,
    .ecomtrix-carousel .wc-block-product-template > li {
        width: 200px;
        min-width: 180px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* Top bar responsive */
    .ecomtrix-topbar .wp-block-group {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 4px;
    }

    /* Header responsive */
    .ecomtrix-main-header .wp-block-group {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 12px;
    }

    .ecomtrix-header-actions {
        order: 3;
        flex-basis: 100%;
        justify-content: center !important;
    }

    .ecomtrix-header-actions .wp-block-search {
        flex: 1;
        max-width: 100%;
    }

    .ecomtrix-header-actions .wp-block-search input {
        width: 100% !important;
    }

    /* Sub banners stack on mobile */
    .ecomtrix-sub-banner {
        min-height: 140px !important;
    }

    .ecomtrix-main-banner {
        min-height: 220px !important;
    }

    /* Carousel slide sizes on mobile */
    .ecomtrix-category-carousel .ecomtrix-carousel-slide {
        width: 180px;
        min-width: 160px;
    }

    .ecomtrix-category-card-img img {
        height: 150px;
    }

    .ecomtrix-testimonial-carousel .ecomtrix-carousel-slide {
        width: 280px;
        min-width: 260px;
    }

    .ecomtrix-blog-carousel .wp-block-post {
        width: 280px;
        min-width: 260px;
    }

    .ecomtrix-blog-card-img img,
    .ecomtrix-blog-card .wp-block-post-featured-image img {
        height: 160px;
    }

    .ecomtrix-carousel .wp-block-woocommerce-product-collection .wp-block-post,
    .ecomtrix-carousel .wc-block-product-template > li {
        width: 220px;
        min-width: 200px;
    }

    .ecomtrix-product-card .wc-block-components-product-image img,
    .ecomtrix-product-card .wp-block-woocommerce-product-image img {
        height: 200px;
    }

    /* Category blocks responsive */
    .ecomtrix-category-block {
        min-height: 200px !important;
    }

    /* Navigation arrows smaller on mobile */
    .ecomtrix-carousel-prev,
    .ecomtrix-carousel-next {
        width: 36px;
        height: 36px;
    }

    .ecomtrix-carousel-arrow {
        width: 36px;
        height: 36px;
    }

    .ecomtrix-carousel-arrow--prev {
        left: 4px;
    }

    .ecomtrix-carousel-arrow--next {
        right: 4px;
    }

    .ecomtrix-carousel-arrow svg {
        width: 16px;
        height: 16px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .ecomtrix-category-carousel .ecomtrix-carousel-slide {
        width: 160px;
        min-width: 150px;
    }

    .ecomtrix-category-card-img img {
        height: 130px;
    }

    .ecomtrix-testimonial-carousel .ecomtrix-carousel-slide {
        width: 260px;
        min-width: 240px;
    }

    .ecomtrix-blog-carousel .wp-block-post {
        width: 260px;
        min-width: 240px;
    }

    .ecomtrix-blog-card-img img,
    .ecomtrix-blog-card .wp-block-post-featured-image img {
        height: 140px;
    }

    .ecomtrix-carousel .wp-block-woocommerce-product-collection .wp-block-post,
    .ecomtrix-carousel .wc-block-product-template > li {
        width: 200px;
        min-width: 180px;
    }

    .ecomtrix-product-card .wc-block-components-product-image img,
    .ecomtrix-product-card .wp-block-woocommerce-product-image img {
        height: 180px;
    }

    .ecomtrix-main-banner {
        min-height: 180px !important;
    }

    .ecomtrix-sub-banner {
        min-height: 120px !important;
    }
}
