/* WCFSB Frontend Styles */

:root {
    --wcfsb-bar-color: #10b981;
    --wcfsb-bar-bg: #e5e7eb;
    --wcfsb-announcement-bg: #fef3c7;
    --wcfsb-announcement-text: #92400e;
}

/* Reset */
.wcfsb-bar *,
.wcfsb-inline *,
.wcfsb-mini * {
    box-sizing: border-box;
}

/* ==========================================
   Announcement Bar (Top of page)
   ========================================== */

.wcfsb-announcement_bar {
    position: relative;
    z-index: 999999;
    background: var(--wcfsb-announcement-bg);
    animation: wcfsb-fade-in 0.3s ease-out;
}

.wcfsb-announcement_bar .wcfsb-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
}

.wcfsb-announcement_bar .wcfsb-bar-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.wcfsb-announcement_bar .wcfsb-bar-icon {
    color: var(--wcfsb-announcement-text);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.wcfsb-announcement_bar .wcfsb-bar-message {
    font-size: 14px;
    font-weight: 600;
    color: var(--wcfsb-announcement-text);
    text-align: center;
}

.wcfsb-announcement_bar .wcfsb-bar-checkmark {
    color: var(--wcfsb-bar-color);
    display: flex;
    align-items: center;
    animation: wcfsb-pop 0.3s ease;
}

@keyframes wcfsb-pop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.wcfsb-announcement_bar .wcfsb-bar-progress {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.wcfsb-announcement_bar .wcfsb-bar-progress-track {
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.wcfsb-announcement_bar .wcfsb-bar-progress-fill {
    height: 100%;
    background: var(--wcfsb-bar-color);
    border-radius: 4px;
    transition: width 0.5s ease;
    position: relative;
}

.wcfsb-announcement_bar .wcfsb-bar-progress-fill.achieved {
    background: var(--wcfsb-bar-color);
}

.wcfsb-announcement_bar .wcfsb-bar-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: wcfsb-shimmer 2s infinite;
}

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

/* Milestones */
.wcfsb-bar-milestones {
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 24px;
    pointer-events: none;
}

.wcfsb-milestone {
    position: absolute;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: white;
    border: 2px solid var(--wcfsb-bar-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wcfsb-announcement-text);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.wcfsb-milestone.achieved {
    background: var(--wcfsb-bar-color);
    border-color: var(--wcfsb-bar-color);
    color: white;
}

.wcfsb-milestone[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: #1f2937;
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    margin-bottom: 8px;
}

.wcfsb-milestone:hover[data-tooltip]::before {
    opacity: 1;
    visibility: visible;
}


/* ==========================================
   Floating Bar (Bottom sticky)
   ========================================== */

.wcfsb-floating_bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 999999;
    width: calc(100% - 40px);
    max-width: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: wcfsb-float-up 0.5s ease forwards;
}

@keyframes wcfsb-float-up {
    to {
        transform: translateX(-50%) translateY(0);
    }
}

.wcfsb-floating_bar .wcfsb-bar-inner {
    padding: 16px 20px;
}

.wcfsb-floating_bar .wcfsb-bar-content {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.wcfsb-floating_bar .wcfsb-bar-icon {
    width: 40px;
    height: 40px;
    background: var(--wcfsb-announcement-bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wcfsb-announcement-text);
    flex-shrink: 0;
}

.wcfsb-floating_bar .wcfsb-bar-message {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
}

.wcfsb-floating_bar .wcfsb-bar-checkmark {
    width: 28px;
    height: 28px;
    background: var(--wcfsb-bar-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    animation: wcfsb-pop 0.3s ease;
}

.wcfsb-floating_bar .wcfsb-bar-progress {
    position: relative;
}

.wcfsb-floating_bar .wcfsb-bar-progress-track {
    height: 8px;
    background: var(--wcfsb-bar-bg);
    border-radius: 4px;
    overflow: hidden;
}

.wcfsb-floating_bar .wcfsb-bar-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--wcfsb-bar-color), #34d399);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ==========================================
   Inline (Cart/Checkout)
   ========================================== */

.wcfsb-cart-inline,
.wcfsb-checkout-inline {
    margin-bottom: 24px;
}

.wcfsb-inline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wcfsb-inline-goal {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    transition: all 0.3s ease;
}

.wcfsb-inline-goal.achieved {
    border-color: var(--wcfsb-bar-color);
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.wcfsb-inline-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.wcfsb-inline-icon {
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    flex-shrink: 0;
}

.wcfsb-inline-goal.achieved .wcfsb-inline-icon {
    background: var(--wcfsb-bar-color);
    color: white;
}

.wcfsb-inline-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.wcfsb-inline-check {
    width: 24px;
    height: 24px;
    background: var(--wcfsb-bar-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.wcfsb-inline-progress {
    height: 8px;
    background: var(--wcfsb-bar-bg);
    border-radius: 4px;
    overflow: hidden;
}

.wcfsb-inline-progress-fill {
    height: 100%;
    background: var(--wcfsb-bar-color);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.wcfsb-inline-progress-fill.achieved {
    background: linear-gradient(90deg, var(--wcfsb-bar-color), #34d399);
}

/* ==========================================
   Mini Cart
   ========================================== */

.wcfsb-mini-cart {
    margin-bottom: 12px;
}

.wcfsb-mini {
    background: var(--wcfsb-announcement-bg);
    border-radius: 8px;
    padding: 12px;
}

.wcfsb-mini-content {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.wcfsb-mini-icon {
    color: var(--wcfsb-announcement-text);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.wcfsb-mini-message {
    font-size: 12px;
    font-weight: 600;
    color: var(--wcfsb-announcement-text);
    line-height: 1.3;
}

.wcfsb-mini-progress {
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.wcfsb-mini-progress-fill {
    height: 100%;
    background: var(--wcfsb-bar-color);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ==========================================
   Style Variations
   ========================================== */

/* Rounded Style */
.wcfsb-style-rounded .wcfsb-bar-progress-track,
.wcfsb-style-rounded .wcfsb-bar-progress-fill,
.wcfsb-style-rounded .wcfsb-inline-progress,
.wcfsb-style-rounded .wcfsb-inline-progress-fill {
    border-radius: 20px;
}

.wcfsb-style-rounded .wcfsb-bar-progress-track,
.wcfsb-style-rounded .wcfsb-inline-progress {
    height: 12px;
}

/* Minimal Style */
.wcfsb-style-minimal .wcfsb-bar-progress-track,
.wcfsb-style-minimal .wcfsb-inline-progress {
    height: 4px;
    border-radius: 0;
}

.wcfsb-style-minimal .wcfsb-bar-progress-fill,
.wcfsb-style-minimal .wcfsb-inline-progress-fill {
    border-radius: 0;
}

/* ==========================================
   Celebration Animation
   ========================================== */

.wcfsb-celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999999;
}

.wcfsb-confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: wcfsb-confetti-fall 3s ease-out forwards;
}

@keyframes wcfsb-confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-100px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

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

@media (max-width: 768px) {
    .wcfsb-announcement_bar .wcfsb-bar-inner {
        padding: 10px 16px;
    }

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

    .wcfsb-floating_bar {
        bottom: 10px;
        width: calc(100% - 20px);
        border-radius: 10px;
    }

    .wcfsb-floating_bar .wcfsb-bar-inner {
        padding: 12px 16px;
    }

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

    .wcfsb-bar-milestones {
        display: none;
    }
}

/* ==========================================
   Dark Mode Support
   ========================================== */

@media (prefers-color-scheme: dark) {
    .wcfsb-inline-goal {
        background: #1f2937;
        border-color: #374151;
    }

    .wcfsb-inline-goal.achieved {
        background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
        border-color: var(--wcfsb-bar-color);
    }

    .wcfsb-inline-message {
        color: #f9fafb;
    }

    .wcfsb-inline-icon {
        background: #374151;
        color: #9ca3af;
    }

    .wcfsb-floating_bar {
        background: #1f2937;
    }

    .wcfsb-floating_bar .wcfsb-bar-message {
        color: #f9fafb;
    }

    .wcfsb-floating_bar .wcfsb-bar-icon {
        background: #374151;
    }
}

/* ==========================================
   Print Styles
   ========================================== */

@media print {
    .wcfsb-bar,
    .wcfsb-celebration {
        display: none !important;
    }
}

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

.wcfsb-bar,
.wcfsb-inline,
.wcfsb-mini {
    animation: wcfsb-fade-in 0.3s ease;
}

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

/* Pulse animation for close-to-goal state */
.wcfsb-bar-progress-fill[style*="width: 9"],
.wcfsb-inline-progress-fill[style*="width: 9"] {
    animation: wcfsb-pulse 1.5s ease infinite;
}

@keyframes wcfsb-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}
