*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg-gray: #f4f7f9;
    --white: #ffffff;
    --text-dark: #333333;
    --text-gray: #666666;
    --border-color: #eeeeee;
    /* 更換為台灣大哥大橘色 */
    --accent-orange: #FF6700;
    --accent-light: #fff3e6;
    /* 淺橘色背景，用於 hover 或選中態 */
}

body {
    font-family: "PingFang TC", "Microsoft JhengHei", sans-serif;
    background-color: var(--bg-gray);
    margin: 0;
    color: var(--text-dark);
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
}

.wrapper-faq {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-header {
    text-align: center;
    padding: 20px 0;
}

.page-header h1 {
    font-size: 24px;
    color: var(--accent-orange);
}

.mobile-filter-btn {
    display: none;
    width: 100%;
    padding: 16px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 18px;
    margin-bottom: 20px;
    text-align: left;
    position: relative;
    cursor: pointer;
}

.mobile-filter-btn::after {
    content: '⌵';
    position: absolute;
    right: 20px;
    top: 14px;
    font-weight: bold;
}

.main-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

.sidebar {
    background: var(--white);
    padding: 25px;
    border-radius: 16px;
    height: fit-content;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    padding: 16px 10px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-gray);
    transition: 0.3s;
}

/* 選中狀態與文字顏色 */
.category-item.active>.menu-title {
    color: var(--accent-orange);
    font-weight: bold;
    font-size: 19px;
}

.menu-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 19px;
}

.arrow {
    font-size: 10px;
    transition: 0.3s;
    transform: rotate(-90deg);
}

.has-submenu.open>.menu-title .arrow {
    transform: rotate(0deg);
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 15px;
    display: none;
    border-left: 2px solid var(--border-color);
}

.has-submenu.open>.submenu {
    display: block;
}

.submenu-item {
    padding: 12px 15px;
    font-size: 18px;
    color: var(--text-gray);
    cursor: pointer;
    transition: 0.2s;
}

.submenu-item:hover {
    color: var(--accent-orange);
    background: var(--accent-light);
}

.submenu-item.active {
    color: var(--accent-orange);
    font-weight: bold;
    background: var(--accent-light);
}

/* 動態標題底線延伸 */
#categoryTitle {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--text-dark);
    padding-bottom: 18px;
    border-bottom: 2px solid var(--accent-orange);
    display: block;
    width: 100%;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: 0.3s;
}

.faq-item.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.faq-q {
    width: 100%;
    padding: 20px;
    background: none;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 19px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.faq-q span {
   line-height: 30px;
}

/* QA 圖示顏色 */
.faq-q .icon {
    transition: 0.3s;
    font-size: 22px;
    color: var(--accent-orange);
}

.faq-item.active .icon {
    transform: rotate(45deg);
}

.faq-a {
    max-height: 0;
    overflow: hidden;
    transition: 0.3s ease;
}

.faq-a-content {
    padding: 0 20px 20px;
    color: var(--text-gray);
    line-height: 1.7;
    font-size: 17px;
    border-top: 1px solid #f9f9f9;
    padding-top: 0px;
}

.faq-item.active .faq-a {
    max-height: 1000px;
}

/* Bottom Sheet 手機版 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    visibility: hidden;
    opacity: 0;
    transition: 0.3s;
    z-index: 999;
}

.bottom-sheet {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    background: var(--white);
    border-radius: 20px 20px 0 0;
    z-index: 1000;
    transition: 0.4s;
    max-height: 80vh;
    overflow-y: auto;
    padding-bottom: 40px;
}

.bottom-sheet.open {
    bottom: 0;
}

.overlay.open {
    visibility: visible;
    opacity: 1;
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .mobile-filter-btn {
        display: block;
        border-left: 4px solid var(--accent-orange);
    }
}