/**
 * Free Shipping Progress Bar Widget Styles
 */

.free-shipping-notice {
    position: relative;
    overflow: visible;
    z-index: 1;
}

/* Allow celebrations to overflow the widget boundaries */
.free-shipping-notice.fsw-celebrating {
    overflow: visible !important;
}

.free-shipping-notice.fsw-celebrating * {
    overflow: visible !important;
}

.free-shipping-notice-text {
    margin-bottom: 15px;
}

.free-shipping-progress-bar {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: flex !important;
    flex-direction: row;
    min-height: 20px;
    border-radius: 10px;
}

/* Allow overflow during celebrations */
.free-shipping-progress-bar.fsw-celebration {
    overflow: visible !important;
}

.free-shipping-progress-fill,
.free-shipping-progress-remaining {
    overflow: hidden;
    border-radius: inherit;
}

.free-shipping-progress-fill {
    transition: width 0.3s ease-in-out;
    flex-shrink: 0;
    align-self: stretch;
}

.free-shipping-progress-remaining {
    transition: width 0.3s ease-in-out;
    flex-shrink: 0;
    align-self: stretch;
}

/* Fix rounded corners */
.free-shipping-progress-bar:not(.free-shipping-progress-bar--rtl) .free-shipping-progress-fill {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.free-shipping-progress-bar:not(.free-shipping-progress-bar--rtl) .free-shipping-progress-remaining {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* RTL Support */
.free-shipping-progress-bar--rtl {
    flex-direction: row-reverse;
}

.free-shipping-progress-bar--rtl .free-shipping-progress-fill {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.free-shipping-progress-bar--rtl .free-shipping-progress-remaining {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Ensure visibility */
.free-shipping-notice * {
    box-sizing: border-box;
}

.free-shipping-progress-bar,
.free-shipping-progress-fill,
.free-shipping-progress-remaining {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Stripes animation */
@keyframes stripes-animation {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 20px 20px;
    }
}

/* =============================================
   Progress Bar Style Presets
   ============================================= */

/* Glossy Style */
.fsw-style-glossy .free-shipping-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 100%);
    border-radius: inherit;
    pointer-events: none;
}

/* Neon Style */
.fsw-style-neon .free-shipping-progress-fill {
    position: relative;
}

.fsw-style-neon .free-shipping-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 50%);
    border-radius: inherit;
}

/* Glass Style */
.fsw-style-glass .free-shipping-progress-fill {
    position: relative;
}

/* Cyberpunk Style */
.fsw-style-cyber::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff00ff, #00ffff, #ff00ff);
    border-radius: inherit;
    z-index: -1;
    animation: fsw-cyber-border 2s linear infinite;
    background-size: 200% 200%;
}

@keyframes fsw-cyber-border {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 3D Style */
.fsw-style-3d .free-shipping-progress-fill {
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), inset 0 3px 0 rgba(255, 255, 255, 0.2);
}

/* Gradient Style */
.fsw-style-gradient .free-shipping-progress-fill {
    background: linear-gradient(90deg, #4caf50, #8bc34a, #cddc39);
}

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

/* Pulse Animation */
.fsw-animate-pulse .free-shipping-progress-fill {
    animation: fsw-pulse 2s ease-in-out infinite;
}

@keyframes fsw-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Shimmer Animation */
.fsw-animate-shimmer .free-shipping-progress-fill {
    position: relative;
    overflow: hidden;
}

.fsw-animate-shimmer .free-shipping-progress-fill::before {
    content: '';
    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: fsw-shimmer 2s ease-in-out infinite;
}

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

/* Wave Animation */
.fsw-animate-wave .free-shipping-progress-fill {
    position: relative;
    overflow: hidden;
}

.fsw-animate-wave .free-shipping-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 25%, transparent 50%, rgba(255, 255, 255, 0.2) 75%, transparent 100%);
    background-size: 200% 100%;
    animation: fsw-wave 1.5s ease-in-out infinite;
}

@keyframes fsw-wave {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Glow Animation */
.fsw-animate-glow .free-shipping-progress-fill {
    animation: fsw-glow 2s ease-in-out infinite;
}

@keyframes fsw-glow {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 5px currentColor); }
    50% { filter: brightness(1.2) drop-shadow(0 0 15px currentColor); }
}

/* Direction indicator */
.free-shipping-indicator {
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 10;
    line-height: 1;
}

/* RTL indicator - transform is now handled inline in PHP */

/* =============================================
   Engagement Mode Styles
   ============================================= */

.fsw-engagement {
    position: relative;
}

/* Milestone Markers */
.fsw-milestone-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
}

