/**
 * Shared styles for Products Highlight + Brands Highlight
 * Loaded on FO and Elementor editor preview.
 */

/* Unified carousel navigation */
.cex-ph .swiper-container-wrapper,
.cex-bh .swiper-container-wrapper {
    position: relative;
    overflow: visible;
}
.cex-ph .elementor-swiper-button,
.cex-bh .elementor-swiper-button {
    width: 42px;
    height: 62px;
    margin-top: -31px;
    background: #333333;
    color: #ffffff;
    border: none;
    border-radius: 0;
    opacity: 1;
    z-index: 5;
    transition: background .2s ease, opacity .2s ease, left .2s ease, right .2s ease;
}
.cex-ph .elementor-swiper-button:hover,
.cex-bh .elementor-swiper-button:hover {
    background: #262a32;
    opacity: 1;
}
.cex-ph .elementor-swiper-button:after,
.cex-bh .elementor-swiper-button:after {
    font-size: 16px;
    font-weight: 700;
}

/* Arrows horizontal offset (negative = outside container)
   Prefer Elementor selectors (higher specificity / !important) when set. */
.cex-ph,
.cex-bh {
    --cex-arrows-offset: 0px;
}
.cex-ph .swiper-arrows-middle > .elementor-swiper-button-prev,
.cex-bh .swiper-arrows-middle > .elementor-swiper-button-prev,
.cex-ph .swiper-container-wrapper.swiper-arrows-middle > .swiper-button-prev,
.cex-bh .swiper-container-wrapper.swiper-arrows-middle > .swiper-button-prev {
    left: var(--cex-arrows-offset, 0px);
}
.cex-ph .swiper-arrows-middle > .elementor-swiper-button-next,
.cex-bh .swiper-arrows-middle > .elementor-swiper-button-next,
.cex-ph .swiper-container-wrapper.swiper-arrows-middle > .swiper-button-next,
.cex-bh .swiper-container-wrapper.swiper-arrows-middle > .swiper-button-next {
    right: var(--cex-arrows-offset, 0px);
}

/* Allow arrows outside without expanding content width */
.elementor-widget-prestashop-widget-ProductsHighlight,
.elementor-widget-prestashop-widget-BrandsHighlight,
.elementor-editor-active .elementor-widget-prestashop-widget-ProductsHighlight,
.elementor-editor-active .elementor-widget-prestashop-widget-BrandsHighlight,
.elementor-editor-active .elementor-element.elementor-widget-prestashop-widget-ProductsHighlight,
.elementor-editor-active .elementor-element.elementor-widget-prestashop-widget-BrandsHighlight {
    overflow: visible !important;
}
.elementor-widget-prestashop-widget-ProductsHighlight > .elementor-widget-container,
.elementor-widget-prestashop-widget-BrandsHighlight > .elementor-widget-container,
.elementor-editor-active .elementor-widget-prestashop-widget-ProductsHighlight > .elementor-widget-container,
.elementor-editor-active .elementor-widget-prestashop-widget-BrandsHighlight > .elementor-widget-container {
    overflow: visible !important;
}
/* Editor: keep parent wraps from clipping offset arrows */
.elementor-editor-active .elementor-widget-wrap:has(.cex-ph),
.elementor-editor-active .elementor-widget-wrap:has(.cex-bh),
.elementor-editor-active .elementor-column-wrap:has(.cex-ph),
.elementor-editor-active .elementor-column-wrap:has(.cex-bh),
.elementor-editor-active .elementor-section:has(.cex-ph),
.elementor-editor-active .elementor-section:has(.cex-bh) {
    overflow: visible !important;
}

/* ——— Categories boxes ——— */
.cex-cb {
    --cex-cb-cols: 3;
    --cex-cb-cols-tablet: 2;
    --cex-cb-cols-mobile: 1;
    --cex-cb-gap-x: 14px;
    --cex-cb-gap-y: 14px;
    --cex-cb-box-height: 112px;
    --cex-cb-media-width: 112px;
}
.cex-cb .cex-cats {
    display: grid;
    grid-template-columns: repeat(var(--cex-cb-cols), minmax(0, 1fr));
    column-gap: var(--cex-cb-gap-x);
    row-gap: var(--cex-cb-gap-y);
    margin: 0;
    padding: 0;
    align-items: stretch;
}
.cex-cb .cex-cat {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: var(--cex-cb-box-height);
    min-height: var(--cex-cb-box-height);
    max-height: var(--cex-cb-box-height);
    background: #fff;
    border: 1px solid #e6ebef;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none !important;
    color: #262a32;
    transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.cex-cb .cex-cat:hover,
.cex-cb .cex-cat:focus-visible {
    border-color: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 40, 55, 0.07);
    outline: none;
}
.cex-cb .cex-cat__media {
    flex: 0 0 var(--cex-cb-media-width);
    width: var(--cex-cb-media-width);
    height: var(--cex-cb-box-height);
    background: #ffffff;
    border-right: 1px solid #eef2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.cex-cb .cex-cat__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 10px;
    box-sizing: border-box;
    display: block;
    transition: transform .35s ease;
}
.cex-cb .cex-cat:hover .cex-cat__media img,
.cex-cb .cex-cat:focus-visible .cex-cat__media img {
    transform: scale(1.04);
}
.cex-cb .cex-cat__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 12px 14px;
    background: #f9f9f9;
    flex: 1;
    min-width: 0;
}
.cex-cb .cex-cat__title {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.25;
    color: #262a32;
}
.cex-cb .cex-cat__desc {
    font-size: 0.82rem;
    line-height: 1.35;
    color: #6a737c;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cex-cb .cex-cat__cta {
    margin-top: 6px;
    align-self: flex-start;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #0091c8;
    position: relative;
    padding-right: 12px;
}
.cex-cb .cex-cat__cta::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: 6px;
    height: 6px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: translateY(-50%) rotate(45deg);
    transition: transform .25s ease;
}
.cex-cb .cex-cat:hover .cex-cat__cta::after,
.cex-cb .cex-cat:focus-visible .cex-cat__cta::after {
    transform: translate(2px, -50%) rotate(45deg);
}
@media (max-width: 991px) {
    .cex-cb .cex-cats {
        grid-template-columns: repeat(var(--cex-cb-cols-tablet), minmax(0, 1fr));
    }
}
@media (max-width: 575px) {
    .cex-cb .cex-cats {
        grid-template-columns: repeat(var(--cex-cb-cols-mobile), minmax(0, 1fr));
    }
}

