/* assets/faq.css */

/* ============================================================
   CSS 变量（主题色由 PHP 通过 wp_add_inline_style 动态覆盖）
   ============================================================ */
:root {
    --faq-accent: #c5a880; /* 默认拿铁色，部署时由 ACF 全局设置覆盖 */
}


/* ============================================================
   整体容器
   ============================================================ */
.faq-section {
    margin: 60px auto !important;
    padding: 0 !important;
    background: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    max-width: 800px !important;
    width: 100% !important;
}

.faq-section::before {
    display: none !important;
}

.faq-container {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}


/* ============================================================
   标题
   ============================================================ */
.faq-title {
    text-align: center !important;
    margin-bottom: 40px !important;
    font-size: 26px !important;
    font-weight: 500 !important;
    color: #383838 !important;
    position: relative !important;
    padding-bottom: 15px !important;
}

.faq-title::after {
    content: "" !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 50px !important;
    height: 2px !important;
    background: var(--faq-accent) !important;
    border-radius: 2px !important;
}


/* ============================================================
   模板 A：线条极简（默认，data-template="a" 或无属性）
   ============================================================ */
.faq-section[data-template="a"] .faq-list,
.faq-section:not([data-template="b"]) .faq-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    border-top: 1px solid #e9e9e9 !important;
}

.faq-section[data-template="a"] .faq-item,
.faq-section:not([data-template="b"]) .faq-item {
    background: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    transition: none !important;
    border: none !important;
    border-bottom: 1px solid #e9e9e9 !important;
}

.faq-section[data-template="a"] .faq-item:hover,
.faq-section:not([data-template="b"]) .faq-item:hover {
    transform: none !important;
    box-shadow: none !important;
}

.faq-section[data-template="a"] .faq-question,
.faq-section:not([data-template="b"]) .faq-question {
    padding: 22px 10px !important;
    background: none !important;
}

.faq-section[data-template="a"] .faq-question:hover,
.faq-section:not([data-template="b"]) .faq-question:hover {
    background-color: #f9f9f9 !important;
}

.faq-section[data-template="a"] .faq-item.active .faq-question,
.faq-section:not([data-template="b"]) .faq-item.active .faq-question {
    background-color: #f9f9f9 !important;
}

.faq-section[data-template="a"] .faq-answer-content,
.faq-section:not([data-template="b"]) .faq-answer-content {
    padding: 5px 10px 25px 10px !important;
}


/* ============================================================
   模板 B：卡片浮起风格（data-template="b"）
   ============================================================ */
.faq-section[data-template="b"] .faq-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    border-top: none !important;
}

.faq-section[data-template="b"] .faq-item {
    background: #ffffff !important;
    border-radius: 10px !important;
    border: 1px solid #eeeeee !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden !important;
    transition: box-shadow 0.3s ease, border-color 0.3s ease !important;
}

.faq-section[data-template="b"] .faq-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.09) !important;
    border-color: #e0e0e0 !important;
    transform: none !important;
}

.faq-section[data-template="b"] .faq-item.active {
    border-color: var(--faq-accent) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.09) !important;
}

.faq-section[data-template="b"] .faq-question {
    padding: 20px 22px !important;
    background: none !important;
}

.faq-section[data-template="b"] .faq-question:hover {
    background-color: #fafafa !important;
}

.faq-section[data-template="b"] .faq-item.active .faq-question {
    background-color: #fafafa !important;
}

.faq-section[data-template="b"] .faq-answer-content {
    padding: 0 22px 22px 22px !important;
}


/* ============================================================
   问题文本（两套模板共用）
   ============================================================ */
.faq-question {
    cursor: pointer !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    transition: background-color 0.3s ease !important;
    border-bottom: none !important;
    margin: 0 !important;
    font-size: 16px !important;
}

.faq-question-text {
    font-weight: 400 !important;
    font-size: 16px !important;
    color: #4a4a4a !important;
    line-height: 1.6 !important;
    flex: 1 !important;
    margin-right: 20px !important;
    transition: color 0.3s ease !important;
}

.faq-item.active .faq-question-text {
    color: var(--faq-accent) !important;
}


/* ============================================================
   切换图标（两套模板共用）
   ============================================================ */
.faq-toggle {
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    background: none !important;
    color: #b0b0b0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    font-weight: 300 !important;
    transition: transform 0.3s ease, color 0.3s ease !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}

.faq-item.active .faq-toggle {
    transform: rotate(45deg) !important;
    background: none !important;
    color: var(--faq-accent) !important;
}


/* ============================================================
   答案展开/收起（两套模板共用）
   ============================================================ */
.faq-answer {
    max-height: 0 !important;
    overflow: hidden !important;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    background: none !important;
}

.faq-item.active .faq-answer {
    max-height: 1000px !important;
}

.faq-answer-content {
    color: #666 !important;
    line-height: 1.8 !important;
    font-size: 15px !important;
}

.faq-answer-content p {
    margin: 0 0 15px 0 !important;
}

.faq-answer-content p:last-child {
    margin-bottom: 0 !important;
}


/* ============================================================
   移动端适配
   ============================================================ */
@media (max-width: 768px) {
    .faq-section {
        margin: 40px auto !important;
        padding: 0 20px !important; /* 核心修复：增加手机端左右 20px 的安全距离 */
        box-sizing: border-box !important; /* 确保 padding 不会撑破 100% 的宽度 */
    }

    .faq-title {
        font-size: 22px !important;
        margin-bottom: 30px !important;
    }

    .faq-section[data-template="a"] .faq-question,
    .faq-section:not([data-template="b"]) .faq-question {
        padding: 18px 5px !important;
    }

    .faq-section[data-template="b"] .faq-question {
        padding: 16px 16px !important;
    }

    .faq-question-text {
        font-size: 15px !important;
        margin-right: 15px !important;
    }

    .faq-toggle {
        font-size: 22px !important;
    }

    .faq-section[data-template="a"] .faq-answer-content,
    .faq-section:not([data-template="b"]) .faq-answer-content {
        padding: 0 5px 20px 5px !important;
        font-size: 14px !important;
    }

    .faq-section[data-template="b"] .faq-answer-content {
        padding: 0 16px 18px 16px !important;
        font-size: 14px !important;
    }
}
