/* ================================================================
   theme_aster — subtle animation layer
   Loaded after style.css/custom.css. Pure CSS + IntersectionObserver.
   Honors prefers-reduced-motion.
   ================================================================ */

/* ---------- Page fade-in on initial paint ---------- */
body {
    animation: aster-page-fade .35s ease-out both;
}
@keyframes aster-page-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---------- Top progress bar (injected by JS) ---------- */
.aster-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--bs-primary, #0177CD);
    box-shadow: 0 0 6px rgba(var(--bs-primary-rgb, 1, 119, 205), .55);
    z-index: 99999;
    pointer-events: none;
    transition: width .25s ease;
    opacity: 0;
}
.aster-progress.aster-progress--active { opacity: 1; }

/* ---------- Scroll reveal base ---------- */
.aster-reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .55s cubic-bezier(.22,.61,.36,1),
                transform .55s cubic-bezier(.22,.61,.36,1);
    will-change: opacity, transform;
}
.aster-reveal.is-visible {
    opacity: 1;
    transform: none;
}
/* Stagger inside a parent that has .aster-reveal-group */
.aster-reveal-group > .aster-reveal:nth-child(2)  { transition-delay: .06s; }
.aster-reveal-group > .aster-reveal:nth-child(3)  { transition-delay: .12s; }
.aster-reveal-group > .aster-reveal:nth-child(4)  { transition-delay: .18s; }
.aster-reveal-group > .aster-reveal:nth-child(5)  { transition-delay: .22s; }
.aster-reveal-group > .aster-reveal:nth-child(6)  { transition-delay: .26s; }
.aster-reveal-group > .aster-reveal:nth-child(7)  { transition-delay: .30s; }
.aster-reveal-group > .aster-reveal:nth-child(8)  { transition-delay: .34s; }

/* ---------- Product card: hover lift + image zoom ---------- */
.product,
.card-product,
.product-card {
    transition: transform .28s cubic-bezier(.22,.61,.36,1);
}
.product:hover,
.card-product:hover,
.product-card:hover {
    transform: translateY(-3px);
}
.product .product__top,
.card-product .product__top {
    overflow: hidden;
    transition: box-shadow .28s ease;
}
.product:hover .product__top,
.card-product:hover .product__top {
    box-shadow: 0 14px 28px rgba(0, 0, 0, .08);
}
.product .product__top img,
.product img.product-img,
.card-product img.product-img,
.card-product .product__top img {
    transition: transform .45s cubic-bezier(.22,.61,.36,1);
    will-change: transform;
}
.product:hover .product__top img,
.product:hover img.product-img,
.card-product:hover .product__top img,
.card-product:hover img.product-img {
    transform: scale(1.045);
}

/* Hover-revealed actions (wishlist / compare / quick-view column) */
.product .product__actions {
    opacity: 0;
    transform: translateX(8px);
    transition: opacity .25s ease, transform .25s ease;
}
.product:hover .product__actions {
    opacity: 1;
    transform: none;
}

/* Discount/sale badge gentle pulse */
.discount-badge {
    transition: transform .25s ease;
}
.product:hover .discount-badge {
    transform: scale(1.06);
}

/* ---------- Buttons: press feedback + smooth transitions ---------- */
.btn,
button:not(.aster-no-anim) {
    transition: background-color .2s ease,
                border-color .2s ease,
                color .2s ease,
                transform .12s ease,
                box-shadow .2s ease;
}
.btn:active,
button:not(.aster-no-anim):active {
    transform: scale(.97);
}
.btn-primary:hover,
.btn-outline-primary:hover,
.btn-outline-success:hover {
    box-shadow: 0 6px 14px rgba(var(--bs-primary-rgb, 1, 119, 205), .22);
}

/* ---------- Links: underline-from-left (only inside content, not nav/menu) ---------- */
.aster-link-underline,
.product__summary a,
.footer a {
    position: relative;
    display: inline-block;
    text-decoration: none !important;
}
.aster-link-underline::after,
.product__summary a::after,
.footer a::after {
    content: '';
    display: block;
    position: absolute;
    left: 0; bottom: -2px;
    width: 0;
    height: 1px;
    background: currentColor;
    opacity: .55;
    transition: width .25s cubic-bezier(.22,.61,.36,1);
}
.aster-link-underline:hover::after,
.product__summary a:hover::after,
.footer a:hover::after {
    width: 100%;
}

/* ---------- Nav items: subtle slide ---------- */
.navbar-nav .nav-link,
.header .nav a {
    transition: color .2s ease, transform .2s ease;
}
.navbar-nav .nav-link:hover,
.header .nav a:hover {
    transform: translateY(-1px);
}

