/* 隐藏Astra主题自动生成的面包屑 */
.ast-archive-entry-banner,
.ast-breadcrumbs-wrapper,
.woocommerce-breadcrumb:not(.custom-product-category-page .woocommerce-breadcrumb) {
    display: none !important;
}

/* 确保自定义面包屑可见 */
.custom-product-category-page .breadcrumb-container .woocommerce-breadcrumb {
    display: flex !important;
}

body.woocommerce-taxonomy-product_cat,
body.woocommerce-product_cat,
.custom-product-category-page,
#content {
    background-color: white !important;
    overflow-x: hidden;
    /* 防止横向滚动 */
}

.custom-product-category-page {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    background-color: white;
    overflow-x: hidden;
    /* 确保不产生横向滚动 */
}

.custom-product-category-page .category-header-image {
    width: 100%;
    /* height: 300px; */
    overflow: hidden;
}

.custom-product-category-page .category-header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.custom-page-container {
    /* max-width: 1200px; */
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    overflow-x: hidden;
    /* 防止容器产生横向滚动 */
}

.custom-product-category-page .breadcrumb-container {
    margin-bottom: 20px;
    background-color: white;
}

.custom-product-category-page .woocommerce-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 18px;
}

.custom-product-category-page .woocommerce-breadcrumb a {
    color: #013BA6;
    text-decoration: none;
}

.custom-product-category-page .woocommerce-breadcrumb a:hover {
    text-decoration: underline;
}

.category-content-wrapper {
    display: flex;
    gap: 30px;
    background-color: white;
    overflow-x: hidden;
    /* 防止内容区域产生横向滚动 */
}

.custom-product-category-page .category-sidebar {
    flex: 0 0 250px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    background-color: white;
    overflow-x: hidden;
    /* 防止侧边栏产生横向滚动 */
}

.custom-product-category-page .category-filter h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.custom-product-category-page .category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    /* 防止列表产生横向滚动 */
}

.custom-product-category-page .category-item {
    margin-bottom: 10px;
}

.custom-product-category-page .category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    text-decoration: none;
    color: rgba(51, 51, 51, 0.6) !important;
    border-radius: 3px;
    transition: all 0.3s ease;
    white-space: nowrap;
    /* 防止文字换行 */
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-product-category-page .category-link.active {
    color: #033CA4 !important;
}

.custom-product-category-page .sub-category {
    margin-left: 15px;
}

.category-products {
    flex: 1;
    background-color: white;
    overflow-x: hidden;
    /* 防止商品区域产生横向滚动 */
}

/* 电脑端网格布局 - 自然适应列数 */
.products-grid {
    display: grid;
    gap: 20px;
    /* 统一间隙 */
    width: 100%;
    max-width: 100%;
    /* 确保网格不超出容器 */
    overflow-x: hidden;
    /* 防止网格产生横向滚动 */
    box-sizing: border-box;
    /* 确保padding和border包含在宽度内 */
    justify-items: stretch;
    /* 确保项目充满网格单元 */
    grid-template-columns: repeat(auto-fit, 300px);
    /* 核心修改：将 1fr 改为固定像素值，并配合 auto-fit 实现自动换行 */
}

.product-grid-item {
    width: 100%;
    max-width: 300px;
    /* 限制单个商品卡片的最大宽度 */
    box-sizing: border-box;
    /* 确保padding和border包含在宽度内 */
    display: flex;
    /* 使用flexbox确保内容对齐 */
    flex-direction: column;
    /* 内容垂直排列 */
    break-inside: avoid;
    /* 防止网格项被分割 */
    /* margin: 0 auto; */
    /* 居中显示单个项目 */
}

.custom-product-category-page .product-card {
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 30px;
    margin: 0;
    /* 移除卡片本身的margin，使用grid的gap */
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    /* 防止卡片内容溢出 */
    opacity: 0.5;
    background-color: #ffffff;
    box-shadow: 7px -3px 8px rgba(68, 111, 191, 0.2);
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    /* 确保卡片不超出容器 */
    max-width: 100%;
    /* 确保卡片不超出容器 */
    box-sizing: border-box;
    /* 确保padding和border包含在宽度内 */
    min-height: 300px;
    /* 设置最小高度以保持一致性 */
}

.custom-product-category-page .product-card:hover {
    box-shadow: 0 5px 15px rgba(68, 111, 191, 0.3);
    border-color: transparent;
    opacity: 1;
}

.custom-product-category-page .product-card:hover:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #446FBF;
}

