/* assets/css/frontend-styles.css */
/* Simple Woo Promo - Modern Flash Sale Bar (v2.0) */

.swp-flash-sale-bar {
    --swp-primary: #ff2468;
    --swp-accent: #ff5743;
    --swp-radius: 14px;

    position: relative;
    display: block;
    width: 100%;
    max-width: 650px;
    margin: 0 0 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    border-radius: var(--swp-radius);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    background: #fff;
    border: 1px solid rgba(255, 36, 104, 0.18);
    animation: swp-fade-in 0.35s ease-out;
    box-sizing: border-box;
    container-type: inline-size;
    container-name: swp-promo;
}

.swp-flash-sale-bar * {
    box-sizing: border-box;
}

.swp-bar-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
}

/* ---------- Badge / Label ---------- */

.swp-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.swp-ends-in-label {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
}

.flash-sale-label {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 6px;
    background: linear-gradient(90deg, var(--swp-primary) 0%, var(--swp-accent) 100%);
    color: #fff;
    padding: 5px 14px;
    border-radius: 999px;
    font-weight: 800;
    font-style: italic;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15);
}

.swp-flash-sale-bar .flash-icon {
    font-size: 15px;
    line-height: 1;
    animation: swp-pulse-icon 1.6s ease-in-out infinite;
}

/* ---------- Countdown + Progress row ---------- */

.flash-sale-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.flash-sale-countdown {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #555;
    flex-wrap: nowrap;
    flex-basis: 100%;
}

.flash-sale-countdown .timer-text {
    display: none;
}

.flash-sale-countdown .time-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 8px 6px;
    flex: 1;
    line-height: 1.2;
}

.flash-sale-countdown .time-value {
    color: var(--swp-primary);
    font-weight: 800;
    font-size: 18px;
}

.flash-sale-countdown .time-unit {
    color: #999;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.flash-sale-countdown .swp-expired-text {
    color: var(--swp-primary);
    font-weight: 700;
    font-size: 12px;
}

/* ---------- Progress bar ---------- */

.swp-flash-sale-bar .flash-sale-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 100%;
    justify-content: space-between;
}

.swp-flash-sale-bar .sold-count {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}

.swp-flash-sale-bar .sold-value {
    font-weight: 700;
    color: #555;
}

.swp-flash-sale-bar .progress-bar-container {
    flex: 1 1 auto;
    height: 7px;
    background-color: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
}

.swp-flash-sale-bar .progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--swp-primary), var(--swp-accent));
    border-radius: 5px;
    transition: width 0.6s ease-out;
}

/* ---------- Meta row: low stock + viewers ---------- */

.swp-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 11px;
}

.swp-low-stock-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    color: var(--swp-primary);
    font-size: 12px;
    background: color-mix(in srgb, var(--swp-primary) 10%, transparent);
    padding: 8px 12px;
    border-radius: 10px;
}

.swp-low-stock-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    white-space: nowrap;
}

.swp-low-stock-cta {
    font-weight: 700;
    font-size: 11px;
    white-space: nowrap;
}

.swp-sold-percent {
    font-weight: 700;
    color: var(--swp-primary);
}

.swp-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--swp-primary);
    flex-shrink: 0;
    animation: swp-pulse-dot 1.4s ease-in-out infinite;
}

.swp-viewers-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #777;
}

.swp-viewers-badge .swp-eye-icon {
    flex-shrink: 0;
    opacity: 0.6;
}

.swp-viewers-count {
    font-weight: 700;
    color: #444;
    transition: color 0.3s ease;
}

.swp-viewers-count.swp-bump {
    color: var(--swp-primary);
}

/* ================================================================
   STYLE VARIANTS
   ================================================================ */

