/* Sales Bar for WooCommerce — bar.css */

/* FIX 9: will-change promotes bar to its own compositor layer,
   eliminating paint during transform/opacity animations */
#sbw-bar {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: var(--sbw-h, 48px);
    background: var(--sbw-bg, #1a1a2e);
    color: var(--sbw-tc, #fff);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 12px rgba(0,0,0,.2);
    will-change: transform;         /* FIX 9 */
}

#sbw-bar.sbw-dismissing {
    transform: translateY(-110%);
    opacity: 0;
    transition: transform .3s ease, opacity .3s ease;
}

/* Progress strip */
#sbw-prog-track {
    height: 3px;
    width: 100%;
    background: rgba(255,255,255,.15);
    flex-shrink: 0;
}
#sbw-prog-fill {
    height: 100%;
    background: var(--sbw-prog, #22c55e);
    width: 0;
    transition: width .6s ease;
    box-shadow: 0 0 8px var(--sbw-prog, #22c55e);
    will-change: width;             /* FIX 9 */
}

/* Inner row */
#sbw-inner {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 40px;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

/* Message */
#sbw-msg {
    color: inherit;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 20px);
    transition: opacity .15s ease;
}
#sbw-msg.sbw-fading { opacity: 0; }
#sbw-msg strong { font-weight: 700; }
#sbw-msg:hover { text-decoration: underline; text-underline-offset: 3px; }

/* FIX 8: Loading state — subtle pulse while fetching */
#sbw-bar.sbw-loading #sbw-msg {
    opacity: 0.5;
    animation: sbw-pulse 1s ease infinite;
}
@keyframes sbw-pulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 0.3; }
}

/* Highlight colour for {remaining} amounts */
.sbw-hi { color: var(--sbw-hi, #f5a623); }

/* Close button */
#sbw-close {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: inherit;
    opacity: .45;
    cursor: pointer;
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    transition: opacity .2s, background .2s;
    flex-shrink: 0;
}
#sbw-close:hover { opacity: 1; background: rgba(255,255,255,.15); }

/* Body offset — prevents bar overlapping page content */
body.sbw-active { padding-top: var(--sbw-h, 48px) !important; }

/* Mobile */
@media (max-width: 600px) {
    #sbw-msg   { font-size: 12px; }
    #sbw-inner { padding: 0 30px; }
    #sbw-close { right: 6px; width: 22px; height: 22px; }
}
