/* Hide Google's default Translate UI - we drive it with our own dropdown (see i18n.js) */
.goog-te-banner-frame, .goog-te-gadget-icon, .skiptranslate > iframe { display: none !important; }
body { top: 0px !important; position: static !important; }
#google_translate_element { display: none !important; }
.goog-tooltip, .goog-tooltip:hover { display: none !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-2: #F1F3F6;
  --border: #E1E4E9;
  --text: #14171C;
  --text-muted: #6B7280;
  --teal: #0E9C89;
  --teal-dim: #0B7A6B;
  --amber: #B7791F;
  --red: #C13B4E;
  --radius: 14px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --shadow-sm: 0 1px 2px rgba(20, 23, 28, 0.05), 0 1px 3px rgba(20, 23, 28, 0.06);
  --shadow-md: 0 4px 10px rgba(20, 23, 28, 0.06), 0 2px 4px rgba(20, 23, 28, 0.05);
}

* { box-sizing: border-box; }

*, *::before, *::after { transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; }

@keyframes scanline-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: scanline-fade-up 0.35s ease both; }
main, .app-content { animation: scanline-fade-up 0.3s ease both; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { color: var(--teal); font-size: 20px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.brand-tag { color: var(--text-muted); font-size: 13px; }
.domain-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ---------- Search panel ---------- */
.shell { max-width: 1080px; margin: 0 auto; padding: 56px 32px 80px; }
.search-panel { text-align: center; margin-bottom: 48px; }
.search-headline {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.search-sub { color: var(--text-muted); font-size: 16px; margin: 0 0 32px; }

.search-bar-wrap { position: relative; max-width: 680px; margin: 0 auto; }
.search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 6px 6px 18px;
  transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--teal); }
.search-icon { color: var(--text-muted); font-size: 18px; margin-right: 10px; }
#keywordInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  padding: 14px 0;
  font-family: var(--font-body);
}
#keywordInput::placeholder { color: #565C6B; }

.scan-btn {
  background: var(--teal);
  color: #08211C;
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.scan-btn:hover { background: #45E2C7; }
.scan-btn:active { transform: scale(0.97); }
.scan-btn:disabled { background: var(--teal-dim); cursor: not-allowed; }

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  z-index: 10;
  text-align: left;
}
.suggestions.hidden { display: none; }
.suggestion-item {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
}
.suggestion-item:hover { background: var(--surface); color: var(--text); }

.status-line { margin-top: 16px; font-size: 13px; color: var(--red); min-height: 18px; font-family: var(--font-mono); }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
}
.filter-bar.hidden { display: none; }
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-group label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.filter-dash { color: var(--text-muted); font-size: 12px; }
.filter-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: var(--font-mono);
}
.filter-input:focus { outline: none; border-color: var(--teal); }
.filter-input-sm { width: 68px; }
.checkbox-label {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-body); text-transform: none; letter-spacing: normal; font-size: 13px; color: var(--text);
  cursor: pointer;
}
.checkbox-label input { accent-color: var(--teal); }
.filter-reset-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.15s, color 0.15s;
}
.filter-reset-btn:hover { border-color: var(--teal); color: var(--teal); }

/* ---------- Results ---------- */
.results-header {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--border);
}
.results-header.hidden { display: none; }
.results-count { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--teal); margin-right: 8px; }
.results-label { color: var(--text-muted); font-size: 13px; }
.results-source { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.empty-state, .loading-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-glyph { font-size: 32px; color: var(--border); margin-bottom: 12px; }
.hidden { display: none !important; }

.scan-line {
  width: 100%;
  max-width: 320px;
  height: 2px;
  margin: 0 auto 20px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  background-size: 200% 100%;
  animation: scanmove 1.4s linear infinite;
}
@keyframes scanmove {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, transform 0.15s;
}
.product-card:hover { border-color: #3A4152; transform: translateY(-2px); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.card-image {
  width: 64px; height: 64px; object-fit: contain; border-radius: 8px;
  background: #fff; padding: 4px;
}

.gauge { position: relative; width: 52px; height: 52px; }
.gauge-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: var(--surface-2); stroke-width: 5; }
.gauge-fill {
  fill: none; stroke: var(--teal); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 163.36; stroke-dashoffset: 163.36;
  transition: stroke-dashoffset 0.6s ease, stroke 0.3s;
}
.gauge-value {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
}

.card-title {
  font-size: 13.5px; font-weight: 500; line-height: 1.4; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 37px;
}

.card-meta { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: 13px; }
.card-price { color: var(--amber); font-weight: 700; }
.card-rating { color: var(--text-muted); }

.card-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 6px; border-top: 1px solid var(--border); }
.card-reviews { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.analyze-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 6px 10px; font-size: 12px; cursor: pointer; font-family: var(--font-body);
  transition: border-color 0.15s, color 0.15s;
}
.analyze-btn:hover { border-color: var(--teal); color: var(--teal); }

/* ---------- Detail overlay ---------- */
.detail-overlay {
  position: fixed; inset: 0; background: rgba(4,5,8,0.75);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.detail-overlay.hidden { display: none; }
.detail-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 28px; position: relative;
}
.close-btn {
  position: absolute; top: 16px; right: 16px; background: var(--surface-2); border: none;
  color: var(--text-muted); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.close-btn:hover { color: var(--text); }

.detail-content h2 { font-family: var(--font-display); font-size: 20px; margin: 0 24px 16px 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.detail-stat {
  background: var(--surface-2); border-radius: 10px; padding: 12px 14px;
}
.detail-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.detail-stat-value { font-family: var(--font-mono); font-size: 17px; font-weight: 700; }
.detail-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; padding-top: 10px; border-top: 1px solid var(--border); }

@media (max-width: 640px) {
  .search-headline { font-size: 28px; }
  .shell { padding: 32px 18px 60px; }
}
