/* =====================================================================
   eiomart – animations.css
   Product card hover, scroll reveal, add-to-cart micro-interaction.
   Load AFTER style.css and responsive.css.
   ===================================================================== */

/* ---------- 1. Product card hover (desktop / mouse only) ---------- */
@media (hover: hover) and (pointer: fine) {
    .product-item-wrapper {
        transition: transform .35s cubic-bezier(.2, .8, .2, 1),
                    box-shadow .35s ease,
                    border-color .25s ease;
    }

    .product-item-wrapper:hover {
        transform: translateY(-6px);
        box-shadow: 0 18px 34px rgba(0, 0, 0, .10);
        /* original rule had "var(--primary)66" which is invalid CSS and
           made the border vanish on hover – fixed here */
        border: 1px solid var(--primary);
        border: 1px solid color-mix(in srgb, var(--primary) 45%, transparent);
    }

    .quick-order-btn-inner {
        transition: all .3s ease;
    }

    .product-item-wrapper:hover .quick-order-btn-inner {
        box-shadow: 0 6px 14px rgba(0, 0, 0, .12);
    }
}

/* ---------- 2. Scroll reveal ---------- */
/* Only active when JS added .js-reveal, so nothing is ever hidden if JS fails */
.js-reveal .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1);
    transition-delay: calc(var(--reveal-i, 0) * 70ms);
}

.js-reveal .reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- 3. Add to cart micro-interaction ---------- */
@keyframes eioCartBounce {
    0%   { transform: scale(1) rotate(0); }
    30%  { transform: scale(1.3) rotate(-10deg); }
    50%  { transform: scale(.92) rotate(8deg); }
    70%  { transform: scale(1.12) rotate(-3deg); }
    100% { transform: scale(1) rotate(0); }
}

@keyframes eioCountPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.7); }
    100% { transform: scale(1); }
}

@keyframes eioAddIcon {
    0%   { transform: translateX(0) scale(1); }
    50%  { transform: translateX(7px) scale(1.25); }
    100% { transform: translateX(0) scale(1); }
}

#cart .icon-outer i.eio-cart-bounce,
.mbn-cart-btn i.eio-cart-bounce {
    animation: eioCartBounce .6s ease both;
}

#cart .count-number.eio-count-pop,
.mbn-cart-count.eio-count-pop {
    animation: eioCountPop .5s ease both;
}

.add-cart-btn.is-adding i {
    animation: eioAddIcon .45s ease both;
}

/* ---------- Respect "reduce motion" / slow phones ---------- */
@media (prefers-reduced-motion: reduce) {
    .js-reveal .reveal,
    .js-reveal .reveal.is-visible {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .product-item-wrapper:hover {
        transform: none;
    }

    #cart .icon-outer i.eio-cart-bounce,
    #cart .count-number.eio-count-pop,
    .mbn-cart-btn i.eio-cart-bounce,
    .mbn-cart-count.eio-count-pop,
    .add-cart-btn.is-adding i {
        animation: none;
    }
}


/* =====================================================================
   PART 2 – button/link hover, category hover, banner slider polish
   ===================================================================== */

/* ---------- 4. Button & link hover ---------- */
.quick-order-btn-inner,
.checkout-link,
.view-cart-link,
.cart-btn-inner,
.order-btn,
.see-more-btn,
.shop-now-btn {
    transition: transform .25s ease, box-shadow .25s ease,
                background-color .25s ease, color .25s ease, border-color .25s ease;
}

@media (hover: hover) and (pointer: fine) {
    .quick-order-btn-inner:hover,
    .checkout-link:hover,
    .view-cart-link:hover,
    .cart-btn-inner:hover,
    .order-btn:hover,
    .shop-now-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 18px rgba(0, 0, 0, .14);
    }
}

/* press feedback (works on phones too) */
.quick-order-btn-inner:active,
.checkout-link:active,
.view-cart-link:active,
.cart-btn-inner:active,
.order-btn:active,
.see-more-btn:active,
.shop-now-btn:active {
    transform: scale(.97);
    box-shadow: none;
}

.add-cart-btn:active {
    opacity: .85;
}

/* top menu: underline slides in */
.manu-list .manu-list-item .manu-list-item-link {
    position: relative;
}

.manu-list .manu-list-item .manu-list-item-link::after {
    content: '';
    position: absolute;
    left: 15px;
    right: 15px;
    bottom: -6px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .3s ease;
}

.manu-list .manu-list-item .manu-list-item-link:hover::after {
    transform: scaleX(1);
}

/* ---------- 5. Category item hover ---------- */
.categoris-item {
    transition: background-color .3s ease, box-shadow .3s ease;
}

