* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif;
  background: #f8fafc;
  min-height: 100vh;
  color: #1e293b;
  line-height: 1.6;
}

/* ========== Header ========== */
header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.logo:hover {
  opacity: 0.8;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: #2563eb;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 600;
}

.logo-text {
  font-size: 1.375rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.02em;
}

.ai-summary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.ai-summary-btn:hover {
  background: #1d4ed8;
}

/* ========== Search Section ========== */
.search-section {
  background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
  padding: 4rem 2rem 3rem;
  border-bottom: 1px solid #e2e8f0;
}

.search-container {
  max-width: 900px;
  margin: 0 auto;
}

.search-title {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  text-align: center;
  color: #1e293b;
  letter-spacing: -0.03em;
}

.search-description {
  text-align: center;
  font-size: 1.0625rem;
  margin-bottom: 2.5rem;
  color: #64748b;
  font-weight: 400;
}

.search-box-large {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.search-input-large {
  flex: 1;
  padding: 1rem 1.25rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  background: white;
  transition: all 0.2s;
}

.search-input-large:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-button {
  padding: 1rem 2rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.search-button:hover {
  background: #1d4ed8;
}

.search-button:active {
  transform: scale(0.98);
}

/* Quick Search */
.quick-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.quick-search-label {
  font-weight: 500;
  color: #64748b;
  font-size: 0.9375rem;
}

.category-filters {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.category-btn-quick {
  padding: 0.5rem 1rem;
  background: white;
  color: #475569;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.category-btn-quick:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
}

/* ========== Results Section ========== */
.results-section {
  padding: 3rem 2rem;
  min-height: 60vh;
  background: #f8fafc;
}

.results-container {
  max-width: 1200px;
  margin: 0 auto;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.results-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.02em;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.results-count {
  font-size: 0.9375rem;
  color: #64748b;
}

.sort-select {
  padding: 0.5rem 0.875rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  background: white;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

.sort-select:hover {
  border-color: #cbd5e1;
}

.sort-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  color: #64748b;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1.25rem;
}

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

.loading-state p {
  font-size: 0.9375rem;
  color: #64748b;
}

/* Empty State */
.empty-state-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1.25rem;
  opacity: 0.3;
}

.empty-state-large h2 {
  font-size: 1.5rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.empty-state-large p {
  font-size: 1rem;
  color: #64748b;
  line-height: 1.6;
}

/* Error State */
.error-state-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1.25rem;
  opacity: 0.5;
}

.error-state-large h2 {
  font-size: 1.5rem;
  color: #ef4444;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.error-state-large p {
  font-size: 1rem;
  color: #64748b;
  margin-bottom: 2rem;
}

.retry-button {
  padding: 0.75rem 1.75rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.retry-button:hover {
  background: #1d4ed8;
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

/* Article Card */
.article-card-search {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  transition: all 0.2s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.article-card-search:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
}

.article-image-wrapper {
  position: relative;
  overflow: hidden;
  height: 200px;
  background: #f1f5f9;
}

.article-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.article-card-search:hover .article-image-wrapper img {
  transform: scale(1.05);
}

.article-content-search {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-title-search {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.75rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.01em;
}

.article-card-search:hover .article-title-search {
  color: #2563eb;
}

.article-summary-search {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.article-meta-search {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: #94a3b8;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.article-date {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.article-views {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header-container {
    padding: 1rem 1.25rem;
  }

  .search-section {
    padding: 3rem 1.25rem 2rem;
  }

  .search-title {
    font-size: 1.75rem;
  }

  .search-description {
    font-size: 0.9375rem;
  }

  .search-box-large {
    flex-direction: column;
    gap: 0.625rem;
  }

  .search-button {
    width: 100%;
    justify-content: center;
  }

  .results-section {
    padding: 2rem 1.25rem;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .results-meta {
    width: 100%;
    justify-content: space-between;
  }

  .quick-search {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}
