/* ================================================================
   PREMIUM-ECOM.CSS — World-Class E-Commerce Layer
   Bhavani Stationery | theme_aster
   Features: Flying cart · Typewriter · Counters · Marquee ·
             Trust badges · Card shimmer · Search slide ·
             Frosted header · Dark toggle · View Transitions
   ================================================================ */

/* ----------------------------------------------------------------
   1. FLYING-TO-CART ANIMATION
   ---------------------------------------------------------------- */
.fly-to-cart-clone {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none;
    z-index: 99999;
    box-shadow: 0 8px 24px rgba(var(--bs-primary-rgb), 0.4);
    border: 3px solid rgba(255,255,255,0.8);
    will-change: transform, opacity;
}

@keyframes cart-receive-pulse {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.45); }
    60%  { transform: scale(0.92); }
    80%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.cart-badge-bounce {
    display: inline-block;
    animation: cart-receive-pulse 0.55s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes badge-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.65); }
    100% { transform: scale(1); }
}

.count.badge-pop {
    animation: badge-pop 0.45s cubic-bezier(.36,.07,.19,.97) both;
}

/* ----------------------------------------------------------------
   2. TYPEWRITER HERO BADGE
   ---------------------------------------------------------------- */
.hero-typewriter-wrap {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    text-align: center;
    pointer-events: none;
    width: 100%;
}

.hero-typewriter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(var(--bs-primary-rgb), 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 3rem;
    padding: 0.6rem 1.5rem;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 32px rgba(var(--bs-primary-rgb), 0.35);
}

.hero-typewriter-badge .cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: #fff;
    border-radius: 2px;
    margin-left: 2px;
    animation: cursor-blink 0.75s step-end infinite;
    vertical-align: middle;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* ----------------------------------------------------------------
   3. TRUST STATS SECTION
   ---------------------------------------------------------------- */
.trust-stats-section {
    background: linear-gradient(135deg,
        rgba(var(--bs-primary-rgb), 0.05) 0%,
        rgba(var(--bs-secondary-rgb), 0.05) 100%);
    border-top: 1px solid rgba(var(--bs-primary-rgb), 0.1);
    border-bottom: 1px solid rgba(var(--bs-primary-rgb), 0.1);
    padding: 2.5rem 0;
    margin: 1rem 0;
}

.trust-stat-card {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: 1.5rem;
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 4px 24px rgba(0,0,0,0.05);
    transition: transform 0.3s cubic-bezier(.22,.61,.36,1), box-shadow 0.3s ease;
    height: 100%;
}

.trust-stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(var(--bs-primary-rgb), 0.14);
}

[theme="dark"] .trust-stat-card {
    background: rgba(30,41,59,0.8);
    border-color: rgba(255,255,255,0.07);
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}

.trust-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 1rem;
    background: linear-gradient(135deg,
        rgba(var(--bs-primary-rgb),0.14),
        rgba(var(--bs-secondary-rgb),0.14));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: var(--bs-primary);
}

.trust-stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--bs-primary);
    font-family: 'Outfit', sans-serif;
    line-height: 1;
    margin-bottom: 0.35rem;
}

.trust-stat-label {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

[theme="dark"] .trust-stat-label { color: #94a3b8; }

/* ----------------------------------------------------------------
   4. SCROLLING BRAND MARQUEE
   ---------------------------------------------------------------- */
.brand-marquee-section {
    padding: 1.25rem 0;
    overflow: hidden;
    border-top: 1px solid rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

[theme="dark"] .brand-marquee-section {
    border-color: rgba(255,255,255,0.05);
}

.marquee-track {
    display: flex;
    gap: 2rem;
    width: max-content;
    animation: marquee-scroll 32s linear infinite;
    align-items: center;
}

.marquee-track:hover { animation-play-state: paused; }

@keyframes marquee-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

.marquee-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1.25rem;
    border-radius: 3rem;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(var(--bs-primary-rgb),0.12);
    font-weight: 600;
    font-size: 0.82rem;
    color: #334155;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.marquee-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(var(--bs-primary-rgb),0.15);
}

[theme="dark"] .marquee-item {
    background: rgba(30,41,59,0.9);
    color: #cbd5e1;
    border-color: rgba(255,255,255,0.07);
}

.marquee-item i { color: var(--bs-primary); }

/* ----------------------------------------------------------------
   5. PRODUCT CARD SHIMMER HOVER
   ---------------------------------------------------------------- */
.product,
.card-product,
.product-card { position: relative; overflow: hidden; }

.product::after,
.card-product::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255,255,255,0.32) 50%,
        transparent 60%
    );
    transform: skewX(-15deg);
    pointer-events: none;
    z-index: 2;
    transition: left 0s;
}

.product:hover::after,
.card-product:hover::after {
    left: 150%;
    transition: left 0.55s ease;
}

/* Glassmorphic discount badge */
.badge.bg-danger,
.discount-badge,
[class*="discount-badge"] {
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    box-shadow: 0 3px 12px rgba(var(--bs-primary-rgb),0.28) !important;
}

/* ----------------------------------------------------------------
   6. SEARCH PANEL SLIDE-DOWN
   ---------------------------------------------------------------- */
.search-result-box {
    border-radius: 1rem !important;
    border: 1px solid rgba(var(--bs-primary-rgb),0.12) !important;
    box-shadow: 0 16px 48px rgba(0,0,0,0.11) !important;
    overflow: hidden;
    transform-origin: top center;
}

