/**
 * Blog Search Styles
 *
 * Styles for the blog search functionality
 */

/* Search Bar */
.blog-search {
  max-width: 400px;
  margin: 0 auto 2rem;
  position: relative;
}

.blog-search__input {
  width: 100%;
  padding: 0.75rem 3rem 0.75rem 1rem;
  font-size: 1.125rem;
  border: 2px solid #d1d5db;
  border-radius: 50px;
  background: #ffffff;
  color: #1f2937;
  transition: all 0.3s ease;
  font-family: inherit;
}

.blog-search__input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: #ffffff;
}

.blog-search__input::placeholder {
  color: #6b7280;
}

.blog-search__button {
  position: absolute;
  right: 0.375rem;
  top: 50%;
  transform: translateY(-50%);
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s ease;
}

.blog-search__button:hover {
  background: #1d4ed8;
}

.blog-search__button:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Search Results Message */
.search-results-message {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-results-message p {
  margin: 0;
  color: #0c4a6e;
  font-size: 0.95rem;
}

.search-results-message strong {
  color: #075985;
  font-weight: 600;
}

.clear-search-button {
  background: transparent;
  color: #0369a1;
  border: 1px solid #0369a1;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-search-button:hover {
  background: #0369a1;
  color: white;
}

.clear-search-button:focus {
  outline: 2px solid #0369a1;
  outline-offset: 2px;
}

/* No Results State */
.no-results {
  text-align: center;
  padding: 4rem 2rem;
  background: #f9fafb;
  border-radius: 12px;
  margin: 2rem 0;
}

.no-results h3 {
  font-size: 1.5rem;
  color: #111827;
  margin: 0 0 1rem;
}

.no-results p {
  font-size: 1rem;
  color: #6b7280;
  margin: 0;
}

/* Highlight Search Terms */
mark {
  background-color: #fef08a;
  color: #713f12;
  padding: 0.1em 0.2em;
  border-radius: 3px;
  font-weight: 500;
}

/* Tag List in Posts */
.blog-post__tags {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}

.blog-post__tags h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 1rem;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #f3f4f6;
  color: #374151;
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tag:hover {
  background: #2563eb;
  color: white;
}

/* Loading State */
.blog-search--loading .blog-search__button {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: translateY(-50%) rotate(0deg);
  }
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .blog-search {
    margin-bottom: 2rem;
  }

  .blog-search__input {
    padding: 0.875rem 3rem 0.875rem 1.25rem;
    font-size: 1rem;
  }

  .search-results-message {
    flex-direction: column;
    align-items: flex-start;
  }

  .clear-search-button {
    width: 100%;
    text-align: center;
  }

  .no-results {
    padding: 3rem 1.5rem;
  }

  .no-results h3 {
    font-size: 1.25rem;
  }

  .no-results p {
    font-size: 0.9375rem;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .blog-search__input,
  .blog-search__button,
  .clear-search-button,
  .tag {
    transition: none;
  }

  .blog-search--loading .blog-search__button {
    animation: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .blog-search__input {
    border-width: 3px;
  }

  .blog-search__input:focus {
    border-width: 3px;
    outline: 3px solid #2563eb;
  }

  mark {
    background-color: #fbbf24;
    color: #000;
    font-weight: 700;
  }
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
  .blog-search__input {
    background: #ffffff;
    border-color: #d1d5db;
    color: #1f2937;
  }

  .blog-search__input::placeholder {
    color: #6b7280;
  }

  .blog-search__input:focus {
    border-color: #2563eb;
    background: #ffffff;
  }

  .search-results-message {
    background: #1e3a5f;
    border-color: #1e40af;
  }

  .search-results-message p {
    color: #93c5fd;
  }

  .search-results-message strong {
    color: #dbeafe;
  }

  .clear-search-button {
    color: #93c5fd;
    border-color: #3b82f6;
  }

  .clear-search-button:hover {
    background: #3b82f6;
    color: white;
  }

  .no-results {
    background: #1f2937;
  }

  .no-results h3 {
    color: #f9fafb;
  }

  .no-results p {
    color: #9ca3af;
  }

  .tag {
    background: #374151;
    color: #d1d5db;
  }

  .tag:hover {
    background: #3b82f6;
    color: white;
  }

  mark {
    background-color: #713f12;
    color: #fef08a;
  }
}
