/* Shop and product-category archive layouts */

/* ==================================================
   产品分类页：清除 Flatsome 空白标题区域
================================================== */

body.tax-product_cat .shop-page-title,
body.tax-product_cat .page-title-inner {
    display: none !important;
}


/* ==================================================
   产品分类动态介绍模块
================================================== */

.product-category-hero {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 58px 20px 70px;
    background: #ffffff;
}

.product-category-hero__container {
    width: 100%;
    max-width: 1340px;
    margin: 0 auto;
}

/* 分类名称 */
.product-category-hero__title {
    margin: 0 0 26px !important;
    padding: 0 !important;

    color: #172033;
    font-size: 34px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.4px;
    text-transform: none !important;
}

/* 左图右文 */
.product-category-hero__layout {
    display: grid;
    grid-template-columns:
        minmax(0, 1.08fr)
        minmax(0, 0.92fr);
    align-items: center;
    gap: 44px;
}

/* 图片外框 */
.product-category-hero__media {
    width: 100%;
    min-width: 0;
    overflow: hidden;

    background: #ffffff;
    border: 1px solid #e7eaee;
    border-radius: 18px;
}

/* 分类图片 */
.product-category-hero__image {
    display: block !important;

    width: 100% !important;
    height: 380px !important;
    max-width: 100% !important;

    margin: 0 !important;
    padding: 0 !important;

    object-fit: contain;
    object-position: center;

    background: #ffffff;
}

/* 右侧内容 */
.product-category-hero__content {
    width: 100%;
    min-width: 0;
}

/* 分类描述 */
.product-category-hero__description {
    color: #697386;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.75;
}

.product-category-hero__description p {
    margin: 0 0 16px !important;
}

.product-category-hero__description > :last-child {
    margin-bottom: 0 !important;
}

/* 咨询按钮 */
.product-category-hero__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 52px;
    margin-top: 25px;
    padding: 12px 31px;

    color: #ffffff !important;
    background: #005732;

    border: 1px solid #005732;
    border-radius: 999px;

    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none !important;

    transition:
        background-color 0.25s ease,
        border-color 0.25s ease,
        transform 0.25s ease;
}

.product-category-hero__button:hover {
    color: #ffffff !important;
    background: #003f25;
    border-color: #003f25;
    transform: translateY(-2px);
}


/* ==================================================
   产品集合页、产品分类页侧边栏
================================================== */

body:is(.woocommerce-shop, .tax-product_cat) #shop-sidebar {
    padding-right: 20px;
}

/* 清除 Flatsome 小工具默认间距 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .widget {
    margin-bottom: 0;
}

/* Categories 标题 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .widget_product_categories .widget-title {
    display: block;
    margin: 0 0 24px !important;

    color: #171717;
    font-size: 23px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0;
    text-transform: none;
}

/* 隐藏 Flatsome 标题下方默认短横线 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .widget_product_categories .is-divider {
    display: none !important;
}

/* 产品分类列表 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* 顶级分类卡片 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories > li {
    position: relative;
    overflow: hidden;

    margin: 0 0 12px !important;
    padding: 0 !important;

    background: #ffffff;
    border: 1px solid #006238;
    border-radius: 12px;

    list-style: none !important;
}

/* 去掉主题可能添加的列表符号 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories li::before {
    display: none !important;
    content: none !important;
}

/* 顶级分类标题 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories > li > a {
    display: flex;
    align-items: center;
    gap: 14px;

    width: 100%;
    min-height: 52px;
    margin: 0 !important;
    padding: 14px 20px !important;

    color: #4b4f54 !important;
    background: #ffffff;

    border: 0 !important;

    font-size: 17px;
    font-weight: 500;
    line-height: 1.35;
    text-decoration: none !important;
    text-transform: none;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}

/* 顶级分类左侧图标 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories > li > a::before {
    content: "";

    flex: 0 0 21px;
    width: 21px;
    height: 21px;

    background-color: currentColor;

    -webkit-mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 3 8 5-8 5-8-5 8-5Zm-6.5 9 6.5 4 6.5-4M5.5 16l6.5 4 6.5-4' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        center / contain no-repeat;

    mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 3 8 5-8 5-8-5 8-5Zm-6.5 9 6.5 4 6.5-4M5.5 16l6.5 4 6.5-4' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        center / contain no-repeat;
}

/* 当前父分类或当前顶级分类：绿色背景 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories > li.current-cat-parent > a,

body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories > li.current-cat > a {
    color: #ffffff !important;
    background: #006238 !important;

    font-size: 19px;
    font-weight: 700;
}

/* 未激活顶级分类悬停 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar
.product-categories > li:not(.current-cat):not(.current-cat-parent) > a:hover {
    color: #006238 !important;
    background: #f2f8f5 !important;
}

/* 默认隐藏所有子分类 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories > li > .children {
    display: none !important;

    margin: 0 !important;
    padding: 20px 0 20px !important;

    background: #ffffff;
    border: 0 !important;

    list-style: none !important;
}

/* 展开当前分类的子分类 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories > li.current-cat-parent > .children,

body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories > li.current-cat > .children {
    display: block !important;
}

/* 子分类项目 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories .children li {
    margin: 0 !important;
    padding: 0 !important;

    border: 0 !important;
    list-style: none !important;
}

/* 子分类链接 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories .children li > a {
    display: block;

    margin: 0 !important;
    padding: 9px 22px 9px 50px !important;

    color: #4d5054 !important;
    background: transparent !important;

    border: 0 !important;

    font-size: 17px;
    font-weight: 400;
    line-height: 1.45;
    text-decoration: none !important;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}

/* 子分类悬停 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories .children li > a:hover {
    color: #006238 !important;
    background: #f2f8f5 !important;
}

/* 当前子分类 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories .children li.current-cat > a {
    color: #006238 !important;
    font-weight: 700;
}

/* 隐藏产品数量 */
body:is(.woocommerce-shop, .tax-product_cat)
#shop-sidebar .product-categories .count {
    display: none !important;
}

/* 产品集合页、产品分类页：内容区域与页脚之间增加 100px 间距 */
body.woocommerce-shop #main,
body.post-type-archive-product #main,
body.tax-product_cat #main {
    padding-bottom: 100px !important;
}