.search-result-box:not(:empty) {
    animation: search-slide-down 0.22s cubic-bezier(.22,.61,.36,1) both;
}

@keyframes search-slide-down {
    from { opacity: 0; transform: scaleY(0.85) translateY(-6px); }
    to   { opacity: 1; transform: scaleY(1) translateY(0); }
}

/* ----------------------------------------------------------------
   7. FROSTED STICKY HEADER
   ---------------------------------------------------------------- */
.header-main.scrolled-active {
    background: rgba(255,255,255,0.85) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-bottom: 1px solid rgba(var(--bs-primary-rgb),0.1) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07) !important;
    transition: background 0.35s ease, box-shadow 0.35s ease !important;
}

[theme="dark"] .header-main.scrolled-active {
    background: rgba(15,23,42,0.9) !important;
    border-bottom-color: rgba(255,255,255,0.06) !important;
}

/* ----------------------------------------------------------------
   8. DARK MODE ICON MORPH
   ---------------------------------------------------------------- */
.dark-mode-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 24px;
    height: 24px;
}

.dark-mode-icon-wrap .icon-sun,
.dark-mode-icon-wrap .icon-moon {
    position: absolute;
    font-size: 1.1rem;
    transition: transform 0.4s cubic-bezier(.34,1.56,.64,1), opacity 0.3s ease;
}

.dark-mode-icon-wrap .icon-sun  { transform: rotate(0deg) scale(1); opacity: 1; }
.dark-mode-icon-wrap .icon-moon { transform: rotate(-90deg) scale(0); opacity: 0; }

[theme="dark"] .dark-mode-icon-wrap .icon-sun  { transform: rotate(90deg) scale(0); opacity: 0; }
[theme="dark"] .dark-mode-icon-wrap .icon-moon { transform: rotate(0deg) scale(1); opacity: 1; }

/* ----------------------------------------------------------------
   9. VIEW TRANSITIONS API
   ---------------------------------------------------------------- */
@view-transition { navigation: auto; }

::view-transition-old(root) {
    animation: vt-out 0.22s ease both;
}
::view-transition-new(root) {
    animation: vt-in 0.28s cubic-bezier(.22,.61,.36,1) both;
}

@keyframes vt-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vt-in  { from { opacity: 0; transform: translateY(6px); } }

/* ----------------------------------------------------------------
   10. TRUST BADGES STRIP
   ---------------------------------------------------------------- */
.trust-badges-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 1.25rem 1rem;
    background: linear-gradient(135deg,
        rgba(var(--bs-primary-rgb),0.04),
        rgba(var(--bs-secondary-rgb),0.04));
    border-radius: 1.5rem;
    margin: 1rem 0;
}

.trust-badge-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: #334155;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.trust-badge-item.is-visible { opacity: 1; transform: none; }
.trust-badge-item:nth-child(2) { transition-delay: 0.07s; }
.trust-badge-item:nth-child(3) { transition-delay: 0.14s; }
.trust-badge-item:nth-child(4) { transition-delay: 0.21s; }

[theme="dark"] .trust-badge-item { color: #cbd5e1; }

.trust-badge-icon {
    width: 36px; height: 36px;
    border-radius: 0.65rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.trust-badge-icon.green  { background: rgba(34,197,94,0.12);  color: #16a34a; }
.trust-badge-icon.blue   { background: rgba(59,130,246,0.12); color: #2563eb; }
.trust-badge-icon.orange { background: rgba(249,115,22,0.12); color: #ea580c; }
.trust-badge-icon.purple { background: rgba(168,85,247,0.12); color: #9333ea; }

/* ----------------------------------------------------------------
   11. SECTION TITLE UNDERLINE REVEAL
   ---------------------------------------------------------------- */
.title-section h2,
.section-title h2,
.title-area h2 {
    position: relative;
    display: inline-block;
}

.title-section h2::after,
.section-title h2::after,
.title-area h2::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--bs-primary), var(--bs-secondary));
    transition: width 0.65s cubic-bezier(.22,.61,.36,1);
}

.title-section.is-visible h2::after,
.section-title.is-visible h2::after,
.title-area.is-visible h2::after { width: 100%; }

/* ----------------------------------------------------------------
   12. FLOATING OFFER PILL
   ---------------------------------------------------------------- */
.offer-pill-float {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, var(--bs-primary), var(--bs-secondary));
    color: #fff;
    border-radius: 3rem;
    padding: 0.3rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 4px 16px rgba(var(--bs-primary-rgb),0.4);
    animation: offer-float 3s ease-in-out infinite;
}

@keyframes offer-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-5px); }
}

/* ----------------------------------------------------------------
   13. MOBILE APP-BAR CART PULSE
   ---------------------------------------------------------------- */
@keyframes cart-pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0.5); }
    70%  { box-shadow: 0 0 0 10px rgba(var(--bs-primary-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0); }
}

.cart-count-pulse { animation: cart-pulse-ring 0.8s ease-out; }

/* ----------------------------------------------------------------
   14. REDUCE MOTION OVERRIDES
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .marquee-track,
    .offer-pill-float,
    .hero-typewriter-badge .cursor { animation: none !important; }

    ::view-transition-old(root),
    ::view-transition-new(root) { animation: none !important; }
}
