/* =============================================
   Sticky Products Bar — Frontend Styles
   ============================================= */

/* ── Anchor (invisible placeholder in post) ── */
.sticky-product-anchor {
    display: block;
    width: 100%;
    height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Sticky Bar Container ── */
#sp-sticky-bar {
    position: fixed;
    z-index: 999999;

    /* Desktop: 1200px wide, horizontally centered */
    bottom: 0;
    top: auto;
    left: 50%;
    width: 1200px;
    max-width: calc(100% - 32px);

    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
    border-top: 1px solid rgba(0, 159, 167, 0.3);
    border-radius: 10px 10px 0 0;

    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    gap: 16px;

    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.45);

    /* Hidden: slide down (translateX keeps horizontal centering) */
    transform: translateX(-50%) translateY(calc(100% + 2px));
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.35s ease;
    will-change: transform, opacity;
}

/* Desktop: slide up into view */
#sp-sticky-bar.sp-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ── Mobile: stick to TOP ── */
@media (max-width: 767px) {
    #sp-sticky-bar {
        /* Full width on mobile */
        left: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;

        bottom: auto;
        /* 13px offset: clears the 13px tall reading progress bar */
        top: 13px;
        border-top: none;
        border-bottom: 1px solid rgba(0, 159, 167, 0.3);
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
        padding: 8px 14px;

        /* Slide up from above (no X translation needed — full width) */
        transform: translateX(0) translateY(calc(-100% - 13px));
    }

    #sp-sticky-bar.sp-visible {
        transform: translateX(0) translateY(0);
    }
}

/* ── Left Side: Labels ── */
.sp-bar-left {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.sp-bar-editor-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #009FA7;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-bar-product-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #f9fafb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}

@media (max-width: 767px) {
    .sp-bar-product-name {
        font-size: 13px;
    }
}

/* ── Separator ── */
.sp-bar-sep {
    width: 1px;
    height: 32px;
    background: rgba(0, 159, 167, 0.25);
    flex-shrink: 0;
}

/* ── Right Side: Buy Button ── */
.sp-bar-right {
    flex-shrink: 0;
}

.sp-bar-buy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #009FA7, #007E85);
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 159, 167, 0.45);
    flex-shrink: 0;
}

.sp-bar-buy-btn:hover,
.sp-bar-buy-btn:focus {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 159, 167, 0.65);
    color: #ffffff;
    text-decoration: none;
    outline: none;
}

.sp-bar-buy-btn svg {
    display: block;
}

@media (max-width: 767px) {
    .sp-bar-buy-btn {
        width: 36px;
        height: 36px;
    }
}

/* ── Product transition animation ── */
.sp-bar-left.sp-fade-out {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sp-bar-left.sp-fade-in {
    opacity: 0;
    transform: translateY(6px);
}

.sp-bar-left.sp-fade-in.sp-animate {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
}