/* ==========================================================================
   Keyword Research Tool — Stylesheet
   Simple, single file, no build step. Edit the tokens in :root to re-theme.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* --- Color tokens ------------------------------------------------- */
  --bg:            #F5F7FA;   /* page background — pale slate blue, not cream */
  --surface:       #FFFFFF;   /* cards / panels */
  --surface-sunken:#EEF1F0;   /* input backgrounds, subtle wells */
  --ink:           #1B2430;   /* primary text — dark slate, not pure black */
  --ink-soft:      #5B6472;   /* secondary text */
  --border:        #E1E6E2;   /* hairline borders instead of shadows */

  --teal:          #2F6F5E;   /* primary accent — forest teal */
  --teal-dark:     #234F42;
  --teal-tint:     #E4EEEA;

  --gold:          #C9A227;   /* secondary accent — muted gold, used sparingly */
  --gold-tint:     #F7F1DE;

  --red:           #B5484A;   /* used only for limits / destructive actions */
  --red-tint:      #F6E9E9;

  /* --- Type ----------------------------------------------------------- */
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* --- Layout ----------------------------------------------------------- */
  --radius: 8px;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; }

/* Faint dot-grid on the page background — nods to graph-paper / research feel */
body {
  background-image: radial-gradient(circle, #DCE2E6 1px, transparent 1px);
  background-size: 22px 22px;
}

/* ==========================================================================
   Top navbar (replaces the old sidebar)
   ========================================================================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-link svg { flex-shrink: 0; }

.nav-link.active {
  background: var(--teal-tint);
  color: var(--teal-dark);
}

.nav-link:not(.active):hover {
  background: var(--surface-sunken);
  color: var(--ink);
}

.navbar-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-outline {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}
.btn-outline:hover { border-color: var(--teal); color: var(--teal-dark); }

.btn-text {
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 6px;
  text-decoration: none;
}
.btn-text:hover { color: var(--ink); }

/* Compact usage pill shown in the app navbar (dashboard/admin) */
.usage-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ink-soft);
}
.usage-pill strong {
  font-family: var(--font-mono);
  color: var(--ink);
  font-weight: 500;
}
.usage-pill .usage-bar-track {
  width: 46px;
  height: 5px;
  background: #DCE2DE;
  border-radius: 4px;
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 4px;
  display: block;
}
.usage-bar-fill.warn { background: var(--gold); }
.usage-bar-fill.limit { background: var(--red); }

/* Mobile nav (links hide on small screens — kept intentionally simple) */
@media (max-width: 860px) {
  .navbar-links { display: none; }
}

/* --- Main column ------------------------------------------------------ */

.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 28px 70px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
}

.page-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
}

.page-subtitle {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin: 0;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px 6px 6px;
  font-size: 13px;
}

.account-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold-tint);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 11px;
}

.plan-badge {
  font-size: 10.5px;
  background: var(--teal-tint);
  color: var(--teal-dark);
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 600;
}

/* --- Search hero -------------------------------------------------------- */

.search-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 34px;
  margin-bottom: 28px;
}

.search-hero-label {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin-bottom: 14px;
  text-align: center;
}

.search-row {
  display: flex;
  gap: 12px;
  max-width: 780px;
  margin: 0 auto;
}

.search-input-wrap {
  flex: 1;
  position: relative;
}

.search-input-wrap svg {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  width: 20px;
  height: 20px;
}

#keyword-input {
  width: 100%;
  height: 58px;
  padding: 0 20px 0 52px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-sunken);
  font-size: 17px;
  font-family: var(--font-body);
  color: var(--ink);
}

#keyword-input:focus {
  outline: none;
  border-color: var(--teal);
  background: var(--surface);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: none;
  border-radius: 8px;
  padding: 0 20px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover { background: var(--teal-dark); }
.btn-primary:disabled { background: #9FB4AD; cursor: not-allowed; }

.search-row .btn-primary {
  height: 58px;
  padding: 0 28px;
  font-size: 15.5px;
  border-radius: 12px;
}

.search-meta {
  justify-content: center;
}

.search-meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.search-meta span strong { color: var(--ink); font-family: var(--font-mono); font-weight: 500; }

/* --- Results grid ------------------------------------------------------- */

.results-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 980px) {
  .results-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px 20px;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.panel-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.panel-tag {
  font-size: 11px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
}

/* Suggestion / question lists */
.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
}
.pill:hover { border-color: var(--teal); color: var(--teal-dark); }

.qa-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.qa-list li {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}
.qa-list li:last-child { border-bottom: none; }
.qa-list li:hover { color: var(--teal-dark); }
.qa-list li span.src {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  align-self: center;
}

/* Source engine tag colors (subtle text only, no loud badges) */
.src.google { color: #4285A6; }
.src.bing   { color: #2F6F5E; }
.src.yahoo  { color: #7A5FA0; }
.src.ddg    { color: #B5484A; }

/* --- Mind map panel ------------------------------------------------------ */

#mindmap-panel .panel-head { margin-bottom: 6px; }

#mindmap-svg {
  width: 100%;
  height: 360px;
  display: block;
}

.mindmap-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-soft);
}
.mindmap-legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* --- Metrics table ------------------------------------------------------- */

table.metrics {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.metrics th {
  text-align: left;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 500;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
table.metrics td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
}
table.metrics tr:last-child td { border-bottom: none; }
table.metrics td.kw { font-weight: 500; }
table.metrics td.num { font-family: var(--font-mono); text-align: right; }

.diff-bar-track {
  width: 60px;
  height: 5px;
  background: var(--surface-sunken);
  border-radius: 3px;
  display: inline-block;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}
.diff-bar-fill { height: 100%; border-radius: 3px; background: var(--teal); }

/* --- SERP panel ------------------------------------------------------- */

.serp-list { list-style: none; margin: 0; padding: 0; }
.serp-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.serp-item:last-child { border-bottom: none; }
.serp-rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--teal-dark);
  background: var(--teal-tint);
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 8px;
}
.serp-domain { font-weight: 600; font-size: 13.5px; }
.serp-title { font-size: 13px; color: var(--ink-soft); margin: 3px 0 0 0; }

