/* WC Carousel Manager v1.4.0 — Public Styles
   All rules scoped under .wccm-carousel-wrap to prevent ANY leakage
   into WooCommerce shop loop or Page Builder layouts               */

/* ── Scoped reset ────────────────────────────────────────────────────────── */
.wccm-carousel-wrap,
.wccm-carousel-wrap * ,
.wccm-carousel-wrap *::before,
.wccm-carousel-wrap *::after {
    box-sizing: border-box;
}

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.wccm-carousel-wrap {
    position: relative;
    width: 100%;
    padding: 32px 0 16px;
    overflow: visible;          /* let arrows poke out */
    /* reset anything the page theme may inject */
    float: none;
    clear: both;
}

/* ── Swiper: strict containment — THE main bug fix ───────────────────────── */
.wccm-carousel-wrap .wccm-swiper {
    position: relative;         /* override any absolute from theme */
    width: 100%;
    height: auto !important;    /* kill Swiper's 100% height that causes black block */
    min-height: 0 !important;
    overflow: hidden;
    padding-bottom: 40px;       /* room for pagination */
    margin: 0;
    display: block;
}
.wccm-carousel-wrap .swiper-wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    min-height: 0;
    align-items: stretch;
    /* height is left to Swiper's autoHeight (set inline via JS) — do not force !important here,
       or the wrapper can't grow to fit tall slides (e.g. boxed cards, long titles) */
    /* DO NOT set position:relative here — Swiper needs to control it */
}
.wccm-carousel-wrap .swiper-slide {
    flex-shrink: 0;
    height: auto !important;
    min-height: 0 !important;
    /* width is set by Swiper JS — do not override */
}

/* Prevent Swiper from affecting elements OUTSIDE .wccm-carousel-wrap */
.wccm-carousel-wrap + * { clear: none; }

/* ── Header row ──────────────────────────────────────────────────────────── */
.wccm-carousel-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
}
.wccm-layout-modern .wccm-carousel-header { justify-content: space-between; }
.wccm-header-arrows { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Headings ────────────────────────────────────────────────────────────── */
.wccm-carousel-wrap .wccm-section-heading {
    font-size: clamp(18px, 5vw, 30px);
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    display: block;
    word-break: normal;
    overflow-wrap: break-word;
    max-width: 100%;
}
.wccm-layout-classic .wccm-section-heading { text-align: center; }
.wccm-layout-modern  .wccm-section-heading { text-align: left; }

.wccm-carousel-wrap .wccm-section-subheading {
    text-align: center;
    font-size: 15px;
    margin: 0 0 20px;
    line-height: 1.5;
    display: block;
}

/* ── Arrows: Classic layout (floating ± wrapper) ─────────────────────────── */
.wccm-layout-classic .wccm-nav,
.wccm-product-carousel .wccm-tab-panel > .wccm-nav,
.wccm-taxonomy-carousel .wccm-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,.10);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    transition: background .15s, color .15s, box-shadow .15s;
    padding: 0;
    line-height: 1;
}
.wccm-layout-classic .wccm-prev,
.wccm-product-carousel .wccm-tab-panel > .wccm-prev,
.wccm-taxonomy-carousel .wccm-prev { left: -22px; }

.wccm-layout-classic .wccm-next,
.wccm-product-carousel .wccm-tab-panel > .wccm-next,
.wccm-taxonomy-carousel .wccm-next { right: -22px; }

.wccm-layout-classic .wccm-nav:hover,
.wccm-product-carousel .wccm-tab-panel > .wccm-nav:hover,
.wccm-taxonomy-carousel .wccm-nav:hover {
    background: #1a1a2e;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
/* Classic: hide when at boundary */
.wccm-layout-classic .wccm-nav.is-hidden,
.wccm-product-carousel .wccm-tab-panel > .wccm-nav.is-hidden,
.wccm-taxonomy-carousel .wccm-nav.is-hidden { display: none !important; }

/* ── Arrows: Modern layout (inline top-right) ────────────────────────────── */
.wccm-layout-modern .wccm-header-arrows .wccm-nav {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    transition: background .15s, color .15s, opacity .15s;
    padding: 0;
}
.wccm-layout-modern .wccm-header-arrows .wccm-nav:hover:not(:disabled) {
    background: #1a1a2e;
    color: #fff;
}
.wccm-layout-modern .wccm-header-arrows .wccm-nav.is-disabled,
.wccm-layout-modern .wccm-header-arrows .wccm-nav:disabled {
    opacity: .3;
    cursor: default;
    pointer-events: none;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.wccm-carousel-wrap .wccm-pagination {
    position: absolute !important;
    bottom: 10px !important;
    left: 0 !important;
    width: 100% !important;
    text-align: center;
    z-index: 5;
}
.wccm-carousel-wrap .wccm-pagination .swiper-pagination-bullet {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #cbd5e1;
    opacity: 1;
    border-radius: 50%;
    margin: 0 3px !important;
    transition: background .2s, transform .2s;
    cursor: pointer;
}
.wccm-carousel-wrap .wccm-pagination .swiper-pagination-bullet-active {
    transform: scale(1.35);
    /* background via inline <style> per-instance */
}

/* ── Category card ───────────────────────────────────────────────────────── */
.wccm-carousel-wrap .wccm-cat-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}
.wccm-carousel-wrap .wccm-cat-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9; /* placeholder fallback only — cleared once a real image loads */
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.wccm-carousel-wrap .wccm-cat-img-wrap.has-image {
    background: transparent;
    border-color: transparent;
}
.wccm-carousel-wrap .wccm-cat-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}
.wccm-carousel-wrap .wccm-cat-card:hover .wccm-cat-img-wrap img,
.wccm-carousel-wrap .wccm-cat-card.is-active .wccm-cat-img-wrap img { transform: scale(1.04); }

