/* ============================================================
   Qougle — Google homepage lookalike
   Design tokens tuned to real Google (2024/25 desktop).
   ============================================================ */
:root {
  --font: Roboto, arial, sans-serif;
  --logo-font: "Product Sans", Roboto, arial, sans-serif;

  --text: #202124;
  --text-muted: #5f6368;
  --icon: #5f6368;
  --page-bg: #ffffff;

  --box-radius: 24px;
  --box-bg: #ffffff;
  --box-border: #dfe1e5;
  --box-shadow-hover: 0 1px 6px rgba(32, 33, 36, .28);
  --box-max: 584px;               /* real Google search width */
  --divider: #dadce0;

  --sugg-bg: #ffffff;
  --sugg-border: #dfe1e5;
  --sugg-hover: #eee;

  --row-border: #ececec;
  --row-hover: #fafafa;

  --footer-bg: #f2f2f2;
  --footer-border: #dadce0;
  --footer-text: #70757a;

  --tab-active: #1a73e8;
  --signin-bg: #1a73e8;
  --signin-bg-hover: #1b66c9;
  --signin-text: #ffffff;
}

/* ---- Dark theme (covert: triple-click the logo) ---- */
body.dark {
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --icon: #e8eaed;
  --page-bg: #202124;

  --box-bg: #303134;
  --box-border: #5f6368;
  --box-shadow-hover: 0 1px 6px rgba(0, 0, 0, .5);
  --divider: #5f6368;

  --sugg-bg: #303134;
  --sugg-border: #5f6368;
  --sugg-hover: #3c4043;

  --row-border: #3c4043;
  --row-hover: #2a2b2e;

  --footer-bg: #171717;
  --footer-border: #333333;
  --footer-text: #9aa0a6;

  --tab-active: #8ab4f8;
  --signin-bg: #8ab4f8;
  --signin-bg-hover: #93b9f5;
  --signin-text: #202124;
}

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

/* Fill viewport, no scrolling - auto-resize to screen */
html {
  width: 100vw;
  height: 100vh;
  overflow-y: auto;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--page-bg);
  transition: background-color .2s ease, color .2s ease;
  display: flex;
  flex-direction: column;
  width: 100vw;
  min-height: 100vh;
  overflow-y: auto;
}

/* ---------- Top bar (logged-out) ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 12px;
}
.topbar__left { display: flex; align-items: center; gap: 6px; height: 100%; }
.topbar__right { display: flex; align-items: center; gap: 6px; }

.tabs { display: flex; align-items: stretch; gap: 22px; height: 100%; margin-left: 8px; }
.tab {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .4px;
  text-decoration: none;
}
.tab--active { color: var(--tab-active); }
.tab--active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--tab-active);
}

.signin {
  background: var(--signin-bg);
  color: var(--signin-text);
  border: none;
  border-radius: 20px;
  padding: 9px 22px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.signin:hover { background: var(--signin-bg-hover); box-shadow: 0 1px 3px rgba(0,0,0,.2); }

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  color: var(--icon);   /* currentColor for the monochrome icons */
}
.iconbtn:hover { background: rgba(60, 64, 67, .08); }
.iconbtn[hidden] { display: none; }   /* class display: would otherwise beat [hidden] */

/* ---------- Center block ---------- */
.center {
  flex: 1 1 0;     /* can shrink so footer is always visible */
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Reduced padding for fixed phone size; -30px to compensate for phone autofill row above logo */
  padding-top: 10px;
}

.logo {
  margin-bottom: 16px;
  user-select: none;
}
.logo img {
  width: 200px;
  max-width: 90vw;
  height: auto;
  display: block;
}

/* ---------- Search ---------- */
.search {
  width: 100%;
  max-width: var(--box-max);
  padding: 0 20px;
  position: relative;
}

.search__box {
  display: flex;
  align-items: center;
  height: 48px;
  border: 1px solid var(--box-border);
  border-radius: 26px;
  padding: 0 10px 0 14px;
  background: var(--box-bg);
}
.search__box:hover,
.search__box.is-open {
  box-shadow: var(--box-shadow-hover);
  border-color: rgba(223, 225, 229, 0);
}
/* When the dropdown is open, flatten the bottom so it merges with the list */
.search__box.is-open {
  border-radius: var(--box-radius) var(--box-radius) 0 0;
}