/* ---------- Modal / popup ---------- */
.modal.fade .modal-dialog {
    transform: translateY(12px) scale(.985);
    transition: transform .28s cubic-bezier(.22,.61,.36,1), opacity .28s;
}
.modal.show .modal-dialog {
    transform: none;
}

/* ---------- Image lazy fade ----------
   Self-contained so an image can NEVER get stuck invisible when the JS
   tag (.aster-img-loaded) is missed — e.g. carousel loop-clones, AJAX /
   variant / related-product injections, or any late DOM. Base opacity
   stays 1; the fade is a pure-CSS entrance that always settles at 1, so
   no hover/repaint is ever needed to reveal the image. */
@keyframes aster-img-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
img[loading="lazy"] {
    animation: aster-img-in .45s ease both;
}
/* Back-compat with the JS tagger (harmless if present). */
img[loading="lazy"].aster-img-loaded,
img[loading="lazy"].loaded {
    opacity: 1;
}

/* ---------- Back-to-top floating button ---------- */
.back-to-top {
    transition: opacity .25s ease, transform .25s ease, background-color .2s;
}
.back-to-top:hover {
    transform: translateY(-3px);
}

/* ---------- Accordion (FAQ etc) chevron rotate ---------- */
.accordion-button::after {
    transition: transform .25s ease;
}

/* ---------- Respect user preference ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .aster-reveal { opacity: 1; transform: none; }
    body { animation: none; }
}

/* ---------- Smooth scroll for anchors ---------- */
html { scroll-behavior: smooth; }

/* ================================================================
   ASTER-ANIMATIONS EXTENSION — premium additions
   Frosted header · Parallax hero · Mobile bar · Input focus ring
   ================================================================ */

/* ----------------------------------------------------------------
   FROSTED STICKY HEADER
   ---------------------------------------------------------------- */
.header-main {
    transition: background 0.35s ease,
                box-shadow 0.35s ease,
                backdrop-filter 0.35s ease;
}

/* ----------------------------------------------------------------
   HERO BANNER — subtle parallax via CSS scroll-driven animation
   Only activates in supporting browsers; degrades silently.
   ---------------------------------------------------------------- */
@supports (animation-timeline: scroll()) {
    .full-width-hero img.banner-img {
        animation: parallax-hero linear both;
        animation-timeline: scroll(root);
        animation-range: 0px 400px;
    }

    @keyframes parallax-hero {
        from { transform: scale(1) translateY(0); }
        to   { transform: scale(1.06) translateY(16px); }
    }
}

/* ----------------------------------------------------------------
   MOBILE APP-BAR — smooth active tab indicator
   ---------------------------------------------------------------- */
.app-bar {
    transition: transform 0.3s ease;
}

/* Scrolled below fold → slightly reduces in height */
.app-bar .nav-tab-btn {
    transition: color 0.2s ease, transform 0.2s ease;
}

.app-bar .nav-tab-btn.active {
    color: var(--bs-primary) !important;
    transform: translateY(-2px);
}

.app-bar .nav-tab-btn i,
.app-bar .nav-tab-btn svg {
    transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
}

.app-bar .nav-tab-btn.active i,
.app-bar .nav-tab-btn.active svg {
    transform: scale(1.2) translateY(-1px);
}

/* ----------------------------------------------------------------
   INPUT FOCUS — global polished ring
   ---------------------------------------------------------------- */
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.16) !important;
    border-color: var(--bs-primary) !important;
    transition: box-shadow 0.22s ease, border-color 0.22s ease;
}

/* ----------------------------------------------------------------
   DROPDOWN MENU — smooth appear
   ---------------------------------------------------------------- */
.dropdown-menu {
    animation: dropdown-appear 0.2s cubic-bezier(.22,.61,.36,1) both;
    transform-origin: top center;
}

@keyframes dropdown-appear {
    from { opacity: 0; transform: scaleY(0.92) translateY(-6px); }
    to   { opacity: 1; transform: scaleY(1) translateY(0); }
}

/* ----------------------------------------------------------------
   FOOTER LINKS — staggered reveal
   ---------------------------------------------------------------- */
.footer-widget {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ----------------------------------------------------------------
   TOAST / TOASTR — modern pill style
   ---------------------------------------------------------------- */
.toast-container .toast {
    border-radius: 1rem !important;
    box-shadow: 0 12px 32px rgba(0,0,0,0.15) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

/* ----------------------------------------------------------------
   PRODUCT RATING STARS — micro-animation on hover
   ---------------------------------------------------------------- */
.product .reviews-star-wrap i:hover,
.product .star-rating i:hover {
    transform: scale(1.25) rotate(-5deg);
    transition: transform 0.18s cubic-bezier(.34,1.56,.64,1);
}

