/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Amazon Ember", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #f2f3f3;
  color: #232f3e;
  line-height: 1.6;
}

a { color: #0073bb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Utility Bar (top row) ────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.utility-bar {
  background: #232f3e;
  border-bottom: 1px solid #37475a;
}

.utility-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.utility-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.utility-link {
  background: none;
  border: none;
  color: #d5dbdb;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 3px;
  transition: color .12s;
}

.utility-link:hover {
  color: #ff9900;
  text-decoration: none;
}

.utility-globe { font-size: 13px; }

.caret {
  font-size: 10px;
  opacity: .7;
}

.utility-profile {
  background: none;
  border: 1px solid #879596;
  color: #d5dbdb;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 6px;
  transition: border-color .12s;
}

.utility-profile:hover { border-color: #ff9900; color: #ff9900; }

/* ── Main Nav (bottom row) ───────────────────────────── */
.main-nav {
  background: #fff;
  border-bottom: 1px solid #d5dbdb;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.main-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  margin-right: 8px;
  flex-shrink: 0;
}

.nav-divider {
  width: 1px;
  height: 24px;
  background: #d5dbdb;
  margin: 0 12px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0;
  margin: 0;
  padding: 0;
}

.nav-links li a {
  display: block;
  padding: 8px 14px;
  font-size: 14px;
  color: #232f3e;
  text-decoration: none;
  font-weight: 500;
  border-radius: 4px;
  transition: background .12s, color .12s;
  white-space: nowrap;
}

.nav-links li a:hover {
  color: #0073bb;
  background: #f2f3f3;
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #232f3e;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
  transition: background .12s;
}

.nav-search-btn:hover { background: #f2f3f3; }

.nav-signin {
  font-size: 14px;
  color: #232f3e;
  font-weight: 500;
  padding: 8px 12px;
  text-decoration: none;
  border-radius: 4px;
  transition: background .12s;
  white-space: nowrap;
}

.nav-signin:hover {
  background: #f2f3f3;
  text-decoration: none;
}

.nav-create-account {
  display: inline-flex;
  align-items: center;
  background: #ff9900;
  color: #232f3e;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 20px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s;
}

.nav-create-account:hover {
  background: #ec7211;
  text-decoration: none;
}

/* ── Search Hero ─────────────────────────────────────── */
.search-hero {
  background: #232f3e;
  padding: 40px 24px 48px;
  text-align: center;
}

.search-hero h1 {
  color: #fff;
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 20px;
}

.search-bar-wrapper {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 12px 48px 12px 16px;
  font-size: 16px;
  border: 2px solid #ff9900;
  border-radius: 4px;
  outline: none;
  background: #fff;
}

.search-input:focus { border-color: #ec7211; }

.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #879596;
  font-size: 18px;
  pointer-events: none;
}

.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d5dbdb;
  border-top: none;
  border-radius: 0 0 4px 4px;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.suggestion-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
}

.suggestion-item:hover { background: #f2f3f3; }

/* ── Main Layout ─────────────────────────────────────── */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  gap: 24px;
}

/* ── Sidebar – Filter by type ────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
}

.filter-section {
  background: #fff;
  border: 1px solid #d5dbdb;
  border-radius: 8px;
  padding: 20px;
}

.filter-section h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #232f3e;
}

.filter-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.filter-list li {
  margin-bottom: 2px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #232f3e;
  transition: background .12s;
  user-select: none;
}

.filter-option:hover {
  background: #f2f3f3;
}

.filter-option--active {
  background: #e9f3fc;
  color: #0073bb;
  font-weight: 600;
}

.filter-option--active:hover {
  background: #d4e8f8;
}

/* Custom checkbox appearance */
.filter-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #879596;
  border-radius: 4px;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition: all .12s;
  background: #fff;
}

.filter-checkbox:checked {
  background: #0073bb;
  border-color: #0073bb;
}

.filter-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.filter-checkbox:focus-visible {
  outline: 2px solid #0073bb;
  outline-offset: 2px;
}

.filter-label {
  flex: 1;
}

.filter-count {
  color: #879596;
  font-size: 12px;
  font-weight: 400;
}

.filter-option--active .filter-count {
  color: #0073bb;
}

