/* ==========================================================================
   GLOBAL SHOPPING CART COMPONENTS
   悬浮按钮 / 徽章 / 抽屉 / 商品项 / 遮罩 —— 全站公共
   依赖公共变量：--secondary-color / --title-color / --text-color / --border-color
   ========================================================================== */

/* Cart Float Button - above WhatsApp button */
.cart-float-btn {
    position: fixed;
    bottom: 162px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    z-index: 9998;
}
.cart-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #EF4444;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* Cart Drawer */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}
.cart-drawer.open {
    right: 0;
}
.cart-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.cart-drawer-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--title-color);
}
.cart-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-color);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.cart-drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 24px;
}

/* Cart Item */
.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.cart-item-img {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
}
.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cart-item-info {
    flex: 1;
    min-width: 0;
}
.cart-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--title-color);
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cart-item-size {
    font-size: 13px;
    color: var(--title-color);
    font-weight: 500;
    margin: 0 0 4px 0;
}
.cart-item-qty {
    font-size: 13px;
    color: var(--text-color);
}
/* 垃圾桶 - 灰色 */
.cart-item-remove {
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s ease;
}
.cart-item-remove:hover {
    color: #6B7280;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-color);
}
.cart-empty i {
    font-size: 48px;
    color: #D1D5DB;
    margin-bottom: 16px;
}
.cart-drawer-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

/* Overlay */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}
.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cart-drawer {
        width: 100%;
        right: -100%;
    }
    .cart-float-btn {
        bottom: 160px;
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}
