/**
 * 商品推荐模块2 样式 (横向布局)
 * 兼容任何WordPress主题
 */

.cb-recommend-2-container,
.cb-recommend-2-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.cb-recommend-2-container {
    width: 100%;
    max-width: 1400px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

/* ===== 头部：标题 + 分类标签 ===== */
.cb-recommend-2-header {
    margin-bottom: 25px;
}

.cb-recommend-2-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--cb-text-color, #333);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cb-recommend-2-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--cb-primary-color, #ff4400);
    border-radius: 2px;
}

.cb-recommend-2-tabs-wrapper {
    width: 100%;
    overflow: hidden;
}

.cb-recommend-2-tabs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 5px;
}

.cb-recommend-2-tabs::-webkit-scrollbar {
    display: none;
}

.cb-recommend-2-tab {
    padding: 8px 22px;
    border: 1px solid #eee;
    border-radius: 25px;
    background: #fff;
    color: var(--cb-tab-text-color, #666);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.cb-recommend-2-tab:hover {
    border-color: var(--cb-tab-active-bg-color, #ff4400);
    color: var(--cb-tab-active-bg-color, #ff4400);
}

.cb-recommend-2-tab.active {
    background: var(--cb-tab-active-bg-color, #ff4400);
    border-color: var(--cb-tab-active-bg-color, #ff4400);
    color: var(--cb-tab-active-text-color, #fff);
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(255, 68, 0, 0.2);
}

/* ===== 商品网格 ===== */
.cb-recommend-2-products {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 默认5列 */
    gap: 15px;
    min-height: 300px;
}

.cb-recommend-2-product {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #f2f2f2;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cb-recommend-2-product:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.cb-recommend-2-product a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cb-recommend-2-product-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8f8f8;
    position: relative;
}

.cb-recommend-2-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.cb-recommend-2-product:hover .cb-recommend-2-product-img img {
    transform: scale(1.08);
}

.cb-recommend-2-product-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cb-recommend-2-product-title {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    height: 42px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 10px;
}

.cb-tag-1688 {
    background: var(--cb-primary-color, #ff4400);
    color: var(--cb-btn-text-color, #fff);
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 2px;
    margin-right: 5px;
    font-weight: bold;
    vertical-align: middle;
}

.cb-recommend-2-product-price-row {
    margin-bottom: 8px;
}

.cb-recommend-2-product-price {
    font-size: 20px;
    font-weight: bold;
    color: var(--cb-price-color, #ff4400);
}

.cb-recommend-2-product-meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    padding-top: 10px;
    border-top: 1px solid #f5f5f5;
}

/* 加载与空状态 */
.cb-recommend-2-loading,
.cb-recommend-2-empty {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    color: #999;
}

.cb-recommend-2-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f0;
    border-top-color: var(--cb-primary-color, #ff4400);
    border-radius: 50%;
    animation: cb-spin 0.8s linear infinite;
    margin-left: 10px;
}

@keyframes cb-spin {
    to { transform: rotate(360deg); }
}

/* ===== 响应式适配 ===== */
@media (max-width: 1200px) {
    .cb-recommend-2-products {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .cb-recommend-2-products {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .cb-recommend-2-container {
        padding: 15px 10px;
    }
    
    .cb-recommend-2-title {
        font-size: 18px;
        margin-bottom: 15px;
        text-align: center;
    }

    .cb-recommend-2-products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .cb-recommend-2-product-info {
        padding: 8px;
    }

    .cb-recommend-2-product-title {
        font-size: 12px;
        height: 36px;
        margin-bottom: 6px;
    }

    .cb-recommend-2-product-price {
        font-size: 16px;
    }

    .cb-recommend-2-product-meta {
        font-size: 10px;
        padding-top: 6px;
    }
}

@media (max-width: 480px) {
    .cb-recommend-2-container {
        padding: 10px 5px;
        border-radius: 0;
    }

    .cb-recommend-2-tab {
        padding: 5px 12px;
        font-size: 12px;
    }

    .cb-recommend-2-products {
        gap: 8px;
    }
}
