/* 書庫篩選樣式 - TY Theme (based on HX filter pattern) */

/* === 基礎佈局 === */
.innerWrap {
    padding: 15px;
    border-radius: 6px;
    background: var(--sn-white);
}

.sectionLR {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.innerWrap-span1 {
    width: 280px;
}

.innerWrap-span2 {
    width: calc(100% - 300px);
}

main {
    padding-bottom: 15px;
}

.sectionTitle {
    margin-bottom: 15px;
}

.filterItem {
    margin-bottom: 20px;
}

.filterItem:last-child {
    margin-bottom: 0;
}

.filterLabel {
    font-size: 14px;
    font-weight: 600;
    color: var(--sn-text);
    margin-bottom: 10px;
}

.filterOptions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filterOption {
    display: inline-block;
    padding: 6px 16px;
    font-size: 14px;
    color: var(--sn-text-secondary);
    background: var(--sn-gray-bg);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.filterOption:hover {
    background: #f0e0e6;
    color: var(--sn-text);
}

.filterOption.active {
    background: var(--sn-primary);
    color: #fff;
}

/* PC端隱藏切換按鈕 */
.filterToggle {
    display: none;
}

/* 篩選按鈕組 */
.filterActions {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--sn-white);
    border-top: 1px solid var(--sn-border);
    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(--sn-gray-bg);
    color: var(--sn-text-secondary);
}

.filterBtn-cancel:hover {
    background: #e0e0e0;
}

.filterBtn-confirm {
    background: var(--sn-primary);
    color: #fff;
}

.filterBtn-confirm:hover {
    opacity: 0.9;
}

/* PC端左右區域 */
.innerWrap-span1 {
    max-height: calc(100vh - 135px - 84px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.innerWrap-span1 .filterBox {
    overflow-y: auto;
    flex: 1;
}

.innerWrap-span1::-webkit-scrollbar {
    display: none;
}

.innerWrap-span1 .filterBox::-webkit-scrollbar {
    display: none;
}

.innerWrap-span2 {
    max-height: calc(100vh - 135px - 84px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.innerWrap-span2 .sectionTitle {
    flex-shrink: 0;
}

/* 移動端響應式設計 */
@media screen and (max-width: 1080px) {
    main {
        padding-bottom: 0;
    }

    .sectionLR {
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        margin-top: 0;
        transition: all 0.3s ease;
    }

    .innerWrap {
        padding: 12px;
        box-shadow: none;
        border-radius: 0;
    }

    .innerWrap-span1 {
        width: 100%;
    }

    .innerWrap-span2 {
        width: 100%;
    }

    /* ========== 状态1：完全收起 ========== */
    .sectionLR.filter-state-collapsed .innerWrap-span1 {
        position: fixed !important;
        top: var(--sn-header-height) !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 98;
        width: 100% !important;
        background: var(--sn-white);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        padding: 0;
        margin: 0;
        overflow: hidden;
    }

    .sectionLR.filter-state-collapsed .filterBox {
        display: none;
    }

    .sectionLR.filter-state-collapsed .filterActions {
        display: none;
    }

    .sectionLR.filter-state-collapsed .filterToggle-current {
        display: flex;
    }

    .sectionLR.filter-state-collapsed .filterToggle-icon {
        transform: rotate(0deg);
    }

    .sectionLR.filter-state-collapsed .innerWrap-span2 {
        margin-top: 58px;
    }

    /* ========== 状态2：半展开（默认） ========== */
    .sectionLR.filter-state-half .innerWrap-span1 {
        position: fixed !important;
        top: var(--sn-header-height) !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 98;
        width: 100% !important;
        background: var(--sn-white);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        padding: 0;
        margin: 0;
        overflow: visible;
    }

    .sectionLR.filter-state-half .filterBox {
        display: flex;
    }

    .sectionLR.filter-state-half .filterActions {
        display: none;
    }

    .sectionLR.filter-state-half .filterToggle-current {
        display: none;
    }

    .sectionLR.filter-state-half .filterToggle-icon {
        transform: rotate(0deg);
    }

    .sectionLR.filter-state-half .filterOptions {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .sectionLR.filter-state-half .innerWrap-span2 {
        margin-top: 210px !important;
    }

    /* ========== 状态3：完全展开 ========== */
    .sectionLR.filter-state-full .innerWrap-span1 {
        position: fixed !important;
        top: var(--sn-header-height) !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 98;
        width: 100% !important;
        background: var(--sn-white);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        padding: 0;
        margin: 0;
        overflow: visible;
    }

    .sectionLR.filter-state-full .filterBox {
        display: flex;
    }

    .sectionLR.filter-state-full .filterActions {
        display: flex;
    }

    .sectionLR.filter-state-full .filterToggle-current {
        display: none;
    }

    .sectionLR.filter-state-full .filterToggle-icon {
        transform: rotate(-180deg);
    }

    .sectionLR.filter-state-full .filterOptions {
        flex-wrap: wrap;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .sectionLR.filter-state-full .innerWrap-span2 {
        margin-top: 58px;
    }

    /* ========== 通用样式 ========== */
    .innerWrap-span1 {
        display: flex;
        flex-direction: column;
    }

    .innerWrap-span2 {
        max-height: none;
        overflow: visible;
        display: block;
        transition: padding-top 0.3s ease;
    }

    .sectionTitle {
        margin-bottom: 12px;
    }

    /* 篩選切換按鈕 */
    .filterToggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px;
        cursor: pointer;
        background: var(--sn-white);
        border-bottom: 1px solid var(--sn-border);
        user-select: none;
        flex-shrink: 0;
    }

    .sectionLR.filter-state-collapsed .filterToggle {
        border-bottom: 1px solid transparent;
    }

    .filterToggle-text {
        font-size: 14px;
        font-weight: 600;
        color: var(--sn-text);
        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(--sn-text-secondary);
        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(--sn-border);
    }

    .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(--sn-primary);
        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(--sn-text-secondary);
    }

    /* 篩選內容區域 */
    .filterBox {
        padding: 12px;
        width: 100%;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        background: var(--sn-white);
    }

    .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;
        min-height: 0;
    }

    .filterLabel {
        font-size: 13px;
        margin-bottom: 0;
        color: var(--sn-text-secondary);
        flex-shrink: 0;
        min-width: 40px;
        padding-top: 6px;
    }

    .filterOptions {
        display: flex;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        flex: 1;
    }

    .filterOptions::-webkit-scrollbar {
        display: none;
    }

    .filterOption {
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* 移動端按鈕交互 */
    .filterBtn-cancel:hover {
        background: var(--sn-gray-bg);
    }

    .filterBtn-cancel:active {
        background: #e0e0e0;
    }

    .filterBtn-confirm:hover {
        opacity: 1;
    }

    .filterBtn-confirm:active {
        opacity: 0.8;
    }
}
