/* ==========================================================================
   Awk_FreeShippingBar - Frontend Styles
   ========================================================================== */

/* Container reset */
#awk-free-shipping-bar {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
}

#awk-free-shipping-bar *,
#awk-free-shipping-bar *::before,
#awk-free-shipping-bar *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Wrapper - Positioning
   ========================================================================== */

.fsb-wrapper {
    width: 100%;
    z-index: 9999;
    position: relative;
    overflow: hidden;
    transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Static top (in content flow) */
.fsb-wrapper.fsb-position-top {
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Fixed top */
.fsb-wrapper.fsb-position-fixed-top {
    position: fixed;
    top: 0;
    left: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

/* Fixed bottom */
.fsb-wrapper.fsb-position-fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Entrance Animations
   ========================================================================== */

.fsb-wrapper.fsb-position-top,
.fsb-wrapper.fsb-position-fixed-top {
    animation: fsb-slide-down 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.fsb-wrapper.fsb-position-fixed-bottom {
    animation: fsb-slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fsb-slide-down {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fsb-slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==========================================================================
   Inner Layout
   ========================================================================== */

.fsb-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 11px 24px;
    gap: 14px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

/* ==========================================================================
   Icon
   ========================================================================== */

.fsb-icon {
    font-size: 18px;
    flex-shrink: 0;
    animation: fsb-bounce 2s ease-in-out infinite;
}

@keyframes fsb-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* ==========================================================================
   Message
   ========================================================================== */

.fsb-message {
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.fsb-message strong {
    font-weight: 700;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.fsb-progress-track {
    flex: 0 0 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.fsb-progress-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    min-width: 0;
}

/* Shimmer animation on the progress fill */
.fsb-progress-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: fsb-shimmer 2.5s ease-in-out infinite;
}

@keyframes fsb-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

/* ==========================================================================
   Percentage Text
   ========================================================================== */

.fsb-percentage {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
    min-width: 35px;
    text-align: right;
    flex-shrink: 0;
}

/* ==========================================================================
   Close Button
   ========================================================================== */

.fsb-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 22px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
    padding: 0;
    margin-left: 6px;
    line-height: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
}

.fsb-close:hover {
    opacity: 1;
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.12);
}

.fsb-close:active {
    transform: scale(0.95);
}

/* ==========================================================================
   Achievement State
   ========================================================================== */

.fsb-wrapper.fsb-achieved {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

/* Celebration icon animation */
.fsb-wrapper.fsb-achieved .fsb-icon {
    animation: fsb-celebrate-icon 0.8s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes fsb-celebrate-icon {
    0% {
        transform: scale(1) rotate(0deg);
    }
    20% {
        transform: scale(1.4) rotate(-12deg);
    }
    40% {
        transform: scale(1.4) rotate(12deg);
    }
    60% {
        transform: scale(1.2) rotate(-6deg);
    }
    80% {
        transform: scale(1.1) rotate(3deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Achievement shimmer overlay */
.fsb-wrapper.fsb-achieved::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    animation: fsb-achieved-shimmer 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes fsb-achieved-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Pulse glow for fixed positions */
.fsb-wrapper.fsb-achieved.fsb-position-fixed-top {
    animation: fsb-slide-down 0.6s cubic-bezier(0.16, 1, 0.3, 1) both,
               fsb-glow-top 2.5s ease-in-out infinite 0.6s;
}

.fsb-wrapper.fsb-achieved.fsb-position-fixed-bottom {
    animation: fsb-slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) both,
               fsb-glow-bottom 2.5s ease-in-out infinite 0.6s;
}

@keyframes fsb-glow-top {
    0%, 100% {
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 4px 25px rgba(0, 212, 170, 0.35);
    }
}

@keyframes fsb-glow-bottom {
    0%, 100% {
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 -4px 25px rgba(0, 212, 170, 0.35);
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .fsb-inner {
        padding: 10px 16px;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .fsb-icon {
        font-size: 16px;
    }

    .fsb-message {
        font-size: 12px;
        white-space: normal;
        text-align: center;
        flex: 1 1 auto;
    }

    .fsb-progress-track {
        flex: 1 1 100%;
        order: 10;
        height: 6px;
    }

    .fsb-percentage {
        display: none;
    }

    .fsb-close {
        position: absolute;
        right: 8px;
        top: 6px;
        font-size: 18px;
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .fsb-inner {
        padding: 8px 12px;
        gap: 6px;
    }

    .fsb-message {
        font-size: 11px;
    }

    .fsb-progress-track {
        height: 5px;
    }
}