.wccm-carousel-wrap .wccm-cat-card.is-active .wccm-cat-img-wrap {
    outline: 3px solid;
    outline-offset: 2px;
    /* color via inline CSS */
}
.wccm-carousel-wrap .wccm-active-badge {
    position: absolute;
    top: 8px; right: 8px;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    color: #fff;
    /* background via inline CSS */
}
.wccm-carousel-wrap .wccm-cat-img-placeholder {
    width: 100%;
    height: 100%;
    background: repeating-conic-gradient(#e2e8f0 0% 25%, #f8fafc 0% 50%) 0 0 / 20px 20px;
}

/* Card text — fixed-height so count always aligns at bottom */
.wccm-carousel-wrap .wccm-cat-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding-top: 10px;
}
.wccm-carousel-wrap .wccm-cat-name {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #1e293b;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
    line-height: 1.4;
}
.wccm-carousel-wrap .wccm-cat-count {
    font-size: 13px;
    color: #64748b;
    margin: auto 0 0;
    text-align: center;
    display: block;
}

/* ── Boxed card style — dark portrait card, image inset near top ────────── */
.wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed {
    background: #1a1a2e; /* overridden inline per-instance */
    border-radius: 18px;
    padding: 20px 16px 24px;
    aspect-ratio: 3 / 4.6;
    justify-content: flex-start;
}
.wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed .wccm-cat-img-wrap {
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    background: #fff; /* placeholder fallback only — cleared once a real image loads */
    border: none;
    flex: 1 1 auto;
    min-height: 0;
}
.wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed .wccm-cat-img-wrap.has-image {
    background: transparent;
}
.wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed .wccm-cat-img-wrap img {
    object-fit: contain;
    padding: 12px;
}
.wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed .wccm-cat-text {
    flex: 0 0 auto;
    padding-top: 16px;
}
.wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed .wccm-cat-name {
    color: #fff; /* overridden inline per-instance */
    font-size: 16px;
    min-height: 2.6em; /* fixed — always reserves space for 2 lines so image size stays constant */
    -webkit-line-clamp: 2;
    -webkit-box-pack: start; /* pin text to top of the reserved box, whether 1 or 2 lines */
    justify-content: flex-start;
}
.wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed .wccm-cat-count {
    color: #fff; /* overridden inline per-instance */
    opacity: .7;
    margin-top: 4px;
}
.wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed.is-active .wccm-cat-img-wrap {
    outline-offset: -2px;
}

/* ── Product carousel tabs ───────────────────────────────────────────────── */
.wccm-carousel-wrap .wccm-tab-nav {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 24px;
    justify-content: center;
}
.wccm-carousel-wrap .wccm-tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
    line-height: 1.4;
}
.wccm-carousel-wrap .wccm-tab-btn:hover { color: #1e293b; }
/* .active color via inline CSS per-instance */

.wccm-carousel-wrap .wccm-tab-panel { display: none; position: relative; }
.wccm-carousel-wrap .wccm-tab-panel.active { display: block; }
.wccm-carousel-wrap .wccm-no-products { text-align: center; color: #94a3b8; padding: 40px 0; margin: 0; }

/* ── Product card (custom) ───────────────────────────────────────────────── */
.wccm-carousel-wrap .wccm-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow .2s;
}
.wccm-carousel-wrap .wccm-product-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.09); }

.wccm-carousel-wrap .wccm-product-img-wrap {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8fafc;
    flex-shrink: 0;
    text-decoration: none;
}
.wccm-carousel-wrap .wccm-product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}
.wccm-carousel-wrap .wccm-product-card:hover .wccm-product-img-wrap img { transform: scale(1.04); }

