/* PB Bookshop Stage 2 AJAX cart — isolated from theme/Blocksy cart CSS. */
.pb-bookshop-cart-drawer {
    --pb-cart-accent: #111827;
    --pb-cart-text: #111827;
    --pb-cart-muted: #6b7280;
    --pb-cart-line: #e5e7eb;
    --pb-cart-bg: #ffffff;
    --pb-cart-soft: #f7f7f8;
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    visibility: hidden;
    pointer-events: none;
    direction: rtl;
    font-family: var(--pbsp-panel-font, Estedad, Tahoma, sans-serif);
}
.pb-bookshop-cart-drawer.is-open { visibility: visible; pointer-events: auto; }
.pb-bookshop-cart-drawer__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, .48);
    opacity: 0;
    transition: opacity .25s ease;
    cursor: default;
}
.pb-bookshop-cart-drawer.is-open .pb-bookshop-cart-drawer__backdrop { opacity: 1; }
.pb-bookshop-cart-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(440px, 94vw);
    height: 100%;
    background: var(--pb-cart-bg);
    color: var(--pb-cart-text);
    box-shadow: -18px 0 48px rgba(15, 23, 42, .2);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    transform: translateX(105%);
    transition: transform .3s cubic-bezier(.22,.8,.3,1);
    outline: none;
}
.pb-bookshop-cart-drawer.is-open .pb-bookshop-cart-drawer__panel { transform: translateX(0); }
body.pb-bookshop-cart-open { overflow: hidden !important; }
.pb-bookshop-cart-drawer__header {
    min-height: 76px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pb-cart-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.pb-bookshop-cart-drawer__header h2 { margin: 0 0 3px !important; font-size: 20px !important; line-height: 1.35 !important; font-weight: 800 !important; color: var(--pb-cart-text) !important; }
.pb-bookshop-cart-drawer__count-label { display: block; font-size: 12px; color: var(--pb-cart-muted); }
.pb-bookshop-cart-drawer__close,
.pb-bookshop-cart-item__remove {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--pb-cart-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
}
.pb-bookshop-cart-drawer__close {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--pb-cart-soft);
    font-size: 28px;
    line-height: 1;
}
.pb-bookshop-cart-drawer__close:hover { background: #eceef1; }
.pb-bookshop-cart-drawer__body { overflow: auto; overscroll-behavior: contain; padding: 4px 20px 10px; }
.pb-bookshop-cart-items { display: flex; flex-direction: column; }
.pb-bookshop-cart-item {
    position: relative;
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 13px;
    padding: 16px 0;
    border-bottom: 1px solid var(--pb-cart-line);
    transition: opacity .18s ease;
}
.pb-bookshop-cart-item.is-updating,
.pb-bookshop-cart-item.is-removing { opacity: .5; pointer-events: none; }
.pb-bookshop-cart-item__media { width: 78px; }
.pb-bookshop-cart-item__media img { display: block; width: 78px !important; height: 106px !important; object-fit: cover; border-radius: 8px; margin: 0 !important; }
.pb-bookshop-cart-item__content { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.pb-bookshop-cart-item__top { display: flex; gap: 8px; align-items: flex-start; }
.pb-bookshop-cart-item__name { flex: 1; color: var(--pb-cart-text) !important; text-decoration: none !important; font-size: 14px; line-height: 1.75; font-weight: 700; }
.pb-bookshop-cart-item__remove { flex: 0 0 auto; width: 29px; height: 29px; border-radius: 9px; color: #8b949f; background: #f5f5f6; font-size: 20px; }
.pb-bookshop-cart-item__remove:hover { color: #b42318; background: #fff0ee; }
.pb-bookshop-cart-item__meta { color: var(--pb-cart-muted); font-size: 11px; line-height: 1.65; }
.pb-bookshop-cart-item__meta dl.variation { margin: 0; }
.pb-bookshop-cart-item__meta dt,
.pb-bookshop-cart-item__meta dd { display: inline; float: none; margin: 0 0 0 4px; padding: 0; }
.pb-bookshop-cart-item__meta dd p { display: inline; margin: 0; }
.pb-bookshop-cart-item__bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pb-bookshop-cart-item__price { font-size: 13px; font-weight: 800; white-space: nowrap; }
.pb-bookshop-cart-qty { direction: ltr; display: inline-grid; grid-template-columns: 31px 38px 31px; align-items: center; border: 1px solid var(--pb-cart-line); border-radius: 10px; overflow: hidden; background: #fff; }
.pb-bookshop-cart-qty__btn { appearance: none; border: 0; height: 31px; background: var(--pb-cart-soft); color: var(--pb-cart-text); font-size: 18px; line-height: 1; cursor: pointer; padding: 0; }
.pb-bookshop-cart-qty__input { appearance: textfield; -moz-appearance: textfield; width: 38px !important; min-width: 0 !important; height: 31px !important; margin: 0 !important; padding: 0 2px !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: #fff !important; color: var(--pb-cart-text) !important; text-align: center !important; font-size: 12px !important; }
.pb-bookshop-cart-qty__input::-webkit-outer-spin-button,
.pb-bookshop-cart-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pb-bookshop-cart-drawer__footer { padding: 16px 20px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--pb-cart-line); background: #fff; box-shadow: 0 -10px 28px rgba(15, 23, 42, .04); }
.pb-bookshop-cart-drawer__subtotal { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; font-size: 14px; font-weight: 700; }
.pb-bookshop-cart-subtotal { font-size: 16px; font-weight: 900; }
.pb-bookshop-cart-drawer__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pb-bookshop-cart-btn { min-height: 46px; padding: 10px 14px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; text-align: center; text-decoration: none !important; font-size: 13px; font-weight: 800; transition: transform .18s ease, background .18s ease, color .18s ease; }
.pb-bookshop-cart-btn:hover { transform: translateY(-1px); }
.pb-bookshop-cart-btn--primary { background: var(--pb-cart-accent); color: #fff !important; }
.pb-bookshop-cart-btn--secondary { background: var(--pb-cart-soft); color: var(--pb-cart-text) !important; }
.pb-bookshop-cart-empty { min-height: 310px; padding: 60px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--pb-cart-muted); }
.pb-bookshop-cart-empty__icon { width: 64px; height: 64px; border-radius: 20px; background: var(--pb-cart-soft); display: grid; place-items: center; font-size: 28px; margin-bottom: 14px; }
.pb-bookshop-cart-empty strong { color: var(--pb-cart-text); font-size: 15px; margin-bottom: 5px; }
.pb-bookshop-cart-empty p { margin: 0; font-size: 12px; line-height: 1.8; }

/* Toast replaces the old full-width WooCommerce success row. */
.pb-bookshop-cart-toasts { position: fixed; z-index: 2147483100; right: 22px; bottom: 24px; width: min(370px, calc(100vw - 32px)); pointer-events: none; direction: rtl; font-family: var(--pbsp-panel-font, Estedad, Tahoma, sans-serif); }
.pb-bookshop-cart-toast { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 11px 13px; border: 1px solid #d9e7dd; border-radius: 15px; background: rgba(255,255,255,.97); color: #173b25; box-shadow: 0 14px 36px rgba(15, 23, 42, .18); opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .22s ease, transform .22s ease; backdrop-filter: blur(8px); }
.pb-bookshop-cart-toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.pb-bookshop-cart-toast--error { border-color: #f2cbc6; color: #842c25; }
.pb-bookshop-cart-toast__icon { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #e9f6ed; color: #18733b; font-weight: 900; }
.pb-bookshop-cart-toast--error .pb-bookshop-cart-toast__icon { background: #fff0ee; color: #b42318; }
.pb-bookshop-cart-toast__text { font-size: 12.5px; line-height: 1.75; font-weight: 700; }

/* Loading state for the existing canonical add-to-cart button. */
form.cart .single_add_to_cart_button.is-loading { position: relative; opacity: .78; cursor: wait !important; }
form.cart.pb-bookshop-cart-submitting { pointer-events: none; }

@media (max-width: 767px) {
    .pb-bookshop-cart-drawer { align-items: flex-end; }
    .pb-bookshop-cart-drawer__panel {
        top: auto;
        right: 0;
        bottom: 0;
        width: 100%;
        height: min(82dvh, 720px);
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -18px 48px rgba(15, 23, 42, .22);
        transform: translateY(105%);
    }
    .pb-bookshop-cart-drawer.is-open .pb-bookshop-cart-drawer__panel { transform: translateY(0); }
    .pb-bookshop-cart-drawer__panel::before { content: ''; position: absolute; top: 7px; left: 50%; width: 42px; height: 4px; border-radius: 99px; background: #d7dbe0; transform: translateX(-50%); }
    .pb-bookshop-cart-drawer__header { min-height: 70px; padding: 18px 16px 11px; }
    .pb-bookshop-cart-drawer__header h2 { font-size: 18px !important; }
    .pb-bookshop-cart-drawer__body { padding: 2px 16px 8px; }
    .pb-bookshop-cart-item { grid-template-columns: 68px minmax(0, 1fr); gap: 11px; padding: 13px 0; }
    .pb-bookshop-cart-item__media,
    .pb-bookshop-cart-item__media img { width: 68px !important; }
    .pb-bookshop-cart-item__media img { height: 92px !important; }
    .pb-bookshop-cart-item__name { font-size: 13px; line-height: 1.7; }
    .pb-bookshop-cart-item__bottom { gap: 8px; }
    .pb-bookshop-cart-item__price { font-size: 12px; }
    .pb-bookshop-cart-drawer__footer { padding: 12px 16px max(13px, env(safe-area-inset-bottom)); }
    .pb-bookshop-cart-drawer__actions { gap: 8px; }
    .pb-bookshop-cart-btn { min-height: 44px; font-size: 12px; border-radius: 11px; }
    .pb-bookshop-cart-toasts { right: 16px; bottom: calc(16px + var(--pb-mobile-nav-offset, 0px) + env(safe-area-inset-bottom)); width: calc(100vw - 32px); }
    .pb-bookshop-cart-toast { min-height: 52px; border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .pb-bookshop-cart-drawer__backdrop,
    .pb-bookshop-cart-drawer__panel,
    .pb-bookshop-cart-toast,
    .pb-bookshop-cart-btn { transition: none !important; }
}
.pb-bookshop-cart-drawer__footer.is-empty { display: none !important; }
