/* 搜索框样式 */
.search-box {
  position: relative;
}

.search-box .input-group {
  position: relative;
  z-index: 1000;
}

/* 搜索结果容器 */
.search-results-container {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 0.375rem 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1001;
}

/* 搜索结果头部 */
.search-results-header {
  padding: 0.75rem 1rem;
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  font-size: 0.875rem;
}

/* 搜索结果列表 */
.search-results-list {
  padding: 0.5rem 0;
}

/* 搜索结果项 */
.search-result-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #f8f9fa;
  transition: background-color 0.15s ease-in-out;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
  background-color: #e9ecef;
}

.search-result-item:focus {
  outline: 2px solid #0d6efd;
  outline-offset: -2px;
}

/* 搜索结果标题 */
.search-result-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #212529;
}

.search-result-title mark {
  background-color: #fff3cd;
  color: #856404;
  padding: 0.1em 0.2em;
  border-radius: 0.2em;
}

/* 搜索结果描述 */
.search-result-description {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

/* 搜索结果预览 */
.search-result-preview {
  line-height: 1.4;
}

.search-result-preview mark {
  background-color: #fff3cd;
  color: #856404;
  padding: 0.1em 0.2em;
  border-radius: 0.2em;
  font-weight: 600;
}

/* 无结果提示 */
.search-no-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 0.375rem 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  z-index: 1001;
}

/* 移动端适配 */
@media (max-width: 991.98px) {
  .search-results-container,
  .search-no-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 60vh;
    border-radius: 0 0 0.375rem 0.375rem;
    border-top: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  .search-results-container,
  .search-no-results {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }
  
  .search-results-header {
    background-color: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
  }
  
  .search-result-item:hover,
  .search-result-item.selected {
    background-color: #4a5568;
  }
  
  .search-result-title {
    color: #e2e8f0;
  }
  
  .search-result-title mark {
    background-color: #d69e2e;
    color: #1a202c;
  }
  
  .search-result-description,
  .search-result-preview {
    color: #cbd5e0;
  }
  
  .search-result-preview mark {
    background-color: #d69e2e;
    color: #1a202c;
  }
}

/* 加载状态 */
.search-loading {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #0d6efd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
