/* ============ Local SEO Audit Tool ============ */
:root {
  --bg: #0b1020;
  --bg-soft: #11182f;
  --card: #151d38;
  --card-2: #1a2344;
  --border: rgba(255,255,255,.08);
  --text: #eef1fb;
  --muted: #9aa3c0;
  --accent: #6c5ce7;
  --accent-2: #00d2a8;
  --grad: linear-gradient(100deg, #6c5ce7, #00d2a8);
  --pass: #22c55e;
  --warn: #f59e0b;
  --fail: #ef4444;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1e2a5e 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > section, body > header { flex: 0 0 auto; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 640px; }
.center { text-align: center; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Topbar */
.topbar { padding: 18px 0; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; }
.logo { font-family: 'Archivo Black', 'Inter', sans-serif; font-weight: 400; font-size: 1.35rem; letter-spacing: .5px; color: var(--text); text-decoration: none; text-transform: uppercase; line-height: 1.1; }
.logo-sub { display: block; font-family: 'Inter', sans-serif; font-weight: 600; font-size: .6rem; letter-spacing: 4px; color: var(--muted); }
.opt { font-weight: 500; font-size: .72rem; color: var(--muted); opacity: .8; margin-left: 4px; }
.footer a { color: var(--muted); }
.logo-mark { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Buttons */
.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none;
  font-family: inherit; font-weight: 700; font-size: 1rem;
  padding: 12px 22px; border-radius: 12px; transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 24px rgba(108,92,231,.4); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(108,92,231,.55); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-big { width: 100%; padding: 16px 24px; font-size: 1.08rem; }

/* Hero */
.hero { padding: 48px 0 72px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.pill {
  display: inline-block; font-size: .82rem; font-weight: 600; color: var(--accent-2);
  border: 1px solid rgba(0,210,168,.35); background: rgba(0,210,168,.08);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 18px;
}
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.3rem); line-height: 1.12; font-weight: 900; letter-spacing: -1px; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { margin-top: 18px; color: var(--muted); font-size: 1.08rem; max-width: 54ch; }
.trust { list-style: none; margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: .95rem; }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px;
}

/* Form */
.form-card h2 { font-size: 1.4rem; }
.form-sub { color: var(--muted); font-size: .92rem; margin: 4px 0 18px; }
#audit-form label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
#audit-form input {
  display: block; width: 100%; margin-top: 6px;
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; color: var(--text); font: inherit; font-size: .98rem;
  transition: border-color .15s, box-shadow .15s;
}
#audit-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,92,231,.25); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hp { position: absolute !important; left: -9999px !important; height: 0; width: 0; opacity: 0; }
.privacy { font-size: .78rem; color: var(--muted); text-align: center; margin-top: 12px; }
#run-btn { margin-top: 6px; }
#run-btn:disabled { opacity: .6; cursor: wait; }

/* Loading */
.loading { padding: 90px 0 120px; }
.scanner { position: relative; width: 110px; height: 110px; margin: 0 auto 26px; }
.scan-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid rgba(108,92,231,.25); border-top-color: var(--accent-2);
  animation: spin 1s linear infinite;
}
.scan-dot {
  position: absolute; inset: 32px; border-radius: 50%;
  background: var(--grad); opacity: .9; animation: pulse 1.4s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { transform: scale(.85); opacity: .7; } 50% { transform: scale(1); opacity: 1; } }
.progress-track { height: 8px; background: rgba(255,255,255,.08); border-radius: 999px; margin: 26px auto 14px; max-width: 420px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--grad); border-radius: 999px; transition: width .6s ease; }
.loading-step { color: var(--muted); min-height: 1.6em; }

/* Report head */
.results { padding: 48px 0 80px; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 28px; flex-wrap: wrap; margin-bottom: 22px; }
.report-meta h2 { font-size: 1.7rem; }
.report-meta p { color: var(--muted); }
.report-date { font-size: .82rem; margin-top: 6px; }

