/* 書庫篩選樣式 */
/* .filterBox {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
} */
main {
    padding-bottom: 15px;
}

.sectionTitle {
    margin-bottom: 15px;
}

.listBox .listItem:nth-child(1),
.listBox .listItem:nth-child(2) {
    margin-top: 0;
}

.listBox.listBox-w4 .listItem:nth-child(1),
.listBox.listBox-w4 .listItem:nth-child(2),
.listBox.listBox-w4 .listItem:nth-child(3),
.listBox.listBox-w4 .listItem:nth-child(4) {
    margin-top: 0;
}

.sectionLR {
    margin-top: 15px;
}

.filterItem {
    margin-bottom: 20px;
}

.filterItem:last-child {
    margin-bottom: 0;
}

.filterLabel {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.filterOptions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filterOption {
    display: inline-block;
    padding: 6px 16px;
    font-size: 14px;
    color: #666;
    background: #f5f5f5;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.filterOption:hover {
    background: #e8e8e8;
    color: #333;
}

.filterOption.active {
    background: linear-gradient(135deg, var(--primary-color-2) 0%, var(--primary-color) 100%);
    color: var(--white-color);
}

/* PC端隱藏切換按鈕 */
.filterToggle {
    display: none;
}

/* 篩選按鈕組 - PC端和移動端都顯示 */
.filterActions {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--white-color);
    border-top: 1px solid var(--color-efefef);
    flex-shrink: 0;
}

