.search-container {
  width: 100%;
  position: relative;
}

.search-wrapper {
  background: white;
  border-radius: 6px;
  border: 2px solid #000;
  display: flex;
  align-items: center;
  padding: 5px;
  transition: all 0.2s ease;
  position: relative;
  z-index: 10;
  height: 2.9rem;
  min-height: 2.9rem;
}

.search-wrapper.dropdown-open {
  border-radius: 5px 5px 0 0;
  border-bottom-color: transparent;
  /* box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28); */
  box-shadow: none;
}

.search-wrapper.ai-mode {
  position: relative;
  border: 2px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(90deg, #0078d4, #5b5fc7, #b146c2) border-box;

  box-shadow:
    0 0 0 3px rgba(91, 95, 199, 0.12),
    0 6px 18px rgba(0, 120, 212, 0.14);
}

.search-input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 16px;
  background: transparent;
  resize: none;

  height: 2.3rem;
  min-height: 2.3rem;
  max-height: 2.3rem;

  line-height: 2.3rem;
  padding: 0;

  overflow: hidden;
  font-family: Arial, sans-serif;
}

.search-input::placeholder {
  color: #666;
  opacity: 1;
}

.search-input:focus {
  outline: none;
  box-shadow: none;
}

.btn-ai-toggle {
  height: 2.2rem;
  min-height: 2.2rem;
  padding: 0 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-ai-toggle:hover {
  background: #f8f9fa;
}

.btn-ai-toggle.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(90deg, #0078d4, #5b5fc7, #b146c2);
  box-shadow: 0 3px 10px rgba(91, 95, 199, 0.25);
}
.btn-ai-toggle.active .ai-icon {
  color: white;
  margin-right: 5px;
}

.logo {
  text-align: center;
  margin-bottom: 30px;
}

.logo h1 {
  font-size: 48px;
  font-weight: 400;
  color: #333;
  margin: 0;
}

.logo .ai-badge {
  display: inline-block;
  background: black;
  color: white;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-left: 5px;
  vertical-align: middle;
}

.logo .ai-badge.hidden {
  display: none;
}

.mode-indicator {
  text-align: center;
  margin-top: 15px;
  font-size: 14px;
  color: #666;
}

.mode-indicator.ai-active {
  color: black;
}

.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: -2px;
  right: -2px;
  background: white;
  border: 2px solid #000;
  border-top: none;
  border-radius: 0 0 5px 5px;
  box-shadow: 0 4px 12px rgba(32, 33, 36, 0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 20;
  display: none;
  padding: 8px 0;
  margin-top: 0;
}

.suggestions-dropdown.active {
  display: block;
}

.suggestion-item {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  display: flex;
  align-items: center;
  transition: background 0.15s;
}

.suggestion-item:hover,
.suggestion-item.selected {
  background: #f1f3f4;
}

.suggestion-item .suggest-icon {
  color: #9aa0a6;
  margin-right: 12px;
  font-size: 14px;
}

.suggestion-item .suggest-text {
  flex: 1;
}

.suggestion-item .suggest-highlight {
  font-weight: 600;
}

@media (max-width: 480px) {
  .search-wrapper {
    flex-wrap: nowrap;
    min-height: 2.9rem;
    padding: 4px 10px;
  }

  .search-input {
    height: 2.3rem;
    min-height: 2.3rem;
    max-height: 6rem;
    line-height: 1.15rem;
    padding: 0.55rem 0;
    flex: 1;
  }

  .btn-ai-toggle {
    height: 2rem;
    padding: 0 10px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .search-icon-left {
    margin-left: 0;
    margin-right: 6px;
    height: 2.9rem;
  }
}

.btn-ai-toggle {
  border-radius: 5px;
}

.search-wrapper.ai-mode.dropdown-open {
  border-color: black;
  border-bottom-color: transparent;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15);
}

.search-wrapper.ai-mode .suggestions-dropdown {
  border-color: black;
}

.btn-clear-search {
  border: none;
  background: transparent;
  color: #9aa0a6;
  height: 2.9rem;
  width: 2.2rem;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-clear-search:hover {
  color: #333;
}

.search-icon-left {
  width: 2rem;
  min-width: 2rem;
  height: 2.3rem;
  line-height: 2.3rem;
  margin: 0 6px 0 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 16px;
  text-align: center;
  color: #333;
}

.search-icon-left.fa-spinner {
  width: 2rem;
  min-width: 2rem;
  height: 2.3rem;
  line-height: 2.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
}

.search-icon-left.fa-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-clear-search {
  height: 2.3rem;
  width: 2.2rem;
}

.search-icon-left.loading {
  color: black;
}

/* results */
.search-results-section {
  margin-top: 28px;
  width: 100%;
}

.search-results-summary {
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 14px;
  margin-bottom: 10px;
}

.search-results-query {
  font-size: 20px;
  font-weight: 400;
  color: #111827;
  margin-bottom: 6px;
}

.search-results-count {
  font-size: 14px;
  color: #6b7280;
}

.search-results-list {
  display: flex;
  flex-direction: column;
}

.search-result-item {
  display: block;
  padding: 18px 0;
  border-bottom: 1px solid #e5e7eb;
  text-decoration: none;
  color: inherit;
}

.search-result-item:hover {
  text-decoration: none;
}

.search-result-title {
  font-size: 18px;
  font-weight: 600;
  color: #004b8d;
  margin-bottom: 6px;
}

.search-result-item:hover .search-result-title {
  text-decoration: underline;
}
.search-results-highlight {
  background: #fef3c7;
  padding: 1px 1px 1px 1px;
  border-radius: 5px;
}

.search-result-description {
  font-size: 15px;
  line-height: 1.45;
  color: #374151;
  max-width: 850px;
}

.search-results-actions {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

.btn-show-more-results {
  border: 2px solid #000;
  background: #fff;
  color: #000;
  border-radius: 5px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-show-more-results:hover {
  background: #000;
  color: #fff;
}

.search-results-actions {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.search-results-progress {
  font-size: 14px;
  color: #6b7280;
}

/**/
.search-no-results {
  padding: 32px 0;
  max-width: 800px;
}

.search-no-results-title {
  font-size: 22px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 24px;
}

.search-no-results-tips h4 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.search-no-results-tips ul {
  margin: 0;
  padding-left: 22px;
}

.search-no-results-tips li {
  margin-bottom: 8px;
  font-size: 15px;
  color: #374151;
}

.search-no-results-help {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
  font-size: 15px;
  line-height: 1.6;
  color: #374151;
}

/**ai summary**/
.ai-summary-section {
  margin: 20px 0 24px;
}

.ai-summary-card {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(90deg, #0078d4, #5b5fc7, #b146c2) border-box;
  border: 2px solid transparent;
  box-shadow: 0 4px 14px rgba(0, 120, 212, 0.10);
  padding: 20px;
  max-width: 900px;
}

.ai-summary-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ai-summary-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(90deg, #0078d4, #5b5fc7, #b146c2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-summary-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.ai-summary-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}

.ai-summary-content {
  font-size: 15px;
  line-height: 1.6;
  color: #1f2937;
}

.ai-summary-content p {
  margin: 0 0 12px;
}

.ai-citations {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.ai-citations-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
}

.ai-citation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #004b8d;
  text-decoration: none;
  font-size: 14px;
  padding: 6px 0;
}

.ai-citation-item:hover {
  text-decoration: underline;
}

.ai-citation-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-summary-disclaimer {
  margin-top: 16px;
  font-size: 12px;
  color: #6b7280;
}

.ai-summary-loading {
  margin-top: 18px;
}

.ai-loading-line {
  height: 14px;
  background: linear-gradient(90deg, #f3f4f6, #e5e7eb, #f3f4f6);
  border-radius: 20px;
  margin-bottom: 10px;
  animation: aiLoadingPulse 1.2s ease-in-out infinite;
}

.ai-loading-line-large {
  width: 92%;
}

.ai-loading-line {
  width: 78%;
}

.ai-loading-line-short {
  width: 55%;
}

.ai-loading-icon {
  animation: aiIconPulse 1.4s ease-in-out infinite;
}

@keyframes aiLoadingPulse {
  0% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.45;
  }
}

@keyframes aiIconPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(91, 95, 199, 0.35);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(91, 95, 199, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(91, 95, 199, 0);
  }
}
.ai-inline-citation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin: 0 2px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  vertical-align: baseline;
}

.ai-inline-citation:hover {
  background: #dbeafe;
  color: #1d4ed8;
  text-decoration: none;
}