/* ===== SEARCH ===== */

.search {
  display: flex;
  justify-content: center; /* Center the search bar */
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
  border-bottom: 1px solid var(--border-primary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.search-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch; /* Full width of container */
  width: 100%;
  max-width: 80%; /* 80% width like you wanted */
  gap: 0.5rem;
}

/* === Form Styles === */
.search-bar form {
  display: flex;
  width: 100%;
  gap: 0.5rem;
}

.search-bar input[type="search"] {
  flex-grow: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 4px 8px var(--shadow-light);
  transition: all 0.3s ease;
}

.search-bar input[type="search"]:focus {
  border-color: var(--border-secondary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(244, 197, 66, 0.15);
}

.search-bar button[type="submit"] {
  padding: 0.75rem 1.25rem;
  background: var(--accent-primary);
  color: var(--text-light);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 8px var(--shadow-light);
  transition: all 0.3s ease;
  white-space: nowrap; /* Prevent button text from wrapping */
}

.search-bar button:hover,
.search-bar button:focus {
  background: var(--accent-secondary);
  box-shadow: 0 6px 12px var(--shadow-medium);
}

/* === Feed Links === */
.feed-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.9rem;
  padding-top: 0.5rem;
}

.feed-label {
  font-weight: bold;
}

/* === Responsive Design === */
@media (max-width: 768px) {
  .search {
    padding: 1rem;
  }

  .search-bar {
    max-width: 95%; /* Wider on mobile */
  }

  .search-bar form {
    flex-direction: column; /* Stack vertically on small screens */
    gap: 0.75rem;
  }

  .search-bar input[type="search"] {
    width: 100%;
  }

  .search-bar button[type="submit"] {
    width: 100%;
    padding: 1rem;
  }

  .feed-links {
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .search {
    padding: 0.75rem 0.5rem;
  }

  .search-bar {
    max-width: 100%;
  }

  .search-bar input[type="search"],
  .search-bar button[type="submit"] {
    padding: 0.875rem;
    font-size: 0.95rem;
  }
}

/* Search results page styles (separate from main page search) */
.search-results .search-stats {
  margin-bottom: 1rem;
}

.search-results .search-result {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  transition: transform 0.2s;
}

.search-results .search-result-hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-light);
}

.search-results .search-result-title {
  margin: 0 0 0.5rem 0;
}

.search-results .search-result-link {
  text-decoration: none;
  color: var(--text-primary);
}

.search-results .search-result-link:hover {
  text-decoration: underline;
}

.search-results .search-result-url {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.search-results .search-result-snippet {
  line-height: 1.6;
}

.search-results .search-result-score {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.search-results .search-highlight {
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
  font-weight: 500;
  background: var(--accent-primary);
  color: var(--text-light);
}

.search-results .search-error {
  padding: 1rem;
  border-radius: 8px;
  background: var(--bg-error, #fef2f2);
  color: var(--text-error, #dc2626);
  border: 1px solid var(--border-error, #fecaca);
}

.search-results .no-results {
  text-align: center;
  padding: 3rem;
}

.feed-link {
  margin-left: 0.5rem;
}