/* 产品分类Tab小部件样式 */
.product-category-tabs-widget {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 覆盖Elementor容器限制 */
.elementor-widget-product_category_tabs_home,
.elementor-widget-product_category_tabs_home .elementor-widget-container {
    width: 100% !important;
    max-width: 100% !important;
}

/* 头部区域 */
.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.section-subtitle {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #888888;
}

.section-title {
    font-size: 36px;
    font-weight: 700;
    color: #333333;
    margin: 0;
    line-height: 1.2;
}

/* Tab导航 - 背景向外延伸不占位 */
.category-tabs-nav {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
}

.category-tab {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background-color: #f5f5f5;
    color: #333333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-tab:hover {
    background-color: #e0e0e0;
}

.category-tab.active {
    background-color: #4a7c59;
    color: #ffffff;
}

/* 产品网格 */
.products-container {
    width: 100%;
}

.products-grid {
    display: grid;
    gap: 20px;
}

.products-grid[style*="display: grid"] {
    grid-template-columns: repeat(var(--columns, 4), 1fr);
}

.products-container[data-columns="2"] .products-grid {
    grid-template-columns: repeat(2, 1fr);
}

.products-container[data-columns="3"] .products-grid {
    grid-template-columns: repeat(3, 1fr);
}

.products-container[data-columns="4"] .products-grid {
    grid-template-columns: repeat(4, 1fr);
}

.products-container[data-columns="5"] .products-grid {
    grid-template-columns: repeat(5, 1fr);
}

.products-container[data-columns="6"] .products-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* 产品卡片 */
.product-card {
    overflow: visible;
    width: 100%;
    min-width: 0;
}

/* 产品卡片内容区域 - 带边框 */
.product-card-link {
    display: block;
    width: 100%;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: visible;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.product-card:hover .product-card-link {
    border-color: #4a7c59;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 产品图片区域 */
.product-card-image-wrap {
    position: relative;
    overflow: visible;
    width: 100%;
}

/* 图片容器 - 裁剪放大效果，保持边框圆角 */
.product-card-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    box-sizing: border-box;
}

.product-card-logo {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 2;
    width: 100px;
    height: auto;
}

.product-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #f9f9f9;
    transition: transform 0.4s ease;
}

.product-card:hover .product-card-image {
    transform: scale(1.05);
}

/* 悬停覆盖层 - 40%在图片内，60%超出覆盖标题 */
.product-card-overlay {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 0;
    transform: translateY(60%);
    opacity: 0;
    transition: all 0.4s ease;
    text-align: center;
    z-index: 10;
}

.product-card:hover .product-card-overlay {
    opacity: 1;
}

/* 半圆图标容器 - 突出显示，图标一半在半圆中 */
.overlay-icon {
    width: 56px;
    height: 28px;
    margin: 0 auto -1px;
    background-color: #4a7c59;
    border-radius: 56px 56px 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 6px;
    position: relative;
    z-index: 2;
}

.overlay-icon svg {
    width: 18px;
    height: 18px;
    color: #ffffff;
    transform: translateY(9px);
}

/* 信息框 */
.overlay-content {
    background-color: #4a7c59;
    color: #ffffff;
    padding: 20px 20px 20px;
    border-radius: var(--overlay-radius, 8px);
}

.overlay-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 30px 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.overlay-description {
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 产品名称 - 在边框外面的底部 */
.product-card-name {
    padding: 15px 15px;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    text-align: center;
    background-color: transparent;
    position: relative;
    z-index: 1;
}

/* 无产品提示 */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #888888;
}

/* 响应式 */
@media (max-width: 1024px) {
    .products-container[data-columns="5"] .products-grid,
    .products-container[data-columns="6"] .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .widget-header {
        flex-direction: column;
        align-items: center;
    }
    
    .header-left {
        text-align: center;
        align-items: center;
    }
    
    .section-subtitle,
    .section-title {
        text-align: center;
    }
    
    .section-title {
        font-size: 28px;
    }
    
    .category-tabs-nav {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 5px;
    }
    
    .category-tabs-nav::-webkit-scrollbar {
        display: none;
    }
    
    .category-tab {
        flex-shrink: 0;
        padding: 8px 15px;
        font-size: 13px;
    }
    
    /* 手机端产品轮播 */
    .product-category-tabs-widget .products-container {
        position: relative;
        padding: 0 40px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .product-category-tabs-widget .products-grid[style*="display: grid"],
    .product-category-tabs-widget .products-grid[style*="display: flex"] {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 20px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scrollbar-width: none;
        -ms-overflow-style: none;
        grid-template-columns: none !important;
        width: 100%;
    }
    
    .product-category-tabs-widget .products-grid[style*="display: none"] {
        display: none !important;
    }
    
    .product-category-tabs-widget .products-grid::-webkit-scrollbar {
        display: none;
    }
    
    /* 产品卡片各占50%，居中显示 */
    .product-category-tabs-widget .product-card {
        flex: 0 0 calc(50% - 10px) !important;
        scroll-snap-align: start;
        min-width: calc(50% - 10px);
        max-width: calc(50% - 10px);
        box-sizing: border-box;
    }
    
    /* 手机端图片自适应 */
    .product-category-tabs-widget .product-card-link,
    .product-category-tabs-widget .product-card-image-wrap,
    .product-category-tabs-widget .product-card-image-container {
        width: 100% !important;
    }
    
    .product-category-tabs-widget .product-card-image {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    /* 手机端隐藏悬停覆盖层 */
    .product-category-tabs-widget .product-card-overlay {
        display: none !important;
    }
    
    /* 轮播箭头显示 - 在产品区域两侧 */
    .product-category-tabs-widget .carousel-arrow {
        display: flex !important;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .product-category-tabs-widget .carousel-arrow-left {
        left: 0;
    }
    
    .product-category-tabs-widget .carousel-arrow-right {
        right: 0;
    }
}

@media (max-width: 480px) {
    .category-tabs-nav {
        width: 100%;
    }
    
    .category-tab {
        flex: 1;
        text-align: center;
    }
}

/* 轮播箭头样式 - 默认隐藏，手机端在标题两侧显示 */
.carousel-arrow {
    display: none;
    width: 24px;
    height: 24px;
    background-color: transparent;
    color: #333333;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: color 0.3s ease;
    padding: 0;
}

.carousel-arrow:hover {
    color: #000000;
}

.carousel-arrow svg {
    width: 20px;
    height: 20px;
}
