/* 健康知识库新搜索样式 - 参考第二张图 */

/* 搜索区域 */
.kb-search-section-new {
  margin-bottom: 16px;
}

/* 搜索栏 */
.kb-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.kb-search-bar__input-wrapper {
  flex: 1;
  position: relative;
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 12px 12px 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  min-height: 52px;
}

.kb-search-bar__input-wrapper:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(24,144,255,0.15);
}

.kb-search-bar__input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--color-text);
  outline: none;
  min-width: 0;
  padding: 0;
}

.kb-search-bar__input::placeholder {
  color: transparent;
}

/* 占位符文字滚动区域 */
.kb-placeholder-scroll {
  position: absolute;
  left: 16px;
  right: 52px;
  top: 50%;
  transform: translateY(-50%);
  overflow: hidden;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
  height: 20px;
  display: flex;
  align-items: center;
}

.kb-search-bar__input-wrapper:focus-within .kb-placeholder-scroll {
  opacity: 0;
  pointer-events: none;
}

.kb-search-bar__input:not(:placeholder-shown) ~ .kb-placeholder-scroll,
.kb-search-bar__input:focus ~ .kb-placeholder-scroll {
  opacity: 0;
}

.kb-placeholder-scroll__content {
  display: flex;
  flex-direction: column;
  gap: 0;
  animation: scrollPlaceholderVertical 36s linear infinite;
  will-change: transform;
}

.kb-placeholder-scroll__content:hover {
  animation-play-state: paused;
}

@keyframes scrollPlaceholderVertical {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-50%);
  }
}

.kb-placeholder-item {
  display: flex;
  align-items: center;
  height: 20px;
  font-size: 15px;
  color: var(--color-text-muted);
  opacity: 0.6;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* 搜索按钮 */
.kb-search-bar__search-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(24,144,255,0.25);
  flex-shrink: 0;
}

.kb-search-bar__search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24,144,255,0.35);
  background: rgba(24,144,255,0.9);
}

.kb-search-bar__search-btn:active {
  transform: translateY(0);
}

.kb-search-bar__search-btn svg {
  width: 18px;
  height: 18px;
}

/* 过滤/急救按钮 */
.kb-search-bar__filter-btn {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(24,144,255,0.25);
  flex-shrink: 0;
}

.kb-search-bar__filter-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(24,144,255,0.35);
}

.kb-search-bar__filter-btn:active {
  transform: translateY(0);
}

.kb-search-bar__filter-btn svg {
  width: 20px;
  height: 20px;
}

/* 搜索建议 */
.kb-search-suggest {
  margin-top: 8px;
  display: none;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  animation: fadeInDown 0.3s ease;
}

.kb-search-suggest:not(:empty) {
  display: flex;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 知识分类区域 */
.kb-categories-section {
  margin-bottom: 16px;
}

.kb-categories-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0 12px 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.kb-categories-scroll::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.kb-category-btn {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-radius: 16px;
  border: none;
  background: var(--color-bg-elev);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.kb-category-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.kb-category-btn:active {
  transform: translateY(-2px);
}

.kb-category-btn__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 24px;
  transition: all 0.2s ease;
}

.kb-category-btn__icon--red {
  background: linear-gradient(135deg, rgba(255,77,79,0.2) 0%, rgba(255,77,79,0.1) 100%);
}

.kb-category-btn__icon--green {
  background: linear-gradient(135deg, rgba(82,196,26,0.2) 0%, rgba(82,196,26,0.1) 100%);
}

.kb-category-btn__icon--purple {
  background: linear-gradient(135deg, rgba(114,46,209,0.2) 0%, rgba(114,46,209,0.1) 100%);
}

.kb-category-btn__icon--blue {
  background: linear-gradient(135deg, rgba(24,144,255,0.2) 0%, rgba(24,144,255,0.1) 100%);
}

.kb-category-btn__icon--orange {
  background: linear-gradient(135deg, rgba(250,173,20,0.2) 0%, rgba(250,173,20,0.1) 100%);
}

.kb-category-btn__icon--pink {
  background: linear-gradient(135deg, rgba(255,107,129,0.2) 0%, rgba(255,107,129,0.1) 100%);
}

.kb-category-btn__text {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
}

.kb-category-btn:hover .kb-category-btn__icon {
  transform: scale(1.1);
}

/* 移动端优化 */
@media (max-width: 767px) {
  .kb-search-bar {
    gap: 8px;
  }

  .kb-search-bar__input-wrapper {
    padding: 10px 14px;
    min-height: 48px;
  }

  .kb-search-bar__icon {
    font-size: 18px;
  }

  .kb-search-bar__input {
    font-size: 14px;
  }

  .kb-placeholder-scroll {
    left: 14px;
    right: 48px;
    height: 18px;
  }
  
  .kb-search-bar__search-btn {
    width: 36px;
    height: 36px;
  }
  
  .kb-search-bar__search-btn svg {
    width: 16px;
    height: 16px;
  }

  .kb-placeholder-item {
    font-size: 14px;
    height: 18px;
  }

  .kb-search-bar__filter-btn {
    width: 48px;
    height: 48px;
  }

  .kb-search-bar__filter-btn svg {
    width: 18px;
    height: 18px;
  }

  .kb-categories-scroll {
    gap: 10px;
  }

  .kb-category-btn {
    padding: 14px 16px;
    min-width: 90px;
  }

  .kb-category-btn__icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .kb-category-btn__text {
    font-size: 12px;
  }
}

/* 深色模式适配 */
[data-theme="dark"] .kb-search-bar__input-wrapper {
  background: var(--color-bg-elev);
  border-color: var(--color-border);
}

[data-theme="dark"] .kb-search-bar__input-wrapper:focus-within {
  box-shadow: 0 4px 16px rgba(24,144,255,0.25);
}

[data-theme="dark"] .kb-category-btn {
  background: var(--color-bg-elev);
}

[data-theme="dark"] .kb-category-btn:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

