/* SEO Analyzer Pro v3.0 — Mobile-First CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Reset & Base ──────────────────────────────── */
#sap-wrap, #sap-wrap * { box-sizing: border-box; }
#sap-wrap {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 12px 60px;
  color: #111827;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Hero ──────────────────────────────────────── */
.sap-hero {
  text-align: center;
  padding: 40px 16px 28px;
}
.sap-badge-free {
  display: inline-block;
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.sap-hero-title {
  font-size: clamp(22px, 6vw, 38px);
  font-weight: 800;
  margin: 0 0 8px;
  background: linear-gradient(135deg, #111827, #1d4ed8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sap-hero-sub { color: #6b7280; font-size: 15px; margin: 0 0 14px; }
.sap-hero-checks {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.sap-hero-checks span {
  background: #f0fdf4; color: #166534;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
  border: 1px solid #bbf7d0;
}

/* ── Form Card ─────────────────────────────────── */
.sap-form-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  border: 1px solid #f3f4f6;
  margin-bottom: 16px;
}
.sap-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .sap-field-row { grid-template-columns: 1fr; } }

.sap-field { margin-bottom: 16px; }
.sap-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.sap-req { color: #ef4444; }
.sap-optional { color: #9ca3af; font-weight: 400; font-size: 11px; }
.sap-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #f9fafb;
  transition: border-color .2s, box-shadow .2s, background .2s;
  -webkit-appearance: none;
}
.sap-field input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: #fff;
}

/* ── Primary Button ────────────────────────────── */
.sap-btn-primary {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37,99,235,.3);
  transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.sap-btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,235,.4); }
.sap-btn-primary:active:not(:disabled) { transform: scale(.98); }
.sap-btn-primary:disabled { opacity: .65; cursor: not-allowed; }

