/* Search Styles */

/* Search Results Container */
#lunrsearchresults {
  position: fixed;
  top: 80px; /* Adjust based on navbar height */
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 800px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  max-height: 500px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  backdrop-filter: blur(10px);
}

#lunrsearchresults.show {
  display: block;
  animation: fadeInDown 0.3s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Search Results Header */
.search-results-header {
  padding: 1rem;
  border-bottom: 1px solid #2a2a2a;
  background: #111111;
}

.search-results-header p {
  margin: 0;
  color: #b0b0b0;
  font-size: 0.875rem;
}

.search-results-header strong {
  color: #6366f1;
}

/* Search Results List */
.search-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-result-item {
  border-bottom: 1px solid #2a2a2a;
  transition: background-color 0.2s ease;
}

.search-result-item:hover {
  background-color: rgba(99, 102, 241, 0.05);
}

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

.search-result-content {
  padding: 1rem;
}

/* Search Result Title */
.search-result-title {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
}

.search-result-link {
  color: #ffffff;
  text-decoration: none;
  transition: color 0.2s ease;
}

.search-result-link:hover {
  color: #6366f1;
  text-decoration: none;
}

/* Search Result Excerpt */
.search-result-excerpt {
  margin: 0 0 0.75rem 0;
  color: #b0b0b0;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Search Result Meta */
.search-result-meta {
  font-size: 0.75rem;
}

.search-result-meta small {
  color: #888888;
}

.search-result-meta i {
  margin-right: 0.25rem;
}

/* Badges in search results */
.search-result-meta .badge {
  font-size: 0.625rem;
  padding: 0.125rem 0.375rem;
}

/* No Results */
.search-no-results {
  padding: 2rem 1rem;
  text-align: center;
  color: #b0b0b0;
}

.search-no-results p {
  margin: 0 0 0.5rem 0;
}

.search-no-results strong {
  color: #6366f1;
}

/* Search Error */
.search-error {
  padding: 1rem;
  color: #ef4444;
  text-align: center;
}

.search-error i {
  margin-right: 0.5rem;
}

/* Search Results Footer */
.search-results-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid #2a2a2a;
  background: #111111;
  text-align: center;
}

.search-results-footer p {
  margin: 0;
  color: #888888;
  font-size: 0.75rem;
}

/* Highlighted text in search results */
#lunrsearchresults mark {
  background-color: #6366f1;
  color: #ffffff;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-weight: 600;
}

/* Search Input Styling */
#search-input {
  background-color: #ffffff !important;
  border: 1px solid #ced4da !important;
  color: #495057 !important;
  border-radius: 0.5rem 0 0 0.5rem !important;
  padding: 0.5rem 1rem !important;
  font-size: 0.875rem !important;
  transition: all 0.2s ease !important;
  border-right: none !important;
}

#search-input:focus {
  background-color: #ffffff !important;
  border-color: #6366f1 !important;
  color: #495057 !important;
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25) !important;
}

#search-input::placeholder {
  color: #6c757d !important;
}

/* Search Button Styling */
#search-form .btn {
  background-color: #ffffff !important;
  border: 1px solid #ced4da !important;
  border-left: none !important;
  color: #6c757d !important;
  border-radius: 0 0.5rem 0.5rem 0 !important;
  padding: 0.5rem 0.75rem !important;
  transition: all 0.2s ease !important;
}

#search-form .btn:hover {
  background-color: #6366f1 !important;
  border-color: #6366f1 !important;
  color: #ffffff !important;
}

#search-form .btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25) !important;
}

/* Input Group Styling */
#search-form .input-group {
  border-radius: 0.5rem;
  overflow: hidden;
}

/* Search Form */
#search-form {
  position: relative;
}

/* Responsive Design */
@media (max-width: 768px) {
  #lunrsearchresults {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 60px);
    border-radius: 0;
  }

  .search-result-content {
    padding: 0.75rem;
  }

  .search-result-title {
    font-size: 0.875rem;
  }

  .search-result-excerpt {
    font-size: 0.75rem;
  }
}

/* Loading State */
.search-loading {
  padding: 2rem 1rem;
  text-align: center;
  color: #b0b0b0;
}

.search-loading::after {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #6366f1;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Keyboard Navigation */
.search-result-item:focus-within {
  background-color: rgba(99, 102, 241, 0.1);
  outline: 2px solid #6366f1;
  outline-offset: -2px;
}

/* Scrollbar for search results */
#lunrsearchresults::-webkit-scrollbar {
  width: 6px;
}

#lunrsearchresults::-webkit-scrollbar-track {
  background: #111111;
}

#lunrsearchresults::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border-radius: 3px;
}

#lunrsearchresults::-webkit-scrollbar-thumb:hover {
  background: #6366f1;
}