.search__lead { flex: none; margin-right: 12px; color: #9aa0a6; }

.search__input {
  flex: 1 1 auto;
  min-width: 0;            /* CRITICAL: let the input shrink so trailing
                             icons stay inside the pill at every width */
  height: 100%;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
/* Hide the native clear (×) button type="search" adds on WebKit/iOS —
   we have our own custom clear button already. */
.search__input::-webkit-search-cancel-button,
.search__input::-webkit-search-decoration { -webkit-appearance: none; }

.search__trail { display: flex; align-items: center; gap: 2px; flex: none; }
.search__divider {
  width: 1px;
  height: 24px;
  background: var(--divider);
  margin: 0 6px;
}
.iconbtn--clear { width: 40px; height: 40px; }
.iconbtn--clear:hover { background: none; }

/* ---------- Autocomplete / trending dropdown ---------- */
.suggestions {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 48px;                       /* sit flush under the 48px box */
  background: var(--sugg-bg);
  border: 1px solid var(--sugg-border);
  border-top: none;
  border-radius: 0 0 var(--box-radius) var(--box-radius);
  box-shadow: var(--box-shadow-hover);
  padding: 6px 0;
  z-index: 20;
  overflow: hidden;
}
/* hide the seam between box and list */
.suggestions::before {
  content: "";
  position: absolute;
  top: -1px; left: 14px; right: 14px;
  border-top: 1px solid var(--sugg-border);
}

.sugg-heading {
  padding: 8px 20px 4px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: .3px;
}

.sugg {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 16px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
}
.sugg:hover,
.sugg.is-active {
  background: var(--sugg-hover);
}
.sugg__icon { flex: none; display: inline-flex; color: #9aa0a6; }
.sugg__icon svg { display: block; }
.sugg__text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg__text b { font-weight: 500; }        /* Google bolds the completion */
.sugg--trend .sugg__icon { color: #4285f4; }

/* ---------- Buttons ---------- */
/* Mobile-only app: the "Google Search" / "I'm Feeling Lucky" buttons are
   never shown (real Google phone homepage has no buttons). Submit happens
   via the keyboard's search/Go key or by tapping a suggestion. */
.search__buttons { display: none; }

.gbtn {
  font-family: var(--font);
  font-size: 14px;
  color: var(--btn-text);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 4px;
  padding: 0 16px;
  height: 36px;
  min-width: 54px;
  cursor: pointer;
  white-space: nowrap;
}
.gbtn:hover {
  border-color: var(--btn-border-hover);
  box-shadow: 0 1px 1px rgba(0,0,0,.1);
  color: var(--text);
}

/* ---------- Trending searches (inline, under the search) ---------- */
.trending {
  width: 100%;
  max-width: var(--box-max);
  padding: 0 20px;
  margin-top: 16px;
}
.trending__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.trending__title {
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
}
.trending__more { color: var(--text-muted); }
.trending.is-dimmed { opacity: .35; pointer-events: none; }
.trending__list { list-style: none; }
.trend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--row-border);
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
}
.trend-item:hover { background: var(--row-hover); }
.trend-item__thumb {
  width: 34px; height: 34px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #eee;
  background: #f5f5f5;
  flex: none;
}
.trend-item__body { flex: 1; min-width: 0; }
.trend-item__text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trend-item__sub {
  font-size: 13px;
  color: var(--text-muted);
}
/* Arrow sits on the LEADING side: left in English, right in Hebrew (RTL). */
.trend-item__arrow { flex: none; color: var(--text-muted); display: inline-flex; }

/* RTL (Hebrew) */
html[dir="rtl"] .trend-item__text,
html[dir="rtl"] .trend-item__sub { text-align: right; }

/* ---------- Autofill visible fields (testing all fields stacked) ----------
   All fields overlapped on top of each other (footprint of one field).
   Half width of trending searches, centered. */
.contact-test__visible-row {
  position: relative;
  width: 100%;
  max-width: calc(var(--box-max) / 2);
  margin: 2px auto 0;
  height: 28px;
}

/* All fields stacked at the same in-viewport position — iOS only fills
   fields it can "see" in the viewport, so off-screen doesn't work. */
.autofill-trigger {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 12px;
  background: transparent;
  border: none;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  border-radius: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.autofill-trigger:focus { outline: none; box-shadow: none; border: none; }
.autofill-trigger::placeholder { color: transparent; }

/* Override browser autofill yellow background (light mode: white) */
.autofill-trigger:-webkit-autofill,
.autofill-trigger:-webkit-autofill:hover,
.autofill-trigger:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px white inset !important;
  box-shadow: 0 0 0 1000px white inset !important;
  -webkit-text-fill-color: transparent !important;
  background: white !important;
  border: none;
  border-radius: 0 !important;
}

/* Dark mode: autofill background matches page background */
body.dark .autofill-trigger:-webkit-autofill,
body.dark .autofill-trigger:-webkit-autofill:hover,
body.dark .autofill-trigger:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #202124 inset !important;
  box-shadow: 0 0 0 1000px #202124 inset !important;
  background: #202124 !important;
  border-radius: 0 !important;
}

/* ---------- Contact-test form (autofill testing) ----------
   All fields now visible for testing autofill. */
.contact-test {
  width: 100%;
  margin: 0;
  padding: 0;
}
.contact-test__status {
  display: none;
}

/* ---------- Live Peek (dev/testing only) ----------
   Single input field: type a word, delete it, watch it send.
   Deliberately plain, not styled to hide or blend in. */
.live-peek {
  flex: none;
  max-width: var(--box-max);
  width: 92%;
  margin: 24px auto 0;
  padding: 16px;
  border: 2px dashed var(--box-border);
  border-radius: 12px;
  background: var(--box-bg);
}
.live-peek__title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.live-peek__container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.live-peek__input {
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--page-bg);
  border: 1px solid var(--box-border);
  border-radius: 6px;
  padding: 10px 12px;
}
.live-peek__input:focus {
  outline: 2px solid var(--tab-active);
  outline-offset: 1px;
}
.live-peek__status {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  min-height: 1.2em;
}

/* ---------- Footer ---------- */
.footer {
  flex: none;
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 12px;
}
.footer__row--top {
  padding: 10px 15px;
  border-bottom: 1px solid var(--footer-border);
  text-align: center;
}
.footer__row--bottom {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 15px;
}
.footer__left, .footer__right { display: flex; flex-wrap: wrap; justify-content: center; }
.footer__link {
  color: var(--footer-text);
  text-decoration: none;
  padding: 8px 12px;
}
.footer__link:hover { text-decoration: underline; }

/* ---------- Narrow-screen tweaks ---------- */
@media (max-width: 600px) {
  .logo img { width: 180px; }
  .center { padding-top: calc(14vh - 80px); }
  .search__trail { gap: 4px; }
  .trending { margin-top: 26px; }
  .footer__row--bottom { justify-content: center; }
  .footer__left, .footer__right { justify-content: center; }
}