.fsw-milestone-marker--reached .fsw-milestone-dot,
.fsw-milestone-marker--reached .fsw-milestone-line {
    background-color: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

.fsw-milestone-marker--pending .fsw-milestone-dot,
.fsw-milestone-marker--pending .fsw-milestone-line {
    background-color: rgba(255, 255, 255, 0.6);
}

.fsw-milestone-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.fsw-milestone-marker--reached .fsw-milestone-dot {
    border-color: #4caf50;
    animation: fsw-milestone-pop 0.5s ease;
}

.fsw-milestone-line {
    width: 3px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.fsw-milestone-icon {
    font-size: 16px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.fsw-milestone-marker--reached .fsw-milestone-icon {
    animation: fsw-milestone-pop 0.5s ease;
}

.fsw-milestone-marker--pending .fsw-milestone-icon {
    opacity: 0.5;
    filter: grayscale(0.8);
}

.fsw-milestone-label {
    position: absolute;
    top: calc(100% + 4px);
    font-size: 10px;
    font-weight: 600;
    color: #666;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.fsw-milestone-marker:hover .fsw-milestone-label {
    opacity: 1;
    visibility: visible;
}

@keyframes fsw-milestone-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Encouraging Message */
.fsw-encouraging-message {
    text-align: center;
    padding: 10px 15px;
    margin-top: 10px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 152, 0, 0.1) 100%);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #856404;
    animation: fsw-message-appear 0.4s ease-out;
}

@keyframes fsw-message-appear {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Urgency Pulse */
.fsw-urgency-pulse .free-shipping-progress-fill {
    animation: fsw-urgency-pulse 0.8s ease-in-out infinite;
}

@keyframes fsw-urgency-pulse {
    0%, 100% { filter: brightness(1); box-shadow: 0 0 5px rgba(255, 152, 0, 0.3); }
    50% { filter: brightness(1.15); box-shadow: 0 0 15px rgba(255, 152, 0, 0.6); }
}

/* =============================================
   Celebration Effects
   ============================================= */

/* Celebration container - appended to body for proper positioning */
.fsw-celebration-container {
    position: absolute;
    overflow: visible !important;
    pointer-events: none;
    z-index: 999999;
}

.fsw-celebration .free-shipping-progress-fill {
    animation: fsw-celebration-glow 1s ease-in-out infinite;
}

@keyframes fsw-celebration-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(76, 175, 80, 0.5), 0 0 20px rgba(76, 175, 80, 0.3); }
    50% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.8), 0 0 40px rgba(76, 175, 80, 0.5), 0 0 60px rgba(76, 175, 80, 0.3); }
}

/* Confetti Celebration - Realistic Particle Based */
.fsw-celebration-confetti .fsw-confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible !important;
    pointer-events: none;
}

.fsw-confetti-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 1;
    will-change: transform, opacity;
}

.fsw-confetti-particle.square {
    border-radius: 2px;
}

.fsw-confetti-particle.circle {
    border-radius: 50%;
}

.fsw-confetti-particle.ribbon {
    width: 8px;
    height: 20px;
    border-radius: 2px;
}

.fsw-confetti-particle.star {
    width: 0;
    height: 0;
    background: transparent !important;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid currentColor;
}

/* Fireworks Celebration - Realistic Particle Based */
.fsw-celebration-fireworks .fsw-fireworks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible !important;
    pointer-events: none;
}

.fsw-firework-particle {
    position: absolute;
    border-radius: 50%;
    will-change: transform, opacity;
}

.fsw-firework-trail {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    will-change: transform, opacity;
}

.fsw-firework-spark {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px currentColor;
    will-change: transform, opacity;
}

/* Sparkle Celebration */
.fsw-celebration-sparkle .fsw-sparkle-burst {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 215, 0, 1) 3px, transparent 3px),
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 1) 2px, transparent 2px),
        radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.9) 4px, transparent 4px),
        radial-gradient(circle at 70% 25%, rgba(255, 255, 255, 1) 3px, transparent 3px),
        radial-gradient(circle at 90% 35%, rgba(255, 215, 0, 0.8) 2px, transparent 2px);
    animation: fsw-sparkle-twinkle 0.6s ease-in-out infinite;
}

@keyframes fsw-sparkle-twinkle {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* Bounce Celebration */
.fsw-celebration-bounce .fsw-bounce-celebrate {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: fsw-bounce-celebrate 0.5s ease-in-out infinite;
}

@keyframes fsw-bounce-celebrate {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -70%) scale(1.3); }
}

/* Party Popper Celebration */
.fsw-celebration-party .fsw-party-popper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10%;
}

.fsw-celebration-party .fsw-party-left,
.fsw-celebration-party .fsw-party-right {
    font-size: 40px;
    animation: fsw-party-pop 0.8s ease-out infinite;
}

.fsw-celebration-party .fsw-party-right {
    animation-delay: 0.2s;
    transform: scaleX(-1);
}

.fsw-celebration-party .fsw-party-center {
    font-size: 50px;
    animation: fsw-party-pulse 0.6s ease-in-out infinite;
}

@keyframes fsw-party-pop {
    0%, 100% { transform: rotate(-15deg) scale(1); }
    50% { transform: rotate(15deg) scale(1.2); }
}

