/* =====================================================
   Sticky Product Bar – spb-style.css
   ===================================================== */

:root {
    --spb-bg:       #ffffff;
    --spb-text:     #1a1a1a;
    --spb-accent:   #c8a96e;
    --spb-height:   68px;
    --spb-shadow:   0 2px 16px rgba(0,0,0,.12);
    --spb-radius:   4px;
    --spb-trans:    .28s cubic-bezier(.4,0,.2,1);
}

/* ── Bar wrapper ── */
#spb-sticky-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 99990;
    background: var(--spb-bg);
    box-shadow: var(--spb-shadow);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform var(--spb-trans), opacity var(--spb-trans);
    will-change: transform, opacity;
    pointer-events: none;
    border-bottom: 2px solid var(--spb-accent);
}

#spb-sticky-bar.spb-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ── Inner layout ── */
.spb-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--spb-height);
    box-sizing: border-box;
}

/* ── Product info (left) ── */
.spb-product-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.spb-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: var(--spb-radius);
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.08);
}

.spb-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.spb-title {
    font-size: .92rem;
    font-weight: 600;
    color: var(--spb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
    line-height: 1.2;
}

.spb-price {
    font-size: .88rem;
    color: var(--spb-accent);
    font-weight: 700;
    line-height: 1.2;
}

.spb-price .woocommerce-Price-amount {
    color: inherit;
}

.spb-price del {
    color: #999;
    font-weight: 400;
    margin-right: 4px;
}

/* ── Actions (right) ── */
.spb-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ── Cart form ── */
.spb-cart-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

/* ── Quantity stepper ── */
.spb-qty-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #ddd;
    border-radius: var(--spb-radius);
    overflow: hidden;
    height: 38px;
}

.spb-qty-btn {
    width: 32px;
    height: 100%;
    background: #f7f7f7;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--spb-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.spb-qty-btn:hover {
    background: #ececec;
}

.spb-qty-input {
    width: 40px;
    height: 100%;
    border: none;
    border-left: 1.5px solid #ddd;
    border-right: 1.5px solid #ddd;
    text-align: center;
    font-size: .88rem;
    color: var(--spb-text);
    outline: none;
    -moz-appearance: textfield;
    padding: 0;
}

.spb-qty-input::-webkit-inner-spin-button,
.spb-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Add to Cart button ── */
.spb-atc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 22px;
    background: var(--spb-accent);
    color: #fff !important;
    font-size: .88rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    border: none;
    border-radius: var(--spb-radius);
    cursor: pointer;
    text-decoration: none !important;
    transition: filter .18s, transform .12s;
    white-space: nowrap;
    line-height: 1;
}

.spb-atc-btn:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.spb-atc-btn:active:not(:disabled) {
    transform: translateY(0);
    filter: brightness(.95);
}

.spb-out-of-stock {
    background: #bbb;
    cursor: not-allowed;
}

/* ── Loading state ── */
.spb-atc-btn.loading {
    pointer-events: none;
    opacity: .75;
}

.spb-atc-btn.loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spb-spin .7s linear infinite;
    display: inline-block;
}

@keyframes spb-spin {
    to { transform: rotate(360deg); }
}

/* ── Added confirmation ── */
.spb-atc-btn.added {
    background: #4caf50;
}

/* ── Desktop: completely hidden ── */
@media (min-width: 768px) {
    #spb-sticky-bar {
        display: none !important;
    }
}

/* ── Mobile styles (< 768px) ── */
@media (max-width: 767px) {
    :root { --spb-height: 60px; }

    .spb-inner { padding: 0 14px; gap: 10px; }

    .spb-thumb { width: 38px; height: 38px; }

    .spb-title { max-width: 140px; font-size: .82rem; }

    .spb-price { font-size: .80rem; }

    .spb-qty-wrap { display: flex; }

    .spb-atc-btn { padding: 0 14px; font-size: .80rem; height: 36px; }
}

@media (max-width: 400px) {
    .spb-qty-wrap { display: none; }
    .spb-title { max-width: 120px; }
}