/* ——— Brands Highlight ——— */
.cex-bh {
    --cex-bh-gap: 8px;
    --cex-bh-gap-row: 8px;
}
.cex-bh__wrap {
    position: relative;
    overflow: visible;
}
.cex-bh-carousel {
    overflow: hidden;
    margin-left: calc(-1 * var(--cex-bh-gap, 8px));
    margin-right: calc(-1 * var(--cex-bh-gap, 8px));
    width: calc(100% + (2 * var(--cex-bh-gap, 8px)));
}
.cex-bh-carousel .swiper-slide {
    padding-left: var(--cex-bh-gap, 8px);
    padding-right: var(--cex-bh-gap, 8px);
    box-sizing: border-box;
    height: auto !important;
}
.cex-bh--multi-row .cex-bh-carousel .swiper-slide {
    padding-bottom: var(--cex-bh-gap-row, 8px);
}
.cex-bh__item {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 92px;
    min-height: 92px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e3e6ea;
    box-sizing: border-box;
    text-decoration: none !important;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.cex-bh__item:hover {
    border-color: #0091c8;
    position: relative;
    z-index: 2;
}
.cex-bh__logo {
    max-width: 100%;
    max-height: 52px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.cex-bh__name {
    font-family: 'Barlow Semi Condensed', 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(1.05rem, 1.6vw, 1.5rem);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #262a32;
    line-height: 1.1;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.cex-bh__item--name:hover .cex-bh__name {
    color: #0091c8;
}
.cex-bh__progress {
    display: block;
    margin: 16px 0 0 auto;
    width: 120px;
    max-width: 40%;
    height: 4px;
    background: rgba(38, 42, 50, 0.12);
    overflow: hidden;
}
.cex-bh__progress-bar {
    display: block;
    width: 100%;
    height: 100%;
    background: #262a32;
    transform-origin: left center;
    transform: scaleX(0.18);
    transition: transform .25s ease;
}
.cex-bh--grid .cex-bh__list {
    display: flex;
    flex-wrap: wrap;
    margin-left: calc(-1 * var(--cex-bh-gap, 8px));
    margin-right: calc(-1 * var(--cex-bh-gap, 8px));
}
.cex-bh--grid .cex-bh__col {
    padding-left: var(--cex-bh-gap, 8px);
    padding-right: var(--cex-bh-gap, 8px);
    margin-bottom: var(--cex-bh-gap-row, 8px);
}

/* CLS / editor fallback before Swiper init */
.cex-bh-carousel.swiper-cls-fix:not(.swiper-initialized) {
    overflow: hidden;
}
.cex-bh-carousel.swiper-cls-fix:not(.swiper-initialized) .swiper-wrapper {
    display: grid;
    grid-template-rows: 1fr;
    grid-auto-rows: 0;
    overflow: hidden;
}
.cex-bh-carousel.swiper-cls-row-fix-2:not(.swiper-initialized) .swiper-wrapper {
    grid-template-rows: repeat(2, 1fr);
    grid-auto-rows: 0;
}
.cex-bh-carousel.desktop-swiper-cls-fix-5:not(.swiper-initialized) .swiper-wrapper {
    grid-template-columns: repeat(5, 1fr);
}
.cex-bh-carousel.desktop-swiper-cls-fix-4:not(.swiper-initialized) .swiper-wrapper {
    grid-template-columns: repeat(4, 1fr);
}
.cex-bh-carousel.desktop-swiper-cls-fix-6:not(.swiper-initialized) .swiper-wrapper {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 991px) {
    .cex-bh__item {
        height: 80px;
        min-height: 80px;
        padding: 10px 12px;
    }
    .cex-bh__logo {
        max-height: 42px;
    }
}
@media (max-width: 767px) {
    .cex-bh__item {
        height: 72px;
        min-height: 72px;
    }
    .cex-bh__name {
        font-size: 0.95rem;
    }
    .cex-bh__progress {
        width: 88px;
    }
}