.custom-product-category-page .product-card-title {
    font-size: 1.3em;
    margin: 0 0 10px 0;
    color: #333;
    white-space: nowrap;
    /* 防止标题换行 */
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card .ast-woo-shop-product-description p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.custom-product-category-page .product-card-description {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.custom-product-category-page .product-card-content {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 15px;
    margin-top: auto;
}

.custom-product-category-page .product-card-content .product-card-image img {
    border-radius: 10px;
    max-width: 100%;
    /* 确保图片不超出容器 */
    height: auto;
}

.custom-product-category-page .product-card-button {
    background: transparent;
    color: #446FBF;
    border: 2px solid #446FBF;
    padding: 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 10px;
    height: 10px;
}

.custom-product-category-page .product-card-button:hover {
    background: #446FBF;
    color: white;
}

.custom-product-category-page .product-card-image {
    max-width: 200px;
    height: auto;
}

/* 移动端Swiper布局 */
.products-swiper {
    width: 100%;
    padding: 10px 0;
    display: none;
    overflow: visible;
    /* 修复：允许内容可见 */
    max-width: 100%;
    /* 确保不超过容器宽度 */
    margin: 0 auto;
    overflow-x: hidden;
    /* 防止Swiper产生横向滚动 */
}

.products-swiper .swiper-container {
    overflow: visible;
    width: 100%;
    max-width: 100%;
    /* 确保Swiper容器不超出 */
}

.products-swiper .swiper-wrapper {
    padding: 10px 0;
    width: 100%;
    max-width: 100%;
    /* 确保wrapper不超出 */
    overflow: visible;
}

.products-swiper .swiper-slide {
    width: 100%;
    flex-shrink: 0;
    margin-right: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    /* 确保滑动项内容不溢出 */
}

/* 响应式设计 */
@media (min-width: 912px) {
    .products-grid {
        display: grid;
    }

    .products-swiper {
        display: none;
    }
}

@media (max-width: 911px) and (min-width: 768px) {
    .products-grid {
        display: none;
    }

    .products-swiper {
        display: block;
        max-width: 100%;
        /* 确保不超过容器宽度 */
        width: 100%;
    }

    .products-swiper .swiper-slide {
        width: calc(50% - 10px) !important;
        /* 每屏显示2个 */
        margin-right: 10px;
    }

    .category-content-wrapper {
        flex-direction: column;
    }

    .custom-product-category-page .category-sidebar {
        flex: none;
        margin-bottom: 20px;
    }
}

@media (max-width: 767px) {
    .products-grid {
        display: none;
    }

    .products-swiper {
        display: block;
        max-width: 100%;
        /* 确保不超过容器宽度 */
        width: 100%;
    }

    .products-swiper .swiper-slide {
        width: calc(100% - 20px) !important;
        /* 每屏显示1个 */
        margin-right: 10px;
    }

    .category-content-wrapper {
        flex-direction: column;
    }

    .custom-product-category-page .category-sidebar {
        flex: none;
        margin-bottom: 20px;
    }
}

/* 移动端分类滑动菜单 */
@media (max-width: 911px) {
    .breadcrumb-container {
        display: none;
    }

    .mobile-category-swiper {
        display: block !important;
        width: 100%;
        max-width: 100%;
        /* 确保不超过容器宽度 */
        padding: 10px 0;
        background-color: white;
        margin-bottom: 20px;
        overflow: visible;
        overflow-x: hidden;
        /* 防止菜单产生横向滚动 */
    }

    .mobile-category-swiper .swiper-container {
        width: 100%;
        max-width: 100%;
        /* 确保菜单容器不超出 */
    }

    .mobile-category-swiper .swiper-wrapper {
        align-items: center;
        display: flex;
        width: 100%;
        max-width: 100%;
        /* 确保菜单wrapper不超出 */
    }

    .mobile-category-swiper .swiper-slide {
        width: auto !important;
        flex-shrink: 0;
        max-width: 200px;
        min-width: 100px;
        overflow: hidden;
        /* 确保菜单项内容不溢出 */
    }

    .mobile-category-swiper .category-link {
        display: block;
        padding: 10px 16px;
        margin: 0 5px;
        text-decoration: none;
        color: rgba(51, 51, 51, 0.6) !important;
        border-radius: 20px;
        transition: all 0.3s ease;
        white-space: nowrap;
        border: 1px solid #eee;
        text-align: center;
        min-width: 80px;
        overflow: hidden;
        /* 防止链接内容溢出 */
        text-overflow: ellipsis;
    }

    .mobile-category-swiper .category-link.active {
        color: #033CA4 !important;
        background-color: #f0f0f0;
        border-color: #033CA4;
    }

    .mobile-category-swiper .category-link:hover {
        background-color: #f0f0f0;
    }

    .category-sidebar {
        display: none;
    }

    .category-products {
        width: 100%;
    }
}

/* 无产品时显示的自定义图像样式 */
.custom-no-products-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px 20px;
    text-align: center;
    min-height: 300px;
    background-color: white;
}

.no-products-image {
    max-width: 100%;
    height: auto;
    max-height: 300px;
}