/* ============================================================
   CheapBattery — animations.css
   Add this file to your theme's assets/css/ folder and
   @import it inside main.css, OR enqueue it separately.
   ============================================================ */

/* ── PAGE TRANSITION OVERLAY ──────────────────────────────── */
#cb-page-transition {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--leaf, #2ECC71), var(--sky, #1AA3D9));
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: scaleY(0);
    transform-origin: bottom;
    transition: opacity .32s ease, transform .32s ease;
}

#cb-page-transition.pt-entering {
    opacity: 1;
    transform: scaleY(1);
    transform-origin: bottom;
    pointer-events: all;
}

#cb-page-transition.pt-leaving {
    opacity: 0;
    transform: scaleY(0);
    transform-origin: top;
}

/* ── SCROLL REVEAL ────────────────────────────────────────── */
.cb-reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity .55s cubic-bezier(.22, 1, .36, 1),
        transform .55s cubic-bezier(.22, 1, .36, 1);
}

.cb-reveal.cb-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Slide in from left for section labels */
.section-label.cb-reveal {
    transform: translateX(-20px);
}

.section-label.cb-revealed {
    transform: translateX(0);
}

/* ── RIPPLE ───────────────────────────────────────────────── */
.cb-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    animation: cbRippleAnim .65s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes cbRippleAnim {
    from {
        transform: scale(0);
        opacity: 1;
    }

    to {
        transform: scale(1);
        opacity: 0;
    }
}

/* ── CURSOR GLOW ──────────────────────────────────────────── */
#cb-cursor-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle,
            rgba(46, 204, 113, .08) 0%,
            rgba(26, 163, 217, .05) 40%,
            transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    transition: width .3s ease, height .3s ease, opacity .3s ease;
    will-change: transform;
}

#cb-cursor-glow.big {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle,
            rgba(46, 204, 113, .13) 0%,
            rgba(26, 163, 217, .07) 40%,
            transparent 70%);
}

/* ── FLOATING PARTICLES ───────────────────────────────────── */
.cb-particle {
    position: absolute;
    pointer-events: none;
    animation: cbFloat linear infinite;
    z-index: 0;
    user-select: none;
}

@keyframes cbFloat {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    33% {
        transform: translateY(-28px) rotate(8deg);
    }

    66% {
        transform: translateY(12px) rotate(-5deg);
    }

    100% {
        transform: translateY(0) rotate(0deg);
    }
}

/* ── BACK TO TOP ──────────────────────────────────────────── */
#cb-btt {
    position: fixed;
    bottom: 5.5rem;
    right: 2rem;
    z-index: 490;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--leaf, #2ECC71), var(--sky-dark, #0F7AAB));
    color: #fff;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(46, 204, 113, .35);
    opacity: 0;
    transform: translateY(16px) scale(.85);
    transition: opacity .3s ease, transform .3s ease, box-shadow .2s ease;
    pointer-events: none;
}

#cb-btt.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#cb-btt:hover {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 8px 24px rgba(46, 204, 113, .45);
}

/* ── ANNOUNCEMENT BAR DISMISS BUTTON ─────────────────────── */
.cb-ann-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .7);
    font-size: .85rem;
    cursor: pointer;
    margin-left: 1rem;
    padding: .1rem .4rem;
    border-radius: 4px;
    transition: color .2s, background .2s;
    vertical-align: middle;
}

.cb-ann-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, .15);
}

/* ── NAV SCROLLED STATE ───────────────────────────────────── */
.cb-nav.scrolled {
    box-shadow: 0 4px 24px rgba(46, 204, 113, .12);
}

/* ── HERO ENTRY ANIMATIONS ────────────────────────────────── */
.hero-content {
    animation: cbSlideUp .7s cubic-bezier(.22, 1, .36, 1) both;
}

.hero-visual {
    animation: cbSlideUp .7s cubic-bezier(.22, 1, .36, 1) .15s both;
}

@keyframes cbSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── SOLAR ANIM (hero icon) ───────────────────────────────── */
.solar-anim {
    animation: cbSpin 18s linear infinite, cbFloat 4s ease-in-out infinite;
    display: inline-block;
}

@keyframes cbSpin {
    from {
        filter: hue-rotate(0deg);
    }

    to {
        filter: hue-rotate(360deg);
    }
}

/* ── FLOATING CARDS ───────────────────────────────────────── */
.floating-card {
    animation: cbFloatCard 5s ease-in-out infinite !important;
}

.floating-card.fc2 {
    animation-delay: 2.5s !important;
}

@keyframes cbFloatCard {

    0%,
    100% {
        transform: translateY(0) rotate(-1deg);
    }

    50% {
        transform: translateY(-10px) rotate(1deg);
    }
}

