/* 百家购物车页面样式 */

/* 主容器 */
.bjcart-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 40px;
}

/* 全宽容器覆盖 */
.woocommerce .bjcart-wrapper,
.woocommerce-cart .bjcart-wrapper {
    max-width: none;
    width: 100%;
    padding: 20px 60px;
}

/* 覆盖主题容器限制 */
.woocommerce-cart .l-section--container,
.woocommerce-cart .l-section__container,
.woocommerce-cart .l-section {
    max-width: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* 头部 */
.bjcart-header {
    margin-bottom: 24px;
}

.bjcart-title {
    font-size: 24px;
    font-weight: 400;
    font-style: italic;
    color: #333;
    margin: 0;
}

/* 主体布局 */
.bjcart-body {
    display: flex;
    gap: 30px;
}

/* 左侧产品列表 */
.bjcart-left {
    flex: 7;
    min-width: 0;
}

/* 右侧订单摘要 */
.bjcart-right {
    flex: 3;
    min-width: 0;
}

/* 产品分组 */
.bjcart-product-group {
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

/* 分组头部 */
.bjcart-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;

    border-bottom: 1px solid #e0e0e0;
}

/* 复选框样式 */
.bjcart-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.bjcart-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.bjcart-group-sku {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* 批发价格下拉 */
.bjcart-wholesale-wrapper {
    margin-left: auto;
    position: relative;
}

.bjcart-wholesale-info {
    font-size: 13px;
    color: #000;
    cursor: pointer;
}

.bjcart-wholesale-info a {
    color: #000;
    font-weight: 700;
    text-decoration: underline;
}

.bjcart-wholesale-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 100;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
}

.bjcart-wholesale-dropdown::before {
    content: '';
    position: absolute;
    top: -16px;
    left: 0;
    right: 0;
    height: 24px;
}

.bjcart-wholesale-wrapper:hover .bjcart-wholesale-dropdown,
.bjcart-wholesale-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bjcart-tier-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 13px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s ease;
}

.bjcart-tier-row:last-child {
    border-bottom: none;
}

.bjcart-tier-row.active {
    background: #f5f5f5;
    border-radius: 4px;
}

.bjcart-tier-row:hover {
    background: #fafafa;
}

.bjcart-tier-qty {
    font-size: 14px;
    color: #333;
}

.bjcart-tier-price {
    font-size: 14px;
    font-weight: 600;
    color: #000;
}

/* 变体列表 */
.bjcart-variations-list {
    padding: 0;
}

/* 变体项目 */
.bjcart-variation-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.bjcart-variation-item:last-child {
    border-bottom: none;
}

/* 项目主要信息 */
.bjcart-item-main {
    display: flex;
    gap: 12px;
    width: 280px;
    flex-shrink: 0;
    align-self: center;
}

.bjcart-item-sizes {
    align-self: center;
}

.bjcart-item-price-wrapper {
    align-self: center;
    position: relative;
}

.bjcart-item-price {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.bjcart-price-arrow {
    transition: transform 0.2s ease;
}

.bjcart-item-price.is-open .bjcart-price-arrow {
    transform: rotate(180deg);
}

/* 价格明细下拉框 */
.bjcart-price-details {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 16px;
    min-width: 370px;
    z-index: 100;
}

.bjcart-price-details-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.bjcart-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.bjcart-price-label {
    color: #666;
}

.bjcart-price-amount {
    color: #333;
    font-weight: 500;
}

.bjcart-price-subtotal {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.bjcart-price-subtotal .bjcart-price-label {
    color: #333;
}

.bjcart-price-subtotal .bjcart-price-amount {
    font-weight: 600;
    color: #333;
}

.bjcart-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border: 1px solid #e0e0e0;
}

.bjcart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bjcart-item-info {
    flex: 1;
    min-width: 0;
}

.bjcart-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.3;
}

.bjcart-item-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}

.bjcart-item-meta span {
    margin-right: 8px;
}

.bjcart-item-color {
    color: #c9a050;
}

/* 标签 */
.bjcart-item-tags {
    margin-bottom: 8px;
}

.bjcart-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    border: 1px solid #333;
    color: #333;
}

/* 操作链接 */
.bjcart-item-actions {
    display: flex;
    gap: 12px;
}

