/* ==========================================================
   SIDE PANEL CART — overlay + drawer
========================================================== */

/* Backdrop */
.ppos-side-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.ppos-side-cart-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Panel */
.ppos-side-cart {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: #fff;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.ppos-side-cart.is-open {
    transform: translateX(0);
}

/* Header */
.ppos-side-cart__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.ppos-side-cart__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ppos-side-cart__icon {
    font-size: 1.2rem;
}

.ppos-side-cart__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease;
}

.ppos-side-cart__close:hover {
    color: #1a1a1a;
    background: #f0f0f0;
}

/* Scrollable item body */
.ppos-side-cart__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Loading / empty states */
.ppos-side-cart__loading,
.ppos-side-cart__empty {
    color: #888;
    font-size: 0.95rem;
    text-align: center;
    padding: 40px 0;
}

/* Cart item row */
.ppos-side-cart__item {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    grid-template-rows: auto auto;
    gap: 0 12px;
    align-items: start;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.ppos-side-cart__item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Item image */
.ppos-side-cart__item-img-wrap {
    grid-row: 1 / 3;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
}

.ppos-side-cart__item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Item name + variant */
.ppos-side-cart__item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    margin-bottom: 2px;
}

.ppos-side-cart__item-variant {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 6px;
}

/* Qty controls + price row */
.ppos-side-cart__item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ppos-side-cart__qty {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.ppos-side-cart__qty-btn {
    background: #f8f8f8;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    font-size: 1rem;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.ppos-side-cart__qty-btn:hover {
    background: #ececec;
}

.ppos-side-cart__qty-value {
    min-width: 28px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a1a;
    padding: 0 4px;
}

.ppos-side-cart__qty--locked {
    border: none;
    padding: 0 4px;
}

.ppos-side-cart__qty--locked .ppos-side-cart__qty-value {
    color: #666;
    font-weight: 500;
}

.ppos-side-cart__item-price {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
}

/* Remove button (trash icon) */
.ppos-side-cart__item-remove {
    grid-column: 3;
    grid-row: 1;
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    font-size: 1rem;
    padding: 2px 4px;
    border-radius: 3px;
    transition: color 0.15s ease;
    align-self: center;
}

.ppos-side-cart__item-remove:hover {
    color: #e53935;
}

/* Subitem styling */
.ppos-side-cart__item--subitem {
    opacity: 0.75;
    padding-left: 8px;
    border-left: 2px solid #e0e0e0;
}

/* Footer: subtotal + checkout */
.ppos-side-cart__footer {
    padding: 16px 20px;
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
    background: #fff;
}

.ppos-side-cart__subtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
    font-size: 0.95rem;
}

.ppos-side-cart__subtotal-label {
    color: #555;
}

.ppos-side-cart__subtotal-value {
    font-weight: 700;
    font-size: 1.05rem;
    color: #1a1a1a;
}

.ppos-side-cart__checkout-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: #0073aa;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 115, 170, 0.3);
}

.ppos-side-cart__checkout-btn:hover {
    background: #005a87;
    box-shadow: 0 4px 10px rgba(0, 115, 170, 0.4);
    color: #fff;
}

.ppos-side-cart__checkout-btn.is-disabled {
    background: #aaa;
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
}

/* Checkout redirect message */
.ppos-side-cart__checkout-msg {
    margin-top: 8px;
    font-size: 0.78rem;
    color: #888;
    text-align: center;
    line-height: 1.4;
}

.ppos-side-cart__checkout-msg strong {
    color: #555;
}

/* Order code */
.ppos-side-cart__order-code {
    margin-top: 8px;
    font-size: 0.75rem;
    color: #aaa;
    text-align: center;
    word-break: break-all;
}

/* Extra shortcode zone */
.ppos-side-cart__extra {
    padding: 16px 20px;
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
    overflow-y: auto;
    max-height: 220px;
}

/* Errors */
.ppos-side-cart__error {
    background: #fff3f3;
    border: 1px solid #f5c6cb;
    color: #721c24;
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* Responsive — full-screen takeover on mobile */
@media (max-width: 480px) {
    .ppos-side-cart {
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        transform: translateY(100%);
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
        border-radius: 0;
    }

    .ppos-side-cart.is-open {
        transform: translateY(0);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ppos-side-cart,
    .ppos-side-cart-overlay {
        transition: none;
    }
}
