/**
 * 自定义购物车样式
 * 完全重写的 HTML 结构，不依赖 WooCommerce 默认样式
 */

/* ==========================================
   字体引入
   ========================================== */
@font-face {
    font-family: 'Air Up Sans';
    src: url('../font/air-up-sans.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ==========================================
   购物车容器
   ========================================== */

.custom-cart-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 20px;
}

/* 页面标题 */
.custom-cart-title {
    font-family: 'Air Up Sans', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: #40001c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 30px 0;
}

/* ==========================================
   左右布局
   ========================================== */

.custom-cart-wrapper {
    display: grid;
    grid-template-columns: 1fr 450px;
    gap: 40px;
    align-items: start;
}

/* ==========================================
   左侧：商品列表
   ========================================== */

.custom-cart-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 单个商品卡片 */
.custom-cart-item {
    position: relative;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.custom-cart-item:hover {
    border-color: #d0d0d0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 删除按钮（右上角） */
.custom-cart-item-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #999;
    transition: all 0.3s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-cart-item-remove:hover {
    color: #40001c;
}

.custom-cart-item-remove svg {
    width: 20px;
    height: 20px;
}

/* 商品内容容器 - 上部分：图片和标题/变体信息 */
.custom-cart-item-content {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 16px;
}

/* 商品图片 */
.custom-cart-item-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    background: #f8f8f8;
    border-radius: 6px;
    overflow: hidden;
}

.custom-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.custom-cart-item-image a {
    display: block;
    width: 100%;
    height: 100%;
}

/* 商品详情 - 右侧：标题和变体信息 */
.custom-cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 商品名称 */
.custom-cart-item-name {
    font-family: 'Air Up Sans', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #40001c;
    margin: 0 0 6px 0;
    line-height: 1.4;
    text-transform: uppercase;
}

.custom-cart-item-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.custom-cart-item-name a:hover {
    color: #ff90c0;
}

/* 变体信息 */
.custom-cart-item-meta {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.custom-cart-item-meta .meta-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: #999;
    margin-top: 2px;
}

.custom-cart-item-meta svg {
    width: 100%;
    height: 100%;
}

/* 数量和价格行 */
.custom-cart-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0;
}

/* 数量控制器 */
.custom-quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.custom-quantity {
    display: inline-flex;
    align-items: center;
    border: none;
    border-radius: 4px;
    overflow: visible;
    background: transparent;
    gap: 8px;
}

.quantity-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #d0d0d0;
    border-radius: 50%;
    background: #fff;
    color: #666;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background: #f5f5f5;
    color: #40001c;
    border-color: #40001c;
}

.quantity-input {
    width: 32px;
    height: 28px;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    background: transparent;
    -moz-appearance: textfield;
    pointer-events: none;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 商品价格 */
.custom-cart-item-price {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

/* ==========================================
   右侧：购物车合计
   ========================================== */

.custom-cart-summary {
    background: #fef4f8;
    border-radius: 12px;
    padding: 32px;
    position: sticky;
    top: 100px;
}

/* 合计标题 */
.custom-summary-title {
    font-family: 'Air Up Sans', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: #40001c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 20px 0;
}

/* 合计行 */
.custom-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.summary-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.summary-value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-align: right;
}

.summary-shipping,
.summary-tax {
    font-size: 13px;
    font-weight: 400;
    color: #666;
}

/* 总计行 */
.custom-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0 0 0;
    margin-top: 16px;
}

.total-label {
    font-size: 18px;
    font-weight: 800;
    color: #333;
    text-transform: uppercase;
}

.total-value {
    font-size: 24px;
    font-weight: 800;
    color: #333;
}

/* 优惠码提示 */
.custom-summary-coupon-hint {
    margin: 24px 0;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    font-size: 14px;
    color: #666;
    text-align: center;
    line-height: 1.5;
}

/* 结账按钮 */
.custom-checkout-button {
    display: block;
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #ff90c0 0%, #ff7ab8 100%);
    color: #40001c;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 144, 192, 0.3);
}

.custom-checkout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 144, 192, 0.4);
    color: #40001c;
}

/* 条款链接 */
.custom-summary-terms {
    margin-top: 16px;
    font-size: 12px;
    color: #999;
    text-align: center;
    line-height: 1.5;
}

.custom-summary-terms a {
    color: #40001c;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.custom-summary-terms a:hover {
    color: #ff90c0;
}

/* ==========================================
   空购物车
   ========================================== */

.custom-cart-empty {
    text-align: center;
    padding: 80px 20px;
}

.custom-cart-empty p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

.custom-button {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 8px;
    font-family: 'Air Up Sans', sans-serif;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.custom-button-primary {
    background: #40001c;
    color: #fff;
}

.custom-button-primary:hover {
    background: #ff90c0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 144, 192, 0.3);
}

/* ==========================================
   响应式设计
   ========================================== */

@media (max-width: 1024px) {
    .custom-cart-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .custom-cart-summary {
        position: static;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .custom-cart-container {
        padding: 30px 16px;
    }

    .custom-cart-title {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .custom-cart-item {
        padding: 16px;
    }

    .custom-cart-item-content {
        gap: 12px;
    }

    .custom-cart-item-image {
        width: 50px;
        height: 50px;
    }

    .custom-cart-item-name {
        font-size: 16px;
    }

    .custom-cart-item-meta {
        font-size: 12px;
    }

    .custom-cart-item-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .custom-cart-item-price {
        font-size: 16px;
    }

    .custom-cart-summary {
        padding: 24px;
    }

    .custom-summary-title {
        font-size: 20px;
    }

    .summary-label,
    .summary-value {
        font-size: 14px;
    }

    .total-label {
        font-size: 16px;
    }

    .total-value {
        font-size: 20px;
    }

    .custom-checkout-button {
        font-size: 15px;
        padding: 14px;
    }
}

/* ==========================================
   加载状态
   ========================================== */

.custom-cart-item.updating {
    opacity: 0.6;
    pointer-events: none;
}

.custom-cart-item.updating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff90c0;
    border-radius: 50%;
    animation: custom-cart-spin 0.8s linear infinite;
}

@keyframes custom-cart-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

