.search-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Search Header */
.search-header {
  position: relative;
  margin-bottom: 20px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  border: 2px solid #e1e5e9;
  border-radius: 12px;
  padding: 0 16px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-input-wrapper:focus-within {
  border-color: #007acc;
  box-shadow: 0 4px 16px rgba(0,122,204,0.2);
}

#search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 16px 0;
  font-size: 16px;
  background: transparent;
}

.search-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-icon {
  color: #666;
  font-size: 18px;
}

.clear-search {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.clear-search:hover {
  background: #f5f5f5;
  color: #333;
}

/* Search Suggestions */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.suggestion-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s ease;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: #f8f9fa;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-text {
  font-weight: 500;
}

.suggestion-type {
  font-size: 12px;
  color: #666;
  margin-left: 8px;
}

/* Filters Toggle */
.filters-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.filters-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
  border: 1px solid #e1e5e9;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filters-btn:hover {
  background: #e9ecef;
}

.toggle-icon {
  transition: transform 0.3s ease;
}

.filters-btn.active .toggle-icon {
  transform: rotate(180deg);
}

.search-stats {
  font-size: 14px;
  color: #666;
}

/* Filters Panel */
.filters-panel {
  background: #f8f9fa;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  display: none;
  animation: slideDown 0.3s ease;
}

.filters-panel.active {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.filter-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: #333;
}

.filter-group select,
.filter-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.date-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Category and Tag Filters */
.category-filters,
.tag-cloud-section {
  margin-bottom: 20px;
}

.category-filters label,
.tag-cloud-section label {
  display: block;
  font-weight: 500;
  margin-bottom: 12px;
  color: #333;
}

.category-tags,
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-tag,
.tag-item {
  background: white;
  border: 1px solid #ddd;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.category-tag:hover,
.tag-item:hover {
  background: #e9ecef;
  border-color: #007acc;
}

.category-tag.active,
.tag-item.active {
  background: #007acc;
  color: white;
  border-color: #007acc;
}

.category-tag .count {
  font-size: 12px;
  opacity: 0.8;
}

/* Search Options */
.search-options {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
  width: auto;
}

/* Filter Actions */
.filter-actions {
  display: flex;
  gap: 12px;
}

.btn-primary,
.btn-secondary {
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #007acc;
  color: white;
  border: 1px solid #007acc;
}

.btn-secondary {
  background: white;
  color: #666;
  border: 1px solid #ddd;
}

.btn-primary:hover {
  background: #0066a3;
}

.btn-secondary:hover {
  background: #f5f5f5;
}

/* Search Results */
.results-header {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e1e5e9;
  font-size: 14px;
  color: #666;
}

.search-results {
  display: grid;
  gap: 16px;
}

.result-item {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.result-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: #007acc;
}

.result-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.result-title a {
  color: inherit;
  text-decoration: none;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #666;
}

.result-category {
  background: #e9ecef;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.result-tag {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}

.result-excerpt {
  line-height: 1.6;
  color: #555;
}

.highlight {
  background: #fff3cd;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 500;
}

/* Category Groups */
.category-group {
  margin-bottom: 32px;
}

.category-group-header {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #007acc;
  color: #333;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.no-results h3 {
  margin-bottom: 8px;
  color: #333;
}

/* Search History */
.search-history {
  background: #f8f9fa;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 16px;
  margin-top: 20px;
}

.search-history h4 {
  margin-bottom: 12px;
  color: #333;
}

.history-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-item {
  background: white;
  border: 1px solid #ddd;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.history-item:hover {
  background: #e9ecef;
}

/* Responsive Design */
@media (max-width: 768px) {
  .search-container {
    padding: 16px;
  }
  
  .filters-grid {
    grid-template-columns: 1fr;
  }
  
  .filters-toggle {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .filter-actions {
    flex-direction: column;
  }
  
  .result-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .search-options {
    flex-direction: column;
    gap: 12px;
  }
  
  .category-tags,
  .tag-cloud {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .search-input-wrapper {
    padding: 0 12px;
  }
  
  #search-input {
    padding: 12px 0;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .filters-panel {
    padding: 16px;
  }
  
  .result-item {
    padding: 16px;
  }
}

/* Keyboard Navigation */
.suggestion-item.keyboard-active {
  background: #007acc;
  color: white;
}

/* Loading States */
.search-loading {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007acc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
