/**
 * 全局搜索样式
 * 适配全局主题，背景框层/功能内容层
 */

/* 搜索建议容器 - 背景框层，最高层级 */
.search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 50px;
    background: var(--bg-primary);
    border: 1px solid var(--bg-border);
    border-radius: calc(var(--border-radius) - 2px);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-height: 300px;
    overflow-y: auto;
    z-index: 9999; /* 最高层级，确保在所有元素之上 */
    /* 自定义滚动条 */
    scrollbar-width: thin;
    scrollbar-color: var(--bg-border) transparent;
}

.search-suggestions::-webkit-scrollbar {
    width: 6px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: transparent;
}

.search-suggestions::-webkit-scrollbar-thumb {
    background: var(--bg-border);
    border-radius: 3px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 建议列表 */
.search-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-suggestions li {
    padding: 10px 14px;
    border-bottom: 1px solid var(--bg-border);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.search-suggestions li:last-child {
    border-bottom: none;
}

.search-suggestions li.hover {
    background: var(--hover-bg);
}

.search-suggestions li.active {
    background: var(--hover-bg);
    border-left: 3px solid var(--link-color);
    padding-left: 11px; /* 调整左边距，为左边框留空间 */
}

/* 建议项内容 */
.suggestion-name {
    font-size: 13px;
    color: var(--text-color);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-category {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: calc(var(--border-radius) - 3px);
    flex-shrink: 0;
}

/* 高亮匹配关键词 */
.suggestion-name mark {
    background: var(--link-color);
    color: var(--active-text-color);
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* 无结果提示 */
.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    cursor: default;
    border-bottom: none !important;
}

.no-results:hover {
    background: transparent !important;
}

/* 响应式 */
@media (max-width: 768px) {
    .search-suggestions {
        max-height: 250px;
    }

    .search-suggestions li {
        padding: 8px 12px;
    }

    .suggestion-name {
        font-size: 12px;
    }

    .suggestion-category {
        font-size: 10px;
        padding: 1px 6px;
    }
}
