/* Search-First Navigation - Smart Search Suggestions */

/* Enhanced Search Input */
.md-search__input {
  background: var(--md-default-bg-color);
  border: 2px solid var(--md-accent-fg-color--transparent);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.md-search__input:focus {
  border-color: var(--md-accent-fg-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  outline: none;
}

.md-search__input::placeholder {
  color: var(--md-default-fg-color--light);
}

/* Search Suggestions Dropdown */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 0.5rem;
  display: none;
}

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

.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: var(--md-default-fg-color);
}

.search-suggestion-item:hover {
  background: var(--md-accent-fg-color--transparent);
  transform: translateX(4px);
}

.search-suggestion-item:last-child {
  border-bottom: none;
}

.search-suggestion-icon {
  width: 32px;
  height: 32px;
  background: var(--md-accent-fg-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-accent-bg-color);
  font-size: 1rem;
  flex-shrink: 0;
}

.search-suggestion-content {
  flex: 1;
}

.search-suggestion-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--md-default-fg-color);
}

.search-suggestion-description {
  font-size: 0.8rem;
  color: var(--md-default-fg-color--light);
  line-height: 1.4;
}

.search-suggestion-meta {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.search-suggestion-tag {
  background: var(--md-accent-fg-color--transparent);
  color: var(--md-accent-fg-color);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Search Categories */
.search-category {
  padding: 0.5rem 1rem;
  background: var(--md-default-bg-color--light);
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  font-weight: 700;
  color: var(--md-accent-fg-color);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Search Results Enhancement */
.md-search-result {
  border-left: 3px solid var(--md-accent-fg-color--transparent);
  transition: all 0.2s ease;
}

.md-search-result:hover {
  border-left-color: var(--md-accent-fg-color);
  background: var(--md-default-bg-color--light);
}

.md-search-result__title {
  color: var(--md-accent-fg-color);
  font-weight: 600;
}

.md-search-result__teaser {
  color: var(--md-default-fg-color--light);
  line-height: 1.5;
}

.md-search-result__teaser mark {
  background: var(--md-accent-fg-color--transparent);
  color: var(--md-accent-fg-color);
  padding: 0.1rem 0.2rem;
  border-radius: 0.2rem;
}

/* Quick Search Actions */
.quick-search-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0 1rem;
}

.quick-search-action {
  background: var(--md-accent-fg-color);
  color: var(--md-accent-bg-color);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quick-search-action:hover {
  background: var(--md-accent-fg-color--dark);
  transform: translateY(-1px);
}

.quick-search-action.secondary {
  background: var(--md-default-fg-color--light);
  color: var(--md-default-fg-color);
}

.quick-search-action.secondary:hover {
  background: var(--md-default-fg-color--lightest);
}

/* Search History */
.search-history {
  padding: 0.5rem 1rem;
  background: var(--md-default-bg-color--light);
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

.search-history-title {
  font-weight: 600;
  color: var(--md-default-fg-color);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-history-clear {
  background: none;
  border: none;
  color: var(--md-accent-fg-color);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 0.2rem;
  transition: all 0.2s ease;
}

.search-history-clear:hover {
  background: var(--md-accent-fg-color--transparent);
}

.search-history-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  color: var(--md-default-fg-color--light);
}

.search-history-item:hover {
  background: var(--md-accent-fg-color--transparent);
  color: var(--md-default-fg-color);
}

.search-history-item::before {
  content: "🕐";
  font-size: 0.8rem;
}

/* Popular Searches */
.popular-searches {
  padding: 0.5rem 1rem;
}

.popular-searches-title {
  font-weight: 600;
  color: var(--md-default-fg-color);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.popular-searches-title::before {
  content: "🔥";
  font-size: 1rem;
}

.popular-search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.popular-search-tag {
  background: var(--md-accent-fg-color--transparent);
  color: var(--md-accent-fg-color);
  padding: 0.3rem 0.6rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--md-accent-fg-color--transparent);
}

.popular-search-tag:hover {
  background: var(--md-accent-fg-color);
  color: var(--md-accent-bg-color);
  border-color: var(--md-accent-fg-color);
  transform: translateY(-1px);
}

/* Search Filters */
.search-filters {
  padding: 0.5rem 1rem;
  background: var(--md-default-bg-color--light);
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

.search-filter-group {
  margin-bottom: 0.75rem;
}

.search-filter-label {
  font-weight: 600;
  color: var(--md-default-fg-color);
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.search-filter-option {
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.25rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--md-default-fg-color);
}

.search-filter-option:hover {
  border-color: var(--md-accent-fg-color);
  color: var(--md-accent-fg-color);
}

.search-filter-option.active {
  background: var(--md-accent-fg-color);
  color: var(--md-accent-bg-color);
  border-color: var(--md-accent-fg-color);
}

/* Search Loading State */
.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--md-default-fg-color--light);
}

.search-loading::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid var(--md-accent-fg-color--transparent);
  border-top: 2px solid var(--md-accent-fg-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Search Empty State */
.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--md-default-fg-color--light);
  text-align: center;
}

.search-empty::before {
  content: "🔍";
  font-size: 2rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.search-empty-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--md-default-fg-color);
}

.search-empty-description {
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Search Keyboard Shortcuts */
.search-shortcuts {
  padding: 0.5rem 1rem;
  background: var(--md-default-bg-color--light);
  border-top: 1px solid var(--md-default-fg-color--lightest);
  font-size: 0.8rem;
  color: var(--md-default-fg-color--light);
}

.search-shortcut {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.search-shortcut-key {
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.2rem;
  padding: 0.2rem 0.4rem;
  font-family: monospace;
  font-size: 0.7rem;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
  .search-suggestions {
    max-height: 300px;
    margin-top: 0.25rem;
  }
  
  .search-suggestion-item {
    padding: 0.5rem 0.75rem;
  }
  
  .search-suggestion-icon {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }
  
  .search-suggestion-title {
    font-size: 0.9rem;
  }
  
  .search-suggestion-description {
    font-size: 0.7rem;
  }
  
  .quick-search-actions {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .popular-search-tags {
    gap: 0.25rem;
  }
  
  .popular-search-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }
  
  .search-filter-options {
    gap: 0.25rem;
  }
  
  .search-filter-option {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }
}

/* Dark Mode Support */
[data-md-color-scheme="slate"] .search-suggestions {
  background: var(--md-default-bg-color);
  border-color: var(--md-default-fg-color--lightest);
}

[data-md-color-scheme="slate"] .search-suggestion-item {
  border-bottom-color: var(--md-default-fg-color--lightest);
}

[data-md-color-scheme="slate"] .search-suggestion-item:hover {
  background: var(--md-accent-fg-color--transparent);
}

[data-md-color-scheme="slate"] .search-history,
[data-md-color-scheme="slate"] .popular-searches,
[data-md-color-scheme="slate"] .search-filters {
  background: var(--md-default-bg-color--light);
  border-bottom-color: var(--md-default-fg-color--lightest);
}

/* Search Animation */
@keyframes searchEntrance {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-suggestions.active .search-suggestion-item {
  animation: searchEntrance 0.3s ease forwards;
}

.search-suggestions.active .search-suggestion-item:nth-child(1) { animation-delay: 0.05s; }
.search-suggestions.active .search-suggestion-item:nth-child(2) { animation-delay: 0.1s; }
.search-suggestions.active .search-suggestion-item:nth-child(3) { animation-delay: 0.15s; }
.search-suggestions.active .search-suggestion-item:nth-child(4) { animation-delay: 0.2s; }
.search-suggestions.active .search-suggestion-item:nth-child(5) { animation-delay: 0.25s; }
