/* ===== LAYOUT ===== */
.wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

/* ===== HEADER / NAV ===== */
.site-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d1f0e 100%);
  color: #fff;
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.site-header .wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.site-logo:hover {
  color: #f97316;
  text-decoration: none;
}

.site-logo .logo-icon {
  font-size: 1.4rem;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.site-nav a {
  color: #d1d5db;
  font-size: 0.875rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.site-nav a:hover, .site-nav a:focus {
  color: #fff;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.site-nav a.active {
  color: #f97316;
  background: rgba(249,115,22,0.1);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  padding: 2rem 0 3rem;
}

/* ===== CARDS ===== */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #f97316;
}

.card-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.card-header .icon {
  font-size: 1.3rem;
}

/* ===== SEARCH SECTION ===== */
.search-section {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.search-section h2 {
  color: #9a3412;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  max-width: 500px;
  margin: 0.75rem auto 0;
}

.search-form input[type="text"] {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.15s ease;
  background: #fff;
  color: #1a1a2e;
}

.search-form input[type="text"]:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249,115,22,0.15);
}

.search-form input[type="text"]::placeholder {
  color: #9ca3af;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #f97316, #e11d48);
  color: #fff;
}

.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, #e11d48, #be123c);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(249,115,22,0.3);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.btn-secondary:hover {
  background: #e5e7eb;
  text-decoration: none;
  color: #374151;
}

/* ===== TRENDING TABLES ===== */
.trending-table {
  width: 100%;
}

.trending-table .rank-col {
  width: 40px;
  text-align: center;
}

.trending-table .value-col {
  width: 70px;
  text-align: center;
}

.trending-table .rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 0.8rem;
  font-weight: 700;
}

.trending-table .value-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
}

.value-badge.high {
  background: #fef2f2;
  color: #dc2626;
}

.value-badge.medium {
  background: #fff7ed;
  color: #f97316;
}

.value-badge.low {
  background: #f0fdf4;
  color: #16a34a;
}

.value-badge.breakout {
  background: #fefce8;
  color: #ca8a04;
}

.value-badge.news {
  background: #eff6ff;
  color: #2563eb;
}

.value-badge.social {
  background: #fdf2f8;
  color: #be185d;
}

.value-badge.trending {
  background: #fef3c7;
  color: #b45309;
}

.trending-table .query-link {
  color: #1a1a2e;
  font-weight: 500;
  font-size: 0.95rem;
}

.trending-table .query-link:hover {
  color: #f97316;
  text-decoration: none;
}

.trending-table .summary-row td {
  padding: 0 0.5rem 0.75rem 40px;
}

.trending-table .summary-text {
  display: block;
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.5;
  padding: 0.5rem 0.75rem;
  background: #f9fafb;
  border-radius: 6px;
  border-left: 3px solid #f97316;
}

.trending-table tr:hover .query-link {
  color: #f97316;
}

/* ===== AI RESPONSE ===== */
.ai-response {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.ai-response .ai-response-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #dcfce7;
  font-weight: 600;
  font-size: 0.9rem;
  color: #166534;
}

.ai-response .ai-response-header .ai-icon {
  font-size: 1.2rem;
}

.ai-response .ai-response-body {
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #1a1a2e;
}

.ai-response .ai-response-body p {
  margin: 0 0 0.75rem 0;
}

.ai-response .ai-response-body p:last-child {
  margin-bottom: 0;
}

.ai-response .ai-response-body strong {
  color: #166534;
}

.search-form .btn-secondary {
  margin-left: 0.25rem;
}

/* ===== TOP QUERIES TABLE ===== */
/* ===== TOP STORIES MULTI-SOURCE GRID ===== */
.top-stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.source-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.75rem;
  transition: box-shadow 0.15s ease;
}

.source-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.source-card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid #f97316;
  font-weight: 700;
  font-size: 0.9rem;
  color: #1a1a2e;
}

.source-card-icon {
  font-size: 1.1rem;
}

.source-card .trending-table {
  margin: 0;
}

.source-card .trending-table td {
  padding: 0.4rem 0.25rem;
  font-size: 0.85rem;
}

.source-card .trending-table td:first-child {
  width: 100%;
}

.source-card .trending-table .query-link {
  font-size: 0.85rem;
}

.source-card .value-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  white-space: nowrap;
}

.top-table td:first-child {
  width: 70%;
}

/* ===== META INFO ===== */
.meta-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.8rem;
  color: #9ca3af;
  margin-bottom: 1rem;
}

.meta-info a {
  color: #6b7280;
}

.meta-info a:hover {
  color: #f97316;
}

/* ===== NOTICE / ALERT ===== */
.notice {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}

.notice-info {
  background: #f0f9ff;
  border-color: #3b82f6;
  color: #1e40af;
}

.notice-warning {
  background: #fefce8;
  border-color: #eab308;
  color: #854d0e;
}

.notice-error {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}