.categoris-item img {
    transition: transform .45s cubic-bezier(.34, 1.56, .64, 1);
}

.categoris-item .categoris-name {
    transition: color .3s ease;
}

@media (hover: hover) and (pointer: fine) {
    .categoris-item:hover {
        background: #fff;
        box-shadow: 0 10px 24px rgba(0, 0, 0, .10);
    }

    .categoris-item:hover img {
        transform: scale(1.14) rotate(-6deg);
    }

    .categoris-item:hover .categoris-name {
        color: var(--primary);
    }
}

/* ---------- 6. Banner slider polish ---------- */
/* gentle slow zoom on the visible slide (the fade itself is already set in main.js) */
.slider-item-outer {
    overflow: hidden;
    border-radius: 30px;
}

@keyframes eioSliderZoom {
    from { transform: scale(1); }
    to   { transform: scale(1.06); }
}

.slider-items-wrapper .slick-active .slider-item-outer img {
    animation: eioSliderZoom 5s ease-out both;
}

/* active dot becomes a pill */
.slider-items-wrapper .slick-dots li.slick-active {
    width: 34px;
    border-radius: 20px;
}

@media (prefers-reduced-motion: reduce) {
    .slider-items-wrapper .slick-active .slider-item-outer img {
        animation: none;
    }

    .categoris-item img,
    .categoris-item:hover img {
        transform: none;
        transition: none;
    }

    .quick-order-btn-inner:hover,
    .checkout-link:hover,
    .view-cart-link:hover,
    .cart-btn-inner:hover,
    .order-btn:hover,
    .shop-now-btn:hover {
        transform: none;
    }
}


/* =====================================================================
   PART 3 – layout fixes (price + Add button wrapping)
   ===================================================================== */
.product-item-bottom {
    gap: 8px;
}

/* price block takes the remaining space and wraps neatly:
   new price on top, old (struck) price below as one piece */
.product-item-bottom .product-price {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 6px;
}

.product-item-bottom .product-price span {
    white-space: nowrap;
}

.product-item-bottom .product-price span + span {
    margin-left: 0 !important; /* overrides the inline margin-left:5px */
}

/* Add button never breaks into two lines */
.product-item-bottom .add-cart {
    flex: 0 0 auto;
}

.product-item-bottom .add-cart .add-cart-btn {
    display: inline-block;
    white-space: nowrap;
}

/* phones (2 cards per row): price on top, full-width Add button below */
@media (max-width: 575px) {
    .product-item-bottom {
        flex-wrap: wrap;
    }

    .product-item-bottom .product-price {
        flex: 1 1 100%;
    }

    .product-item-bottom .add-cart {
        flex: 1 1 100%;
    }

    .product-item-bottom .add-cart .add-cart-btn {
        display: block;
        text-align: center;
    }
}


/* =====================================================================
   PART 4 – sticky header
   Desktop: top bar always visible, menu row hides on scroll-down and
            comes back on scroll-up.
   Mobile : whole header hides on scroll-down, comes back on scroll-up.
   (the hide/show offset is set by animations.js through "top")
   ===================================================================== */
.header-section {
    position: sticky;
    top: 0;
    z-index: 1020;           /* below bottom nav (1030) and chat buttons (1040) */
    background: #fff;
    transition: top .3s ease, box-shadow .3s ease;
}

.header-section.is-stuck {
    box-shadow: 0 4px 18px rgba(0, 0, 0, .08);
}

@media (max-width: 991px) {
    .header-section.is-hidden {
        box-shadow: none;
    }
}

/* "overflow-x:hidden" on body can stop sticky from working in some browsers;
   "clip" hides the overflow without creating a scroll container */
@supports (overflow: clip) {
    body {
        overflow-x: clip;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-section {
        transition: none;
    }
}


/* =====================================================================
   PART 5 – product image zoom on hover
   The image grows a little (inside the card's own 20px padding), so no
   clipping / overflow tricks are needed.
   ===================================================================== */
.product-item-wrapper .product-imgae .main-image {
    transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}

@media (hover: hover) and (pointer: fine) {
    .product-item-wrapper:hover .product-imgae .main-image {
        transform: scale(1.07);
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-item-wrapper .product-imgae .main-image,
    .product-item-wrapper:hover .product-imgae .main-image {
        transform: none;
        transition: none;
    }
}


/* =====================================================================
   PART 6 – AJAX "Add" button states
   ===================================================================== */
.add-cart-btn[aria-busy="true"] {
    opacity: .7;
    pointer-events: none;
}

.product-item-bottom .add-cart .add-cart-btn.is-added {
    background-color: var(--primary);
    color: #fff;
}