/* ── HERO BADGE PULSE ─────────────────────────────────────── */
.hero-badge .dot {
    animation: cbDot 2s ease-in-out infinite;
}

@keyframes cbDot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .4;
        transform: scale(.7);
    }
}

/* ── BRANDS STRIP SCROLL ──────────────────────────────────── */
.brands-track {
    animation: cbScroll 22s linear infinite;
}

@keyframes cbScroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

/* ── CATEGORY CARD HOVER ICON SPIN ───────────────────────── */
.cat-card:hover .cat-icon {
    animation: cbWiggle .4s ease;
}

@keyframes cbWiggle {

    0%,
    100% {
        transform: scale(1.1) rotate(0deg);
    }

    25% {
        transform: scale(1.15) rotate(-8deg);
    }

    75% {
        transform: scale(1.15) rotate(8deg);
    }
}

/* ── PRODUCT CARD IMAGE ZOOM ON HOVER ─────────────────────── */
.prod-card .prod-img img {
    transition: transform .45s ease;
}

.prod-card:hover .prod-img img {
    transform: scale(1.07);
}

/* ── WHY CARD ICON BOUNCE ─────────────────────────────────── */
.why-card:hover .why-icon {
    animation: cbBounce .5s ease;
}

@keyframes cbBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-8px);
    }

    70% {
        transform: translateY(-3px);
    }
}

/* ── STEP NUMBER PULSE ────────────────────────────────────── */
.how-step:hover .step-num {
    animation: cbPop .35s ease;
}

@keyframes cbPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* ── BLOG CARD THUMB OVERLAY ──────────────────────────────── */
.blog-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .35) 0%, transparent 60%);
    opacity: 0;
    transition: opacity .3s ease;
}

.blog-card:hover .blog-thumb::after {
    opacity: 1;
}

/* ── CTA BANNER SHIMMER ───────────────────────────────────── */
.cta-banner::after {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 60%;
    height: 300%;
    background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .04) 50%, transparent 60%);
    animation: cbShimmer 5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cbShimmer {
    0% {
        left: -100%;
        top: -100%;
    }

    100% {
        left: 200%;
        top: 200%;
    }
}

/* ── WHATSAPP BUTTON RING PULSE ───────────────────────────── */
.wa-btn {
    animation: cbWaRing 3s ease-in-out infinite;
}

@keyframes cbWaRing {

    0%,
    100% {
        box-shadow: 0 8px 28px rgba(37, 211, 102, .45);
    }

    50% {
        box-shadow: 0 8px 28px rgba(37, 211, 102, .45), 0 0 0 14px rgba(37, 211, 102, .1);
    }
}

.wa-btn:hover {
    animation: none;
    transform: scale(1.12);
}

/* ── STAT CARD NUMBER GLOW ────────────────────────────────── */
.stat-card.cb-revealed .num {
    animation: cbNumGlow .8s ease .3s both;
}

@keyframes cbNumGlow {
    from {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.4) drop-shadow(0 0 8px rgba(46, 204, 113, .5));
    }

    to {
        filter: brightness(1);
    }
}

/* ── THEME TOGGLE SPIN ────────────────────────────────────── */
.theme-toggle:active {
    animation: cbSpin360 .4s ease;
}

@keyframes cbSpin360 {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ── MOBILE MENU SLIDE ────────────────────────────────────── */
.mobile-menu {
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}

.mobile-menu.open {
    transform: translateX(0);
}

/* ── DROPDOWN FADE ────────────────────────────────────────── */
.dropdown-menu {
    animation: cbDropIn .22s ease;
}

@keyframes cbDropIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ── FORM SUBMIT SUCCESS MODAL ────────────────────────────── */
#cbFormModal .modal-inner {
    animation: cbModalPop .35s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes cbModalPop {
    from {
        opacity: 0;
        transform: scale(.88) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ── PAGE LOAD FADE-IN ────────────────────────────────────── */
body {
    animation: cbFadeIn .4s ease both;
}

@keyframes cbFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── PRODUCT BADGE ENTRANCE ───────────────────────────────── */
.prod-badge {
    animation: cbBadgePop .5s cubic-bezier(.22, 1, .36, 1) .3s both;
}

@keyframes cbBadgePop {
    from {
        opacity: 0;
        transform: scale(.7) rotate(-8deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* ── FOCUS RING (accessibility) ───────────────────────────── */
:focus-visible {
    outline: 2px solid var(--leaf, #2ECC71);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ── REDUCED MOTION ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .cb-reveal {
        opacity: 1;
        transform: none;
    }
}