/**
 * Slide-out cart drawer (site-wide).
 * Type system matches the PDP buy-box / cart / checkout: trade-gothic-next,
 * weight 500 names, 600 prices, no uppercase. Falls back gracefully if the
 * --pdp-* tokens (library/css/pdp.css) aren't loaded.
 */

html.exg-drawer-lock,
html.exg-drawer-lock body {
    overflow: hidden !important;
}

#exg-drawer-root {
    position: fixed;
    inset: 0;
    z-index: 999999; /* above Divi fixed header */
    pointer-events: none;
    font-family: var(--exg-body);
}
#exg-drawer-root .exg-drawer__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
}
#exg-drawer-root .exg-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 92vw;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.18);
    transform: translateX(102%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.29, 0.99);
}
#exg-drawer-root.is-open {
    pointer-events: auto;
}
#exg-drawer-root.is-open .exg-drawer__overlay { opacity: 1; }
#exg-drawer-root.is-open .exg-drawer { transform: translateX(0); }
#exg-drawer-root.is-loading .exg-drawer__body { opacity: 0.5; }

/* --- Head ---------------------------------------------------------------- */
.exg-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--pdp-line, #e0e0e0);
}
.exg-drawer__title {
    margin: 0;
    font-size: 18px;
    font-weight: var(--exg-weight-strong);
    color: var(--pdp-ink, #111);
}
.exg-drawer__close {
    margin: 0;
    padding: 0 4px;
    font-size: 26px;
    line-height: 1;
    font-weight: var(--exg-weight-regular);
    color: var(--pdp-ink, #111);
    background: none !important;
    border: 0 !important;
    cursor: pointer;
}
.exg-drawer__close:hover { color: var(--pdp-muted, #707072); }

.exg-drawer__notice {
    margin: 0;
    padding: 11px 24px;
    border-bottom: 1px solid #dfb000;
    border-left: 5px solid var(--exg-gold, #ffc800);
    background: var(--exg-gold, #ffc800);
    color: var(--exg-black, #0a0a0a);
    font-size: 12px;
    font-weight: var(--exg-weight-action, 800);
    letter-spacing: 0.08em;
    line-height: 18px;
}

.exg-drawer__notice[hidden] {
    display: none;
}

/* --- Body / items --------------------------------------------------------- */
.exg-drawer__body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.15s ease;
}
.exg-drawer__inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}
.exg-drawer__items {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 24px !important;
    flex: 1;
}
.exg-drawer__item {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--pdp-line, #e0e0e0);
    list-style: none !important;
}
.exg-drawer__item:last-child {
    border-bottom: 0; /* no divider line above the subtotal footer */
}
.exg-drawer__item-img {
    flex: 0 0 84px;
}
.exg-drawer__item-img img {
    display: block;
    width: 84px;
    height: 84px;
    object-fit: cover;
    background: #f6f6f6;
}
.exg-drawer__item-info {
    flex: 1;
    min-width: 0;
}
.exg-drawer__item-name {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: var(--exg-weight-regular);
    line-height: 1.35;
    color: var(--pdp-ink, #111);
}
/* Sub-lines injected by the woocommerce_cart_item_name filter (category + Fits) */
.exg-drawer__item-name .exg-cart-item-sub,
.exg-drawer__item-name .exg-cart-item-fits {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    font-weight: var(--exg-weight-regular);
    color: var(--pdp-muted, #707072);
}
.exg-drawer__item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.exg-drawer__item-price {
    font-size: 15px;
    font-weight: var(--exg-weight-semibold);
    color: var(--pdp-ink, #111);
    white-space: nowrap;
}
/* Stepper matches the cart-page pill exactly (hotfix.css):
   44px pill, 26px radius, 34px SVG buttons, trash at qty 1, yellow hover. */
.exg-drawer__qty {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 8px;
    gap: 6px;
    border: 1px solid #d0d0d0;
    border-radius: 26px;
    background: #fff;
}
.exg-drawer__qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    flex: 0 0 34px;
    height: 42px;
    padding: 0;
    line-height: 1;
    color: #111;
    background: none !important;
    border: 0 !important;
    cursor: pointer;
}
.exg-drawer__qty-btn svg { display: block; }
.exg-drawer__qty-btn.is-trash { color: #333; }
.exg-drawer__qty-btn:hover { color: #fdbc19; }
.exg-drawer__qty-num {
    width: 34px;
    min-width: 34px;
    flex: 0 0 34px;
    text-align: center;
    font-size: 16px;
    font-weight: var(--exg-weight-semibold);
    color: #111;
}
/* --- Empty state ----------------------------------------------------------- */
.exg-drawer__empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 40px 24px;
    text-align: center;
}
.exg-drawer__empty-title {
    margin: 0;
    font-size: 16px;
    font-weight: var(--exg-weight-regular);
    color: var(--pdp-ink, #111);
}
.exg-drawer__continue {
    padding: 0;
    font-size: 14px;
    font-weight: var(--exg-weight-semibold);
    color: var(--pdp-ink, #111);
    text-decoration: underline;
    text-underline-offset: 2px;
    background: none !important;
    border: 0 !important;
    cursor: pointer;
}

/* --- Footer (subtotal + actions) ------------------------------------------ */
.exg-drawer__footer {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 18px 24px 22px;
    background: #fff;
}
.exg-drawer__subtotal {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: var(--exg-weight-semibold);
    color: var(--pdp-ink, #111);
}
.exg-drawer__ship-note {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: var(--exg-weight-regular);
    color: var(--pdp-muted, #707072);
}
.exg-drawer__btn {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
    margin: 0 0 10px !important;
    padding: 14px 20px !important;
    font-family: var(--exg-body) !important;
    font-size: 15px !important;
    font-weight: var(--exg-weight-strong) !important;
    text-align: center;
    text-transform: none !important;
    text-decoration: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.exg-drawer__btn:hover { opacity: 0.85; }
.exg-drawer__btn--checkout {
    color: #0a0a0a !important;
    background: var(--pdp-accent, #febc16) !important;
    margin-bottom: 0 !important;
}

/* ATC link while the AJAX add is in flight */
.is-adding { pointer-events: none; opacity: 0.7; }
