/**
 * 选品车优化样式 - 韩式电商风格
 */

:root {
    --cb-cart-primary: #ff5722;
    --cb-cart-text: #333;
    --cb-cart-muted: #999;
    --cb-cart-border: #eee;
    --cb-cart-bg: #f9f9f9;
}

.cb-selection-cart-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--cb-cart-text);
}

/* 顶部工具栏：选项卡 + 搜索 */
.cb-cart-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--cb-cart-border);
    margin-bottom: 20px;
    padding-bottom: 10px;
    flex-wrap: wrap;
    gap: 15px;
}

.cb-cart-tabs {
    display: flex;
    gap: 30px;
    /* 小屏滑动支持 */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    scroll-behavior: smooth;
    padding-bottom: 5px;
}

.cb-cart-tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.cb-cart-tab {
    padding: 10px 0;
    font-size: 16px;
    color: var(--cb-cart-muted);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
}

.cb-cart-tab.active {
    color: var(--cb-cart-primary);
    font-weight: bold;
}

.cb-cart-tab.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--cb-cart-primary);
}

.cb-cart-tab-count {
    font-size: 14px;
    margin-left: 2px;
}

.cb-cart-search-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 2px 2px 12px;
    width: 300px;
    transition: border-color 0.3s;
}

.cb-cart-search-wrapper:focus-within {
    border-color: var(--cb-cart-primary);
}

.cb-cart-search-input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 14px;
    padding: 8px 0;
    background: transparent;
}

.cb-cart-search-btn {
    background: #fff;
    border: none;
    border-left: 1px solid #ddd;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--cb-cart-muted);
}

.cb-cart-search-btn:hover {
    color: var(--cb-cart-primary);
}