/* Gauge */
.overall { position: relative; width: 170px; height: 170px; }
.gauge { width: 170px; height: 170px; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 14; stroke-linecap: round; }
.gauge-bg { stroke: rgba(255,255,255,.08); }
.gauge-val { stroke: url(#gaugeGrad); stroke: var(--accent-2); stroke-dasharray: 540.35; stroke-dashoffset: 540.35; transition: stroke-dashoffset 1.4s cubic-bezier(.22,1,.36,1), stroke .4s; }
.gauge-label { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.gauge-num { font-size: 2.6rem; font-weight: 900; line-height: 1; }
.gauge-grade { font-size: .72rem; font-weight: 700; color: var(--muted); margin-top: 4px; max-width: 100px; text-align: center; line-height: 1.3; }

/* Mini score grid */
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 14px; margin-bottom: 22px; }
.mini {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 12px; text-align: center;
}
.mini .m-num { font-size: 1.55rem; font-weight: 800; }
.mini .m-label { font-size: .74rem; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.c-pass { color: var(--pass); } .c-warn { color: var(--warn); } .c-fail { color: var(--fail); }

/* Benchmark bars */
.bench-card { margin-bottom: 22px; }
.bench-card h3, .opp-card h3 { font-size: 1.2rem; margin-bottom: 6px; }
.bench-row { margin-top: 16px; }
.bench-row .b-head { display: flex; justify-content: space-between; font-size: .86rem; margin-bottom: 6px; }
.b-track { height: 10px; background: rgba(255,255,255,.07); border-radius: 999px; position: relative; overflow: visible; }
.b-you { height: 100%; border-radius: 999px; background: var(--grad); width: 0%; transition: width 1s cubic-bezier(.22,1,.36,1); }
.b-avg { position: absolute; top: -4px; width: 3px; height: 18px; background: #fff; opacity: .55; border-radius: 2px; }
.b-legend { display: flex; gap: 18px; font-size: .78rem; color: var(--muted); margin-top: 14px; }
.b-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Opportunities */
.opp-card { margin-bottom: 22px; }
#opp-list { margin: 14px 0 0 0; padding-left: 0; counter-reset: opp; list-style: none; }
#opp-list li {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
#opp-list li:last-child { border-bottom: 0; }
.opp-badge {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; color: #fff;
}
.opp-badge.fail { background: var(--fail); }
.opp-badge.warn { background: var(--warn); }
#opp-list .o-title { font-weight: 700; }
#opp-list .o-fix { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.opp-cta {
  margin-top: 20px; padding: 18px; border-radius: 12px;
  background: rgba(108,92,231,.12); border: 1px solid rgba(108,92,231,.3);
  display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
}

/* Section cards */
.section-card { margin-bottom: 18px; overflow: hidden; padding: 0; }
.section-head {
  display: flex; align-items: center; gap: 14px; padding: 20px 24px;
  cursor: pointer; user-select: none;
}
.section-head .s-icon { font-size: 1.3rem; }
.section-head h3 { flex: 1; font-size: 1.06rem; }
.s-score { font-weight: 800; font-size: 1.05rem; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.06); }
.s-chev { color: var(--muted); transition: transform .25s; }
.section-card.open .s-chev { transform: rotate(180deg); }
.section-body { display: none; padding: 0 24px 20px; }
.section-card.open .section-body { display: block; }
.check {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-top: 1px solid var(--border); font-size: .93rem;
}
.check .ic { flex: 0 0 auto; margin-top: 1px; }
.check .c-label { font-weight: 700; }
.check .c-detail { color: var(--muted); }
.check .c-fix { color: var(--accent-2); font-size: .87rem; margin-top: 3px; }
.section-note { margin-top: 14px; font-size: .8rem; color: var(--muted); font-style: italic; }

/* AI analysis */
.ai-card { margin-bottom: 22px; border: 1px solid rgba(108,92,231,.45); background:
  radial-gradient(500px 160px at 15% -30%, rgba(108,92,231,.25), transparent), linear-gradient(180deg, var(--card), var(--bg-soft)); }
.ai-card h3 { font-size: 1.2rem; margin-bottom: 10px; }
.ai-summary { font-size: 1rem; line-height: 1.7; }
#ai-recs { margin: 8px 0 0 0; padding-left: 22px; }
#ai-recs li { padding: 5px 0; font-size: .95rem; }

/* Competitors */
.comp-card { margin-bottom: 22px; }
.comp-card h3 { font-size: 1.2rem; margin-bottom: 6px; }
#comp-list { list-style: none; margin-top: 12px; padding: 0; }
#comp-list li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
#comp-list li:last-child { border-bottom: 0; }
.comp-rank {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px;
  background: rgba(108,92,231,.18); border: 1px solid rgba(108,92,231,.4);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem;
}
.comp-fav { width: 20px; height: 20px; border-radius: 5px; background: #fff; padding: 2px; }
.comp-info { display: flex; flex-direction: column; min-width: 0; }
.comp-info a { color: var(--text); font-weight: 700; text-decoration: none; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-info a:hover { color: var(--accent-2); }
.comp-host { color: var(--muted); font-size: .8rem; }
.section-note { margin-top: 14px; font-size: .8rem; color: var(--muted); font-style: italic; }

/* Report head extras */
.r-title-row { display: flex; align-items: center; gap: 12px; }
#r-favicon { display: none; width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.btn-pdf { margin-top: 14px; font-size: .88rem; padding: 9px 16px; }

/* Action plan */
.plan-card { margin-top: 22px; }
.plan-card h3 { font-size: 1.2rem; margin-bottom: 6px; }
.plan-group { margin-top: 22px; }
.plan-group h4 { font-size: 1rem; margin-bottom: 4px; }
.plan-group h4.p-fail { color: var(--fail); }
.plan-group h4.p-warn { color: var(--warn); }
.plan-group h4.p-pass { color: var(--pass); }
.plan-note { font-size: .84rem; margin-bottom: 8px; }
.plan-group ul { list-style: none; padding: 0; }
.plan-group li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .93rem; }
.plan-group li:last-child { border-bottom: 0; }
.plan-sec { font-weight: 500; color: var(--muted); font-size: .8rem; }
.plan-fix { color: var(--muted); }
.print-cta { display: none; }

/* Final CTA */
.final-cta { text-align: center; padding: 44px 30px; margin-top: 30px; background:
  radial-gradient(600px 200px at 50% -40%, rgba(108,92,231,.35), transparent), linear-gradient(180deg, var(--card), var(--bg-soft)); }
.final-cta h2 { font-size: 1.7rem; margin-bottom: 10px; }
.final-cta p { color: var(--muted); max-width: 60ch; margin: 0 auto 22px; }
.final-cta .btn-big { width: auto; }
.rerun { margin-top: 26px; }
.rerun a { color: var(--muted); }

/* Error */
.error-card { padding: 40px; margin: 80px 0; }
.error-card h2 { margin-bottom: 10px; }
.error-card p { color: var(--muted); margin-bottom: 20px; }

.footer { padding: 30px 0; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); margin-top: auto; }

/* Responsive */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .score-grid { grid-template-columns: repeat(3, 1fr); }
  .report-head { justify-content: center; text-align: center; }
}
@media (max-width: 520px) {
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  .row2 { grid-template-columns: 1fr; }
  .trust { grid-template-columns: 1fr; }
  .opp-cta { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ============ PRINT / PDF REPORT ============ */
@media print {
  :root {
    --bg: #ffffff; --bg-soft: #ffffff; --card: #ffffff; --card-2: #f6f7fb;
    --border: #d8dce8; --text: #101322; --muted: #4b5265; --shadow: none;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff !important; }
  .topbar, .footer, .rerun, .btn, .opp-cta, .final-cta, .hero, .loading, #error-box { display: none !important; }
  .results { padding: 0; display: block !important; }
  .card { box-shadow: none !important; border: 1px solid var(--border) !important; background: #fff !important; break-inside: avoid; margin-bottom: 14px; }
  .report-head { page-break-inside: avoid; }
  .section-body { display: block !important; }
  .section-card { break-inside: avoid; }
  .s-chev { display: none; }
  .mini { border: 1px solid var(--border); background: #fff; }
  .b-track { background: #e8eaf2; }
  .b-avg { background: #555; opacity: .8; }
  .gauge-bg { stroke: #e8eaf2; }
  .plan-card { break-inside: avoid-page; }
  .plan-group { break-inside: avoid; }
  .print-cta { display: block !important; margin-top: 18px; font-weight: 700; font-size: .95rem; }
  a { color: #101322; text-decoration: none; }
}
