/**
 * WizAtom ProductImage — v2 CSS
 *
 * Structure matches v1 ProductListingCard image:
 *   - Each image in its own <a> tag
 *   - Switch mode: CSS crossfade between primary and first secondary on hover
 *   - Scroll mode: JS-driven show/hide with dot navigation
 *   - Overlay: ATC, QuickView, ViewSimilar, scroll dots
 */

/* ----------------------------------------------------------------
   Container
   ---------------------------------------------------------------- */
.wiz-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    position: relative;
    overflow: hidden;
    display: flex;
}

.wiz-image .wiz-image__link img {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

.wiz-image__link {
    width: 100%;
    height: 100%;
}

.wiz-image .wiz-image__link--primary img {
    display: block;
}

/* ----------------------------------------------------------------
   Secondary images hidden by default
   ---------------------------------------------------------------- */
.wiz-image__link--secondary {
    display: none;
}

/* ----------------------------------------------------------------
   Switch mode — CSS crossfade on hover
   ---------------------------------------------------------------- */
.wiz-image--switch .wiz-image__link--primary {
    transition: opacity 0.3s ease-in-out;
}

.wiz-image--switch .wiz-image__link--secondary {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Only show first secondary in switch mode */
.wiz-image--switch .wiz-image__link--secondary ~ .wiz-image__link--secondary {
    display: none;
}

.wiz-image--switch:hover .wiz-image__link--primary {
    opacity: 0;
}

.wiz-image--switch:hover .wiz-image__link--secondary {
    opacity: 1;
}

/* ----------------------------------------------------------------
   Scroll mode — JS toggles display on individual links
   ---------------------------------------------------------------- */
.wiz-image--scroll .wiz-image__link--secondary {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ----------------------------------------------------------------
   Overlay Container — positioned at bottom of image
   ---------------------------------------------------------------- */
.wiz-image__overlay-container {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 2;
}

/* ----------------------------------------------------------------
   ATC row
   ---------------------------------------------------------------- */
.wiz-image__overlay-atc {
    justify-content: flex-end;
    display: flex;
}

/* ----------------------------------------------------------------
   ViewSimilar chip row (sits above ATC)
   ---------------------------------------------------------------- */
.wiz-image__overlay-chip-row {
    display: flex;
    justify-content: flex-end;
    padding: 0 10px 8px;
    pointer-events: none;
}

.wiz-image__overlay-chip-row > * {
    pointer-events: auto;
}

/* ----------------------------------------------------------------
   ViewSimilar chip
   ---------------------------------------------------------------- */
.wiz-image__view-similar-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: background 0.2s ease, box-shadow 0.2s ease;
    height: fit-content;
}
.wiz-image__view-similar-chip:hover {
    gap: 5px;
}

.wiz-image__view-similar-chip:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.wiz-image__view-similar-chip .chip-text {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.3s ease-in-out, max-width 0.3s ease-in-out;
    display: inline-block;
    vertical-align: middle;
}

.wiz-image__view-similar-chip:hover .chip-text {
    opacity: 1;
    max-width: 200px;
}

.wiz-image__view-similar-chip svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ----------------------------------------------------------------
   Actions bar — QuickView + ViewSimilar buttons
   ---------------------------------------------------------------- */
.wiz-image__overlay-actions {
    display: flex;
    background-color: rgba(88, 88, 88, 0.9);
    color: #ffffff;
    transform: translateY(100%);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, max-height 0.3s ease-in-out;
}

/*
 * Overlay actions: per-device visibility scoped to exact breakpoints via min-width + max-width.
 * min-width is intentional — each data-attribute must ONLY activate at its breakpoint,
 * not cascade. The data attribute is set by PHP from the responsive Elementor control.
 */

/* Desktop (≥1025px): hover to reveal + always-show option */
@media (min-width: 1025px) {
    .wiz-image:hover .wiz-image__overlay-actions {
        transform: translateY(0);
        opacity: 1;
        max-height: 200px;
        height: 45px;
    }

    .wiz-image[data-overlay-always-desktop="yes"] .wiz-image__overlay-actions {
        transform: translateY(0);
        opacity: 1;
        max-height: 200px;
        height: 45px;
    }
}

/* Tablet (768px–1024px) */
@media (max-width: 1024px) and (min-width: 768px) {
    .wiz-image[data-overlay-always-tablet="yes"] .wiz-image__overlay-actions {
        transform: translateY(0) !important;
        opacity: 1 !important;
        max-height: 200px !important;
        height: 45px;
        display: flex !important;
    }

    .wiz-image[data-overlay-always-tablet="no"] .wiz-image__overlay-actions {
        display: none !important;
    }
}

/* Mobile (≤767px) */
@media (max-width: 767px) {
    .wiz-image[data-overlay-always-mobile="yes"] .wiz-image__overlay-actions {
        transform: translateY(0) !important;
        opacity: 1 !important;
        max-height: 200px !important;
        height: 35px;
        display: flex !important;
    }

    .wiz-image[data-overlay-always-mobile="no"] .wiz-image__overlay-actions {
        display: none !important;
    }
}

.wiz-image__overlay-quick-view {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.wiz-image__overlay-quick-view svg {
    width: 22px;
    height: 22px;
}

.wiz-image__overlay-similar-products {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.wiz-image__overlay-similar-products svg {
    width: 18px;
    height: 18px;
}

/* ----------------------------------------------------------------
   Scroll slider dots
   ---------------------------------------------------------------- */
.wiz-image__scroll-slider {
    position: relative;
    width: 100%;
    height: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    padding: 0px 0px;
    background: #ffffff;
    overflow: hidden;
}

.wiz-image:hover .wiz-image__scroll-slider {
    height: 100%;
    padding: 7px 0px;
    transition: height 0.3s ease, padding 0.3s ease;
}

.wiz-image__scroll-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: background 0.3s ease;
}

.wiz-image__scroll-dot.active {
    background: #000000;
}
