/* ===== 列表搜尋 / 篩選列（_ListSearch.cshtml + st-fe-list-search.js）=====
   skill-frontend-templates v2.15。editorial 變數不一定載入（子站 layout 無 editorial-base.css），
   故所有 var() 皆帶 fallback 值。 */

.st-lsearch {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.st-lsearch-facets {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

/* 分組下拉：細線底框，不用 Bootstrap form-select 的方框 */
.st-lsearch-select {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-bottom: 1px solid var(--paper-edge, #E2D9C4);
    background: transparent url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236E6388' d='M4.5 6.5 8 10l3.5-3.5z'/%3E%3C/svg%3E") no-repeat right 2px center;
    background-size: 16px 16px;
    padding: 6px 24px 6px 2px;
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 0.94rem;
    color: var(--ink, #2A2240);
    cursor: pointer;
    min-width: 140px;
}

.st-lsearch-select:focus {
    outline: none;
    border-bottom-color: var(--gold, #C8A45C);
}

/* 搜尋框槽位：桌機靠右 */
.st-lsearch-slot {
    margin-left: auto;
    flex: 0 0 auto;
}

.st-lsearch-box {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--paper-edge, #E2D9C4);
    padding: 6px 2px;
    transition: border-color 0.2s ease;
    min-width: 260px;
}

.st-lsearch-box:focus-within {
    border-bottom-color: var(--gold, #C8A45C);
}

.st-lsearch-icon {
    color: var(--ink-mute, #6E6388);
    font-size: 1.1rem;
    line-height: 1;
    flex: 0 0 auto;
}

.st-lsearch-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 0;
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 0.96rem;
    color: var(--ink, #2A2240);
}

.st-lsearch-input:focus { outline: none; }

/* 去掉 type=search 的原生清除叉（我們有自己的按鈕） */
.st-lsearch-input::-webkit-search-decoration,
.st-lsearch-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.st-lsearch-count {
    flex: 0 0 auto;
    font-size: 0.82rem;
    color: var(--ink-mute, #6E6388);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.st-lsearch-clear,
.st-lsearch-toggle {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--ink-mute, #6E6388);
    line-height: 1;
    padding: 4px;
    cursor: pointer;
    border-radius: 50%;
}

.st-lsearch-clear:hover,
.st-lsearch-toggle:hover {
    color: var(--ink, #2A2240);
}

/* 桌機不需要收合鈕與 FAB */
.st-lsearch-toggle,
.st-lsearch-fab,
.st-lsearch-sentinel {
    display: none;
}

.st-lsearch-empty {
    text-align: center;
    color: var(--ink-mute, #6E6388);
    font-family: var(--font-body, system-ui, sans-serif);
    padding: 32px 0;
}

/* ── 手機：搜尋收成放大鏡，展開為底部升起的搜尋列 ── */
@media (max-width: 991.98px) {
    .st-lsearch {
        gap: 8px;
        margin-bottom: 20px;
    }

    .st-lsearch-select {
        flex: 1 1 auto;
        min-width: 0;
    }

    /* 收合態：只留一顆放大鏡；名單上方靠右。
       與 FAB 同一個金色家族，但輕量（線框而非實心），因為它在版面內、不該搶名單 */
    .st-lsearch-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
        border: 1px solid var(--gold-soft, #E8D7A8);
        color: var(--gold-deep, #8B6F2E);
    }

    .st-lsearch-toggle:hover {
        color: var(--ink-deep, #1A1530);
        border-color: var(--gold, #C8A45C);
    }

    .st-lsearch-slot .st-lsearch-box {
        display: none;
    }

    /* 哨兵：名單頂端；捲出視窗才浮出 FAB */
    .st-lsearch-sentinel {
        display: block;
        height: 1px;
        margin-top: -1px;
    }

    /* 展開態：整條搜尋列固定在畫面底部（鍵盤彈出時貼在鍵盤上緣），名單在上方即時變少 */
    .st-lsearch.is-open .st-lsearch-toggle {
        display: none;
    }

    .st-lsearch.is-open .st-lsearch-box {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1075;
        margin: 0;
        min-width: 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--paper, #F8F4ED);
        border-top: 1px solid var(--paper-edge, #E2D9C4);
        border-bottom: 0;
        box-shadow: 0 -6px 20px rgba(26, 21, 48, 0.12);
    }

    /* 浮動搜尋鈕：深底托金鏡＋金環（獅子會徽章的金／深底關係）。
       顏色一律走 editorial :root 既有色票，色票改了這顆鈕自動跟著改。 */
    .st-lsearch-fab {
        --lsearch-fab-bg: var(--ink-deep, #1A1530);
        --lsearch-fab-fg: var(--gold, #C8A45C);

        position: fixed;
        right: 1rem;
        bottom: 1rem;
        z-index: 1070;
        width: 44px;
        height: 44px;
        border: 1.5px solid var(--lsearch-fab-fg);
        border-radius: 50%;
        background: var(--lsearch-fab-bg);
        color: var(--lsearch-fab-fg);
        align-items: center;
        justify-content: center;
        font-size: 1.4rem;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 4px 14px rgba(26, 21, 48, 0.30);
        opacity: 0;
        transform: translateY(8px);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    /* hidden 屬性由 JS 控制是否參與版面；is-visible 控制淡入 */
    .st-lsearch-fab:not([hidden]) {
        display: flex;
    }

    .st-lsearch-fab.is-visible {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .st-lsearch-fab { transition: none; }
}
