/* ─── Variables & Reset ─────────────────────────────────────────────────── */
:root {
  --primary:   #6366f1;
  --primary-d: #4f46e5;
  --success:   #22c55e;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --dark:      #0f172a;
  --dark2:     #1e293b;
  --muted:     #64748b;
  --light:     #f0f4f8;
  --white:     #ffffff;
  --border:    #e2e8f0;
  --radius:    14px;
  --shadow:    0 2px 16px rgba(0,0,0,.07);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--light); color: var(--dark2); font-size: 15px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }

/* ─── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--dark);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.navbar-brand { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  transition: opacity .2s;
}
.navbar-brand:hover { opacity: .8; }
.logo-img { width: 50px; height: 50px; object-fit: contain; }
.navbar-logo { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -.5px; }
.navbar-logo span { color: var(--primary); }
.navbar-sub { margin-left: auto; font-size: 12px; color: #475569; }

/* ─── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--dark) 0%, #1e3a5f 100%);
  padding: 60px 32px 52px;
  text-align: center;
  color: #fff;
}
.hero h1 { font-size: clamp(24px, 4vw, 38px); font-weight: 800; margin-bottom: 12px; letter-spacing: -.5px; }
.hero h1 em { color: #818cf8; font-style: normal; }
.hero p { color: #94a3b8; font-size: 16px; margin-bottom: 32px; max-width: 520px; margin-inline: auto; margin-bottom: 32px; }
.url-form { display: flex; max-width: 640px; margin: 0 auto; gap: 0; }
.url-form input {
  flex: 1;
  padding: 16px 20px;
  font-size: 15px;
  border: 2px solid transparent;
  border-radius: var(--radius) 0 0 var(--radius);
  outline: none;
  background: #fff;
  color: var(--dark2);
  transition: border-color .2s;
}
.url-form input:focus { border-color: var(--primary); }
.url-form button {
  padding: 16px 28px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .1s;
  white-space: nowrap;
}
.url-form button:hover  { background: var(--primary-d); }
.url-form button:active { transform: scale(.98); }
.url-form button:disabled { opacity: .6; cursor: not-allowed; }

.url-error { color: #fca5a5; font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ─── Results wrapper ────────────────────────────────────────────────────── */
.results { max-width: 1100px; margin: 32px auto; padding: 0 20px 60px; }
.results-hidden { display: none; }
.analyzed-url { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.analyzed-url strong { color: var(--dark2); }

/* ─── Top grid: score + checks ───────────────────────────────────────────── */
.top-grid { display: grid; grid-template-columns: 290px 1fr; gap: 20px; margin-bottom: 20px; }

/* Score card */
.score-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.score-ring-wrap { position: relative; width: 150px; height: 150px; margin: 0 auto 16px; }
.score-ring {
  width: 150px; height: 150px; border-radius: 50%;
  background: conic-gradient(var(--ring-color, var(--primary)) calc(var(--pct) * 1%), var(--border) 0%);
  display: flex; align-items: center; justify-content: center;
  transition: none;
}
.score-ring-inner {
  width: 116px; height: 116px; background: #fff; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-num { font-size: 40px; font-weight: 900; color: var(--dark2); line-height: 1; }
.score-denom { font-size: 13px; color: var(--muted); }
.score-label { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.score-domain { font-size: 13px; color: var(--muted); margin-bottom: 12px; word-break: break-all; }
.badge { display: inline-block; padding: 4px 14px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warn    { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-blue    { background: #eff6ff; color: #1d4ed8; }
.badge-real    { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; font-size: 11px; }

.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.mini-stat { background: var(--light); padding: 12px; border-radius: 10px; }
.mini-stat .ms-val { font-size: 17px; font-weight: 700; }
.mini-stat .ms-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ms-ok   { color: #16a34a; }
.ms-warn { color: #d97706; }

/* Checks card */
.checks-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; }
.check-item:last-child { border: none; padding-bottom: 0; }
.ci-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.ci-text { flex: 1; min-width: 0; }
.ci-text strong { display: block; font-size: 14px; color: var(--dark2); }
.ci-text span   { font-size: 12px; color: var(--muted); }
.ci-pill { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }

.check-ok   .ci-icon { background: #dcfce7; color: #16a34a; }
.check-warn .ci-icon { background: #fef3c7; color: #d97706; }
.check-bad  .ci-icon { background: #fee2e2; color: #dc2626; }
.check-ok   .ci-pill { background: #dcfce7; color: #15803d; }
.check-warn .ci-pill { background: #fef3c7; color: #b45309; }
.check-bad  .ci-pill { background: #fee2e2; color: #b91c1c; }

/* ─── Traffic cards ──────────────────────────────────────────────────────── */
.section-title { font-size: 15px; font-weight: 700; margin: 24px 0 12px; display: flex; align-items: center; gap: 10px; }
.traffic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.traffic-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.tc-icon  { margin-bottom: 10px; color: var(--primary); line-height: 1; }
.tc-icon svg { display: block; }
.tc-val   { font-size: 26px; font-weight: 800; color: var(--dark2); line-height: 1.1; }
.tc-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tc-trend { font-size: 12px; font-weight: 600; margin-top: 6px; color: #16a34a; }
.tc-trend.real { color: var(--primary); }

/* ─── Keywords table ─────────────────────────────────────────────────────── */
.kw-card { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-top: 20px; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; padding-bottom: 12px; }
tbody td { padding: 10px 0; font-size: 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:last-child td { border: none; }
.pos-badge { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 7px; font-weight: 700; font-size: 13px; }
.pos-top  { background: #dcfce7; color: #15803d; }
.pos-mid  { background: #fef3c7; color: #b45309; }
.pos-low  { background: #fee2e2; color: #b91c1c; }

/* ─── Local SEO (Google Business) ────────────────────────────────────────── */
.local-hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  padding: 6px 16px; border-radius: 99px; font-size: 13px; color: #e2e8f0;
  margin-bottom: 18px;
}
.profile-bar-wrap { margin-top: 18px; }
.profile-bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.profile-bar { height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; }
.profile-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #8b5cf6); border-radius: 99px; transition: width 1.2s ease; }

/* ─── Recommendation banner ─────────────────────────────────────────────── */
.reco-banner {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 18px 20px; border-radius: var(--radius);
  margin-bottom: 20px; font-size: 14px;
}
.reco-banner strong { display: block; font-size: 15px; margin-bottom: 4px; }
.reco-banner p { margin: 0; font-size: 13px; opacity: .85; }
.reco-ok   { background: #f0fdf4; border: 1.5px solid #86efac; color: #166534; }
.reco-warn { background: #fffbeb; border: 1.5px solid #fcd34d; color: #92400e; }
.reco-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.reco-list { margin: 8px 0 0 16px; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }

/* ─── Disclaimer ─────────────────────────────────────────────────────────── */
.disclaimer {
  margin-top: 28px;
  background: #fffbeb;
  border-left: 4px solid var(--warning);
  padding: 14px 18px;
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  color: #92400e;
}

/* ─── Loading overlay ────────────────────────────────────────────────────── */
.loader-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.7);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: #fff;
}
.loader-overlay.active { display: flex; }
.spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.2);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
.loader-text { font-size: 16px; font-weight: 600; opacity: .9; }
.loader-steps { font-size: 13px; color: #94a3b8; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Results Actions ────────────────────────────────────────────────────── */
.results-actions {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}
.btn-new-audit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  padding: 14px 28px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
  transition: all .2s;
}
.btn-new-audit:hover {
  background: var(--primary-d);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  color: #fff;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .top-grid { grid-template-columns: 1fr; }
  .score-card { max-width: 340px; margin: 0 auto; }
}
@media (max-width: 640px) {
  .hero { padding: 40px 16px; }
  .url-form { flex-direction: column; }
  .url-form input  { border-radius: var(--radius); }
  .url-form button { border-radius: var(--radius); margin-top: 8px; }
  .traffic-grid { grid-template-columns: 1fr 1fr; }
  .results { padding: 0 12px 40px; }
  .navbar { padding: 12px 16px; }
}
