/**
 * css/search/suggest.css
 *
 * Suggest 下拉面板样式。
 * 与 .search-bar form 配合，绝对定位到搜索框正下方。
 */

/* ── 面板容器 ─────────────────────────────────────────────────── */
.suggest-panel {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
  overflow: hidden;
  /* 动画 */
  animation: suggest-fadein 0.12s ease;
}

@keyframes suggest-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* 确保 .site-header__inner / .search-bar 父级 position:relative 生效 */
.search-bar {
  position: relative;
  overflow: visible;          /* 允许 suggest-panel 溢出搜索框 */
}

/* ── 单条 item ────────────────────────────────────────────────── */
.suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-subtle, #f0f0f0);
  transition: background 0.08s;
  user-select: none;
}

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

.suggest-item:hover,
.suggest-item.is-active {
  background: var(--color-surface-hover, #f5f5f5);
}

/* 深色模式 */
[data-theme="dark"] .suggest-panel {
  background: var(--color-surface, #1e1e2e);
  border-color: var(--color-border, #3a3a4a);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .suggest-item {
  border-color: var(--color-border-subtle, #2a2a3a);
}
[data-theme="dark"] .suggest-item:hover,
[data-theme="dark"] .suggest-item.is-active {
  background: var(--color-surface-hover, #2a2a3a);
}

/* ── item 左侧：徽章 + 文本 ──────────────────────────────────── */
.suggest-item__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

/* 类型徽章 */
.suggest-item__badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.4;
  min-width: 22px;
}

/* 字 */
.suggest-item__badge--char {
  background: #e8f4fd;
  color: #1a6fa8;
}
/* 词 */
.suggest-item__badge--word {
  background: #e8f5e9;
  color: #2e7d32;
}
/* 成语 */
.suggest-item__badge--chengyu,
.suggest-item__badge--idiom {
  background: #fff3e0;
  color: #e65100;
}

[data-theme="dark"] .suggest-item__badge--char    { background: #1a3a52; color: #7ec8f0; }
[data-theme="dark"] .suggest-item__badge--word    { background: #1a3a1e; color: #7ec87e; }
[data-theme="dark"] .suggest-item__badge--chengyu,
[data-theme="dark"] .suggest-item__badge--idiom   { background: #3a2400; color: #ffa040; }

[data-theme="dark"] .suggest-item__title {
  color: var(--color-text, #e0d8cc);
}

/* 主文本 */
.suggest-item__title {
  font-size: 15px;
  color: var(--color-text, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggest-item__title mark {
  background: transparent;
  color: var(--color-primary, #d97706);
  font-weight: 700;
}

/* 副文本（拼音） */
.suggest-item__subtitle {
  font-size: 12px;
  color: var(--color-text-muted, #9ca3af);
  white-space: nowrap;
  flex-shrink: 0;
}

/* 跳转箭头 */
.suggest-item__arrow {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--color-text-muted, #9ca3af);
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.1s;
}

.suggest-item:hover .suggest-item__arrow,
.suggest-item.is-active .suggest-item__arrow {
  opacity: 1;
}
