/* ==========================================================
   Side Cart for WooCommerce

   Slide-out mini cart triggered from the header cart icon.
   Item rows with qty −/+ controls, subtotal, and a single
   "Checkout" CTA at the bottom.
   ========================================================== */

/* ───────── Cart-icon badge ─────────
   Sits absolute, top-right of whichever element matches the
   selectors in SDCT_SIDE_CART.iconSelectors. JS injects the
   `.sdct-side-cart-count-badge` into each matching icon parent. */

.sdct-side-cart-icon-wrap {
    position: relative;
    display: inline-block;
}

.sdct-side-cart-count-badge {
    position: absolute;
    top: -6px;
    right: 1px;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    box-sizing: border-box;
    border-radius: 999px;
    background: #333;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    letter-spacing: 0;
    pointer-events: none;
    border: 2px solid #fff;
    z-index: 5;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.sdct-side-cart-count-badge.is-hidden {
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
}

@keyframes sdctSideCartBadgePop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}
.sdct-side-cart-count-badge.is-bumping {
    animation: sdctSideCartBadgePop 0.35s ease-out;
}


/* ───────── Drawer root ─────────
   Two stacked layers — overlay (full-screen dim) + the right-side
   panel that slides in. Hidden by default with pointer-events: none
   + opacity 0 so it never blocks clicks when closed. */

.sdct-side-cart-root {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sdct-side-cart-root.is-open {
    pointer-events: auto;
}

.sdct-side-cart-overlay {
    position: absolute;
    inset: 0;
    background: rgba(31, 36, 48, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sdct-side-cart-root.is-open .sdct-side-cart-overlay {
    opacity: 1;
}

.sdct-side-cart-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 420px;
    max-width: 92vw;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    color: #1f2430;
}

/* When the WP admin bar is visible (logged-in users) the panel's top
   edge would otherwise sit underneath it. Push the panel down. */
body.admin-bar .sdct-side-cart-panel {
    top: 32px;
    height: calc(100% - 32px);
}
@media (max-width: 782px) {
    body.admin-bar .sdct-side-cart-panel {
        top: 46px;
        height: calc(100% - 46px);
    }
}

.sdct-side-cart-root.is-open .sdct-side-cart-panel {
    transform: translateX(0);
}


/* ───────── Header ───────── */

.sdct-side-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.sdct-side-cart-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1f2430;
    letter-spacing: -0.2px;
}

.sdct-side-cart-count-inline {
    font-weight: 500;
    color: #777;
    margin-left: 4px;
    font-size: 14px;
}

.sdct-side-cart-close {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    color: #555;
    transition: background 0.2s ease, color 0.2s ease;
}

.sdct-side-cart-close:hover,
.sdct-side-cart-close:focus {
    background: #f5f5f5;
    color: #1f2430;
    outline: none;
}


/* ───────── Body ───────── */

.sdct-side-cart-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 22px;
    -webkit-overflow-scrolling: touch;
}

/* Empty cart state */
.sdct-side-cart-empty {
    text-align: center;
    padding: 32px 8px;
    color: #777;
}

.sdct-side-cart-empty p {
    margin: 0 0 12px;
    font-size: 14px;
}

.sdct-side-cart-shop-link {
    color: #1f2430;
    font-weight: 600;
    text-decoration: none;
    font-size: 13px;
}

.sdct-side-cart-shop-link:hover {
    text-decoration: underline;
}

/* Item list */
.sdct-side-cart-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sdct-side-cart-item {
    display: grid;
    grid-template-columns: 64px 1fr 24px;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 0;
}

.sdct-side-cart-item + .sdct-side-cart-item {
    border-top: 1px solid #e5e5e5;
}

.sdct-side-cart-item-thumb img,
.sdct-side-cart-item-thumb .sdct-side-cart-item-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    display: block;
}

.sdct-side-cart-item-info {
    min-width: 0;
}

.sdct-side-cart-item-name {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 600;
    color: #1f2430;
    line-height: 1.35;
    overflow-wrap: break-word;
}

.sdct-side-cart-item-sku {
    margin: 0 0 8px;
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sdct-side-cart-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Qty control — circular outline buttons */
.sdct-side-cart-qty {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sdct-side-cart-qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #1f2430;
    border-radius: 50%;
    background: transparent;
    color: #1f2430;
    font-size: 14px;
    line-height: 1;
    font-weight: 400;
    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;
}

.sdct-side-cart-qty-btn:hover,
.sdct-side-cart-qty-btn:focus {
    background: #1f2430;
    border-color: #1f2430;
    color: #fff;
    outline: none;
}

.sdct-side-cart-qty-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.sdct-side-cart-qty-value {
    min-width: 18px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #1f2430;
}

.sdct-side-cart-item-price {
    font-size: 14px;
    font-weight: 700;
    color: #1f2430;
    white-space: nowrap;
}

/* × remove link */
.sdct-side-cart-item-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #999;
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
    border-radius: 50%;
    margin-top: 2px;
    transition: background 0.15s ease, color 0.15s ease;
}

.sdct-side-cart-item-remove:hover,
.sdct-side-cart-item-remove:focus {
    background: #f5f5f5;
    color: #1f2430;
    text-decoration: none;
    outline: none;
}


/* ───────── Footer ───────── */

.sdct-side-cart-footer {
    flex-shrink: 0;
    padding: 18px 22px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
}

.sdct-side-cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    font-size: 16px;
}

.sdct-side-cart-subtotal > span:first-child {
    color: #555;
    font-weight: 500;
}

.sdct-side-cart-subtotal-value {
    color: #1f2430;
    font-weight: 700;
}

.sdct-side-cart-cta {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 14px 22px;
    background: #1f2430;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid #1f2430;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.sdct-side-cart-cta:hover,
.sdct-side-cart-cta:focus {
    background: #000;
    border-color: #000;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    text-decoration: none;
}


/* ───────── Loading state during AJAX qty change ───────── */
.sdct-side-cart-item.is-loading {
    opacity: 0.5;
    pointer-events: none;
}


/* ───────── Mobile (≤768px) ───────── */
@media (max-width: 768px) {
    .sdct-side-cart-panel {
        width: 100vw;
        max-width: 100vw;
    }
    .sdct-side-cart-header,
    .sdct-side-cart-body,
    .sdct-side-cart-footer {
        padding-left: 18px;
        padding-right: 18px;
    }
    .sdct-side-cart-close { width: 44px; height: 44px; font-size: 28px; }
    .sdct-side-cart-qty-btn { width: 28px; height: 28px; font-size: 15px; }
}


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