/* 排序与批量管理条 */
.cb-cart-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cb-cart-sort-options {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

.cb-cart-sort-label {
    color: var(--cb-cart-muted);
}

.cb-cart-sort-item {
    cursor: pointer;
    color: var(--cb-cart-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.cb-cart-sort-item.active {
    color: var(--cb-cart-primary);
    font-weight: bold;
}

.cb-cart-sort-item i {
    font-size: 12px;
}

.cb-cart-batch-btn {
    border: 1px solid var(--cb-cart-primary);
    color: var(--cb-cart-primary);
    background: #fff;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.cb-cart-batch-btn:hover {
    background: var(--cb-cart-primary);
    color: #fff;
}

/* 分类过滤行 */
.cb-cart-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    align-items: center;
}

.cb-cart-cat-label {
    color: var(--cb-cart-muted);
    font-size: 14px;
    margin-right: 5px;
}

.cb-cart-cat-item {
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.cb-cart-cat-item:hover, .cb-cart-cat-item.active {
    background: var(--cb-cart-primary);
    color: #fff;
}

.cb-cart-expand-btn {
    font-size: 13px;
    color: var(--cb-cart-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    margin-left: auto;
}

/* 商品网格 */
.cb-cart-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) { .cb-cart-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .cb-cart-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .cb-cart-grid { grid-template-columns: 1fr; } }

/* ===== 小屏选品车适配优化 ===== */
@media (max-width: 768px) {
    /* 页面容器 */
    .cb-selection-cart-page {
        padding: 0 10px;
    }
    
    /* 工具栏垂直布局 */
    .cb-cart-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 15px;
    }
    
    /* 分类标签滑动容器 */
    .cb-cart-tabs {
        gap: 0;
        margin: 0 -10px;
        padding: 0 10px 10px;
        position: relative;
        width: calc(100% + 20px);
        box-sizing: border-box;
        border-bottom: 1px solid var(--cb-cart-border);
    }
    
    /* 分类标签胶囊样式 */
    .cb-cart-tab {
        flex-shrink: 0;
        padding: 6px 12px;
        font-size: 13px;
        background: #f5f5f5;
        border-radius: 16px;
        margin-right: 8px;
        white-space: nowrap;
    }
    
    .cb-cart-tab:last-child {
        margin-right: 0;
    }
    
    .cb-cart-tab.active {
        background: var(--cb-cart-primary);
        color: #fff;
    }
    
    .cb-cart-tab.active::after {
        display: none; /* 小屏使用背景色标识，不用下划线 */
    }
    
    .cb-cart-tab-count {
        font-size: 11px;
        margin-left: 2px;
    }
    
    /* 搜索框全宽 */
    .cb-cart-search-wrapper {
        width: 100%;
        max-width: none;
    }
    
    /* 操作栏优化 */
    .cb-cart-action-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .cb-cart-sort-options {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
        gap: 15px;
    }
    
    .cb-cart-sort-options::-webkit-scrollbar {
        display: none;
    }
    
    .cb-cart-sort-item {
        flex-shrink: 0;
        font-size: 13px;
    }
    
    .cb-cart-batch-btn {
        width: 100%;
        padding: 10px;
    }
    
    /* 分类过滤滑动 */
    .cb-cart-categories {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        margin: 0 -10px 20px;
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .cb-cart-categories::-webkit-scrollbar {
        display: none;
    }
    
    .cb-cart-cat-item {
        flex-shrink: 0;
    }
    
    /* 商品项适配 */
    .cb-cart-item-info {
        padding: 10px;
    }
    
    .cb-cart-item-title {
        font-size: 13px;
        height: 2.6em;
    }
    
    .cb-cart-item-price {
        font-size: 16px;
    }
    
    /* 批量操作栏适配 */
    .cb-batch-footer-content {
        flex-direction: column;
        gap: 12px;
        padding: 0 15px;
    }
    
    .cb-batch-summary {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    .cb-batch-actions {
        width: 100%;
    }
    
    .cb-btn-batch-remove {
        width: 100%;
        padding: 12px;
    }
}

/* 超小屏优化 (iPhone SE等) */
@media (max-width: 375px) {
    .cb-cart-tab {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .cb-cart-item-title {
        font-size: 12px;
    }
    
    .cb-cart-item-price {
        font-size: 15px;
    }
}

.cb-cart-item {
    background: #fff;
    border: 1px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.cb-cart-item:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: #eee;
}

/* 选择框样式 */
.cb-cart-item-check {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    display: none; /* 默认隐藏，批量模式显示 */
}

.cb-batch-mode .cb-cart-item-check {
    display: block;
}

.cb-cart-item-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* 图片区域 */
.cb-cart-item-img-wrap {
    position: relative;
    padding-top: 100%;
    background: #f5f5f5;
}

.cb-cart-item-img-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 状态遮罩 */
.cb-cart-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.cb-cart-status-badge {
    border: 2px solid #fff;
    color: #fff;
    padding: 10px;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    transform: rotate(-15deg);
}

/* 降价标签 */
.cb-cart-price-drop-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 87, 34, 0.9);
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    z-index: 6;
}

/* 信息区域 */
.cb-cart-item-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cb-cart-item-title {
    font-size: 14px;
    line-height: 1.5;
    height: 2.8em;
    overflow: hidden;
    margin-bottom: 10px;
    color: #333;
    text-decoration: none;
    display: block;
}

.cb-cart-item-title:hover {
    color: var(--cb-cart-primary);
}

.cb-cart-item-bottom {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.cb-cart-item-price {
    color: var(--cb-cart-primary);
    font-size: 18px;
    font-weight: bold;
}

.cb-cart-item-price span {
    font-size: 14px;
    margin-right: 2px;
}

.cb-cart-item-time {
    font-size: 11px;
    color: var(--cb-cart-muted);
    margin-top: 4px;
}

.cb-cart-item-remove {
    color: var(--cb-cart-muted);
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px;
}

.cb-cart-item-remove:hover {
    color: #ff4d4f;
}

/* 批量操作悬浮条 */
.cb-cart-batch-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    padding: 15px 0;
    z-index: 1000;
    display: none;
}

.cb-batch-mode .cb-cart-batch-footer {
    display: block;
}

.cb-batch-footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cb-batch-summary {
    font-size: 14px;
}

.cb-batch-summary span {
    color: var(--cb-cart-primary);
    font-weight: bold;
    margin: 0 5px;
}

.cb-batch-actions {
    display: flex;
    gap: 15px;
}

.cb-btn-batch-remove {
    background: #ff4d4f;
    color: #fff;
    border: none;
    padding: 8px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.cb-btn-batch-remove:hover {
    background: #ff7875;
}

/* 空状态与加载中 */
.cb-cart-empty, .cb-cart-loading {
    text-align: center;
    padding: 100px 0;
    color: var(--cb-cart-muted);
}

.cb-cart-empty i {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
}

.cb-cart-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    z-index: 10001;
    display: none;
}

/* 全局加入选品车按钮样式 (用于搜索页、推荐位等) */
.cb-add-to-cart-btn {
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cb-cart-primary);
    background: #fff;
    color: var(--cb-cart-primary);
}

.cb-add-to-cart-btn:hover {
    background: var(--cb-cart-primary);
    color: #fff;
}

.cb-add-to-cart-btn.added {
    background: var(--cb-cart-primary);
    color: #fff;
}

/* 悬浮在图片上的快捷按钮 (如搜索结果页) */
.cb-floating-cart-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    background: #fff; /* 确保有白底 */
    padding: 0;
}

/* 兼容多种容器的悬停触发 */
.cb-product-item:hover .cb-floating-cart-btn,
.cb-product-link:hover .cb-floating-cart-btn,
.cb-recommend-product:hover .cb-floating-cart-btn,
.cb-recommend-product-img:hover .cb-floating-cart-btn,
.cb-recommend-2-product:hover .cb-floating-cart-btn,
.cb-recommend-2-product-img:hover .cb-floating-cart-btn,
.cb-hot-product-item:hover .cb-floating-cart-btn,
.cb-hot-product-img:hover .cb-floating-cart-btn {
    opacity: 1;
    transform: translateY(0);
}

/* 小屏设备优化：不支持悬停，改为默认显示 */
@media (max-width: 768px) {
    .cb-floating-cart-btn {
        opacity: 1;
        transform: translateY(0);
        width: 32px;
        height: 32px;
        right: 5px;
        bottom: 5px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }
}

.cb-floating-cart-btn i {
    font-size: 18px;
}

.cb-floating-cart-btn.added {
    opacity: 1;
    transform: translateY(0);
    background: #52c41a; /* 绿色表示已加入 */
    color: #fff;
}

