/**
 * Search Styles for AI Playground
 * 
 * This file contains styles for the search functionality, including
 * the search bar, auto-suggestions, and search results page.
 */

/* Search Bar Styles */
.search-container {
  position: relative;
  margin-left: auto;
  display: flex;
  align-items: center;
  width: 40px; /* Fixed width for the container */
  flex-shrink: 0; /* Prevent container from shrinking */
}

.search-toggle {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 8px;
  font-size: 16px;
  transition: color 0.3s ease;
  z-index: 1001;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.search-toggle:hover {
  color: #4a90e2;
}

.search-form {
  position: absolute;
  right: 40px; /* Position it to the left of the magnifying glass */
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  width: 0;
  opacity: 0;
  transition: all 0.3s ease;
  overflow: hidden;
  background: #fff;
  z-index: 1000;
  margin-right: 8px;
}

.search-form.active {
  width: 300px;
  opacity: 1;
}

#search-input {
  width: 100%;
  padding: 8px 12px;
  padding-right: 40px;
  border: 1px solid #ccc;
  border-radius: 20px;
  font-size: 14px;
  transition: all 0.3s ease;
  background-color: #f5f5f5;
}

#search-input:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
  background-color: #fff;
}

#search-form button {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
}

#search-form button:hover {
  color: #4a90e2;
}

/* Auto-suggestions Styles */
#search-suggestions {
  position: absolute;
  top: 100%;
  right: 40px; /* Align with the search form */
  width: 300px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.search-suggestion {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

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

.search-suggestion:hover {
  background-color: #f5f7fa;
}

.suggestion-title {
  font-weight: 500;
  margin-bottom: 2px;
  color: #333;
}

.suggestion-category {
  font-size: 12px;
  color: #666;
}

.no-suggestions {
  padding: 15px;
  text-align: center;
  color: #666;
}

/* Search Results Page Styles */
.search-results-container {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  gap: 30px;
}

.search-filters {
  width: 250px;
  flex-shrink: 0;
  background-color: #f5f7fa;
  border-radius: 8px;
  padding: 20px;
  position: sticky;
  top: 20px;
  align-self: flex-start;
}

.search-filters h2 {
  margin-top: 0;
  font-size: 18px;
  color: #333;
  margin-bottom: 15px;
}

.filter-group {
  margin-bottom: 20px;
}

.filter-group h3 {
  font-size: 16px;
  margin-bottom: 10px;
  color: #444;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #555;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  margin-right: 8px;
}

.search-results {
  flex-grow: 1;
}

.search-summary {
  margin-bottom: 20px;
}

.search-summary h1 {
  font-size: 24px;
  color: #333;
  margin-bottom: 5px;
}

.search-summary p {
  color: #666;
  font-size: 14px;
}

.search-result {
  background-color: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid #eee;
}

.result-title {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 18px;
}

.result-title a {
  color: #4a90e2;
  text-decoration: none;
}

.result-title a:hover {
  text-decoration: underline;
}

.result-meta {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: #666;
}

.result-category {
  background-color: #e8f0fe;
  color: #4a90e2;
  padding: 3px 8px;
  border-radius: 12px;
  margin-right: 10px;
  font-weight: 500;
}

.result-url {
  color: #0d652d;
  font-family: monospace;
}

.result-snippet {
  margin-bottom: 15px;
  line-height: 1.5;
  color: #333;
  font-size: 14px;
}

.result-snippet mark {
  background-color: #fff2a8;
  padding: 0 2px;
  border-radius: 2px;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-tag {
  background-color: #f0f0f0;
  color: #666;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.no-results {
  background-color: #f9f9f9;
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  color: #666;
}

.no-results p {
  margin-bottom: 15px;
}

.no-results ul {
  text-align: left;
  display: inline-block;
  margin: 0 auto;
}

.no-results li {
  margin-bottom: 5px;
}

.pagination {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  gap: 5px;
}

.pagination button {
  background-color: #fff;
  border: 1px solid #ddd;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  color: #333;
}

.pagination button.active {
  background-color: #4a90e2;
  color: #fff;
  border-color: #4a90e2;
}

.pagination button:hover:not(.active) {
  background-color: #f5f5f5;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .search-results-container {
    flex-direction: column;
  }
  
  .search-filters {
    width: 100%;
    position: static;
    margin-bottom: 20px;
  }
}

/* Update nav-links to handle dynamic positioning */
body .nav-links {
  display: flex;
  align-items: center;
  gap: var(--spacing-md, 1.5rem);
  margin-right: 40px; /* Reserve space for search container */
}

body .nav-links.search-expanded {
  margin-right: 40px; /* Keep the same margin */
} 