/* --- Empty state --------------------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--ink-soft);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.6; }
.empty-state p { margin: 0; font-size: 13.5px; }

/* --- Limit banner --------------------------------------------------------- */

.limit-banner {
  display: none;
  background: var(--red-tint);
  color: var(--red);
  border: 1px solid #E7C6C6;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}
.limit-banner.show { display: block; }

/* ==========================================================================
   Admin panel specific
   ========================================================================== */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .admin-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.stat-card .stat-label { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.stat-card .stat-value { font-family: var(--font-head); font-size: 24px; font-weight: 600; }
.stat-card .stat-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.admin-table th {
  text-align: left;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
table.admin-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px;
}
.status-dot.ok { background: var(--teal); }
.status-dot.warn { background: var(--gold); }
.status-dot.blocked { background: var(--red); }

.mini-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-body);
}
.mini-btn:hover { border-color: var(--teal); color: var(--teal-dark); }
.mini-btn.danger:hover { border-color: var(--red); color: var(--red); }

.settings-form label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.settings-form input[type="number"] {
  width: 100px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-sunken);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-text strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.settings-row-text span { font-size: 12px; color: var(--ink-soft); }

/* Toggle switch */
.switch { position: relative; width: 38px; height: 21px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute; inset: 0; background: #C7CDC9; border-radius: 20px; cursor: pointer; transition: .15s;
}
.switch-track:before {
  content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .15s;
}
.switch input:checked + .switch-track { background: var(--teal); }
.switch input:checked + .switch-track:before { transform: translateX(17px); }

/* ==========================================================================
   Marketing / public pages: home, pricing, login, signup, legal
   ========================================================================== */

.footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 32px 28px 40px;
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-links {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
}
.footer-links a:hover { color: var(--teal-dark); }
.footer-note {
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* --- Hero (home page) --------------------------------------------------- */

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 64px 28px 40px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--teal-tint);
  color: var(--teal-dark);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--font-head);
  font-size: 40px;
  line-height: 1.18;
  font-weight: 700;
  margin: 0 0 16px;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  letter-spacing: -0.01em;
}

.hero p.hero-sub {
  font-size: 16.5px;
  color: var(--ink-soft);
  max-width: 560px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 8px;
}

.btn-lg {
  padding: 0 26px;
  height: 50px;
  font-size: 15.5px;
  border-radius: 10px;
}

.hero-note {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 14px;
}

/* Hero mock preview panel */
.hero-preview {
  max-width: 900px;
  margin: 40px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: left;
}
.hero-preview-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.hero-preview-bar span {
  width: 9px; height: 9px; border-radius: 50%; background: var(--border);
}

/* --- Feature grid --------------------------------------------------------- */

.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 50px 28px;
}

.section-head {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 36px;
}
.section-head h2 {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 10px;
}
.section-head p {
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 860px) { .feature-grid { grid-template-columns: 1fr; } }

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
}
.feature-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--teal-tint);
  color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.feature-card h3 {
  font-family: var(--font-head);
  font-size: 15.5px;
  margin: 0 0 8px;
}
.feature-card p {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0;
}

/* --- Pricing --------------------------------------------------------------- */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}
@media (max-width: 700px) { .pricing-grid { grid-template-columns: 1fr; } }

.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 26px;
  position: relative;
}
.price-card.featured {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal);
}
.price-card .badge-soon {
  position: absolute;
  top: 22px; right: 22px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-tint);
  padding: 3px 10px;
  border-radius: 20px;
}
.price-plan-name {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
}
.price-value {
  font-family: var(--font-head);
  font-size: 34px;
  font-weight: 700;
  margin: 10px 0 4px;
}
.price-value span {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}
.price-desc {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 18px;
}
.price-features {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.price-features li {
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.price-features li svg { color: var(--teal); flex-shrink: 0; }
.price-features li.disabled { color: var(--ink-soft); }
.price-features li.disabled svg { color: var(--border); }

/* --- Auth pages (login / signup) ------------------------------------------- */

.auth-wrap {
  max-width: 420px;
  margin: 60px auto;
  padding: 0 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px 30px;
}
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-head h1 {
  font-family: var(--font-head);
  font-size: 21px;
  margin: 0 0 6px;
}
.auth-head p {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-sunken);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
}
.field input:focus {
  outline: none;
  border-color: var(--teal);
  background: var(--surface);
}

.btn-block { width: 100%; height: 46px; font-size: 14.5px; margin-top: 6px; }

.auth-divider {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  margin: 18px 0;
}

.auth-switch {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 18px;
}
.auth-switch a { color: var(--teal-dark); font-weight: 600; text-decoration: none; }

.plan-note {
  background: var(--teal-tint);
  color: var(--teal-dark);
  font-size: 12.5px;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 18px;
  text-align: center;
}

/* --- Legal pages (terms / privacy / refund) --------------------------------- */

.legal-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 50px 28px 80px;
}
.legal-wrap h1 {
  font-family: var(--font-head);
  font-size: 28px;
  margin: 0 0 6px;
}
.legal-updated {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0 0 30px;
}
.legal-wrap h2 {
  font-family: var(--font-head);
  font-size: 16px;
  margin: 30px 0 10px;
  color: var(--teal-dark);
}
.legal-wrap p, .legal-wrap li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 12px;
}
.legal-wrap ul { padding-left: 20px; }
.legal-note {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 30px;
}
