/**
 * Category Products Widget Styles
 * 产品分类小部件样式 - 悬停从左往右滑动效果
 */

.cpw-container {
    width: 100%;
}

.cpw-title {
    font-size: 28px;
    font-weight: 600;
    color: #1a3a5c;
    margin: 0 0 30px 0;
}

.cpw-products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 50px;
}

.cpw-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.cpw-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.cpw-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.cpw-columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.cpw-columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

.cpw-container .cpw-products-grid .cpw-product-card {
    display: block;
    position: relative;
    text-decoration: none !important;
    background-color: #f5f5f5;
    padding: 0 !important;
    border: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    outline: 0 !important;
}

.cpw-container .cpw-products-grid .cpw-product-card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    transition: box-shadow 0.3s ease;
    overflow: hidden;
}

.cpw-container .cpw-products-grid .cpw-product-card *,
.cpw-container .cpw-products-grid .cpw-product-card *:before,
.cpw-container .cpw-products-grid .cpw-product-card *:after {
    border-left: 0 !important;
    border-right: 0 !important;
}

.cpw-container .cpw-products-grid .cpw-product-card:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15) !important;
}

.cpw-product-image-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.cpw-product-image {
    width: 100%;
    height: 280px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

.cpw-product-card:hover .cpw-product-image {
    transform: scale(1.02);
}

/* 下方产品名称 */
.cpw-product-name {
    display: block !important;
    padding: 15px !important;
    font-size: 14px;
    font-weight: 500;
    color: #333 !important;
    text-align: center;
    line-height: 1.4;
    background: #fff !important;
    border-top: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.3s ease;
}

.cpw-product-card:hover .cpw-product-name {
    opacity: 0;
}

/* 悬停遮罩层 - 从左往右滑动，覆盖整个卡片 */
.cpw-product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(196, 18, 48, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cpw-product-card:hover .cpw-product-overlay {
    transform: translateX(0);
}

/* 蒙版中的产品标题 */
.cpw-product-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.3s ease 0.15s, transform 0.3s ease 0.15s;
}

.cpw-product-card:hover .cpw-product-title {
    opacity: 1;
    transform: translateX(0);
}

/* 加号按钮 */
.cpw-product-plus {
    width: 50px;
    height: 50px;
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 300;
    color: #fff;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease 0.2s, transform 0.3s ease 0.2s;
}

.cpw-product-card:hover .cpw-product-plus {
    opacity: 1;
    transform: scale(1);
}

.cpw-product-plus:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cpw-no-products {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 40px;
}

/* 分页样式 */
.cpw-container .cpw-pagination {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    flex-wrap: wrap;
    visibility: visible !important;
    opacity: 1 !important;
}

.cpw-container .cpw-pagination .cpw-page-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: all 0.3s ease;
    color: #333333;
    background-color: #ffffff;
}

.cpw-container .cpw-pagination .cpw-page-link:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.cpw-container .cpw-pagination .cpw-page-link.current {
    color: #ffffff !important;
    background-color: #1a3a5c !important;
    border-color: #1a3a5c !important;
}

.cpw-container .cpw-pagination .cpw-page-link {
    cursor: pointer;
}

.cpw-container .cpw-pagination .cpw-page-prev,
.cpw-container .cpw-pagination .cpw-page-next {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #ffffff;
    transition: all 0.3s ease;
}

.cpw-container .cpw-pagination .cpw-page-prev:hover,
.cpw-container .cpw-pagination .cpw-page-next:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.cpw-container .cpw-pagination .cpw-page-prev svg,
.cpw-container .cpw-pagination .cpw-page-next svg {
    stroke: #333333;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .cpw-columns-5,
    .cpw-columns-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .cpw-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .cpw-title {
        font-size: 24px;
    }
    
    .cpw-product-image {
        height: 200px;
    }
    
    .cpw-product-name {
        white-space: normal;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 480px) {
    .cpw-columns-2,
    .cpw-columns-3,
    .cpw-columns-4,
    .cpw-columns-5,
    .cpw-columns-6 {
        grid-template-columns: 1fr;
    }
    
    .cpw-title {
        font-size: 20px;
    }
}