.filterBtn {
    flex: 1;
    height: 44px;
    border: none;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filterBtn-cancel {
    background: var(--color-efefef);
    color: var(--color-666);
}

.filterBtn-cancel:hover {
    background: #e0e0e0;
}

.filterBtn-confirm {
    background: linear-gradient(135deg, var(--primary-color-2) 0%, var(--primary-color) 100%);
    color: var(--white-color);
}

.filterBtn-confirm:hover {
    opacity: 0.9;
}

/* PC端左右區域最大高度（默認樣式） */
.innerWrap-span1 {
    max-height: calc(100vh - 135px - 84px);
    overflow: hidden;
    /* 改為 hidden */
    display: flex;
    /* 添加 flex 布局 */
    flex-direction: column;
    /* 垂直排列 */
    /* 隱藏滾動條但保留滾動功能 */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

/* PC端 filterBox 可滾動 */
.innerWrap-span1 .filterBox {
    overflow-y: auto;
    flex: 1;
}

/* 隱藏 WebKit 瀏覽器的滾動條 */
.innerWrap-span1::-webkit-scrollbar {
    display: none;
}

.innerWrap-span1 .filterBox::-webkit-scrollbar {
    display: none;
}

/* 右側區域不滾動，讓內部的 listBox 滾動 */
.innerWrap-span2 {
    max-height: calc(100vh - 135px - 84px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.innerWrap-span2 .sectionTitle {
    flex-shrink: 0;
    /* 標題不收縮 */
}

.innerWrap-span2 .listBox {
    overflow-y: auto;
    flex: 0 1 auto;
    /* 不增長，只收縮，基於內容大小 */
    min-height: 0;
    /* 修復 flex 子元素滾動問題 */
    align-content: flex-start;
    /* listBox 內部的 flex 項目從頂部開始排列 */
    /* 隱藏滾動條但保留滾動功能 */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.innerWrap-span2 .listBox::-webkit-scrollbar {
    display: none;
}

.innerWrap-span2 .loadmore,
.innerWrap-span2 .page {
    flex-shrink: 0;
    /* 分頁/加載更多不收縮 */
}

/* 移動端響應式設計 */
@media screen and (max-width: 1080px) {
    main {
        padding-bottom: 0;
    }

    /* main 的 padding-bottom 已在 reset.css 中統一設置為 65px */
    .sectionLR {
        margin-top: 57px;
    }

    .sectionTitle {
        margin-bottom: 12px;
    }

    .listBox .listItem:nth-child(1) {
        margin-top: 0 !important;
    }

    .listBox .listItem:nth-child(2) {
        margin-top: 12px;
    }

    .listBox.listBox-w4 .listItem:nth-child(2) {
        margin-top: 0 !important;
    }

    .listBox.listBox-w4 .listItem:nth-child(3),
    .listBox.listBox-w4 .listItem:nth-child(4) {
        margin-top: 12px;
    }

    /* 固定篩選區域到頂部 */
    .innerWrap-span1 {
        position: fixed !important;
        top: 100px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 65px !important;
        /* 為底部導航欄留出空間 */
        z-index: 998;
        width: 100% !important;
        height: auto !important;
        /* 使用 auto 让 bottom 生效 */
        background: var(--white-color);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
        overflow: hidden;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
    }

    /* 收起狀態 */
    .innerWrap-span1.collapsed {
        height: 45px !important;
        /* 收起時固定高度 */
        bottom: auto !important;
        /* 收起時不需要 bottom */
        overflow: hidden !important;
    }

    /* 篩選切換按鈕 */
    .filterToggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px;
        cursor: pointer;
        background: var(--white-color);
        border-bottom: 1px solid var(--color-efefef);
        user-select: none;
        flex-shrink: 0;
        /* 按鈕不收縮 */
    }

    .innerWrap-span1.collapsed .filterToggle {
        border-bottom: 1px solid transparent
    }


    .filterToggle-text {
        font-size: 14px;
        font-weight: 600;
        color: var(--color-333);
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        overflow: hidden;
    }

    .filterToggle-current {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        font-weight: 400;
        color: var(--color-666);
        flex: 1;
        overflow: hidden;
        min-width: 0;
    }

    .filterToggle-current .current-item {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        white-space: nowrap;
        flex-shrink: 0;
        position: relative;
    }

    .filterToggle-current .current-item:not(:last-child)::after {
        content: '|';
        margin-left: 6px;
        color: var(--color-ddd);
    }

    .filterToggle-current .current-item:last-child {
        overflow: hidden;
        flex-shrink: 1;
        min-width: 0;
    }

    .filterToggle-current .current-item:last-child i {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .filterToggle-current .current-item i {
        color: var(--primary-color);
        font-style: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .filterToggle-icon {
        width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.3s ease;
    }

    .filterToggle-icon::before {
        content: '';
        width: 0;
        height: 0;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 8px solid var(--color-666);
    }

    .innerWrap-span1.collapsed .filterToggle-icon {
        transform: rotate(-180deg);
    }

    /* 篩選內容區域 */
    .filterBox {
        padding: 0 12px;
        width: 100%;
        height: 100%;
        /* 明確設置高度為 100% */
        margin: 12px 0;
        box-sizing: border-box;
        flex: 1 1 auto;
        /* 讓 filterBox 占據剩餘空間 */
        overflow-y: auto;
        /* 內容過多時可滾動 */
        min-height: 0;
        /* 修復 flex 子元素滾動問題 */
        display: flex;
        /* 添加 flex 布局 */
        flex-direction: column;
        /* 垂直排列 */
    }
    .collapsed .filterBox{
        margin: 0!important;
        padding: 0!important;
    }
    .collapsed .filterActions{
        display: none;
    }
    /* 重置內容區域樣式（移動端不需要固定高度和滾動） */
    .innerWrap-span2 {
        margin-top: 0 !important;
        max-height: none;
        overflow: visible;
        display: block;
    }

    .innerWrap-span2 .listBox {
        overflow-y: visible;
        flex: none;
    }

    .filterItem {
        margin-bottom: 12px;
        display: flex;
        align-items: flex-start;
        gap: 8px;
        flex-shrink: 0;
        /* 防止被壓縮 */
    }

    .filterItem:last-child {
        margin-bottom: 0;
        padding-bottom: 12px;
        flex: 1;
        /* 讓最後一個 filterItem 占據剩餘空間，撐滿容器 */
        min-height: 0;
    }

    .filterLabel {
        font-size: 13px;
        margin-bottom: 0;
        color: var(--color-666);
        flex-shrink: 0;
        min-width: 40px;
        padding-top: 6px;
    }

    /* 上下滚动容器 - 移除高度限制，让它自然撑开 */
    .filterOptions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        overflow-x: hidden;
        overflow-y: visible;
        /* 改为 visible，不限制高度 */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        flex: 1;
        align-content: flex-start;
        /* 內容從頂部開始排列 */
    }

    .filterOptions::-webkit-scrollbar {
        display: none;
    }

    .filterOption {
        /* padding: 5px 11px; */
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* 移動端按鈕交互改為 active */
    .filterBtn-cancel:hover {
        background: var(--color-efefef);
        /* 移動端取消 hover 效果 */
    }

    .filterBtn-cancel:active {
        background: #e0e0e0;
    }

    .filterBtn-confirm:hover {
        opacity: 1;
        /* 移動端取消 hover 效果 */
    }

    .filterBtn-confirm:active {
        opacity: 0.8;
    }
}