/* ==========================================================================
   Search Results & Code Search Page — Engineering Command Console Design
   ========================================================================== */
.search-results-page { padding: 4px 0 40px; }

/* 1. 统一搜索控制台卡片 (Search Command Console) */
.sr-console {
    display: block; background: #ffffff; border: 1px solid #e2e8f0;
    border-radius: 12px; box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    margin-bottom: 18px; overflow: hidden;
}
.sr-console-top {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 0 20px; background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0; flex-wrap: wrap;
}
.sr-mode-tabs { display: flex; align-items: center; gap: 4px; }
.sr-mode-tab {
    display: inline-flex; align-items: center; gap: 7px; padding: 12px 16px;
    font-size: 14px; font-weight: 600; color: #475569; text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}
.sr-mode-tab:hover { color: #165dff; background: rgba(22, 93, 255, 0.04); text-decoration: none; }
.sr-mode-tab.active { color: #165dff; background: #ffffff; border-bottom-color: #165dff; }
.sr-mode-count {
    display: inline-flex; align-items: center; padding: 1px 7px; font-size: 11px;
    font-weight: 700; color: #165dff; background: #eff6ff; border-radius: 999px;
}
.sr-console-stats { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.sr-stat-pill { font-size: 13px; color: #475569; }
.sr-stat-pill strong { color: #165dff; font-weight: 700; }
.sr-latency-pill {
    font-size: 12px; color: #059669; background: #ecfdf5;
    border: 1px solid #a7f3d0; padding: 2px 8px; border-radius: 999px; font-weight: 500;
}

/* 控制台搜索框与热搜词 */
.sr-console-bar { padding: 16px 20px; }
.sr-refine-form { margin: 0 0 12px; }
.sr-input-group {
    display: flex; align-items: center; background: #f8fafc;
    border: 1.5px solid #cbd5e1; border-radius: 9px; padding-left: 12px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.sr-input-group:focus-within {
    background: #ffffff; border-color: #165dff; box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}
.sr-input-icon { color: #64748b; flex-shrink: 0; }
.sr-refine-input {
    flex: 1; min-width: 0; height: 40px; border: none; background: transparent;
    padding: 0 10px; font-size: 14px; color: #0f172a; outline: none;
}
.sr-clear-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; margin-right: 6px; color: #94a3b8;
    font-size: 18px; text-decoration: none; border-radius: 50%;
}
.sr-clear-btn:hover { color: #475569; background: #e2e8f0; text-decoration: none; }
.sr-refine-submit {
    height: 36px; margin: 2px; padding: 0 20px; border: none; border-radius: 7px;
    background: linear-gradient(135deg, #165dff 0%, #2563eb 100%); color: #ffffff;
    font-size: 14px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.sr-refine-submit:hover { opacity: 0.92; }
.sr-hot-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
.sr-hot-label { color: #64748b; font-weight: 600; }
.sr-hot-chip {
    display: inline-flex; align-items: center; padding: 2px 9px; background: #f1f5f9;
    border: 1px solid #e2e8f0; border-radius: 999px; color: #475569; text-decoration: none;
    transition: all 0.15s ease;
}
.sr-hot-chip:hover, .sr-hot-chip.active {
    color: #165dff; background: #eff6ff; border-color: #bfdbfe; text-decoration: none;
}

/* 分类筛选矩阵 */
.sr-console-facets {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 20px;
    background: #f8fafc; border-top: 1px dashed #e2e8f0;
}
.sr-facet-label { font-size: 12.5px; font-weight: 600; color: #64748b; padding-top: 4px; white-space: nowrap; }
.sr-facet-list { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.sr-facet-pill {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
    font-size: 12.5px; color: #334155; background: #ffffff;
    border: 1px solid #e2e8f0; border-radius: 6px; text-decoration: none; transition: all 0.15s ease;
}
.sr-facet-pill:hover { color: #165dff; border-color: #93c5fd; text-decoration: none; }
.sr-facet-pill.active { color: #ffffff; background: #165dff; border-color: #165dff; font-weight: 600; }
.sr-facet-cnt { font-size: 11px; color: #64748b; background: #f1f5f9; padding: 0 5px; border-radius: 999px; }
.sr-facet-pill.active .sr-facet-cnt { color: #165dff; background: #ffffff; }
.sr-facet-toggle {
    padding: 3px 10px; font-size: 12px; color: #165dff; background: #eff6ff;
    border: 1px dashed #93c5fd; border-radius: 6px; cursor: pointer;
}

/* 2. 主体双栏网格与排序工具栏 */
.sr-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.sr-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px; background: #ffffff; border: 1px solid #e2e8f0;
    border-radius: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.sr-sort-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sr-sort-btn {
    display: inline-flex; align-items: center; padding: 5px 12px; font-size: 13px;
    font-weight: 500; color: #475569; background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 6px; text-decoration: none; cursor: pointer; transition: all 0.15s ease;
}
.sr-sort-btn:hover { color: #165dff; border-color: #bfdbfe; text-decoration: none; }
.sr-sort-btn.active { color: #165dff; background: #eff6ff; border-color: #93c5fd; font-weight: 600; }
.sr-toolbar-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #64748b; }
.sr-active-filter {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; color: #1e40af;
}
.sr-filter-reset { color: #dc2626; font-weight: 700; text-decoration: none; }

/* 3. 工程资料结果卡片 (.sr-item) */
.sr-list { display: flex; flex-direction: column; gap: 10px; }
.sr-item {
    display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px;
    background: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.sr-item:hover { border-color: #93c5fd; box-shadow: 0 6px 18px rgba(22, 93, 255, 0.07); }
.sr-item-icon {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 50px; height: 54px; border-radius: 10px; flex-shrink: 0;
    text-decoration: none; border: 1px solid transparent;
}
.sr-item-ext { font-size: 13px; font-weight: 800; line-height: 1.1; letter-spacing: 0.02em; }
.sr-item-kind { font-size: 10px; margin-top: 3px; opacity: 0.85; white-space: nowrap; }
.sr-item-icon.is-pdf  { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.sr-item-icon.is-pcb  { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.sr-item-icon.is-code { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.sr-item-icon.is-doc  { background: #f0f9ff; color: #0284c7; border-color: #bae6fd; }
.sr-item-icon.is-zip  { background: #fffbeb; color: #d97706; border-color: #fde68a; }

.sr-item-body { flex: 1; min-width: 0; }
.sr-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sr-item-title-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.sr-cat-badge {
    display: inline-flex; align-items: center; padding: 2px 8px; font-size: 11.5px;
    font-weight: 600; color: #1d4ed8; background: #eff6ff; border: 1px solid #dbeafe;
    border-radius: 5px; text-decoration: none; white-space: nowrap;
}
.sr-item-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.4; }
.sr-item-title a { color: #0f172a; text-decoration: none; }
.sr-item-title a:hover { color: #165dff; }
.sr-item-title em, .sr-item-desc em {
    font-style: normal; color: #e11d48; background: #fff1f2;
    padding: 0 3px; border-radius: 3px; font-weight: 700;
}
.sr-size-badge {
    font-size: 11.5px; font-weight: 600; color: #475569; background: #f1f5f9;
    padding: 2px 8px; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.sr-item-desc {
    margin: 0 0 10px; font-size: 13.5px; line-height: 1.65; color: #475569;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-wrap: pretty;
}
.sr-item-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sr-item-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 12px; color: #64748b; }
.sr-meta-cell { display: inline-flex; align-items: center; gap: 4px; }
.sr-meta-cell.is-accent { color: #0f172a; font-weight: 600; }
.sr-item-tags { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.sr-tag-chip {
    padding: 1px 7px; font-size: 11.5px; color: #475569; background: #f8fafc;
    border: 1px solid #e2e8f0; border-radius: 4px; text-decoration: none;
}
.sr-tag-chip:hover { color: #165dff; border-color: #93c5fd; text-decoration: none; }
.sr-action-link {
    display: inline-flex; align-items: center; gap: 3px; padding: 4px 11px;
    font-size: 12.5px; font-weight: 600; color: #165dff; background: #eff6ff;
    border-radius: 6px; text-decoration: none; white-space: nowrap;
}
.sr-action-link:hover { background: #165dff; color: #ffffff; text-decoration: none; }

/* 4. IDE 风格源码检索卡片 (.sr-code-card) */
.sr-code-list { display: flex; flex-direction: column; gap: 12px; }
.sr-code-card {
    background: #ffffff; border: 1px solid #cbd5e1; border-radius: 10px;
    overflow: hidden; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}
.sr-code-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap;
}
.sr-code-file { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.sr-lang-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 28px; height: 22px; padding: 0 6px; font-size: 11px;
    font-weight: 800; border-radius: 5px; color: #ffffff; background: #3b82f6;
}
.sr-lang-badge.lang-c   { background: #2563eb; }
.sr-lang-badge.lang-h   { background: #7c3aed; }
.sr-lang-badge.lang-cpp { background: #0284c7; }
.sr-lang-badge.lang-hdl { background: #059669; }
.sr-lang-badge.lang-py  { background: #d97706; }
.sr-lang-badge.lang-asm { background: #dc2626; }
.sr-code-filename {
    margin: 0; font-size: 14.5px; font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.sr-code-filename a { color: #0f172a; text-decoration: none; }
.sr-code-filename a:hover { color: #165dff; }
.sr-code-filename mark, .sr-code-pre mark {
    background: #fef08a; color: #854d0e; padding: 0 3px; border-radius: 3px;
}
.sr-code-pkg {
    font-size: 12px; color: #475569; background: #eef2ff;
    padding: 2px 8px; border-radius: 5px; text-decoration: none;
}
.sr-code-actions { display: flex; align-items: center; gap: 6px; }
.sr-code-btn {
    padding: 4px 10px; font-size: 12px; font-weight: 600; color: #334155;
    background: #ffffff; border: 1px solid #cbd5e1; border-radius: 6px; text-decoration: none;
}
.sr-code-btn.is-primary { color: #ffffff; background: #165dff; border-color: #165dff; }
.sr-code-pre {
    margin: 0; padding: 10px 14px; background: #0f172a; color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px; line-height: 1.6; overflow-x: auto;
}
.sr-code-line { display: block; white-space: pre; }
.sr-ln { display: inline-block; width: 24px; color: #64748b; user-select: none; margin-right: 10px; text-align: right; }

/* 5. 右侧边栏与零结果引导卡 */
.sr-sidebar { display: flex; flex-direction: column; gap: 14px; }
.sr-side-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 15px 16px; }
.sr-side-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #f1f5f9;
}
.sr-side-title { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: #0f172a; }
.sr-side-badge { font-size: 10.5px; font-weight: 700; color: #165dff; background: #eff6ff; padding: 1px 6px; border-radius: 4px; }
.sr-side-more { font-size: 12px; color: #64748b; text-decoration: none; }
.sr-tips-list { margin: 0; padding-left: 16px; font-size: 12.5px; line-height: 1.65; color: #475569; }
.sr-tips-list li + li { margin-top: 8px; }
.sr-tips-list code { font-size: 11.5px; color: #1e40af; background: #eff6ff; padding: 1px 4px; border-radius: 3px; }
.sr-rank-list { display: flex; flex-direction: column; gap: 8px; }
.sr-rank-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px;
    border-radius: 6px; background: #f8fafc; text-decoration: none; color: #334155; font-size: 12.5px;
}
.sr-rank-item:hover { background: #eff6ff; color: #165dff; text-decoration: none; }
.sr-rank-num {
    width: 18px; height: 18px; border-radius: 4px; background: #e2e8f0; color: #475569;
    font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sr-rank-num.is-top { background: #165dff; color: #ffffff; }
.sr-rank-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-rank-tag {
    font-size: 11px; color: #64748b; background: #ffffff; border: 1px solid #e2e8f0;
    padding: 0 5px; border-radius: 4px; flex-shrink: 0;
}
.sr-channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.sr-channel-box {
    display: flex; flex-direction: column; padding: 8px 10px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 7px; text-decoration: none;
}
.sr-channel-box strong { font-size: 12.5px; color: #0f172a; }
.sr-channel-box span { font-size: 11px; color: #64748b; margin-top: 2px; }
.sr-tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.sr-cloud-tag {
    padding: 3px 9px; font-size: 12px; color: #475569; background: #f8fafc;
    border: 1px solid #e2e8f0; border-radius: 999px; text-decoration: none;
}
.sr-cloud-tag:hover { color: #165dff; border-color: #93c5fd; background: #eff6ff; text-decoration: none; }
.sr-wish-cta {
    margin-top: 12px; padding: 12px; background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #bfdbfe; border-radius: 8px; display: flex; flex-direction: column; gap: 8px;
}
.sr-wish-text strong { display: block; font-size: 12.5px; color: #1e3a8a; }
.sr-wish-text span { font-size: 11.5px; color: #475569; }
.sr-wish-btn {
    align-self: flex-start; padding: 4px 12px; font-size: 12px; font-weight: 600;
    color: #ffffff; background: #165dff; border-radius: 6px; text-decoration: none;
}
.sr-empty-card {
    background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 40px 24px; text-align: center;
}
.sr-empty-icon { color: #94a3b8; margin-bottom: 10px; }
.sr-empty-title { margin: 0 0 8px; font-size: 18px; color: #0f172a; }
.sr-empty-desc { margin: 0 auto 18px; max-width: 560px; font-size: 13.5px; color: #64748b; }
.sr-empty-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.sr-btn-primary { padding: 8px 18px; background: #165dff; color: #fff; border-radius: 7px; font-size: 13.5px; font-weight: 600; text-decoration: none; }
.sr-btn-outline { padding: 8px 16px; background: #f8fafc; color: #334155; border: 1px solid #cbd5e1; border-radius: 7px; font-size: 13.5px; text-decoration: none; }
.sr-empty-suggest { font-size: 12.5px; color: #64748b; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

@media (max-width: 992px) { .sr-layout { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
    .sr-item { flex-direction: column; }
    .sr-code-head { flex-direction: column; align-items: flex-start; }
}
