/* ========================================
   购物车页面样式
   ======================================== */

.cart-page-wrapper {
    background: #f8f8f8;
    min-height: 100vh;
    padding: 40px 0;
}

.cart-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   页面头部
   ======================================== */

.cart-header {
    margin-bottom: 40px;
}

.back-to-shop-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: #333;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin-bottom: 20px;
}

.back-to-shop-link:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
    transform: translateX(-3px);
}

.back-to-shop-link svg {
    transition: transform 0.3s ease;
}

.back-to-shop-link:hover svg {
    transform: translateX(-5px);
}

.cart-title {
    font-size: 36px;
    font-weight: 700;
    color: #222;
    margin: 0;
}

/* ========================================
   空购物车
   ======================================== */

.empty-cart {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.empty-cart-icon {
    margin-bottom: 30px;
}

.empty-cart h2 {
    font-size: 28px;
    font-weight: 700;
    color: #222;
    margin-bottom: 12px;
}

.empty-cart p {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.return-to-shop-btn {
    display: inline-block;
    padding: 14px 40px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.return-to-shop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* ========================================
   购物车内容布局
   ======================================== */

.cart-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    align-items: start;
}

/* ========================================
   商品列表部分
   ======================================== */

.cart-items-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.cart-items-header {
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
}

.items-count {
    font-size: 18px;
    font-weight: 600;
    color: #222;
}

.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ========================================
   单个商品项
   ======================================== */

.cart-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 20px;
    padding: 20px;
    background: #fafafa;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.cart-item:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* 商品图片 */
.cart-item-image {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    background: white;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-image a {
    display: block;
    width: 100%;
    height: 100%;
}

/* 商品详情 */
.cart-item-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-item-info {
    margin-bottom: 15px;
}

.cart-item-name {
    font-size: 18px;
    font-weight: 600;
    color: #222;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.cart-item-name a {
    color: #222;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cart-item-name a:hover {
    color: #ff6b6b;
}

/* 商品标签 */
.cart-item-tags {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.item-tag {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* 商品单价 */
.cart-item-price {
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

.cart-item-price .amount {
    color: #ff6b6b;
    font-weight: 600;
}

/* 商品操作 */
.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 数量控制 */
.quantity-control {
    display: flex;
    align-items: center;
}

.quantity-control .quantity {
    display: flex;
    align-items: center;
    gap: 0;
}

.quantity-control input[type="number"] {
    width: 60px;
    height: 40px;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #222;
    -moz-appearance: textfield;
}

.quantity-control input[type="number"]::-webkit-outer-spin-button,
.quantity-control input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-control input[type="number"]:focus {
    outline: none;
    border-color: #ff6b6b;
}

/* 小计 */
.cart-item-subtotal {
    font-size: 20px;
    font-weight: 700;
    color: #ff6b6b;
    min-width: 100px;
    text-align: right;
}

/* 删除按钮 */
.cart-item-remove {
    margin-left: auto;
}

.remove-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #999;
    transition: all 0.3s ease;
    cursor: pointer;
}

.remove-item:hover {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: white;
    transform: rotate(90deg);
}

/* ========================================
   购物车操作
   ======================================== */

.cart-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.update-cart-btn {
    padding: 12px 32px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.update-cart-btn:hover {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: white;
    transform: translateY(-2px);
}

/* ========================================
   订单摘要
   ======================================== */

.cart-summary-section {
    position: sticky;
    top: 20px;
}

.cart-summary {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.summary-title {
    font-size: 24px;
    font-weight: 700;
    color: #222;
    margin: 0 0 25px 0;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

/* 总计行 */
.cart-totals {
    margin-bottom: 25px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-size: 15px;
}

.total-label {
    color: #666;
    font-weight: 500;
}

.total-value {
    color: #222;
    font-weight: 600;
}

.total-value .amount {
    color: #ff6b6b;
}

/* 总计行 */
.grand-total-row {
    margin-top: 15px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
    font-size: 18px;
}

.grand-total-row .total-label {
    color: #222;
    font-weight: 700;
}

.grand-total {
    font-size: 24px;
    font-weight: 700;
    color: #ff6b6b;
}

/* 结账按钮 */
.checkout-button-wrapper {
    margin-bottom: 20px;
}

.checkout-button {
    display: block;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.checkout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* ========================================
   优惠券部分
   ======================================== */

.coupon-section {
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.coupon-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    color: #ff6b6b;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.coupon-toggle:hover {
    color: #ff8e53;
}

.coupon-toggle svg {
    transition: transform 0.3s ease;
}

.coupon-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.coupon-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.coupon-input:focus {
    outline: none;
    border-color: #ff6b6b;
}

.apply-coupon-btn {
    padding: 12px 24px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.apply-coupon-btn:hover {
    background: #ff8e53;
    transform: translateY(-2px);
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 1024px) {
    .cart-content-wrapper {
        grid-template-columns: 1fr;
    }

    .cart-summary-section {
        position: static;
    }
}

@media (max-width: 768px) {
    .cart-container {
        padding: 0 16px;
    }

    .cart-title {
        font-size: 28px;
    }

    .cart-items-section {
        padding: 20px;
    }

    .cart-item {
        grid-template-columns: 90px 1fr;
        gap: 15px;
        padding: 15px;
    }

    .cart-item-image {
        width: 90px;
        height: 90px;
    }

    .cart-item-name {
        font-size: 16px;
    }

    .cart-item-actions {
        flex-wrap: wrap;
        gap: 12px;
    }

    .cart-item-subtotal {
        min-width: auto;
        flex: 1;
    }

    .cart-summary {
        padding: 20px;
    }

    .summary-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .cart-page-wrapper {
        padding: 20px 0;
    }

    .cart-title {
        font-size: 24px;
    }

    .cart-item {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .cart-item-image {
        width: 100%;
        height: 200px;
        margin: 0 auto;
    }

    .cart-item-actions {
        justify-content: center;
        flex-direction: column;
        width: 100%;
    }

    .cart-item-subtotal {
        text-align: center;
        width: 100%;
    }

    .cart-item-remove {
        margin: 0 auto;
    }

    .checkout-button {
        font-size: 16px;
        padding: 14px;
    }
}

/* ========================================
   WooCommerce默认样式覆盖
   ======================================== */

.woocommerce-cart-form {
    margin: 0;
}

.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border-left: 4px solid #ff6b6b;
}

.woocommerce-message:before,
.woocommerce-error:before,
.woocommerce-info:before {
    display: none;
}