/* search.css — Pitch Black (#000000) Clean Chrome Precision Search Engine */

:root {
  --bg-pitch-black: #000000;
  --bg-surface: #0a0a0a;
  --bg-surface-elevated: #121212;
  --bg-surface-hover: #1c1c20;
  --bg-input: #121212;
  --bg-ai-card: #0a0a0a;
  
  --border-subtle: #1c1c1f;
  --border-default: #27272a;
  --border-focus: #444448;
  
  --text-primary: #ffffff;
  --text-secondary: #c4c4cc;
  --text-muted: #808088;
  --link-blue: #7aa2f7;
  --link-visited: #bb9af7;
  --accent-green: #4ade80;
  --accent-red: #f87171;
  
  --font-google: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --ease-google: cubic-bezier(0.2, 0, 0, 1);
}

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

body.chrome-search-body {
  background-color: var(--bg-pitch-black);
  color: var(--text-primary);
  font-family: var(--font-google);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ========================================================================= */
/* 1. TOP CHROME NAVIGATION HEADER */
/* ========================================================================= */
.chrome-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-pitch-black);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 200;
}

.header-left-col {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
}

.chrome-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.chrome-logo-img {
  height: 25px;
  width: auto;
  display: block;
  object-fit: contain;
  transition: opacity 160ms var(--ease-ui);
}

.chrome-logo-link:hover .chrome-logo-img {
  opacity: 0.85;
}

/* Compact Search Capsule in Header */
.header-search-box {
  display: none; /* Toggled on query */
  flex: 1;
  max-width: 692px;
  position: relative;
}

.chrome-search-capsule {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: 24px;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px 0 18px;
  gap: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: all 120ms var(--ease-google);
}

.chrome-search-capsule:focus-within {
  background: var(--bg-surface-hover);
  border-color: var(--border-focus);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.capsule-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
}

.capsule-btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
}

.capsule-btn-icon:hover {
  color: var(--text-primary);
}

.capsule-divider {
  width: 1px;
  height: 20px;
  background: var(--border-default);
  margin: 0 4px;
}

.header-right-col {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link-item {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 4px;
  transition: background 120ms;
}

.nav-link-item:hover {
  background: var(--bg-surface-elevated);
  color: #fff;
}

.btn-chrome-dev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: #000000;
  border: 1px solid #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
}

.btn-chrome-dev:hover {
  background: #e4e4e7;
}

.app-grid-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
}

.app-grid-icon:hover {
  background: var(--bg-surface-elevated);
  color: #fff;
}

/* Category Filter Tabs */
.chrome-subnav-tabs {
  display: none; /* Toggled on results view */
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  height: 44px;
  background: var(--bg-pitch-black);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px 0 168px; /* Aligns with search results */
  align-items: center;
  gap: 20px;
  z-index: 190;
}

.subnav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 3px solid transparent;
  transition: all 120ms;
}

.subnav-tab:hover {
  color: var(--text-primary);
}

.subnav-tab.active {
  color: var(--link-blue);
  border-bottom-color: var(--link-blue);
  font-weight: 600;
}

.nova-tab-logo {
  height: 20px;
  width: auto;
  max-width: 140px;
  border-radius: 3px;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
}

.nova-badge-logo {
  height: 20px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
}

.nova-card-logo {
  height: 24px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
}

/* ========================================================================= */
/* 2. CHROME HOMEPAGE VIEW (Initial Centered State) */
/* ========================================================================= */
.chrome-home-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 40px 24px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.home-big-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
  user-select: none;
}

.home-hero-logo {
  height: 72px;
  width: auto;
  max-width: 85vw;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 24px rgba(255, 255, 255, 0.06));
}

.home-form-wrapper {
  width: 100%;
  position: relative;
}

.home-search-capsule {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: 28px;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 16px 0 20px;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: all 140ms var(--ease-google);
}

.home-search-capsule:focus-within {
  background: var(--bg-surface-hover);
  border-color: var(--border-focus);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7);
}

.home-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  outline: none;
}

/* AUTOCOMPLETE SUGGESTIONS DROPDOWN */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.85);
  z-index: 600;
  display: none;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--text-primary);
  font-size: 14.5px;
  cursor: pointer;
  transition: background 80ms;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--bg-surface-hover);
}

.autocomplete-item-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.autocomplete-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autocomplete-item-text strong {
  color: #ffffff;
  font-weight: 600;
}

