/**
 * Digitalmart Hub - Sidecart (cart drawer)
 *
 * CSS do cart drawer slide-in usado fora das paginas de checkout
 * (shop, single-product, blog, home etc) quando opcao
 * dmhub_checkout_replace_sidecart === 'yes'.
 *
 * Estrutura HTML .cart-drawer / .cart-drawer__* esperada — themes que
 * usam outra estrutura ignoram silenciosamente. Cores principais via
 * var(--color-primary) com fallback verde (#1f7a4d) pra que o tema
 * possa customizar facilmente.
 *
 * Carregado por: CheckoutAssets::__construct() em paginas non-checkout
 * quando replace_sidecart esta ativo.
 */

/* Lock body scroll when cart is open */
body.cart-drawer-open { overflow: hidden; }

/* Overlay */
.cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
}
.cart-drawer.is-open { pointer-events: auto; }

/* Backdrop */
.cart-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.cart-drawer.is-open .cart-drawer__backdrop { opacity: 1; }

/* Sliding panel */
.cart-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(380px, 82vw);
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    will-change: transform;
}
.cart-drawer.is-open .cart-drawer__panel { transform: translateX(0); }

/* Header */
.cart-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.cart-drawer__title {
    font-size: 18px;
    font-weight: 500;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-drawer__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--color-accent, #1f7a4d);
    color: #fff;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}
.cart-drawer__count:empty { display: none; }
.cart-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    color: #111827;
    transition: background 0.2s;
}
.cart-drawer__close:hover { background: #e5e7eb; }

/* Body — scrollable */
.cart-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    -webkit-overflow-scrolling: touch;
}

/* Footer */
.cart-drawer__foot {
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #fff;
}
.cart-drawer__subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 15px;
    color: #111827;
}
.cart-drawer__subtotal-price {
    font-size: 20px;
    font-weight: 500;
    color: #111827;
}
.cart-drawer__coupons {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cart-drawer__coupon {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #6b7280;
}
.cart-drawer__coupon-code {
    background: #e8f5e9;
    color: #16a34a;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 500;
    letter-spacing: 0.04em;
}
.cart-drawer__coupon-value {
    color: #16a34a;
    font-weight: 500;
}
.cart-drawer__actions {
    display: flex;
    gap: 10px;
}
.cart-drawer__continue {
    flex: 1;
    padding: 14px 12px;
    background: transparent;
    color: #111827;
    border: 2px solid #111827;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.cart-drawer__continue:hover {
    background: #111827;
    color: #fff;
}
.cart-drawer__checkout {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 14px 12px;
    background: var(--color-accent, #1f7a4d);
    color: #fff;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: filter 0.2s;
    white-space: nowrap;
}
.cart-drawer__checkout:hover {
    filter: brightness(1.1);
    color: #fff;
}

/* WC loading overlay */
.cart-drawer .blockUI.blockOverlay {
    background: rgba(255, 255, 255, 0.7) !important;
    border-radius: 8px;
}