.bjcart-action-link {
    font-size: 12px;
    color: #333;
    text-decoration: underline;
}

.bjcart-action-link:hover {
    color: #000;
}

/* 尺码选择区域 */
.bjcart-item-sizes {
    flex: 1;
    min-width: 0;
}

.bjcart-sizes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-width: 240px;
    margin: 0 auto;
}

.bjcart-size-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bjcart-size-label {
    font-size: 11px;
    color: #666;
    font-weight: 500;
    width: 28px;
    flex-shrink: 0;
}

/* 数量控制 */
.bjcart-qty-control {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
}

.bjcart-qty-btn {
    width: 20px;
    height: 24px;
    border: none;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    padding: 0;
}

.bjcart-qty-btn:hover {
    background: #eee;
}

.bjcart-qty-input,
.woocommerce .bjcart-qty-input,
.woocommerce-cart .bjcart-qty-input,
input[type="number"].bjcart-qty-input {
    width: 32px !important;
    height: 24px !important;
    border: none !important;
    border-left: 1px solid #e0e0e0 !important;
    border-right: 1px solid #e0e0e0 !important;
    text-align: center !important;
    font-size: 13px !important;
    color: #333 !important;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 24px !important;
    appearance: textfield;
    -moz-appearance: textfield;
    -webkit-appearance: textfield;
}

.bjcart-qty-input::placeholder {
    color: #ccc !important;
}

.bjcart-qty-input::-webkit-outer-spin-button,
.bjcart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 价格 */
.bjcart-item-price {
    width: 100px;
    text-align: right;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    flex-shrink: 0;
}

.bjcart-price-indicator {
    font-size: 10px;
    color: #999;
    margin-left: 4px;
}

/* 订单摘要 */
.bjcart-summary {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 20px;
    position: sticky;
    top: 100px;
}

.bjcart-summary-title {
    font-size: 18px;
    font-weight: 500;
    color: #333;
    margin: 0 0 16px 0;
}

/* 产品缩略图 */
.bjcart-summary-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.bjcart-thumb-item {
    position: relative;
    width: 48px;
    height: 48px;
    border: 1px solid #e0e0e0;
}

.bjcart-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bjcart-thumb-qty {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #333;
    color: #fff;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* 摘要行 */
.bjcart-summary-rows {
    margin-bottom: 16px;
}

.bjcart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.bjcart-summary-label {
    font-size: 14px;
    color: #666;
}

.bjcart-summary-value {
    font-size: 14px;
    color: #333;
}

/* 总计 */
.bjcart-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-top: 1px solid #e0e0e0;
    margin-bottom: 16px;
}

.bjcart-total-label {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.bjcart-total-value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* 结账按钮 */
.bjcart-checkout-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: #333;
    color: #fff;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.3s ease;
}

.bjcart-checkout-btn:hover {
    background: #000;
    color: #fff;
}

/* 空购物车 */
.bjcart-empty {
    padding: 60px 20px;
    text-align: center;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
}

.bjcart-empty p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* 响应式 */
@media (max-width: 992px) {
    .bjcart-body {
        flex-direction: column;
    }
    
    .bjcart-left,
    .bjcart-right {
        flex: none;
        width: 100%;
    }
    
    .bjcart-summary {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    .bjcart-variation-item {
        flex-direction: column;
    }
    
    .bjcart-item-main {
        width: 100%;
    }
    
    .bjcart-item-sizes {
        width: 100%;
    }
    
    .bjcart-item-price {
        width: 100%;
        text-align: left;
        margin-top: 12px;
    }
}

/* Loading状态 */
.bjcart-wrapper.bjcart-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* 单个变体更新中状态 */
.bjcart-variation-item.bjcart-updating {
    opacity: 0.7;
    pointer-events: none;
}

.bjcart-variation-item.bjcart-updating .bjcart-item-price::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    border: 2px solid #e0e0e0;
    border-top-color: #333;
    border-radius: 50%;
    animation: bjcartSpin 0.6s linear infinite;
    vertical-align: middle;
}

.bjcart-wrapper.bjcart-loading::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #e0e0e0;
    border-top-color: #333;
    border-radius: 50%;
    animation: bjcartSpin 0.8s linear infinite;
}

@keyframes bjcartSpin {
    to {
        transform: rotate(360deg);
    }
}
