/*
 * style.css
 * 用于前端 FAQ 展示页面的样式
 */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 960px;
    margin: 30px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 40px;
    font-size: 2.5em;
    position: relative;
    padding-bottom: 15px;
}

h1::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: #3498db;
    border-radius: 2px;
}

/* --- Tab 样式开始 --- */
.tabs {
    margin-top: 20px;
}

.tab-nav {
    display: flex;
    flex-wrap: wrap; /* 允许换行 */
    justify-content: center; /* 居中显示tab按钮 */
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
    gap: 10px; /* 按钮之间的间距 */
}

.tab-button {
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-bottom: none; /* 底部边框由tab-nav提供 */
    padding: 12px 20px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    color: #555;
    border-radius: 8px 8px 0 0; /* 圆角顶部 */
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    flex-grow: 1; /* 允许按钮增长填充空间 */
    max-width: 200px; /* 限制按钮最大宽度 */
    text-align: center;
}

.tab-button:hover {
    background-color: #e9e9e9;
    color: #333;
}

.tab-button.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
    position: relative;
    z-index: 1; /* 确保激活的tab在上面 */
    transform: translateY(2px); /* 稍微下移，形成突出效果 */
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

.tab-button.active:hover {
    background-color: #3498db; /* 保持激活状态的背景色不变 */
    color: white;
}

.tab-content {
    padding: 10px 0;
}

.tab-pane {
    display: none; /* 默认隐藏所有内容面板 */
    animation: fadeIn 0.5s ease-out; /* 淡入动画 */
}

.tab-pane.active {
    display: block; /* 激活时显示 */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Tab 样式结束 --- */


/* FAQ Item 样式 (保持不变，但移除了 .faq-category 的样式，因为它不再用于直接布局) */
/* .faq-category { /* 移除或注释掉此块，因为Tab布局不再需要它来直接控制分类的显示 */
/*    margin-bottom: 30px; */
/*} */

/* .faq-category h2 { /* 移除或注释掉此块，因为分类标题现在在Tab按钮上 */
/*    color: #3498db; */
/*    border-bottom: 2px solid #e0e0e0; */
/*    padding-bottom: 10px; */
/*    margin-bottom: 20px; */
/*    font-size: 1.8em; */
/*} */


.faq-item {
    margin-bottom: 15px;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
    background-color: #fff;
    transition: all 0.3s ease;
}

.faq-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.faq-question {
    background-color: #f8f8f8;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: #555;
    font-size: 1.1em;
    transition: background-color 0.3s ease;
}

.faq-question:hover {
    background-color: #f0f0f0;
}

.faq-question .toggle-icon {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.faq-question.active .toggle-icon {
    transform: rotate(90deg); /* 展开时旋转图标 */
}

.faq-answer {
    /* 初始状态 */
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    opacity: 0; /* 初始透明 */
    /* 过渡属性 */
    transition: max-height 0.4s ease-out, padding 0.4s ease-out, opacity 0.4s ease-out;
    background-color: #ffffff;
    line-height: 1.6;
    color: #666;
    padding-left: 20px; /* 水平 padding 保持不变 */
    padding-right: 20px; /* 水平 padding 保持不变 */
}

.faq-answer.open {
    /* 展开状态，max-height 通过 JS 动态设置 */
    padding-top: 15px;
    padding-bottom: 15px;
    opacity: 1; /* 展开时完全显示 */
}

.faq-answer p {
    margin-bottom: 10px;
}

.faq-answer img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px 0;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.faq-answer a {
    color: #3498db;
    text-decoration: none;
}

.faq-answer a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    color: #888;
    font-size: 0.9em;
    border-top: 1px solid #eee;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        margin: 15px;
        padding: 15px;
    }
    h1 {
        font-size: 2em;
    }
    /* Tab 导航在小屏幕上允许换行，并调整间距 */
    .tab-nav {
        flex-direction: column; /* 小屏幕上垂直堆叠 */
        gap: 5px;
    }
    .tab-button {
        width: 100%; /* 占据整行 */
        max-width: none; /* 移除最大宽度限制 */
        border-radius: 6px; /* 调整圆角 */
    }
    .tab-button.active {
        transform: translateY(0); /* 小屏幕上不突出 */
    }

    .faq-question {
        font-size: 1em;
        padding: 12px 15px;
    }
    .faq-answer.open {
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .faq-answer {
        padding-left: 15px;
        padding-right: 15px;
    }
}