/* --- Dark mode --- */
.swp-style-dark {
    background: #1c1c22;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}
.swp-style-dark .flash-sale-countdown,
.swp-style-dark .timer-text,
.swp-style-dark .sold-count,
.swp-style-dark .swp-viewers-badge {
    color: #b8b8c2;
}
.swp-style-dark .sold-value {
    color: #fff;
}
.swp-style-dark .time-block {
    background: rgba(255, 255, 255, 0.06);
}
.swp-style-dark .time-unit {
    color: #8a8a96;
}
.swp-style-dark .progress-bar-container {
    background-color: rgba(255, 255, 255, 0.08);
}
.swp-style-dark .swp-viewers-count {
    color: #fff;
}
.swp-style-dark .swp-dismiss-btn {
    color: #fff;
}

/* --- Minimal light --- */
.swp-style-minimal {
    box-shadow: none;
    border: 1px solid #eaeaea;
}
.swp-style-minimal .flash-sale-label {
    background: none;
    color: var(--swp-primary);
    border: 1.5px solid var(--swp-primary);
    text-shadow: none;
    padding: 4px 12px;
}
.swp-style-minimal .flash-icon {
    filter: none;
}

/* --- Neon / high contrast --- */
.swp-style-neon {
    background: #0d0d12;
    border: 1px solid var(--swp-primary);
    box-shadow: 0 0 18px rgba(255, 36, 104, 0.25), inset 0 0 0 1px rgba(255,255,255,0.02);
}
.swp-style-neon .flash-sale-label {
    background: transparent;
    border: 1px solid var(--swp-primary);
    color: var(--swp-primary);
    text-shadow: 0 0 6px var(--swp-primary);
}
.swp-style-neon .flash-sale-countdown,
.swp-style-neon .timer-text,
.swp-style-neon .sold-count,
.swp-style-neon .swp-viewers-badge {
    color: #9a9aa6;
}
.swp-style-neon .sold-value,
.swp-style-neon .swp-viewers-count {
    color: #fff;
}
.swp-style-neon .time-value {
    color: var(--swp-accent);
    text-shadow: 0 0 8px var(--swp-accent);
}
.swp-style-neon .time-block {
    background: rgba(255, 255, 255, 0.04);
}
.swp-style-neon .progress-bar-container {
    background-color: rgba(255, 255, 255, 0.08);
}
.swp-style-neon .swp-dismiss-btn {
    color: #fff;
}

/* ================================================================
   STICKY MOBILE BAR
   ================================================================ */

.swp-dismiss-btn {
    display: none; /* shown only on mobile via media query below */
    position: absolute;
    top: 6px;
    right: 8px;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    color: #555;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.swp-flash-sale-bar.swp-is-dismissed {
    display: none !important;
}

/* ================================================================
   RESPONSIVE / MOBILE
   ================================================================ */

/* The bar switches from a stacked card to a single-row pill once it has
   enough of its OWN width (regardless of viewport) - this is what lets it
   look right inside narrow theme columns on desktop too. */
@container swp-promo (min-width: 460px) {
    .swp-bar-inner {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 6px 10px 6px 0;
        flex-wrap: wrap;
    }

    .flash-sale-label {
        align-self: stretch;
        border-radius: 0;
        padding: 0 14px;
        align-items: center;
        font-size: 12px;
        margin: -1px 0 -1px -1px; /* bleed to edge */
    }

    .swp-style-minimal .flash-sale-label,
    .swp-style-neon .flash-sale-label {
        margin: 0;
        border-radius: 999px;
        align-self: center;
    }

    .flash-sale-details {
        flex: 1 1 auto;
        flex-wrap: nowrap;
        gap: 10px;
        min-width: 0;
    }

    .swp-bar-header {
        display: contents;
    }

    .swp-ends-in-label {
        display: none;
    }

    .flash-sale-countdown {
        gap: 3px;
        flex: 0 0 auto;
    }

    .flash-sale-countdown .timer-text {
        display: inline;
        font-size: 11px;
        color: #888;
        margin-right: 0;
        white-space: nowrap;
    }

    .flash-sale-countdown .time-block {
        flex: 0 0 auto;
        padding: 2px 5px;
        min-width: 26px;
    }

    .flash-sale-countdown .time-value {
        font-size: 13px;
    }

    .flash-sale-countdown .time-unit {
        font-size: 9px;
        margin-top: 1px;
    }

    .swp-flash-sale-bar .flash-sale-progress {
        flex: 1 1 auto;
        justify-content: flex-end;
        min-width: 0;
    }

    .swp-flash-sale-bar .progress-bar-container {
        flex: 1 1 40px;
        min-width: 30px;
        max-width: 160px;
    }

    .swp-flash-sale-bar .sold-count {
        font-size: 11px;
        flex-shrink: 0;
    }

    .swp-sold-percent {
        display: none;
    }

    .swp-meta-row {
        border-top: none;
        padding-top: 0;
        flex-basis: auto;
        padding: 0;
        margin: 0;
        flex-shrink: 0;
    }

    .swp-low-stock-badge {
        display: inline-flex;
        width: auto;
        padding: 3px 10px;
        font-size: 11px;
        color: var(--swp-primary);
        background: color-mix(in srgb, var(--swp-primary) 12%, transparent);
        border-radius: 999px;
    }

    .swp-low-stock-cta {
        display: none;
    }

    .swp-low-stock-badge .swp-pulse-dot {
        background: var(--swp-primary);
    }

    .swp-low-stock-badge .swp-low-stock-suffix {
        display: none;
    }

    .swp-style-minimal .swp-meta-row,
    .swp-style-neon .swp-meta-row {
        padding-left: 0;
    }
}

@media (max-width: 639px) {
    .swp-bar-desktop-only {
        display: none !important;
    }
}

@media (min-width: 640px) {
    .swp-bar-mobile-only {
        display: none !important;
    }
}

@media (max-width: 639px) {
    .swp-flash-sale-bar.swp-sticky-mobile {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: 8px;
        max-width: none;
        z-index: 9999;
        animation: swp-slide-up 0.4s ease-out;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .swp-flash-sale-bar.swp-sticky-mobile .swp-dismiss-btn {
        display: flex;
    }

    .swp-flash-sale-bar.swp-sticky-mobile .flash-sale-countdown .timer-text {
        display: none;
    }
}

@media (max-width: 380px) {
    .flash-sale-countdown .timer-text {
        display: none;
    }

    .flash-sale-countdown .time-block {
        min-width: 26px;
        padding: 2px 4px;
    }
    .flash-sale-countdown .time-value {
        font-size: 13px;
    }
}

/* ================================================================
   ANIMATIONS
   ================================================================ */

@keyframes swp-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes swp-pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.8); }
}
