/* ============================================
   产品分类页面样式 - 基于 BEM 架构
   ============================================
   职责：定义产品分类页面专属样式
   依赖：base.css, components.css, inStyle.css
   命名规范：使用 `ss-` 前缀，遵循 BEM 命名法
   ============================================ */

/* ============================================
   1. 页面容器
   ============================================ */
/* 新样式：使用 ss-page--category */
.ss-page--category {
    font-family: var(--font-family, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    color: var(--text-color, #2c3e50);
    line-height: 1.8;
}

.ss-page--category .ss-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    box-sizing: border-box;
}

/* 兼容旧样式：确保所有产品分类页面都能应用样式 */
/* 使用更具体的选择器，确保优先级足够高 */
body.taxonomy-product_category .ss-page--category,
body.taxonomy-product_category .ss-page,
body.taxonomy-product_category main.ss-page--category,
body.taxonomy-product_category main.ss-page {
    font-family: var(--font-family, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    color: var(--text-color, #2c3e50);
    line-height: 1.8;
}

body.taxonomy-product_category .ss-container,
body.taxonomy-product_category .ss-page--category .ss-container,
body.taxonomy-product_category .ss-page .ss-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    box-sizing: border-box;
}

/* ============================================
   2. Banner 区块
   ============================================ */
.ss-category-banner {
    position: relative;
    width: 100%;
    height: 400px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin-top: 0; /* 移除margin-top，body的padding-top已为fixed header留出空间 */
}

/* 兼容性：确保所有产品分类页面的 Banner 都能应用样式 */
body.taxonomy-product_category .ss-category-banner,
body.taxonomy-product_category section.ss-category-banner {
    position: relative;
    width: 100%;
    height: 400px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin-top: 0; /* 移除margin-top，body的padding-top已为fixed header留出空间 */
}

/* ============================================
   3. 分类头部（H1 + 描述）
   ============================================ */
.ss-category-header {
    margin: 40px 0 30px;
    text-align: center;
}

.ss-category-header__title {
    font-size: 26px;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.3;
}

.ss-category-header__desc {
    font-size: 16px;
    color: #666;
    line-height: 1.8;
    margin-top: 15px;
    text-align: left;
}

/* 兼容性：确保所有产品分类页面的头部都能应用样式 */
body.taxonomy-product_category .ss-category-header,
body.taxonomy-product_category .ss-category-header__title,
body.taxonomy-product_category .ss-category-header__desc {
    margin: 40px 0 30px;
    text-align: center;
}

body.taxonomy-product_category .ss-category-header__title {
    font-size: 26px;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.3;
}

body.taxonomy-product_category .ss-category-header__desc {
    font-size: 16px;
    color: #666;
    line-height: 1.8;
    margin-top: 15px;
    text-align: left;
}

/* ============================================
   4. 产品展示区域
   ============================================ */
.ss-category-products {
    margin: 40px 0;
}

.ss-category-products__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* 兼容性：确保所有产品分类页面的产品网格都能应用样式 */
body.taxonomy-product_category .ss-category-products {
    margin: 40px 0;
}

body.taxonomy-product_category .ss-category-products__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ss-category-product {
    margin: 0;
    padding: 0;
}

.ss-category-product__link {
    text-decoration: none;
    color: #000;
    display: block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ss-category-product__link:hover {
    transform: translateY(-5px);
    text-decoration: none;
    color: #000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.ss-category-product__image-wrapper {
    margin-bottom: 0;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    aspect-ratio: 1 / 1;
    background: #f5f5f5;
}

.ss-category-product__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.ss-category-product__link:hover .ss-category-product__image {
    transform: scale(1.05);
}

.ss-category-product__content {
    padding: 20px;
    height: 110px;
    box-sizing: border-box;
}

.ss-category-product__title {
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 10px;
    color: #222;
    line-height: 1.4;
}

.ss-category-product__excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0;
    display: none;
}

.ss-category-products__empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* ============================================
   5. 分页
   ============================================ */
.ss-category-pagination {
    margin-top: 40px;
    margin-bottom: 40px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ss-category-pagination a.page-numbers,
.ss-category-pagination span.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #666;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
}

.ss-category-pagination a.page-numbers:hover {
    border-color: var(--primary-color, #e91e63);
    color: var(--primary-color, #e91e63);
    background: #fff5f8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.15);
}

.ss-category-pagination span.page-numbers.current {
    border-color: var(--primary-color, #e91e63);
    background: var(--primary-color, #e91e63);
    color: #fff;
    cursor: default;
}

.ss-category-pagination span.page-numbers.dots {
    border: none;
    background: transparent;
    color: #999;
    cursor: default;
    padding: 0 8px;
}

.ss-category-pagination a.page-numbers.prev,
.ss-category-pagination a.page-numbers.next {
    font-weight: 600;
    padding: 0 16px;
}

/* ============================================
   6. 内容区域
   ============================================ */
.ss-category-content {
    margin: 60px 0;
}

.ss-category-content__inner {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
}

.ss-category-content__inner p {
    margin-bottom: 15px;
}

.ss-category-content__inner h2,
.ss-category-content__inner h3,
.ss-category-content__inner h4 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #222;
    font-weight: 600;
}

.ss-category-content__inner ul,
.ss-category-content__inner ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.ss-category-content__inner img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

/* ============================================
   7. 表单区域
   ============================================ */
.ss-category-inquiry {
    margin: 30px 0 60px; /* 底部加大间距，避免与 footer 重叠 */
    padding: 20px 0; /* 压缩上下内边距 */
    background: #f8f9fa;
    border-radius: 12px;
    /* 不固定高度，避免表单内容（如 textarea/submit）被截断 */
    max-height: none;
    overflow: visible;
}

.ss-category-inquiry__title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
    color: #222;
}

.ss-category-inquiry__icon {
    margin-right: 10px;
}

.ss-category-inquiry__form {
    max-width: 800px;
    margin: 0 auto;
}

/* Contact Form 7 样式增强 */
.ss-category-inquiry__form .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 12px; /* 压缩间距 */
}

.ss-category-inquiry__form .wpcf7-form-control-wrap {
    display: block;
}

/* 自定义表单字段样式 */
.ss-category-inquiry__field {
    margin-bottom: 20px;
}

.ss-category-inquiry__form input[type="text"],
.ss-category-inquiry__form input[type="email"],
.ss-category-inquiry__form textarea {
    width: 100%;
    padding: 10px; /* 压缩内边距 */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.ss-category-inquiry__form input[type="text"]:focus,
.ss-category-inquiry__form input[type="email"]:focus,
.ss-category-inquiry__form textarea:focus {
    outline: none;
    border-color: var(--primary-color, #ed6f13);
}

.ss-category-inquiry__form textarea {
    resize: vertical;
    min-height: 80px; /* 压缩 textarea 高度 */
}

.ss-category-inquiry__submit {
    text-align: center;
    margin-top: 20px;
}

.ss-category-inquiry__form input[type="submit"] {
    background: var(--primary-color, #ed6f13);
    color: #fff;
    padding: 12px 40px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ss-category-inquiry__form input[type="submit"]:hover {
    background: var(--primary-hover, #d45f0f);
}

.ss-category-inquiry__form input[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* WPForms Overrides for Category Page */
.ss-category-inquiry__form .wpforms-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.ss-category-inquiry__form .wpforms-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ss-category-inquiry__form .wpforms-field {
    padding: 0;
    margin-bottom: 0;
}

.ss-category-inquiry__form .wpforms-field-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.ss-category-inquiry__form input[type="text"],
.ss-category-inquiry__form input[type="email"],
.ss-category-inquiry__form input[type="tel"],
.ss-category-inquiry__form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.ss-category-inquiry__form input[type="text"]:focus,
.ss-category-inquiry__form input[type="email"]:focus,
.ss-category-inquiry__form input[type="tel"]:focus,
.ss-category-inquiry__form textarea:focus {
    outline: none;
    border-color: var(--primary-color, #ed6f13);
}

.ss-category-inquiry__form textarea {
    resize: vertical;
    min-height: 80px;
}

.ss-category-inquiry__form .wpforms-submit-container {
    text-align: center;
    margin-top: 10px;
    padding: 0;
}

.ss-category-inquiry__form .wpforms-submit {
    background: var(--primary-color, #ed6f13);
    color: #fff;
    padding: 12px 40px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    width: auto;
}

.ss-category-inquiry__form .wpforms-submit:hover {
    background: var(--primary-hover, #d45f0f);
}

/* ============================================
   8. FAQ 部分
   ============================================ */
.ss-category-faqs {
    margin: 60px 0;
}

.ss-category-faqs__title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 30px;
    text-align: center;
    color: #222;
}

.ss-category-faqs__icon {
    margin-right: 10px;
}

.ss-category-faqs__list {
    max-width: 900px;
    margin: 0 auto;
}

.ss-category-faq {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #f0f0f0;
}

.ss-category-faq:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ss-category-faq__question {
    font-size: 18px;
    font-weight: 600;
    color: #222;
    margin-bottom: 10px;
    line-height: 1.4;
}

.ss-category-faq__answer {
    font-size: 15px;
    color: #555;
    line-height: 1.8;
}

/* ============================================
   9. 响应式设计
   ============================================ */
@media (max-width: 1200px) {
    .ss-page--category .ss-container {
        padding: 0 30px;
    }
    
    .ss-category-products__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

@media (max-width: 992px) {
    .ss-category-products__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .ss-page--category .ss-container {
        padding: 0 20px;
    }
    
    /* 手机端产品分类页：H1-H6 字体大小 18px，字重 200 */
    .ss-page--category h1,
    .ss-page--category h2,
    .ss-page--category h3,
    .ss-page--category h4,
    .ss-page--category h5,
    .ss-page--category h6 {
        font-size: 18px;
        font-weight: 200;
    }
    
    .ss-category-banner {
        height: 250px;
    }
    
    .ss-category-header {
        margin: 30px 0 20px;
    }
    
    .ss-category-header__title {
        font-size: 24px;
    }
    
    /* 手机端：产品分类页 H1-H6 字体大小 18px，粗细 200 */
    body.taxonomy-product_category h1,
    body.taxonomy-product_category h2,
    body.taxonomy-product_category h3,
    body.taxonomy-product_category h4,
    body.taxonomy-product_category h5,
    body.taxonomy-product_category h6,
    .ss-page--category h1,
    .ss-page--category h2,
    .ss-page--category h3,
    .ss-page--category h4,
    .ss-page--category h5,
    .ss-page--category h6 {
        font-size: 18px !important;
        font-weight: 200 !important;
    }
    
    .ss-category-products {
        margin: 30px 0;
    }
    
    .ss-category-products__grid {
        grid-template-columns: repeat(2, 183px);
        gap: 15px;
        justify-content: center;
    }
    
    /* 避免 grid item 自身被拉伸导致视觉偏移 */
    .ss-category-product {
        justify-self: center;
    }
    
    /* 移动端：产品卡片容器固定宽度和高度，防止闪跳 */
    .ss-category-product__link {
        width: 183px;
        height: 309px; /* 183px (image) + 126px (title) */
        display: flex;
        flex-direction: column;
    }
    
    /* 移动端：产品图片尺寸固定为 183*183px */
    .ss-category-product__image-wrapper {
        width: 183px;
        height: 183px;
        aspect-ratio: auto;
        flex-shrink: 0; /* 防止在 flex 容器中被压缩 */
    }
    
    .ss-category-product__image {
        width: 183px;
        height: 183px;
        object-fit: cover;
    }
    
    /* 移动端：产品内容区尺寸固定为 183*126px，padding 为 0 */
    .ss-category-product__content {
        width: 183px;
        height: 126px;
        padding: 0;
        box-sizing: border-box;
        flex-shrink: 0; /* 防止在 flex 容器中被压缩 */
    }
    
    /* 移动端：title 盒子固定为 183*126px */
    .ss-category-product__title {
        width: 183px;
        height: 126px;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    /* 移动端：隐藏 p 内容盒子，只保留 title */
    .ss-category-product__excerpt {
        display: none !important;
    }
    
    .ss-category-content {
        margin: 40px 0;
    }
    
    .ss-category-inquiry {
        margin: 40px 0;
        padding: 40px 20px;
    }
    
    .ss-category-faqs {
        margin: 40px 0;
    }
    
    .ss-category-inquiry__title,
    .ss-category-faqs__title {
        font-size: 24px;
    }
    
    .ss-category-pagination {
        gap: 6px;
    }
    
    .ss-category-pagination a.page-numbers,
    .ss-category-pagination span.page-numbers {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 13px;
    }
    
    .ss-category-pagination a.page-numbers.prev,
    .ss-category-pagination a.page-numbers.next {
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    .ss-category-products__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .ss-category-pagination {
        gap: 4px;
    }
    
    .ss-category-pagination a.page-numbers,
    .ss-category-pagination span.page-numbers {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 12px;
    }
}

/* ============================================
   10. 动画效果
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* .ss-category-product {
    animation: fadeInUp 0.6s ease-out;
} */

/* 为产品卡片添加延迟动画 */
/* .ss-category-product:nth-child(1) { animation-delay: 0.1s; } */
/* .ss-category-product:nth-child(2) { animation-delay: 0.2s; } */
/* .ss-category-product:nth-child(3) { animation-delay: 0.3s; } */
/* .ss-category-product:nth-child(4) { animation-delay: 0.4s; } */
