/* ============================================================
   全站搜索（首页顶栏搜索框 + 下拉结果面板）
   设计令牌沿用前台 brandline 主题（--bl-*），未定义时使用后备值
   ============================================================ */

/* 顶栏搜索框：<1280px 隐藏，沿用旧版顶部内联搜索的断点行为。
   这里必须用 .gs.hd-search-global 提高权重，否则会被下面 .gs 的 display:flex 覆盖。 */
.gs.hd-search-global {
    display: none;
}

@media (min-width: 1280px) {
    .gs.hd-search-global {
        display: flex;
    }
}

.gs {
    position: relative;
    display: flex;
    align-items: center;
    width: 244px;
    height: 76px;
}

.gs *,
.gs *::before,
.gs *::after {
    box-sizing: border-box;
}

/* ---------------- 输入区 ---------------- */
.gs__field {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 38px;
    padding: 0 8px 0 11px;
    border: 1px solid var(--bl-line, #e6ecf5);
    border-radius: 9px;
    background: #fbfcfe;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.gs__field:hover {
    border-color: #d5dfee;
}

.gs.is-open .gs__field,
.gs__field:focus-within {
    border-color: #b9cdf7;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(46, 107, 255, 0.1);
}

.gs__icon {
    flex: none;
    width: 15px;
    height: 15px;
    color: #98a2b3;
    transition: color 0.18s ease;
}

.gs__field:focus-within .gs__icon,
.gs.is-open .gs__icon {
    color: var(--bl-brand, #2e6bff);
}

.gs__input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--bl-ink, #0f172a);
    font-family: inherit;
    font-size: 13px;
    line-height: 18px;
    caret-color: var(--bl-brand, #2e6bff);
    -webkit-appearance: none;
    appearance: none;
}

.gs__input::placeholder {
    color: #a3aebf;
}

.gs__input::-webkit-search-cancel-button {
    display: none;
}

.gs__clear {
    display: none;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #98a2b3;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.gs__clear:hover {
    background: #eef2f8;
    color: var(--bl-body, #475569);
}

.gs.has-value .gs__clear {
    display: inline-flex;
}

.gs__esc {
    flex: none;
    padding: 2px 5px;
    border: 1px solid var(--bl-line, #e6ecf5);
    border-bottom-color: #d8dfea;
    border-radius: 5px;
    background: #fff;
    color: #98a2b3;
    font-family: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
    font-size: 10px;
    line-height: 14px;
    letter-spacing: 0.02em;
}

/* ---------------- 下拉面板 ---------------- */
.gs__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    width: 640px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    border: 1px solid var(--bl-line, #e6ecf5);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.13), 0 2px 6px rgba(15, 23, 42, 0.05);
    opacity: 0;
    transform: translateY(-6px) scale(0.995);
    transform-origin: top right;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.gs.is-open .gs__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.gs__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 20px 7px;
}

.gs__count {
    color: var(--bl-muted, #78849a);
    font-size: 12px;
    line-height: 18px;
}

.gs__count b {
    margin: 0 3px;
    color: var(--bl-body, #475569);
    font-weight: 600;
}

.gs__scope {
    color: #a8b2c2;
    font-size: 11px;
    line-height: 16px;
    white-space: nowrap;
}

.gs__body {
    max-height: 430px;
    overflow-y: auto;
    padding: 2px 10px 8px;
    scrollbar-width: thin;
    scrollbar-color: #dde3ec transparent;
}

.gs__body.is-scrollable {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent 100%);
}

.gs__body::-webkit-scrollbar {
    width: 8px;
}

.gs__body::-webkit-scrollbar-thumb {
    border: 2px solid #fff;
    border-radius: 8px;
    background: #dde3ec;
}

.gs__group {
    padding: 6px 0 2px;
}

.gs__group + .gs__group {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid #f0f3f8;
}

.gs__group-label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 4px;
    padding: 0 10px;
    color: #98a2b3;
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: 0.06em;
}

.gs__group-total {
    color: #b3bcc9;
    font-weight: 400;
    letter-spacing: 0;
}

.gs__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.14s ease;
}

.gs__item:hover,
.gs__item.is-active {
    background: #f4f6fb;
}

.gs__item-main {
    min-width: 0;
}

.gs__item-title {
    display: block;
    overflow: hidden;
    color: var(--bl-ink, #0f172a);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gs__item-path {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: var(--bl-muted, #78849a);
    font-size: 12px;
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gs__item-enter {
    flex: none;
    margin-left: auto;
    color: #a8b2c2;
    opacity: 0;
    transform: translateX(-3px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.gs__item:hover .gs__item-enter,
.gs__item.is-active .gs__item-enter {
    opacity: 1;
    transform: translateX(0);
}

.gs__item mark {
    padding: 0 1px;
    border-radius: 3px;
    background: rgba(46, 107, 255, 0.1);
    color: var(--bl-brand-deep, #0a4bd6);
}

.gs__empty {
    margin: 0;
    padding: 9px 10px 11px;
    color: #a8b2c2;
    font-size: 12px;
    line-height: 18px;
}

.gs__hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 22px;
    color: var(--bl-muted, #78849a);
    font-size: 12px;
    line-height: 18px;
}

.gs__hint-keys {
    display: inline-flex;
    gap: 4px;
}

.gs__blank {
    padding: 34px 20px 38px;
    text-align: center;
}

.gs__blank-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: #f2f5fa;
    color: #98a2b3;
}

.gs__blank-title {
    margin: 0;
    color: var(--bl-body, #475569);
    font-size: 13px;
    line-height: 20px;
}

.gs__blank-desc {
    margin: 4px 0 0;
    color: #a8b2c2;
    font-size: 12px;
    line-height: 18px;
}

.gs__blank-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    color: var(--bl-brand, #2e6bff);
    font-size: 12px;
    text-decoration: none;
}

.gs__blank-link:hover {
    color: var(--bl-brand-deep, #0a4bd6);
    text-decoration: underline;
}

.gs__foot {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    border-top: 1px solid #f0f3f8;
    background: #fcfdff;
    color: #a8b2c2;
    font-size: 11px;
    line-height: 16px;
}

.gs__foot-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.gs__foot kbd,
.gs__hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 1px solid var(--bl-line, #e6ecf5);
    border-bottom-color: #d8dfea;
    border-radius: 5px;
    background: #fff;
    color: #98a2b3;
    font-family: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
    font-size: 10px;
    line-height: 1;
}

.gs__foot-spacer {
    margin-left: auto;
}

.gs__loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 22px 20px;
    color: var(--bl-muted, #78849a);
    font-size: 12px;
    line-height: 18px;
}

.gs__spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e6ecf5;
    border-top-color: var(--bl-brand, #2e6bff);
    border-radius: 50%;
    animation: gs-spin 0.7s linear infinite;
}

@keyframes gs-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1439px) {
    .gs {
        width: 216px;
    }

    .gs__panel {
        width: 600px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gs__panel,
    .gs__field,
    .gs__item,
    .gs__item-enter,
    .gs__spinner {
        transition: none;
        animation: none;
    }
}