/* Single segmented control under the search bar. One bordered container with
   hairline-divided cells reads as one control, where three free-standing
   buttons read as three competing choices. */
.home-mode-switch {
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: fit-content;
  margin: 24px auto 0 auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.mode-option {
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 120ms, color 120ms;
}

.mode-option:first-child {
  border-left: none;
}

.mode-option:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.mode-option:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -2px;
}

.nova-mode-logo {
  width: 15px;
  height: 15px;
  border-radius: 3px;
}

/* ========================================================================= */
/* 3. CHROME RESULTS VIEW (Standard 652px Column + Side Panel) */
/* ========================================================================= */
.chrome-results-view {
  display: none; /* Toggled on search */
  max-width: 1200px;
  margin: 108px auto 0 auto;
  padding: 16px 24px 80px 168px; /* Standard Chrome result indent */
  width: 100%;
  display: flex;
  gap: 48px;
}

.results-col-main {
  width: 652px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.results-col-side {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.results-stats-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: -12px;
}

/* ========================================================================= */
/* 4. GOOGLE CHROME "AI OVERVIEW" CONTAINER */
/* ========================================================================= */
.chrome-ai-overview-card {
  background: var(--bg-ai-card);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-overview-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
}

.ai-sparkle-badge {
  color: var(--link-blue);
  display: flex;
  align-items: center;
}

.ai-model-tag {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.btn-ai-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-ai-icon:hover {
  background: var(--bg-surface-elevated);
  color: #fff;
}

/* COMPACT INTEGRATED SOURCES CAROUSEL */
.ai-sources-compact-wrap {
  margin-top: 2px;
  margin-bottom: 2px;
}

.sources-compact-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ai-sources-compact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: #27272a transparent;
}

.ai-sources-compact-row::-webkit-scrollbar {
  height: 4px;
}

.ai-sources-compact-row::-webkit-scrollbar-track {
  background: transparent;
}

.ai-sources-compact-row::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 4px;
}

.ai-sources-compact-row::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

.source-compact-chip {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 12px;
  flex-shrink: 0;
  max-width: 210px;
  transition: all 120ms;
}

.source-compact-chip:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-default);
}

.source-chip-favicon {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.source-chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

/* SLEEK PULSING SHIMMER ANIMATION FOR LOADING */
.ai-shimmer-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0;
}

.ai-shimmer-line {
  height: 14px;
  background: linear-gradient(90deg, #18181b 0%, #27272a 50%, #18181b 100%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmerWave 1.6s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes shimmerWave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* AI Answer Content */
.ai-overview-body {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-primary);
}

.ai-overview-body p {
  margin-bottom: 12px;
}

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

.ai-overview-body strong {
  color: #ffffff;
  font-weight: 600;
}

.ai-overview-body ul {
  padding-left: 18px;
  margin-bottom: 12px;
}

.ai-overview-body li {
  margin-bottom: 6px;
}

.cite-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--link-blue);
  background: rgba(122, 162, 247, 0.12);
  border: 1px solid rgba(122, 162, 247, 0.3);
  padding: 0 4px;
  border-radius: 3px;
  cursor: pointer;
  margin: 0 2px;
  text-decoration: none;
}

.cite-chip:hover {
  background: rgba(122, 162, 247, 0.25);
}

/* ========================================================================= */
/* 5. ORGANIC CHROME WEB RESULTS */
/* ========================================================================= */
.organic-results-group {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.chrome-web-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-site-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-favicon-box {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.result-site-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;          /* allow the breadcrumb below to actually truncate */
}

.result-site-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.result-breadcrumb-url {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Google News RSS URLs are long unbreakable strings. A flat 480px cap made
     the element 480px wide regardless of viewport, which widened the layout
     viewport to 524px on a 375px phone and dragged the fixed header with it. */
  max-width: min(480px, 100%);
}

.result-title-link {
  font-size: 19px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--link-blue);
  text-decoration: none;
  margin-top: 2px;
}

.result-title-link:hover {
  text-decoration: underline;
}

.result-snippet-text {
  font-size: 13.5px;
  line-height: 1.58;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Side Card Finance Panel */
.chrome-side-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 18px 20px;
}