.wccm-carousel-wrap .wccm-product-info {
    padding: 12px 14px 4px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.wccm-carousel-wrap .wccm-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
    margin: 0;
}
.wccm-carousel-wrap .wccm-product-name:hover { color: #2271b1; }

.wccm-carousel-wrap .wccm-product-footer {
    padding: 8px 14px 14px;
}
/* WC add_to_cart — native classes preserved, only wrapped style */
.wccm-carousel-wrap .wccm-product-footer .button,
.wccm-carousel-wrap .wccm-product-footer a.button,
.wccm-carousel-wrap .wccm-product-footer .add_to_cart_button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    text-align: center;
    border-radius: 6px;
    padding: 10px 12px !important;
    font-size: 13px !important;
    font-weight: 600;
    background: #1a1a2e !important;
    color: #fff !important;
    border: none !important;
    text-decoration: none;
    transition: background .15s;
    box-sizing: border-box;
    gap: 6px;
    line-height: 1.4;
}
.wccm-carousel-wrap .wccm-product-footer .button:hover,
.wccm-carousel-wrap .wccm-product-footer a.button:hover { background: #2271b1 !important; }

/* WC default design slide */
.wccm-wc-slide .product,
.wccm-wc-slide li.product {
    margin: 0 !important;
    width: 100% !important;
    float: none !important;
    padding: 0 !important;
}

/* ── Taxonomy carousel label (brand name) ────────────────────────────────── */
.wccm-carousel-wrap .wccm-term-label {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: #1e293b;
    margin: 8px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
    line-height: 1.3;
}
.wccm-carousel-wrap .wccm-term-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9; /* placeholder fallback only — cleared once a real image loads */
    border: 1px solid #e2e8f0;
}
.wccm-carousel-wrap .wccm-term-img-wrap.has-image {
    background: transparent;
    border-color: transparent;
}
.wccm-carousel-wrap .wccm-term-img-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}
.wccm-carousel-wrap .wccm-term-card:hover .wccm-term-img-wrap img { transform: scale(1.04); }
.wccm-carousel-wrap .wccm-term-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* ── Boxed card style — dark portrait card, image inset near top ────────── */
.wccm-carousel-wrap .wccm-term-card.wccm-card-boxed {
    background: #1a1a2e; /* overridden inline per-instance */
    border-radius: 18px;
    padding: 20px 16px 24px;
    aspect-ratio: 3 / 4.6;
    justify-content: flex-start;
}
.wccm-carousel-wrap .wccm-term-card.wccm-card-boxed .wccm-term-img-wrap {
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    background: #fff; /* placeholder fallback only — cleared once a real image loads */
    border: none;
    flex: 1 1 auto;
    min-height: 0;
}
.wccm-carousel-wrap .wccm-term-card.wccm-card-boxed .wccm-term-img-wrap.has-image {
    background: transparent;
}
.wccm-carousel-wrap .wccm-term-card.wccm-card-boxed .wccm-term-img-wrap img {
    object-fit: contain;
    padding: 12px;
}
.wccm-carousel-wrap .wccm-term-card.wccm-card-boxed .wccm-term-label {
    color: #fff; /* overridden inline per-instance */
    font-size: 16px;
    min-height: 2.6em; /* fixed — always reserves space for 2 lines so image size stays constant */
    padding-top: 16px;
    margin-top: 0;
    -webkit-box-pack: start; /* pin text to top of the reserved box, whether 1 or 2 lines */
    justify-content: flex-start;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .wccm-layout-classic .wccm-prev,
    .wccm-product-carousel .wccm-tab-panel > .wccm-prev,
    .wccm-taxonomy-carousel .wccm-prev { left: -10px; }

    .wccm-layout-classic .wccm-next,
    .wccm-product-carousel .wccm-tab-panel > .wccm-next,
    .wccm-taxonomy-carousel .wccm-next { right: -10px; }

    .wccm-carousel-wrap .wccm-tab-btn { padding: 8px 12px; font-size: 13px; }
    .wccm-carousel-wrap .wccm-cat-name { font-size: 13px; }
    .wccm-carousel-wrap .wccm-carousel-header { padding: 0 20px; }

    .wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed,
    .wccm-carousel-wrap .wccm-term-card.wccm-card-boxed {
        padding: 12px 10px 16px;
        border-radius: 14px;
    }
    .wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed .wccm-cat-img-wrap,
    .wccm-carousel-wrap .wccm-term-card.wccm-card-boxed .wccm-term-img-wrap {
        border-radius: 8px;
    }
    .wccm-carousel-wrap .wccm-cat-card.wccm-card-boxed .wccm-cat-name,
    .wccm-carousel-wrap .wccm-term-card.wccm-card-boxed .wccm-term-label {
        font-size: 13px;
        min-height: 2.2em;
        padding-top: 10px;
    }
}

/* ── Banner mode ─────────────────────────────────────────────────────────── */
.wccm-banner-wrap {
    padding: 0;
    overflow: hidden;
}
.wccm-banner {
    position: relative;
    width: 100%;
    min-height: 280px;
    background-color: #f1f5f9;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wccm-banner-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.55);
    backdrop-filter: none;
}
.wccm-banner-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px 24px;
    width: 100%;
}
.wccm-banner-label {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 10px;
    letter-spacing: .5px;
    text-transform: uppercase;
    opacity: .75;
}
.wccm-banner-name {
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 700;
    margin: 0;
    line-height: 1.15;
}

@media (max-width: 767px) {
    .wccm-banner { min-height: 180px; }
    .wccm-banner-name { font-size: clamp(20px, 6vw, 30px); }
}
