/* Root */
.ahs {
  width: 100%;
  position: relative;
}

/* Overlay backdrop */
.ahs .ahs-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 999;
}

.ahs .ahs-overlay-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Search container */
.ahs .ahs-container {
  display: flex;
  gap: 10px;
  position: sticky;
  right: 0;
  top: 0;
  z-index: 1001;
  justify-content: flex-end;
}

/* Search panel (takes up real space in document flow) */
.ahs .ahs-panel {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 0;
  max-width: 0;
  max-height: 80vh;
  overflow: hidden;
  opacity: 0;
  transform: translateX(20px);
  transition: max-width 0.3s ease, opacity 0.3s ease, padding 0.3s ease, transform 0.3s ease;
}

.ahs .ahs-container-open .ahs-panel {
  max-width: 100%;
  width: 500px;
  padding: 5px;
  opacity: 1;
  transform: translateX(0);
  overflow-y: auto;
}

/* Search trigger icon */
.ahs .ahs-trigger {
  background: none;
  border: none;
  padding: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: color 0.2s ease;
  flex-shrink: 0;
  background-color: #00cdff;
  border-radius: 0;
}

.ahs .ahs-trigger:hover {
  background-color: #ff4b93;
}

.ahs-trigger.ahs-trigger-active {
  background-color: #00cdff;
}

.ahs .ahs-trigger svg {
  width: 30px;
  height: 30px;
}

/* Search bar */
.ahs .ahs-bar {
  display: flex;
  gap: 10px;
  align-items: stretch;
  height:100%;
}

.ahs .ahs-input {
  flex: 1;
  padding: 0;
  border: 0;
  font-size: 14px;
  width: 100%;
}

.ahs .ahs-input:focus {
  outline: none;
  border-color: #666;
}

.ahs-search-input {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  padding: 10px;
  position: relative;

  transition: width 300ms ease;
  overflow: hidden;
}

.ahs-search-input input {
  display: none;
}

.ahs .ahs-bar>.ahs-search-input {
  min-width: 0;
}

.ahs-search-input .trigger-ai-search {
  display: none;
}

.ahs .ahs-search-input.ahs-search-input-active {
  width: 100%;
  flex: 1 1 auto;
}

.ahs-search-input-active input {
  display: flex;
}

.ahs-search-input-active .trigger-ai-search {
  display: block;
  animation: beatPause 3.4s ease-in-out infinite;
}

@keyframes beatPause {
  0%   { transform: scale(1); }
  8%   { transform: scale(1.16); }  /* beat */
  16%  { transform: scale(1); }     /* settle */
  100% { transform: scale(1); }     /* pause */
}

.ahs-search-input-active .trigger-ai-search:hover{
  animation:none;
} 

.ahs-search-input-active .show-ai-input {
  display: none;
}

.show-ai-input {
  padding: 0;
  border: 0;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.ahs .ahs-search-input-instant {
  border: solid 1px #00cdff;
  width: 44px;
  /* numeric collapsed width */
  min-width: 44px;
  /* keep your safety */
  flex: 0 0 auto;
}

.ahs .ahs-search-input-ai {
  border: solid 1px #ff4b93;
  width: 80px;
  /* numeric collapsed width */
  min-width: 80px;
  /* keep your safety */
  flex: 0 0 auto;
}

.ahs .ahs-search-input-instant .trigger-instant-search {
  color: #00cdff;
}

.ahs .ahs-search-input-instant:not(.ahs-search-input-active) .trigger-instant-search {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ahs .ahs-search-input-instant:not(.ahs-search-input-active) .trigger-instant-search:hover {
  background-color: #00cdff;
  color: #fff;
}

.ahs .trigger-instant-search:hover {
  color: #323e48;
}

/* Title */
.ahs .ahs-title {
  font-weight: 600;
  margin-bottom: 8px;
}

/* Results */
.ahs .ahs-results {
  margin-top: 12px;
  display: block;
}

.ahs .ahs-results>br {
  display: none;
}

.ahs .ahs-results.ahs-results-ai .ahs-hit:first-of-type {
  margin-top: 10px;
}

/* Single hit */
.ahs .ahs-hit {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid #eee;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  margin-bottom: 5px;
}

.ahs .ahs-hit:hover {
  border-color: #ddd;
  background: #fafafa;
}

/* Thumbnail */
.ahs .ahs-hit-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  flex: 0 0 auto;
}

.ahs .ahs-hit-thumb.ph {
  background: #f2f2f2;
}

/* Hit body */
.ahs .ahs-hit-body {
  min-width: 0;
}

.ahs .ahs-hit-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ahs .ahs-hit-meta,
.ahs-hit-url {
  font-size: 12px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ask AI */
.ahs .ahs-ai {
  margin-top: 12px;
  display: none;
}

.ahs .ahs-ai-label {
  font-weight: 600;
  margin-bottom: 6px;
}

.ahs .ahs-ai-output {
  white-space: pre-wrap;
  border: 1px solid #e5e5e5;
  padding: 10px;
  min-height: 60px;
  font-size: 14px;
}

/* AI Results Container */
.ahs .ahs-ai-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* AI Result Item */
.ahs .ahs-ai-result-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid #eee;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.ahs .ahs-ai-result-item:hover {
  border-color: #ddd;
  background: #fafafa;
  text-decoration: none;
}

/* AI Result Thumbnail */
.ahs .ahs-ai-result-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  flex: 0 0 auto;
}

/* AI Result Content */
.ahs .ahs-ai-result-content {
  flex: 1;
  min-width: 0;
}

.ahs .ahs-ai-result-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  color: #333;
  line-height: 1.4;
}

.ahs .ahs-ai-result-excerpt {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  margin-top: 4px;
}