/* ai-chat-search.css — Search Chats Modal */

/* ========================
   Layout overrides
   ======================== */
.search-modal-content {
  max-width: 560px;
  width: 92%;
  display: flex;
  flex-direction: column;
  max-height: min(520px, 80vh);
  overflow: hidden;
}

/* ========================
   Header (search input)
   ======================== */
.search-modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.search-modal-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: calc(8px * var(--corner-k));
  padding: 0 12px;
  height: 40px;
}

.search-modal-icon {
  flex-shrink: 0;
  width: var(--icon-size);
  height: var(--icon-size);
  color: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-modal-icon svg {
  width: var(--icon-size);
  height: var(--icon-size);
}

.search-modal-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;               /* 与 .chat-input 同基准(字号阶梯,原 15px 孤值) */
  color: #1a1a1a;
  outline: none;
  height: 100%;
}
.search-modal-input::placeholder {
  color: rgba(0, 0, 0, 0.35);
}

/* ========================
   Results area
   ======================== */
.search-modal-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 120px;
}

/* Empty / hint state */
.search-modal-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: rgba(0, 0, 0, 0.35);
  text-align: center;
}
/* The empty state's magnifier is an illustration with a size of its own: 32px, so its drawing (now on the icon
   keyline) reads at the size it had before (owner 2026-09-15: at 36 it read too big). */
.search-modal-empty-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  opacity: var(--dim);
}
.search-modal-empty-icon svg {
  width: 32px;
  height: 32px;
}
.search-modal-empty p {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

/* ========================
   Result item
   ======================== */
.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: calc(8px * var(--corner-k));
  cursor: pointer;
  transition: background 0.12s;
}
/* ★.active 是【状态】(键盘选中的那一条),不能跟 :hover 共用那道触屏门 —— 一起挂上去,
   触屏上选中的那条就不高亮了(同 Studio 那盏在线灯踩过的坑)。hover 留在门里,状态搬出来。 */
.search-result-item.active{
  background: rgba(0, 0, 0, 0.05);
}
html:not([data-input="touch"]) .search-result-item:hover{
  background: rgba(0, 0, 0, 0.05);
}

.search-result-icon {
  flex-shrink: 0;
  width: var(--icon-size);
  height: var(--icon-size);
  color: rgba(0, 0, 0, 0.3);
  margin-top: 2px;
}
.search-result-icon svg {
  width: var(--icon-size);
  height: var(--icon-size);
}

.search-result-body {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 2px;
}

.search-result-snippet {
  font-size: 13px;
  color: rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.search-result-date {
  flex-shrink: 0;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.35);
  margin-top: 2px;
}

/* Highlight matched text */
.search-highlight {
  background: rgba(255, 200, 0, 0.35);
  border-radius: 2px;
  padding: 0 1px;
}

/* No results state */
.search-no-results {
  text-align: center;
  padding: 40px 20px;
  color: rgba(0, 0, 0, 0.4);
  font-size: 14px;
}

/* ========================
   Mobile adjustments
   ======================== */
@media (max-width: 768px), (max-height: 500px) {
  .search-modal-content {
    width: 96%;
    max-height: 85vh;
  }
}

/* =========================
   Dark mode
   ========================= */
.dark-mode .search-modal-content { background: #212121; }
.dark-mode .search-modal-header { border-bottom-color: var(--color-border); }
.dark-mode .search-modal-input-wrap { background: rgba(255,255,255,0.06); }
.dark-mode .search-modal-icon { color: rgba(255,255,255,0.35); }
.dark-mode .search-modal-input { color: rgba(255,255,255,0.9); }
.dark-mode .search-modal-input::placeholder { color: rgba(255,255,255,0.35); }
.dark-mode .search-modal-empty { color: rgba(255,255,255,0.35); }
html:not([data-input="touch"]) .dark-mode .search-result-item:hover,
html:not([data-input="touch"]) .dark-mode .search-result-item.active{ background: rgba(255,255,255,0.06); }
.dark-mode .search-result-icon { color: rgba(255,255,255,0.3); }
.dark-mode .search-result-title { color: rgba(255,255,255,0.9); }
.dark-mode .search-result-snippet { color: rgba(255,255,255,0.5); }
.dark-mode .search-result-date { color: rgba(255,255,255,0.35); }
.dark-mode .search-highlight { background: rgba(255,200,0,0.25); }
.dark-mode .search-no-results { color: rgba(255,255,255,0.4); }
