/* ══════════════════════════════════════════════════════
   isB2B — Cart Drawer
   Loaded globally (header cart icon is on every page).
   ══════════════════════════════════════════════════════ */

/* ── Keyframes ── */
@keyframes isb2b-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}
@keyframes isb2b-spin {
    to { transform: rotate(360deg); }
}
@keyframes isb2b-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Wrapper (fixed full-screen, invisible until open) ── */
.isb2b-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
    visibility: hidden;
    /* Keep visible long enough for the exit animation to finish */
    transition: visibility 0s .3s;
}
.isb2b-cart-drawer.is-open {
    pointer-events: auto;
    visibility: visible;
    transition: visibility 0s; /* instant on open */
}

/* ── Overlay ── */
.isb2b-cart-drawer__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    transition: opacity .25s ease;
}
.isb2b-cart-drawer.is-open .isb2b-cart-drawer__overlay {
    opacity: 1;
}

/* ── Panel (slides in from right) ── */
.isb2b-cart-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 92vw;
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    will-change: transform;
    transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, .12);
}
.isb2b-cart-drawer.is-open .isb2b-cart-drawer__panel {
    transform: translateX(0);
}

/* ── Header ── */
.isb2b-cart-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--rule, #e4e5ea);
    flex-shrink: 0;
}
.isb2b-cart-drawer__title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--isb2b-dark, #192a3d);
}
.isb2b-cart-drawer__close {
    background: none;
    border: 0;
    padding: 4px;
    cursor: pointer;
    color: var(--ink-mid, #52525e);
    display: flex;
    align-items: center;
    line-height: 0;
    border-radius: 4px;
    transition: color .15s, background .15s;
}
.isb2b-cart-drawer__close:hover {
    color: var(--isb2b-dark, #192a3d);
    background: var(--bg, #f4f5f7);
}
.isb2b-cart-drawer__close svg { width: 20px; height: 20px; }

/* ── Body (scrollable items list) ── */
.isb2b-cart-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}
.isb2b-cart-drawer__empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--ink-light, #8f8fa0);
    font-size: 14px;
    margin: 0;
}

/* WC notices (stock errors etc.) shown at top of drawer body */
.isb2b-cart-drawer__notices {
    padding: 12px 20px;
    border-bottom: 1px solid var(--rule, #e4e5ea);
}
.isb2b-cart-drawer__notices .woocommerce-error,
.isb2b-cart-drawer__notices .woocommerce-message,
.isb2b-cart-drawer__notices .woocommerce-info {
    list-style: none;
    margin: 0;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.45;
}
/* Strip the WC font icon that sits before the list */
.isb2b-cart-drawer__notices .woocommerce-error::before,
.isb2b-cart-drawer__notices .woocommerce-message::before,
.isb2b-cart-drawer__notices .woocommerce-info::before {
    display: none !important;
}
.isb2b-cart-drawer__notices .woocommerce-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
.isb2b-cart-drawer__notices .woocommerce-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}
.isb2b-cart-drawer__notices .woocommerce-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}
.isb2b-cart-drawer__notices li {
    margin: 0;
    padding: 0;
}
/* Hide the "View Cart" button WC appends to some notices */
.isb2b-cart-drawer__notices .button,
.isb2b-cart-drawer__notices a.button {
    display: none !important;
}

/* Spinner row — appears at bottom of list while new item is being added */
.isb2b-cart-drawer__spinner-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--rule, #e4e5ea);
}
.isb2b-cart-drawer__spinner {
    display: block;
    width: 22px;
    height: 22px;
    border: 2px solid var(--rule, #e4e5ea);
    border-top-color: var(--isb2b-primary, #00aeef);
    border-radius: 50%;
    animation: isb2b-spin 0.7s linear infinite;
}

/* Shimmer placeholder while loading */
.isb2b-cart-drawer__shimmer {
    height: 80px;
    margin: 16px 20px;
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: isb2b-shimmer 1.2s ease-in-out infinite;
}

/* ── Items ── */
.isb2b-cart-drawer__items {
    list-style: none;
    margin: 0;
    padding: 0;
    animation: isb2b-fade-in .22s ease both;
}
.isb2b-cart-drawer__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--rule, #e4e5ea);
    transition: opacity .15s;
}
.isb2b-cart-drawer__img-link {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--rule, #e4e5ea);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafbfc;
}
.isb2b-cart-drawer__img-link img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.isb2b-cart-drawer__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.isb2b-cart-drawer__name {
    font-size: 13px;
    font-weight: 500;
    color: var(--isb2b-dark, #192a3d);
    text-decoration: none;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.isb2b-cart-drawer__name:hover { color: var(--isb2b-primary, #00aeef); }
.isb2b-cart-drawer__meta {
    font-size: 12px;
    color: var(--ink-light, #8f8fa0);
}
.isb2b-cart-drawer__price {
    font-size: 13px;
    font-weight: 600;
    color: var(--isb2b-dark, #192a3d);
}
.isb2b-cart-drawer__remove {
    background: none;
    border: 0;
    padding: 6px;
    cursor: pointer;
    color: var(--ink-light, #8f8fa0);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    line-height: 0;
    border-radius: 4px;
    transition: color .15s, background .15s;
}
.isb2b-cart-drawer__remove:hover {
    color: #c0392b;
    background: var(--red-bg, #fee2e2);
}
.isb2b-cart-drawer__remove svg { width: 15px; height: 15px; }

/* ── Footer (totals + buttons) ── */
.isb2b-cart-drawer__foot {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--rule, #e4e5ea);
    flex-shrink: 0;
    background: #fff;
}
.isb2b-cart-drawer__subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--isb2b-dark, #192a3d);
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rule, #e4e5ea);
}
.isb2b-cart-drawer__subtotal span:first-child {
    font-weight: 400;
    color: var(--ink-mid, #52525e);
    font-size: 13px;
}
.isb2b-cart-drawer__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.isb2b-cart-drawer__actions a {
    display: block;
    text-align: center;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
    line-height: 1.3;
}
.isb2b-cart-drawer__btn-cart {
    background: #fff;
    border: 1px solid var(--rule, #e4e5ea);
    color: var(--isb2b-dark, #192a3d) !important;
}
.isb2b-cart-drawer__btn-cart:hover {
    border-color: var(--isb2b-dark, #192a3d);
    background: var(--bg, #f4f5f7);
    color: var(--isb2b-dark, #192a3d) !important;
}
.isb2b-cart-drawer__btn-checkout {
    background: var(--isb2b-primary, #00aeef) !important;
    border: 1px solid var(--isb2b-primary, #00aeef) !important;
    color: #fff !important;
}
.isb2b-cart-drawer__btn-checkout:hover {
    background: var(--theme-palette-color-2, #0095cc) !important;
    border-color: var(--theme-palette-color-2, #0095cc) !important;
}

/* Prevent body scroll while drawer is open */
body.isb2b-cart-open { overflow: hidden; }

/* Suppress the WC "added to cart" notice bar on all pages except cart / checkout /
   order-received — the drawer is the feedback mechanism. The DOM insertion still
   happens (our MutationObserver detects it), but it is never painted. */
body:not(.woocommerce-cart):not(.woocommerce-checkout):not(.woocommerce-order-received)
    .woocommerce-notices-wrapper .woocommerce-message {
    display: none !important;
}
