/* ==========================================
   WooCommerce Loop Grid Cart - 前端样式
   ========================================== */

/* ---------- 主容器 ---------- */
.wc-loop-cart-wrapper {
    position: relative;
    width: 100%;
}

/* ---------- 加载状态 ---------- */
.wc-loop-cart-loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.wc-loop-cart-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid #e8e8e8;
    border-top-color: #555;
    border-radius: 50%;
    animation: wcLoopCartSpin 0.7s linear infinite;
}

@keyframes wcLoopCartSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---------- 购物车网格 ---------- */
.wc-loop-cart-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 20px;
    row-gap: 20px;
}

/* ---------- 购物车项 ---------- */
.wc-loop-cart-item {
    position: relative;
    background-color: #ffffff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 16px;
    transition: box-shadow 0.2s ease;
}

.wc-loop-cart-item:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ---------- 购物车项操作区域 ---------- */
.wc-loop-cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

/* ---------- 数量选择器 ---------- */
.wc-loop-cart-qty-wrapper {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.wc-loop-cart-qty-wrapper:hover {
    border-color: #bbb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.wc-loop-cart-qty-wrapper:focus-within {
    border-color: #888;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

/* ---- 数量加减按钮（高优先级选择器防 reset.css） ---- */
.wc-loop-cart-wrapper button.wc-loop-cart-qty-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    max-width: 34px;
    max-height: 34px;
    border: none;
    background: transparent;
    background-color: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 500;
    color: #555;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    outline: none;
    line-height: 1;
    margin: 0;
    padding: 0;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    text-indent: 0;
    text-transform: none;
    letter-spacing: normal;
    vertical-align: middle;
}

.wc-loop-cart-wrapper button.wc-loop-cart-qty-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: #222;
}

.wc-loop-cart-wrapper button.wc-loop-cart-qty-btn:active {
    background-color: rgba(0, 0, 0, 0.1);
}

/* ---- 数量输入框（高优先级选择器防 reset.css） ---- */
.wc-loop-cart-wrapper input.wc-loop-cart-qty-input[type="number"] {
    width: 44px;
    height: 34px;
    min-width: 44px;
    max-width: 60px;
    border: none;
    border-left: 1.5px solid #e0e0e0;
    border-right: 1.5px solid #e0e0e0;
    border-top: none;
    border-bottom: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    background: #fff;
    background-color: #fff;
    outline: none;
    -moz-appearance: textfield;
    -webkit-appearance: none;
    appearance: none;
    line-height: 1;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    vertical-align: middle;
}

.wc-loop-cart-qty-input::-webkit-outer-spin-button,
.wc-loop-cart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wc-loop-cart-qty-input[type="number"] {
    -moz-appearance: textfield;
}

/* ---------- 移除按钮（高优先级选择器防 reset.css） ---------- */
.wc-loop-cart-wrapper button.wc-loop-cart-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1.5px solid #e8e8e8;
    background: #fff;
    background-color: #fff;
    color: #888;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.25s ease;
    outline: none;
    white-space: nowrap;
    line-height: 1.2;
    letter-spacing: 0.3px;
    margin: 0;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    text-decoration: none;
    text-transform: none;
    vertical-align: middle;
}

.wc-loop-cart-wrapper button.wc-loop-cart-remove-btn:hover {
    color: #e74c3c;
    border-color: #e74c3c;
    background: #fef5f5;
    background-color: #fef5f5;
}

.wc-loop-cart-wrapper button.wc-loop-cart-remove-btn:active {
    background: #fde8e8;
    background-color: #fde8e8;
    border-color: #d63031;
    color: #d63031;
}

/* 移除按钮图标模式 */
.wc-loop-cart-remove-btn .wc-loop-cart-remove-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    line-height: 1;
}

.wc-loop-cart-remove-btn .wc-loop-cart-remove-icon svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

.wc-loop-cart-removing {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------- 空购物车 ---------- */
.wc-loop-cart-empty {
    text-align: center;
    padding: 60px 20px;
}

.wc-loop-cart-empty-text {
    color: #999;
    font-size: 16px;
    margin: 0 0 20px 0;
}

.wc-loop-cart-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    background-color: #333;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.wc-loop-cart-empty-btn:hover {
    opacity: 0.9;
    color: #fff;
}

/* ---------- 购物车合计 ---------- */
.wc-loop-cart-totals {
    margin-top: 24px;
    padding: 16px 20px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
}

.wc-loop-cart-totals-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.wc-loop-cart-totals-label {
    font-size: 15px;
    color: #333;
}

.wc-loop-cart-totals-price {
    font-size: 18px;
    font-weight: 700;
    color: #111;
}
