/* ============================================================
   Floating cart drawer — Phase 3 (spec §7.20-§7.24)
   Desktop: bottom-right growable panel, collapses to a cart pill.
   Phone: compact bar above .bsh-bottom-nav, expands to a sheet.
   ============================================================ */
.bsh-cart-drawer[hidden],
.bsh-cd-pill[hidden],
.bsh-cd-panel[hidden] {
    display: none !important;
}

.bsh-cart-drawer {
    --cd-brand: #d4a017;
    --cd-brand-2: #b8890e;
    --cd-bg: #ffffff;
    --cd-fg: #14171c;
    --cd-mut: #6b7280;
    --cd-brd: rgba(15, 23, 42, .12);

    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9940;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}
html[data-bs-theme="dark"] .bsh-cart-drawer {
    --cd-brand: #e6b64a;
    --cd-brand-2: #c9972e;
    --cd-bg: #1d2129;
    --cd-fg: #eceff3;
    --cd-mut: #9aa3af;
    --cd-brd: rgba(255, 255, 255, .12);
}

/* ---------- Collapsed pill ---------- */
.bsh-cd-pill {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: var(--cd-fg);
    font-weight: 700;
    font-size: .95rem;
    line-height: 1.2;
}
.bsh-cd-pillbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--cd-brand), var(--cd-brand-2));
    color: #fff;
    padding: 11px 18px;
    border-radius: 999px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .22);
    transition: transform .12s ease, box-shadow .12s ease;
    max-width: calc(100vw - 32px);
}
.bsh-cd-pill:hover .bsh-cd-pillbox,
.bsh-cd-pill:focus-visible .bsh-cd-pillbox {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .26);
}
/* §0B.10 / §40.8: the floating pill carries no numeric badge — it reads
   "[icon] N items in cart". The .bsh-cd-count rule was deleted with its
   element; do not reintroduce it here. The top-nav #cart-count badge is a
   different component (.cart-badge) and is deliberately untouched. */
.bsh-cd-ic { display: inline-flex; }
.bsh-cd-caret { opacity: .92; font-size: .8rem; }

/* ---------- Expanded panel ---------- */
.bsh-cd-panel {
    width: 382px;
    max-width: calc(100vw - 32px);
    background: var(--cd-bg);
    color: var(--cd-fg);
    border: 1px solid var(--cd-brd);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .24);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.bsh-cd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--cd-brd);
}
.bsh-cd-head h6 { margin: 0; font-weight: 800; font-size: 1rem; }
.bsh-cd-head .bsh-cd-sub { display: block; color: var(--cd-mut); font-size: .72rem; }
.bsh-cd-close {
    border: 0;
    background: transparent;
    color: var(--cd-mut);
    font-size: 1.05rem;
    padding: 5px 8px;
    border-radius: 8px;
    cursor: pointer;
}
.bsh-cd-close:hover { background: rgba(128, 128, 128, .14); color: var(--cd-fg); }

.bsh-cd-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    overflow-y: auto;
    max-height: min(50vh, 380px);
}
.bsh-cd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
}
.bsh-cd-item img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--cd-brd);
    flex: none;
}
.bsh-cd-mid { min-width: 0; flex: 1; }
.bsh-cd-mid a {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--cd-fg);
    text-decoration: none;
    font-size: .84rem;
    font-weight: 600;
}
.bsh-cd-mid a:hover { color: var(--cd-brand-2); }
.bsh-cd-mid .bsh-cd-meta {
    color: var(--cd-mut);
    font-size: .7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bsh-cd-amt { font-weight: 700; font-size: .86rem; white-space: nowrap; }
.bsh-cd-more {
    display: block;
    text-align: center;
    color: var(--cd-brand-2);
    font-weight: 700;
    font-size: .8rem;
    text-decoration: none;
    padding: 4px 12px 8px;
    cursor: pointer;
}
.bsh-cd-more:hover { text-decoration: underline; }

.bsh-cd-foot {
    border-top: 1px solid var(--cd-brd);
    padding: 10px 16px 14px;
}
.bsh-cd-subrow {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: .82rem;
    color: var(--cd-mut);
    margin-bottom: 8px;
}
.bsh-cd-subrow b { color: var(--cd-fg); font-size: .95rem; }
.bsh-cd-cta {
    display: block;
    width: 100%;
    text-align: center;
    background: linear-gradient(135deg, var(--cd-brand), var(--cd-brand-2));
    color: #fff !important;
    border: 0;
    padding: 11px;
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
    font-size: .95rem;
}
.bsh-cd-cta:hover { filter: brightness(1.06); }

/* ---------- Phone / tablet-portrait ---------- */
@media (max-width: 767.98px) {
    .bsh-cart-drawer {
        left: 10px;
        right: 10px;
        bottom: calc(66px + env(safe-area-inset-bottom));
        align-items: stretch;
        gap: 8px;
    }
    .bsh-cd-pill { width: 100%; }
    .bsh-cd-pillbox {
        width: 100%;
        justify-content: center;
        border-radius: 14px;
        padding: 12px 16px;
        max-width: none;
    }
    .bsh-cd-panel {
        width: auto;
        max-width: none;
        max-height: min(60vh, 560px);
        border-radius: 14px;
    }
}
