/* Shopping Cart — Admin Only */

/* ── Cart Icon (floating button) ── */
.cart-trigger {
    position: fixed;
    bottom: 100px; /* above chatbot trigger */
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #573285 0%, #7b4faa 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(87, 50, 133, 0.4);
    z-index: 9996;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.cart-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(87, 50, 133, 0.5);
}
.cart-trigger svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}
.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #D4AF37;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.cart-badge:empty,
.cart-badge[data-count="0"] {
    display: none;
}

/* ── Cart Drawer Overlay ── */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ── Cart Drawer ── */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    z-index: 10001;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.cart-overlay.open + .cart-drawer,
.cart-drawer.open {
    transform: translateX(0);
}

/* ── Drawer Header ── */
.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #573285 0%, #7b4faa 100%);
    color: #fff;
}
.cart-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.cart-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

/* ── Cart Items ── */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}
.cart-empty {
    text-align: center;
    color: #999;
    padding: 40px 16px;
    font-size: 14px;
}
.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: flex-start;
}
.cart-item:last-child {
    border-bottom: none;
}
.cart-item-img {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    background: #f5f5f5;
    flex-shrink: 0;
}
.cart-item-details {
    flex: 1;
    min-width: 0;
}
.cart-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.cart-item-sku {
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
}
.cart-item-price {
    font-size: 14px;
    font-weight: 700;
    color: #573285;
}
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}
.cart-qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.15s;
}
.cart-qty-btn:hover {
    background: #eee;
}
.cart-item-qty {
    font-size: 13px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}
.cart-remove {
    margin-left: auto;
    background: none;
    border: none;
    color: #cc3333;
    cursor: pointer;
    font-size: 18px;
    padding: 2px 4px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.cart-remove:hover {
    opacity: 1;
}

/* ── Cart Footer ── */
.cart-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    background: #fafafa;
}
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 700;
    color: #333;
}
.cart-total-amount {
    color: #573285;
    font-size: 18px;
}
.cart-checkout-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #573285 0%, #7b4faa 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.cart-checkout-btn:hover {
    opacity: 0.9;
}
.cart-checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.cart-clear-btn {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s;
}
.cart-clear-btn:hover {
    background: #f5f5f5;
}

/* ── Add to Cart Button (product cards) ── */
.add-to-cart-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #573285;
    border-radius: 6px;
    background: #fff;
    color: #573285;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.15s, color 0.15s;
}
.add-to-cart-btn:hover {
    background: #573285;
    color: #fff;
}
.add-to-cart-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* ── Add to Cart Button (product detail page) ── */
.add-to-cart-detail {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #573285 0%, #7b4faa 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: opacity 0.2s, transform 0.15s;
}
.add-to-cart-detail:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
.add-to-cart-detail svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* ── Success feedback ── */
.add-to-cart-btn.added,
.add-to-cart-detail.added {
    background: #2ecc71;
    border-color: #2ecc71;
    color: #fff;
}

/* ── Hidden (non-admin) ── */
.cart-hidden {
    display: none !important;
}

/* ── Checkout success/cancel toast ── */
.cart-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    z-index: 10002;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.cart-toast.show {
    opacity: 1;
    transform: translateY(0);
}
.cart-toast.success {
    background: #2ecc71;
}
.cart-toast.error {
    background: #e74c3c;
}
.cart-toast.info {
    background: #573285;
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .cart-drawer {
        width: 100vw;
        max-width: 100vw;
    }
    .cart-trigger {
        bottom: 90px;
        right: 16px;
        width: 44px;
        height: 44px;
    }
}
