/**
 * 热门产品模块样式
 * 兼容任何WordPress主题
 */

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

.cb-hot-products-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-hot-products-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f5f5f5;
    position: relative;
}

.cb-hot-products-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--cb-primary-color, #ff4400);
}

.cb-hot-products-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

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

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

.cb-hot-product-rank {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
}

.cb-hot-product-item:nth-child(1) .cb-hot-product-rank { background: var(--cb-primary-color, #ff4400); }
.cb-hot-product-item:nth-child(2) .cb-hot-product-rank { background: #ff6600; }
.cb-hot-product-item:nth-child(3) .cb-hot-product-rank { background: #ff9900; }

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

.cb-hot-product-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8f8f8;
    position: relative; /* 为悬浮按钮提供定位基准 */
}

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

.cb-hot-product-item:hover .cb-hot-product-img img {
    transform: scale(1.08);
}

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

.cb-hot-product-title-text {
    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-hot-product-price-row {
    margin-bottom: 8px;
}

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

.cb-hot-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-hot-products-loading,
.cb-hot-products-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    color: #999;
    grid-column: 1 / -1;
}

.cb-hot-products-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-hot-products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

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

@media (max-width: 768px) {
    .cb-hot-products-container {
        padding: 15px;
    }
    .cb-hot-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    .cb-hot-products-title {
        font-size: 20px;
    }
}

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