/* ── DESIGN TOKENS ───────────────────────────────────────────── */
:root {
    --gm-red:          #E73427;
    --gm-black:        #252522;
    --gm-white:        #FFFFFF;
    --gm-cream:        #FAF9F6;
    --gm-border:       #D9D7CB;
    --gm-gray:         #7B7970;
    --gm-subtle:       #A09890;
    --gm-green:        #1D8A50;
    --gm-green-bg:     #EBF7F0;
    --gm-green-border: #B8E4CC;
    --gm-amber:        #E8830A;
}

/* ── BODY LOCK ───────────────────────────────────────────────── */
body.sidecart-open {
    overflow: hidden;
    height: 100%;
    touch-action: none;
}

/* ── DRAWER ──────────────────────────────────────────────────── */
.side-cart {
    position: fixed;
    top: 0;
    right: 0;
    width: 440px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--gm-white);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.35s ease-in-out;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--gm-black);
}

.side-cart.open {
    transform: translateX(0);
    pointer-events: auto;
}

/* ── OVERLAY ─────────────────────────────────────────────────── */
#side-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#side-cart-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ── INNER WRAPPER ───────────────────────────────────────────── */
.gm-side-cart-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── HEADER ──────────────────────────────────────────────────── */
.gm-cart-header {
    padding: 28px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.gm-cart-header-left {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.gm-cart-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gm-black);
    flex-shrink: 0;
}

.gm-cart-close svg,
.gm-cart-close path {
    pointer-events: none;
}

.gm-cart-title {
    font-size: 38px;
    font-weight: 700;
    color: var(--gm-black);
    letter-spacing: -0.03em;
    line-height: 1;
}

.gm-cart-count {
    font-size: 18px;
    font-weight: 600;
    color: var(--gm-subtle);
    vertical-align: super;
    line-height: 1;
}

/* ── SHIPPING BAR ────────────────────────────────────────────── */
.gm-shipping-banner {
    flex-shrink: 0;
}

.gm-shipping-banner--free {
    margin: 12px 24px 0;
    padding: 10px 13px;
    background: #EDF7F2;
    border: 1px solid #C3E8D4;
    border-radius: 8px;
    display: flex;
    align-items: center;
}

.gm-free-ship-text {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--gm-green);
}

.gm-shipping-banner--progress {
    padding: 12px 24px 14px;
    background: var(--gm-cream);
    border-bottom: 1px solid var(--gm-border);
    margin-top: 12px;
}

.gm-shipping-label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 9px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gm-black);
}

.gm-shipping-track {
    height: 3px;
    background: var(--gm-border);
    border-radius: 99px;
    overflow: hidden;
}

.gm-shipping-fill {
    height: 100%;
    background: var(--gm-red);
    border-radius: 99px;
    transition: width 0.6s ease;
}

/* ── CART ITEMS ──────────────────────────────────────────────── */
.gm-cart-items {
    flex: 1;
    overflow-y: auto;
}

.gm-cart-item {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gm-border);
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.gm-item-image {
    flex-shrink: 0;
    border-radius: 3px;
    overflow: hidden;
    width: 88px;
    height: 88px;
}

.gm-item-image img {
    width: 88px;
    height: 88px;
    object-fit: cover;
    display: block;
}

.gm-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gm-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.gm-item-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    padding-right: 8px;
}

.gm-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gm-subtle);
    font-size: 20px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    text-decoration: none;
}

.gm-item-variant {
    font-size: 12px;
    color: var(--gm-gray);
    margin-bottom: 10px;
}

/* ── STOCK URGENCY ───────────────────────────────────────────── */
.gm-stock-urgency {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.gm-urgency-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gm-amber);
    flex-shrink: 0;
    display: block;
}

.gm-urgency-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gm-amber);
    letter-spacing: 0.01em;
}

/* ── STOCK STATUS (WC default) ───────────────────────────────── */
.gm-stock-status {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-bottom: 12px;
}

.gm-stock-status.in-stock   { color: var(--gm-green); }
.gm-stock-status.on-backorder { color: var(--gm-amber); }
.gm-stock-status.out-of-stock { color: var(--gm-red); }

/* ── QTY STEPPER ─────────────────────────────────────────────── */
.gm-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
}

.gm-qty-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--gm-border);
    border-radius: 2px;
    overflow: hidden;
}

.gm-qty-btn {
    width: 32px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 17px;
    color: var(--gm-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    font-family: inherit;
}

.gm-qty-minus {
    border-right: 1px solid var(--gm-border);
}

.gm-qty-plus {
    border-left: 1px solid var(--gm-border);
}

.gm-qty-val {
    width: 32px;
    height: 30px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gm-item-price {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ── FOOTER ──────────────────────────────────────────────────── */
.gm-cart-footer {
    padding: 20px 24px 24px;
    flex-shrink: 0;
    border-top: 1px solid var(--gm-border);
}

.gm-subtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.gm-subtotal-label {
    font-size: 15px;
    font-weight: 600;
}

.gm-subtotal-amount {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
}


/* ── COUPON ROW ──────────────────────────────────────────────── */
.gm-coupon-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #EEF9F3;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gm-green);
}

/* ── TOTAL ROW (after coupon) ────────────────────────────────── */
.gm-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
    padding-top: 10px;
    border-top: 1px solid var(--gm-border);
}

.gm-total-label {
    font-size: 15px;
    font-weight: 600;
}

.gm-total-amount {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

/* ── DELIVERY STRIP ──────────────────────────────────────────── */
.gm-delivery-strip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    background: var(--gm-cream);
    border: 1px solid var(--gm-border);
    margin-bottom: 16px;
}

.gm-delivery-text {
    font-size: 12px;
    color: var(--gm-black);
    line-height: 1.4;
}

/* ── CHECKOUT BUTTON ─────────────────────────────────────────── */
.gm-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: var(--gm-red);
    color: var(--gm-white);
    border: none;
    padding: 17px 24px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: 'Space Grotesk', sans-serif;
    cursor: pointer;
    margin-bottom: 14px;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

.gm-checkout-btn:hover {
    background: #cc2e23;
    color: var(--gm-white);
    text-decoration: none;
}

/* ── CONTINUE SHOPPING ───────────────────────────────────────── */
.gm-continue-shopping {
    display: block;
    text-align: center;
    font-size: 12px;
    color: var(--gm-subtle);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.gm-cart-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 40px 24px;
    text-align: center;
}

.gm-cart-empty p {
    font-size: 16px;
    font-weight: 500;
    color: var(--gm-subtle);
}

.gm-empty-cta {
    background: var(--gm-red);
    color: var(--gm-white);
    border: none;
    padding: 14px 28px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'Space Grotesk', sans-serif;
    cursor: pointer;
}

/* ── CART COUNT BADGE (header icon) ──────────────────────────── */
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--gm-red);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    padding: 2px 6px;
}

/* ── LOADING STATE ───────────────────────────────────────────── */
.gm-side-cart-inner {
    position: relative;
}

.gm-side-cart-inner.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gm-side-cart-inner.is-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 11;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 2px solid var(--gm-border);
    border-top-color: var(--gm-red);
    border-radius: 50%;
    animation: gm-spin 0.6s linear infinite;
}

@keyframes gm-spin {
    to { transform: rotate(360deg); }
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .side-cart {
        width: 100vw;
    }
}