.side-card-heading {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.side-card-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.stock-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.stock-price-main {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
}

.stock-price-change {
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.stock-price-change.is-up {
  color: var(--accent-green);
}

.stock-price-change.is-down {
  color: var(--accent-red);
}

.side-card-footnote {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Quote is in flight — dim the figures rather than showing stale ones. */
.chrome-side-card.is-loading .stock-price-main,
.chrome-side-card.is-loading .stock-price-change,
.chrome-side-card.is-loading .stock-metrics-grid {
  opacity: 0.45;
}

.stock-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
}

.metric-pair {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}

.metric-pair strong {
  color: var(--text-primary);
}

/* Citation Tooltip */
.citation-tooltip {
  position: absolute;
  z-index: 1000;
  background: #141416;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 12px 14px;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  font-size: 12px;
}

.tooltip-header {
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.tooltip-quote {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 6px;
}

.tooltip-link {
  color: var(--link-blue);
  text-decoration: none;
  font-size: 11.5px;
}

.tooltip-link:hover {
  text-decoration: underline;
}

/* Footer */
.chrome-footer {
  margin-top: auto;
  background: var(--bg-pitch-black);
  border-top: 1px solid var(--border-subtle);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--text-primary);
}

/* ========================================================================= */
/* 8. RESPONSIVE — NARROW VIEWPORTS */
/* ========================================================================= */
/* The desktop layout is built from fixed widths: a 168px Chrome-style result
   indent, a 652px main column, a 48px gap and a 360px side column. Side by
   side those need 1252px of viewport, so everything below that overflowed
   horizontally — iPads and part-screen laptop windows included, not just
   phones. Three steps down: drop the indent, then stack the columns, then trim
   the header and footer. */

/* Labels should break the layout before they break themselves. */
.nav-link-item,
.btn-chrome-dev,
.footer-link,
.footer-left > span {
  white-space: nowrap;
}

/* Step 1 — reclaim the 168px indent, which buys ~144px. */
@media (max-width: 1260px) {
  .chrome-results-view {
    padding-left: 24px;
  }

  .chrome-subnav-tabs {
    padding-left: 24px;
  }
}

/* Step 2 — below this the two columns cannot sit side by side at all, so the
   side card moves under the results instead. */
@media (max-width: 1120px) {
  .chrome-results-view {
    flex-direction: column;
    gap: 28px;
  }

  .results-col-main,
  .results-col-side {
    width: 100%;
    max-width: 652px;
    flex-shrink: 1;
    min-width: 0;
  }
}

/* Step 3 — phone widths: the header and footer rows stop fitting. */
@media (max-width: 720px) {
  .chrome-header {
    padding: 0 12px;
    gap: 10px;
  }

  .header-left-col {
    gap: 12px;
    min-width: 0;        /* let the search capsule shrink instead of overflow */
  }

  .header-search-box {
    min-width: 0;
  }

  /* A text input has an intrinsic default width and will not shrink below it
     on its own, which is what still forced the layout viewport to 524px on a
     375px phone even after the flex parents were allowed to shrink. */
  .capsule-search-input {
    min-width: 0;
  }

  /* Voice and image search are secondary; dropping them gives the query text
     the room it needs at this width. Clear and submit stay. */
  .capsule-btn-optional {
    display: none;
  }

  /* Both links remain reachable in the footer, which is the better place for
     them at this width than a header that has a search field to fit. */
  .nav-link-item {
    display: none;
  }

  /* Decorative only — no handler is bound to it. */
  .app-grid-icon {
    display: none;
  }

  .btn-chrome-dev {
    font-size: 12px;
    padding: 6px 10px;
  }

  .chrome-footer {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    text-align: center;
  }

  .footer-left,
  .footer-right {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
  }

  /* The subnav bar is part of the fixed header stack and carried the same
     desktop indent, which pushed its own last tabs off-screen. */
  .chrome-subnav-tabs {
    padding: 0 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chrome-subnav-tabs::-webkit-scrollbar {
    display: none;
  }

  /* Note: display is left alone here — search.js toggles it inline. */
  .chrome-results-view {
    gap: 24px;
    padding: 16px 16px 60px 16px;
  }
}

@media (max-width: 400px) {
  /* At phone widths the home capsule's two icon buttons crowd the input. */
  .home-search-capsule {
    padding: 0 10px 0 14px;
    gap: 8px;
  }

  .mode-option {
    padding: 9px 13px;
  }
}