/* ===== HERO SECTION (landing page) ===== */
.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.hero h1 {
  font-size: 2.2rem;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

.hero h1 .hero-icon {
  display: inline-block;
}

.hero h1 .hero-text {
  background: linear-gradient(135deg, #f97316, #e11d48);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  color: #6b7280;
  max-width: 500px;
  margin: 0 auto 1.5rem;
}

.hero-search {
  max-width: 550px;
  margin: 0 auto;
}

/* ===== FEATURES GRID ===== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.feature-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #f0f0f0;
  transition: all 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border-color: #fed7aa;
}

.feature-card .feature-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.feature-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0;
}

/* ===== CITY EXAMPLES ===== */
.city-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.city-chip {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: #f3f4f6;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #374151;
  transition: all 0.15s ease;
}

.city-chip:hover {
  background: #f97316;
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

/* ===== ERROR PAGE ===== */
.error-page {
  text-align: center;
  padding: 3rem 1rem;
}

.error-page .error-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ===== FOOTER ===== */
.site-footer {
  background: #1a1a2e;
  color: #9ca3af;
  padding: 2rem 0;
  margin-top: auto;
}

.site-footer .wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.site-footer a {
  color: #d1d5db;
  font-size: 0.85rem;
}

.site-footer a:hover {
  color: #f97316;
  text-decoration: none;
}

.site-footer .footer-copy {
  font-size: 0.8rem;
  color: #6b7280;
}

/* ===== ABOUT / PRIVACY PAGES ===== */
.content-page h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: #1a1a2e;
}

.content-page h2 {
  font-size: 1.2rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.content-page p, .content-page li {
  color: #4b5563;
  line-height: 1.7;
}

.content-page .last-updated {
  color: #9ca3af;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* ===== AD PLACEHOLDER ===== */
.ad-container {
  text-align: center;
  margin: 1.5rem 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.75rem;
  color: #9ca3af;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  html { font-size: 95%; }

  .site-header .wrapper {
    flex-direction: column;
    gap: 0.5rem;
  }

  .site-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .site-nav a {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
  }

  .hero h1 { font-size: 1.6rem; }

  .search-form {
    flex-direction: column;
  }

  .search-form input[type="text"] {
    width: 100%;
  }

  .card { padding: 1rem; }

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

  .site-footer .wrapper {
    flex-direction: column;
    text-align: center;
  }

  .site-footer .footer-links {
    justify-content: center;
  }

  .trending-table .summary-row td {
    padding-left: 0;
  }
}

/* ===== PRINT ===== */
@media print {
  .site-header, .site-footer, .search-section, .ad-container { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ===== DARK MODE PREFERENCE ===== */
@media (prefers-color-scheme: dark) {
  body {
    background: #0f0f1a;
    color: #e5e7eb;
  }

  h1, h2, h3, h4, h5, h6 { color: #f3f4f6; }

  .card, .feature-card {
    background: #1a1a2e;
    border-color: #2d2d4a;
  }

  .card-header {
    border-bottom-color: #f97316;
  }

  .site-header {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
  }

  .search-section {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1f0e 100%);
    border-color: #3d2f1e;
  }

  .search-section h2 { color: #f97316; }

  .search-form input[type="text"] {
    background: #2d2d4a;
    border-color: #3d3d5a;
    color: #e5e7eb;
  }

  .search-form input[type="text"]:focus {
    border-color: #f97316;
  }

  .trending-table .rank-num {
    background: #2d2d4a;
    color: #9ca3af;
  }

  .trending-table .query-link { color: #e5e7eb; }

  .trending-table .summary-text {
    background: #2d2d4a;
    color: #d1d5db;
  }

  .site-footer {
    background: #0a0a14;
  }

  .city-chip {
    background: #2d2d4a;
    color: #d1d5db;
  }

  .city-chip:hover {
    background: #f97316;
    color: #fff;
  }

  .notice-info {
    background: #1e3a5f;
    border-color: #3b82f6;
    color: #93c5fd;
  }

  .notice-warning {
    background: #3d2f1e;
    border-color: #eab308;
    color: #fde68a;
  }

  .notice-error {
    background: #3d1e1e;
    border-color: #ef4444;
    color: #fca5a5;
  }

  .ai-response {
    background: #2d2d4a;
    border-color: #374151;
  }

  .ai-response .ai-response-header {
    color: #d1d5db;
  }

  .ai-response .ai-response-body {
    color: #e5e7eb;
  }

  .ai-response .ai-response-body strong {
    color: #86efac;
  }

  .content-page p, .content-page li { color: #d1d5db; }

  .ad-container {
    background: #1a1a2e;
    border-color: #2d2d4a;
  }

  th { color: #9ca3af; border-bottom-color: #2d2d4a; }
  td { border-bottom-color: #2d2d4a; }

  .source-card {
    background: #2d2d4a;
    border-color: #3d3d5a;
  }

  .source-card-header {
    color: #f3f4f6;
  }

  .meta-info { color: #6b7280; }
  .meta-info a { color: #9ca3af; }
}