/* Side Cart Container */
.cm-side-cart-overlay, #side-cart-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999999;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: none; /* Default to none to prevent lingering clicks */
}
.cm-side-cart-overlay.open, #side-cart-overlay.open { 
    opacity: 1; 
    visibility: visible; 
    display: block; 
}

.cm-side-cart, #side-cart {
    position: fixed; top: 0; right: 0;
    width: 100%; max-width: 450px; height: 100vh;
    background: #0B0C15;
    box-shadow: -5px 0 30px rgba(0,0,0,0.5), inset 1px 0 0 rgba(255,255,255,0.05);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; flex-direction: column;
    z-index: 1000000; color: white;
}
.cm-side-cart.open, #side-cart.open { 
    transform: translateX(0); 
    display: flex !important;
}

/* Header */
/* Header Pattern */
.cm-side-cart-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: #0B0C15;
}
.cm-side-cart-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem; /* 20px - slightly larger */
    font-weight: 700;
    letter-spacing: -0.02em; margin: 0; color: white;
}
.cm-side-cart-close {
    background: transparent; border: none;
    color: #9CA3AF;
    cursor: pointer; font-size: 28px; padding: 0;
    line-height: 1;
    transition: color 0.2s;
}
.cm-side-cart-close:hover { color: white; }

/* Body */
.cm-side-cart-body { flex: 1; overflow-y: auto; padding: 24px; }

/* Woo Mini Cart Overrides */
.cm-side-cart-body .widget_shopping_cart_content ul.cart_list li {
    padding: 16px;
    display: grid;
    grid-template-columns: 72px 1fr;
    grid-template-areas:
        "img info"
        "img actions";
    gap: 16px;
    align-items: start;
    border: 1px solid #272733; /* Lighter border */
    border-radius: 16px; /* Softer corners */
    background: #12131C; /* Dark card background */
    margin-bottom: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}
.cm-side-cart-body .widget_shopping_cart_content ul.cart_list li img {
    grid-area: img;
    width: 72px; height: 72px; object-fit: cover;
    border-radius: 12px; float: none; margin: 0;
}
.cm-cart-item-price {
    margin-left: auto;
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
}
.cm-unit-price {
    font-size: 0.85rem;
    color: #9CA3AF;
    font-weight: 400;
}
.cm-side-cart-body a {
    color: white !important;
    text-decoration: none; font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
    display: block; margin-bottom: 4px;
}

/* ... existing code ... */

.cm-side-cart-footer .buttons .checkout {
    background: #5850ec; /* Indigo - Match Mockup */
    border: none;
    box-shadow: 0 4px 12px rgba(88, 80, 236, 0.4);
    /* Try to use theme color if available in vars, else fallback */
    background: var(--cm-primary-color, #5850ec);
}
.cm-side-cart-footer .buttons .checkout:hover {
    background: #4f46e5;
    box-shadow: 0 6px 16px rgba(88, 80, 236, 0.5); 
    transform: translateY(-1px);
}
.cm-side-cart-footer .buttons .view-cart:hover {
    border-color: white; background: rgba(255,255,255,0.05);
}

/* Loading Spinner */
.single_add_to_cart_button.loading { color: transparent !important; pointer-events: none; position: relative; }
.single_add_to_cart_button.loading::after {
    content: ""; position: absolute;
    width: 20px; height: 20px;
    top: 50%; left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white; border-radius: 50%;
    animation: cm-spin 0.8s linear infinite;
}
@keyframes cm-spin { to { transform: rotate(360deg); } }

/* Cart Totals Block */
.cm-cart-totals-block {
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.cm-cart-total-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
    font-size: 0.95rem; color: rgba(255,255,255,0.7);
}
.cm-cart-total-row.cm-final-total {
    margin-top: 12px;
    font-size: 1.25rem; font-weight: 700; color: white;
}
.cm-cart-total-row.cm-discount {
    color: #4ade80; /* Green for discount */
}

/* Remove Link Styling */
/* Remove Link Styling */
/* Remove Link Styling */
.cm-remove-link {
    font-size: 0.8rem;
    color: #ffb3b3; /* Soft red default */
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s, opacity 0.2s;
    margin-left: 12px; /* Spacing from Qty */
}
.cm-remove-link:hover { 
    text-decoration: none; 
    color: #EF4444; /* Brighter red on hover */
    opacity: 1;
}
.cm-remove-link.loading { opacity: 0.5; pointer-events: none; }