@keyframes fsw-party-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Stars Celebration */
.fsw-celebration-stars .fsw-stars {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.fsw-celebration-stars .fsw-star {
    position: absolute;
    font-size: 24px;
    animation: fsw-star-float 2s ease-in-out infinite;
}

.fsw-celebration-stars .fsw-star:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; color: #ffd93d; }
.fsw-celebration-stars .fsw-star:nth-child(2) { left: 25%; top: 60%; animation-delay: 0.3s; color: #ff6b6b; }
.fsw-celebration-stars .fsw-star:nth-child(3) { left: 40%; top: 30%; animation-delay: 0.6s; color: #6bcb77; }
.fsw-celebration-stars .fsw-star:nth-child(4) { left: 55%; top: 70%; animation-delay: 0.9s; color: #4d96ff; }
.fsw-celebration-stars .fsw-star:nth-child(5) { left: 70%; top: 25%; animation-delay: 1.2s; color: #c678dd; }
.fsw-celebration-stars .fsw-star:nth-child(6) { left: 85%; top: 55%; animation-delay: 1.5s; color: #ff9f43; }

@keyframes fsw-star-float {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 0.6; }
    50% { transform: translateY(-20px) rotate(180deg) scale(1.4); opacity: 1; }
}

/* Hearts Celebration */
.fsw-celebration-hearts .fsw-hearts {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.fsw-celebration-hearts .fsw-heart {
    position: absolute;
    bottom: -20px;
    font-size: 20px;
    animation: fsw-heart-float 2.5s ease-out infinite;
}

.fsw-celebration-hearts .fsw-heart:nth-child(1) { left: 10%; animation-delay: 0s; font-size: 24px; }
.fsw-celebration-hearts .fsw-heart:nth-child(2) { left: 30%; animation-delay: 0.5s; font-size: 18px; }
.fsw-celebration-hearts .fsw-heart:nth-child(3) { left: 50%; animation-delay: 0.3s; font-size: 22px; }
.fsw-celebration-hearts .fsw-heart:nth-child(4) { left: 70%; animation-delay: 0.8s; font-size: 20px; }
.fsw-celebration-hearts .fsw-heart:nth-child(5) { left: 90%; animation-delay: 0.6s; font-size: 24px; }

@keyframes fsw-heart-float {
    0% { transform: translateY(0) scale(0); opacity: 0; }
    10% { opacity: 1; transform: translateY(0) scale(1); }
    100% { transform: translateY(-180px) scale(0.5); opacity: 0; }
}

/* Trophy Celebration */
.fsw-celebration-trophy .fsw-trophy {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60px;
    animation: fsw-trophy-shine 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
}

@keyframes fsw-trophy-shine {
    0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(-5deg); filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8)); }
    50% { transform: translate(-50%, -50%) scale(1.15) rotate(5deg); filter: drop-shadow(0 0 25px rgba(255, 215, 0, 1)); }
}

/* Rainbow Celebration */
.fsw-celebration-rainbow .fsw-rainbow {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 100px;
    border-radius: 100px 100px 0 0;
    background: linear-gradient(180deg, #ff6b6b 0%, #ff9f43 14%, #ffd93d 28%, #6bcb77 42%, #4d96ff 56%, #667eea 70%, #c678dd 84%, #ff6b9d 100%);
    opacity: 0.8;
    animation: fsw-rainbow-appear 1.5s ease-out infinite;
}

.fsw-celebration-rainbow .fsw-rainbow::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 0;
    background: white;
    border-radius: 85px 85px 0 0;
}

@keyframes fsw-rainbow-appear {
    0% { transform: translateX(-50%) scaleY(0); opacity: 0; }
    30% { transform: translateX(-50%) scaleY(1.1); opacity: 1; }
    100% { transform: translateX(-50%) scaleY(1); opacity: 0.8; }
}

/* RTL Support for Milestone Markers */
[dir="rtl"] .fsw-milestone-marker {
    transform: translate(50%, -50%);
}

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

@media (max-width: 768px) {
    .fsw-milestone-dot {
        width: 10px;
        height: 10px;
    }

    .fsw-milestone-line {
        width: 2px;
        height: 18px;
    }

    .fsw-milestone-icon {
        font-size: 14px;
    }

    .fsw-encouraging-message {
        font-size: 13px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .fsw-milestone-label {
        display: none;
    }

    .fsw-milestone-dot {
        width: 8px;
        height: 8px;
    }

    .fsw-milestone-icon {
        font-size: 12px;
    }

    .fsw-encouraging-message {
        font-size: 12px;
    }

    .fsw-celebration-bounce .fsw-bounce-celebrate {
        font-size: 22px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .fsw-urgency-pulse .free-shipping-progress-fill,
    .fsw-milestone-marker--reached .fsw-milestone-dot,
    .fsw-milestone-marker--reached .fsw-milestone-icon,
    .fsw-celebration-confetti .fsw-confetti::before,
    .fsw-celebration-confetti .fsw-confetti::after,
    .fsw-celebration-fireworks .fsw-fireworks::before,
    .fsw-celebration-fireworks .fsw-fireworks::after,
    .fsw-celebration-sparkle .fsw-sparkle-burst,
    .fsw-celebration-bounce .fsw-bounce-celebrate {
        animation: none;
    }
}
