/* ========================================
   Sidebar Search - 侧边栏搜索样式
   ======================================== */

/* 搜索卡片 */
.sidebar-search-card .item-content {
  padding: 0 16px 16px;
}

/* 搜索输入框容器 */
.sidebar-search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--search-bg, var(--card-bg));
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.06));
  border-radius: 8px;
  padding: 0 4px 0 12px;
  transition: all 0.3s ease;
  height: 36px;
}

[data-theme="dark"] .sidebar-search-input-wrap {
  border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-search-input-wrap:focus-within {
  border-color: var(--sidebar-search-accent, #49b1f5);
  box-shadow: 0 0 0 2px rgba(73, 177, 245, 0.15);
}

/* 搜索输入框 */
.sidebar-search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--font-color, #1a1a1a);
  padding: 0 8px;
  height: 100%;
  font-family: inherit;
}

[data-theme="dark"] .sidebar-search-input-wrap input {
  color: var(--font-color, #ddd);
}

.sidebar-search-input-wrap input::placeholder {
  color: var(--search-placeholder, var(--font-color-secondary, #999));
  font-size: 13px;
}

/* 去掉浏览器默认的 search 输入框样式 */
.sidebar-search-input-wrap input::-webkit-search-decoration,
.sidebar-search-input-wrap input::-webkit-search-cancel-button,
.sidebar-search-input-wrap input::-webkit-search-results-button,
.sidebar-search-input-wrap input::-webkit-search-results-decoration {
  display: none;
}

/* 搜索按钮 */
.sidebar-search-input-wrap button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--sidebar-search-accent, #49b1f5);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s ease;
  font-size: 12px;
}

.sidebar-search-input-wrap button:hover {
  background: var(--sidebar-search-accent-hover, #3399dd);
  transform: scale(1.05);
}

.sidebar-search-input-wrap button:active {
  transform: scale(0.95);
}

/* 搜索结果区域 */
.sidebar-search-results {
  display: none;
  margin-top: 10px;
  max-height: 400px;
  overflow-y: auto;
  border-radius: 8px;
  background: var(--search-bg, var(--card-bg));
}

/* 自定义滚动条 */
.sidebar-search-results::-webkit-scrollbar {
  width: 4px;
}

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

.sidebar-search-results::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

[data-theme="dark"] .sidebar-search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

/* 空结果提示 */
.sidebar-search-empty {
  text-align: center;
  padding: 20px 10px;
  color: var(--font-color-secondary, #999);
  font-size: 13px;
}

/* 搜索结果条目 */
.sidebar-search-item {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none !important;
  transition: background 0.2s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .sidebar-search-item {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.sidebar-search-item:last-child {
  border-bottom: none;
}

.sidebar-search-item:hover {
  background: rgba(73, 177, 245, 0.08);
}

[data-theme="dark"] .sidebar-search-item:hover {
  background: rgba(73, 177, 245, 0.12);
}

/* 文章标题 */
.sidebar-search-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--font-color, #333);
  line-height: 1.4;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .sidebar-search-item-title {
  color: var(--font-color, #e0e0e0);
}

/* 摘要 */
.sidebar-search-item-excerpt {
  font-size: 12px;
  color: var(--font-color-secondary, #888);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[data-theme="dark"] .sidebar-search-item-excerpt {
  color: var(--font-color-secondary, #aaa);
}

/* 高亮匹配文本 */
.sidebar-search-item mark,
.sidebar-search-empty mark {
  background: rgba(255, 213, 0, 0.35);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
  font-style: normal;
}

[data-theme="dark"] .sidebar-search-item mark,
[data-theme="dark"] .sidebar-search-empty mark {
  background: rgba(255, 213, 0, 0.25);
}