/* ── Progress ──────────────────────────────────── */
.sap-progress-wrap { margin-top: 14px; }
.sap-progress-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
}
.sap-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 99px;
  transition: width .4s ease;
}
.sap-progress-msg {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  margin: 8px 0 0;
  animation: sap-pulse 1.5s infinite;
}
@keyframes sap-pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.sap-privacy-note { text-align: center; font-size: 12px; color: #9ca3af; margin: 12px 0 0; }

/* ── Alerts ────────────────────────────────────── */
.sap-alert-error {
  background: #fef2f2; color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ── Upgrade Card ──────────────────────────────── */
.sap-upgrade-card {
  background: linear-gradient(135deg, #fffbeb, #fff);
  border: 2px solid #f59e0b;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 16px;
}
.sap-upgrade-emoji { font-size: 44px; margin-bottom: 10px; }
.sap-upgrade-card h3 { font-size: 20px; margin: 0 0 8px; }
.sap-upgrade-card p  { color: #6b7280; margin: 0 0 16px; }
.sap-upgrade-price   { font-size: 32px; font-weight: 800; margin-bottom: 20px; }
.sap-upgrade-price small { font-size: 13px; font-weight: 400; color: #9ca3af; }
.sap-upgrade-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.sap-btn-paypal,.sap-btn-stripe {
  padding: 12px 24px; border-radius: 10px; font-weight: 700;
  font-size: 14px; text-decoration: none; display: inline-block;
  -webkit-tap-highlight-color: transparent;
}
.sap-btn-paypal { background: #003087; color: #fff; }
.sap-btn-stripe  { background: #635bff; color: #fff; }

/* ── Score Header ──────────────────────────────── */
.sap-score-header {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  border: 1px solid #f3f4f6;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.sap-ring-wrap { position: relative; width: 100px; height: 100px; flex-shrink: 0; }
.sap-ring-svg  { width: 100px; height: 100px; }
.sap-ring-arc  { transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1), stroke .4s; }
.sap-ring-num  {
  position: absolute; top:50%; left:50%; transform: translate(-50%,-50%);
  font-size: 22px; font-weight: 800; text-align: center; color: #111827;
}
.sap-ring-num small { font-size: 12px; font-weight: 500; }

.sap-score-info { flex: 1; min-width: 0; }
.sap-analyzed-url { font-size: 13px; color: #6b7280; word-break: break-all; margin-bottom: 8px; }
.sap-badges-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.sap-chip {
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.sap-chip.good { background: #dcfce7; color: #16a34a; }
.sap-chip.warn { background: #fef9c3; color: #a16207; }
.sap-chip.bad  { background: #fee2e2; color: #dc2626; }
.sap-report-meta { font-size: 11px; color: #9ca3af; }

/* ── Action Bar ────────────────────────────────── */
.sap-action-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.sap-action-btn {
  flex: 1; min-width: 120px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px;
  border: none; border-radius: 10px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .15s, box-shadow .15s;
}
.sap-action-btn:active { transform: scale(.97); }
.sap-action-btn.pdf   { background: #0f172a; color: #fff; }
.sap-action-btn.share { background: #2563eb; color: #fff; }
.sap-action-btn.reset { background: #f3f4f6; color: #374151; }
.sap-action-btn.pdf:hover   { box-shadow: 0 4px 12px rgba(15,23,42,.3); }
.sap-action-btn.share:hover { box-shadow: 0 4px 12px rgba(37,99,235,.3); }

/* ── Toast ─────────────────────────────────────── */
.sap-toast {
  background: #111827; color: #fff;
  padding: 10px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  text-align: center; margin-bottom: 12px;
  animation: sap-fadeout 3s forwards;
}
@keyframes sap-fadeout { 0%,70%{opacity:1} 100%{opacity:0} }

/* ── Tabs ───────────────────────────────────────── */
.sap-tabs {
  display: flex; gap: 4px;
  background: #f3f4f6;
  border-radius: 12px; padding: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.sap-tab {
  flex: 1; min-width: 80px;
  padding: 9px 12px;
  border: none; border-radius: 9px;
  background: transparent;
  font-size: 13px; font-weight: 600; font-family: inherit;
  color: #6b7280; cursor: pointer;
  white-space: nowrap;
  transition: background .2s, color .2s;
  -webkit-tap-highlight-color: transparent;
}
.sap-tab.active { background: #fff; color: #111827; box-shadow: 0 1px 4px rgba(0,0,0,.1); }

.sap-tab-panel { display: none; }
.sap-tab-panel.active { display: block; }

/* ── Results Grid ───────────────────────────────── */
.sap-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 480px) { .sap-results-grid { grid-template-columns: 1fr; } }

.sap-result-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #f3f4f6;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  display: flex; gap: 12px; align-items: flex-start;
  transition: transform .15s;
}
.sap-result-card:hover { transform: translateY(-1px); }
.sap-result-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.sap-result-icon.good { background: #dcfce7; }
.sap-result-icon.warn { background: #fef9c3; }
.sap-result-icon.bad  { background: #fee2e2; }
.sap-result-body { flex: 1; min-width: 0; }
.sap-result-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #9ca3af; margin-bottom: 3px; }
.sap-result-value { font-size: 13px; font-weight: 600; color: #111827; word-break: break-all; margin-bottom: 4px; }
.sap-result-note  { font-size: 12px; color: #6b7280; line-height: 1.4; }
.sap-dot { width:7px; height:7px; border-radius:50%; display:inline-block; margin-right:5px; flex-shrink:0; }
.sap-dot.good{background:#22c55e} .sap-dot.warn{background:#f59e0b} .sap-dot.bad{background:#ef4444}

/* ── Speed Panel ────────────────────────────────── */
.sap-speed-panel { background: #fff; border-radius: 14px; padding: 20px; border: 1px solid #f3f4f6; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.sap-speed-top { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.sap-speed-gauge {
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 8px solid #e5e7eb;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sap-speed-gauge.good { border-color: #22c55e; }
.sap-speed-gauge.warn { border-color: #f59e0b; }
.sap-speed-gauge.bad  { border-color: #ef4444; }
.sap-speed-score-num  { font-size: 26px; font-weight: 800; line-height: 1; }
.sap-speed-score-lbl  { font-size: 9px; color: #9ca3af; font-weight: 500; text-align: center; }
.sap-speed-info h4    { margin: 0 0 4px; font-size: 16px; }
.sap-speed-info p     { margin: 0; font-size: 13px; color: #6b7280; }
.sap-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.sap-metric {
  background: #f9fafb; border-radius: 10px;
  padding: 12px; border: 1px solid #e5e7eb;
}
.sap-metric-name { font-size: 11px; color: #6b7280; margin-bottom: 4px; }
.sap-metric-val  { font-size: 18px; font-weight: 700; }
.sap-metric-val.good{color:#16a34a} .sap-metric-val.warn{color:#d97706} .sap-metric-val.bad{color:#dc2626}
.sap-psi-link { font-size: 13px; color: #2563eb; text-decoration: none; font-weight: 600; display: inline-block; margin-top: 4px; }
.sap-psi-link:hover { text-decoration: underline; }

/* ── Priority Fixes ─────────────────────────────── */
.sap-fixes-card {
  background: #fff; border-radius: 14px;
  padding: 20px; border: 1px solid #f3f4f6;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  margin-bottom: 16px;
}
.sap-fixes-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; }
.sap-fix-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}
.sap-fix-item:last-child { border-bottom: none; padding-bottom: 0; }
.sap-fix-badge {
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 20px; white-space: nowrap; margin-top: 2px;
}
.sap-fix-badge.bad  { background:#fee2e2; color:#dc2626; }
.sap-fix-badge.warn { background:#fef9c3; color:#a16207; }
.sap-fix-text { font-size: 13px; color: #374151; }
.sap-fix-label { font-weight: 600; }

/* ── CTA ────────────────────────────────────────── */
.sap-cta-strip {
  text-align: center;
  padding: 20px;
  background: #f9fafb;
  border-radius: 14px;
  border: 2px dashed #e5e7eb;
}
.sap-cta-strip p { color: #6b7280; font-size: 14px; margin: 0 0 12px; }
.sap-btn-secondary {
  padding: 11px 24px;
  background: #fff;
  color: #111827;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sap-btn-secondary:hover { background: #f3f4f6; }

/* ── Spinner ────────────────────────────────────── */
.sap-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sap-spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes sap-spin { to { transform: rotate(360deg); } }

/* ── Responsive tweaks ──────────────────────────── */
@media (max-width: 480px) {
  .sap-form-card { padding: 16px; }
  .sap-score-header { gap: 14px; }
  .sap-action-bar { gap: 6px; }
  .sap-action-btn { font-size: 13px; padding: 10px 12px; }
  .sap-metrics-grid { grid-template-columns: 1fr 1fr; }
}
