/* ============================================================
   Ecom Custom Side Bar Cart — side-bar-cart-style.css
   BEM prefix: escb-
   Brand: dark teal #005B7F, accent #2a7d9c, hover tint #f0f8fb
   ============================================================ */

/* ── Overlay ──────────────────────────────────────────────── */
.escb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.escb-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ── Drawer shell ─────────────────────────────────────────── */
.escb-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    background: #fff;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}

.escb-drawer.is-open {
    transform: translateX(0);
}

/* Offset for WP admin toolbar */
body.admin-bar .escb-drawer {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .escb-drawer {
        top: 46px;
    }
}

/* ── Inner content wrapper ────────────────────────────────── */
.escb-drawer__content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────── */
.escb-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #ebebeb;
    flex-shrink: 0;
}

.escb-drawer__title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1a1a1a;
}

.escb-drawer__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #666;
    padding: 4px 6px;
    line-height: 1;
    transition: color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.escb-drawer__close:hover {
    color: #1a1a1a;
}

/* ── Scrollable body ──────────────────────────────────────── */
.escb-drawer__body {
    flex: 1;
    overflow-y: auto;
    transition: opacity 0.2s ease;
}

.escb-drawer__body.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

.escb-drawer__empty {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin: 0;
}

/* ── Cart items list ──────────────────────────────────────── */
.escb-cart-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.escb-cart-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.escb-cart-item__thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 4px;
    background: #f8f8f8;
}

.escb-cart-item__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.escb-cart-item__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.escb-cart-item__info .escb-qty {
    margin-top: 2px;
    align-self: flex-start;
}

.escb-cart-item__name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.escb-cart-item__meta {
    font-size: 0.74rem;
    color: #888;
    display: block;
}

.escb-cart-item__price {
    font-size: 0.82rem;
    font-weight: 600;
    color: #005B7F;
    display: block;
}

/* Remove any WC inline margin/padding on price spans */
.escb-cart-item__price .woocommerce-Price-amount,
.escb-cart-item__price .amount {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* ── Quantity control ─────────────────────────────────────── */
.escb-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 2px;
}

.escb-qty__btn {
    background: none;
    border: none;
    padding: 5px 10px;
    font-size: 0.95rem;
    cursor: pointer;
    color: #555;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.escb-qty__btn:hover {
    background: #f0f8fb;
    color: #005B7F;
}

.escb-qty__num {
    font-size: 0.82rem;
    min-width: 28px;
    text-align: center;
    padding: 0 2px;
    color: #1a1a1a;
    font-weight: 500;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    line-height: 2;
}

/* ── Footer ───────────────────────────────────────────────── */
.escb-drawer__footer {
    flex-shrink: 0;
    border-top: 1px solid #ebebeb;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
}

.escb-drawer__subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.escb-drawer__subtotal-label {
    color: #1a1a1a;
    font-weight: 500;
}

.escb-drawer__subtotal-price {
    font-weight: 700;
    color: #1a1a1a;
}

/* Remove WC inline styles on subtotal price */
.escb-drawer__subtotal-price .woocommerce-Price-amount,
.escb-drawer__subtotal-price .amount {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* ── Action buttons ───────────────────────────────────────── */
.escb-drawer__actions {
    display: flex;
    gap: 8px;
}

.escb-btn {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    line-height: 1;
}

.escb-btn--outline {
    border: 1.5px solid #1a1a1a;
    color: #1a1a1a;
    background: transparent;
}

.escb-btn--outline:hover {
    background: #1a1a1a;
    color: #fff;
    text-decoration: none;
}

.escb-btn--filled {
    border: 1.5px solid #005B7F;
    background: #005B7F;
    color: #fff;
}

.escb-btn--filled:hover {
    background: #2a7d9c;
    border-color: #2a7d9c;
    text-decoration: none;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 480px) {
    .escb-drawer {
        width: 100%;
    }
}
