/* =============================================================
   WC Free Shipping Bar — Frontend Styles
   Version: 1.0.0
   ============================================================= */

/* ── Wrapper ───────────────────────────────────────────────── */
.wcfsb-bar {
    display: block;
    padding: 14px 18px 12px;
    margin: 0 0 16px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
    transition: background 0.4s ease, color 0.4s ease;
    overflow: hidden;
}

/* Slide-down entry animation */
.wcfsb-bar.wcfsb-anim-slide {
    animation: wcfsb-slide-down 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* Fade-in entry animation */
.wcfsb-bar.wcfsb-anim-fade {
    animation: wcfsb-fade-in 0.5s ease both;
}

@keyframes wcfsb-slide-down {
    from {
        opacity: 0;
        transform: translateY(-12px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
    }
}

@keyframes wcfsb-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Message ───────────────────────────────────────────────── */
.wcfsb-message {
    margin: 0 0 10px;
    font-size: 13.5px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.01em;
}

.wcfsb-achieved .wcfsb-message {
    font-size: 14px;
}

/* ── Progress Track ────────────────────────────────────────── */
.wcfsb-track {
    position: relative;
    width: 100%;
    height: 10px;
    overflow: hidden;
}

.wcfsb-track.wcfsb-track--lg {
    height: 14px;
}

/* ── Progress Fill ─────────────────────────────────────────── */
.wcfsb-fill {
    height: 100%;
    min-width: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.4s ease;
    position: relative;
    overflow: hidden;
}

/* Shimmer/shine sweep */
.wcfsb-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0)   0%,
        rgba(255,255,255,0.35) 50%,
        rgba(255,255,255,0)   100%
    );
    animation: wcfsb-shimmer 2.2s ease-in-out infinite;
}

@keyframes wcfsb-shimmer {
    0%   { left: -60%; }
    100% { left: 120%; }
}

/* ── Labels row ────────────────────────────────────────────── */
.wcfsb-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 11px;
    opacity: 0.7;
}

.wcfsb-label-percent {
    font-weight: 700;
    opacity: 1;
    font-size: 12px;
}

/* ── Success state ─────────────────────────────────────────── */
.wcfsb-achieved .wcfsb-fill::after {
    animation: none; /* disable shimmer on completion */
}

/* Pulse on achievement */
.wcfsb-achieved {
    animation: wcfsb-pulse-border 0.7s ease 1;
}

@keyframes wcfsb-pulse-border {
    0%   { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* ── Mini-cart / cart drawer specific adjustments ──────────── */
.widget_shopping_cart .wcfsb-bar,
.woocommerce-mini-cart .wcfsb-bar,
[class*="cart-drawer"] .wcfsb-bar,
[class*="side-cart"] .wcfsb-bar,
[class*="offcanvas-cart"] .wcfsb-bar {
    margin: 0;
    border-radius: 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.07);
}

/* ── Elementor Menu Cart Widget ────────────────────────────── */
.elementor-menu-cart__main .wcfsb-bar {
    border-radius: 0 !important;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
    .wcfsb-bar {
        padding: 12px 14px 10px;
        font-size: 13px;
    }

    .wcfsb-message {
        font-size: 13px;
    }
}

/* ── Dark mode support (prefers-color-scheme) ──────────────── */
@media (prefers-color-scheme: dark) {
    .wcfsb-bar:not([style*="background"]) {
        background: #1e1e1e;
        color: #f0f0f0;
    }
}

/* ── Fragment wrapper (invisible) ──────────────────────────── */
.wcfsb-bar-fragment {
    display: contents; /* transparent wrapper, no layout impact */
}

/* ── WooCommerce cart-page spacing fix ─────────────────────── */
.woocommerce-cart .wcfsb-bar {
    margin-bottom: 20px;
}


/* ── Deduplication safety net ──────────────────────────────── */
/* If two .wcfsb-bar elements are siblings, hide all after the first */
.wcfsb-bar ~ .wcfsb-bar {
    display: none !important;
}