/* ── AI Overview Card ─────────────────────────────────── */
.ai-overview {
  background: linear-gradient(135deg, #f0f4ff 0%, #e8f5e9 50%, #fff8e1 100%);
  border: 1px solid #c8d6e5;
  border-radius: 12px;
  padding: 0;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.ai-overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 0;
  cursor: default;
}

.ai-overview-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-sparkle {
  font-size: 20px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: sparkle-pulse 2s ease-in-out infinite;
}

@keyframes sparkle-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .7; transform: scale(1.15); }
}

.ai-overview-label {
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: .3px;
}

.ai-loading-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 4px;
}

.ai-loading-dots span {
  font-size: 18px;
  font-weight: 700;
  color: #8b5cf6;
  animation: dot-bounce .6s ease-in-out infinite;
}

.ai-loading-dots span:nth-child(2) { animation-delay: .15s; }
.ai-loading-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes dot-bounce {
  0%, 100% { opacity: .3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.ai-collapse-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: #879596;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.ai-collapse-btn:hover { background: rgba(0,0,0,.05); }

.ai-overview-body {
  padding: 8px 20px 18px;
}

.ai-overview-title {
  font-size: 17px;
  font-weight: 600;
  color: #232f3e;
  margin-bottom: 8px;
}

.ai-overview-text {
  font-size: 14px;
  line-height: 1.7;
  color: #37474f;
  margin-bottom: 12px;
}

.ai-cursor {
  display: inline-block;
  color: #8b5cf6;
  font-weight: 300;
  animation: blink .7s step-end infinite;
  margin-left: 1px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.ai-overview-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
}

.ai-overview-bullets li {
  position: relative;
  padding: 5px 0 5px 20px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #37474f;
}

.ai-overview-bullets li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: #8b5cf6;
  font-size: 14px;
  font-weight: 700;
}

.ai-overview-sources {
  border-top: 1px solid rgba(0,0,0,.08);
  padding-top: 12px;
}

.ai-sources-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #879596;
  display: block;
  margin-bottom: 8px;
}

.ai-sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-source-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background: #fff;
  border: 1px solid #d5dbdb;
  border-radius: 16px;
  font-size: 12px;
  color: #0073bb;
  text-decoration: none;
  transition: all .12s;
  white-space: nowrap;
}

.ai-source-chip:hover {
  background: #e9f3fc;
  border-color: #0073bb;
  text-decoration: none;
}

/* ── Results Area ────────────────────────────────────── */
.results-area {
  flex: 1;
  min-width: 0;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.results-count-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.results-count {
  font-size: 14px;
  color: #545b64;
}

.top-query-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff3e0;
  color: #b45309;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid #fcd9a0;
  white-space: nowrap;
}

.sort-select {
  padding: 6px 12px;
  border: 1px solid #d5dbdb;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
  color: #232f3e;
  cursor: pointer;
}

/* ── Result Card ─────────────────────────────────────── */
.result-card {
  background: #fff;
  border: 1px solid #d5dbdb;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 12px;
  transition: box-shadow .15s;
}

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

.result-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.result-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.result-card h2 a { color: #0073bb; }
.result-card h2 a:hover { text-decoration: underline; }

.result-rank {
  flex-shrink: 0;
  background: #232f3e;
  color: #ff9900;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.4;
}

.result-url {
  font-size: 13px;
  color: #2a7230;
  margin-bottom: 8px;
  word-break: break-all;
}

.result-description {
  font-size: 14px;
  color: #545b64;
  margin-bottom: 8px;
}

.result-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #879596;
}

.result-tag {
  background: #f2f3f3;
  padding: 2px 8px;
  border-radius: 3px;
}

/* ── Empty / Loading States ──────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #545b64;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  color: #d5dbdb;
}

.empty-state h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 60px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #d5dbdb;
  border-top-color: #0073bb;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ── Footer ──────────────────────────────────────────── */
.footer {
  background: #232f3e;
  color: #d5dbdb;
  text-align: center;
  padding: 24px;
  font-size: 13px;
  margin-top: 40px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
  .main-content { flex-direction: column; }
  .sidebar { width: 100%; }
  .nav-links { display: none; }
  .nav-divider { display: none; }
  .utility-bar-inner { padding: 0 12px; }
  .main-nav-inner { padding: 0 12px; }
  .nav-signin { display: none; }
}

@media (max-width: 600px) {
  .utility-right { gap: 0; }
  .utility-link { padding: 4px 6px; font-size: 11px; }
  .nav-create-account { padding: 6px 12px; font-size: 13px; }
}
