/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #1a1a1a;
  background: #f9fafb;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

.container { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* ─── Header ─────────────────────────────────────── */

.site-header {
  background: #1a1a1a;
  color: #fff;
  padding: 14px 0;
  border-bottom: 3px solid #e53e3e;
}
.site-header .container { display: flex; align-items: center; gap: 16px; }
.logo { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; color: #fff; text-decoration: none; }
.logo:hover { color: #e5e7eb; }
.logo .dot { color: #e53e3e; }
.tagline { font-size: 0.8rem; color: #9ca3af; }

/* ─── Hero ───────────────────────────────────────── */

.hero { padding: 72px 0 80px; }

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.hero h1 em { font-style: normal; color: #e53e3e; }

.subtitle {
  font-size: 1.05rem;
  color: #4b5563;
  max-width: 540px;
  margin-bottom: 36px;
}

.input-wrap { display: flex; gap: 8px; margin-bottom: 10px; }

#url-input {
  flex: 1;
  padding: 14px 18px;
  font-size: 1rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}
#url-input:focus { border-color: #2563eb; }

#analyze-btn {
  padding: 14px 24px;
  background: #e53e3e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
#analyze-btn:hover { background: #c53030; }
#analyze-btn:disabled { background: #9ca3af; cursor: not-allowed; }

.form-note { font-size: 0.82rem; color: #6b7280; }

/* ─── Loading ────────────────────────────────────── */

.loading { padding: 100px 0; text-align: center; color: #4b5563; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #e53e3e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-note { font-size: 0.85rem; color: #9ca3af; margin-top: 8px; }

/* ─── Results ────────────────────────────────────── */

.results { padding: 48px 0 80px; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.site-label { font-size: 0.75rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.06em; display: block; }
.site-url { font-size: 1rem; color: #2563eb; text-decoration: none; font-weight: 500; }
.site-url:hover { text-decoration: underline; }

.score-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.real-user-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
}
.rub-good { background: #d1fae5; color: #065f46; }
.rub-ok   { background: #fef3c7; color: #92400e; }
.rub-poor { background: #fee2e2; color: #991b1b; }

.score-pill {
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
}
.score-label { font-weight: 400; }
.score-good  { background: #d1fae5; color: #065f46; }
.score-ok    { background: #fef3c7; color: #92400e; }
.score-poor  { background: #fee2e2; color: #991b1b; }

/* Core Web Vitals */
.vitals-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.vital-card {
  flex: 1;
  min-width: 80px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}
.vital-value { display: block; font-size: 1rem; font-weight: 700; line-height: 1.2; }
.vital-label { display: block; font-size: 0.72rem; color: #6b7280; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.metric-good  { border-color: #86efac; }
.metric-good .vital-value  { color: #15803d; }
.metric-ok    { border-color: #fde68a; }
.metric-ok .vital-value    { color: #92400e; }
.metric-poor  { border-color: #fca5a5; }
.metric-poor .vital-value  { color: #991b1b; }
.metric-na .vital-value    { color: #374151; }

/* Summary card */
.summary-card {
  background: #fff;
  border: 2px solid #fecaca;
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 36px;
  text-align: center;
}
.waste-number {
  display: block;
  font-size: 3rem;
  font-weight: 800;
  color: #e53e3e;
  letter-spacing: -0.04em;
  line-height: 1;
}
.waste-label { display: block; font-size: 1rem; color: #6b7280; margin-top: 8px; }
.summary-meta { font-size: 0.88rem; color: #9ca3af; margin-top: 10px; }

.no-waste {
  background: #f0fdf4;
  border: 2px solid #bbf7d0;
  border-radius: 12px;
  padding: 20px 28px;
  color: #166534;
  margin-bottom: 36px;
  font-size: 0.95rem;
}

/* Images table */
.images-section { margin-bottom: 48px; }
.images-section h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 16px; }

.effort-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 100px;
  margin-left: 8px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.effort-easy { background: #d1fae5; color: #065f46; }
.effort-dev  { background: #fef3c7; color: #92400e; }

.count-badge {
  display: inline-block;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 100px;
  margin-left: 6px;
  vertical-align: middle;
}

.table-wrap { overflow-x: auto; border-radius: 10px; border: 1.5px solid #e5e7eb; }

.images-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; background: #fff; }
.images-table th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1.5px solid #e5e7eb;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  font-weight: 600;
  background: #f9fafb;
}
.images-table td { padding: 10px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.images-table tbody tr:last-child td { border-bottom: none; }

.col-filename { max-width: 280px; }
.filename { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #374151; font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace; font-size: 0.82rem; }
.col-size { color: #6b7280; white-space: nowrap; }
.savings-positive { color: #059669; font-weight: 600; white-space: nowrap; }

.pct-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.78rem; font-weight: 700; }
.pct-high { background: #fee2e2; color: #991b1b; }
.pct-med  { background: #fef3c7; color: #92400e; }
.pct-low  { background: #f3f4f6; color: #4b5563; }

.show-more-row td { text-align: center; padding: 14px; background: #f9fafb; }

/* ─── Other issues ──────────────────────────────── */

.other-issues { margin-bottom: 48px; }
.other-issues h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 16px; }

.issues-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.issue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.88rem;
}
.issue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.issue-fail .issue-dot { background: #e53e3e; }
.issue-warn .issue-dot { background: #d97706; }
.issue-title { flex: 1; color: #374151; font-weight: 500; }
.issue-value { color: #6b7280; white-space: nowrap; font-size: 0.82rem; }

/* ─── CTA ────────────────────────────────────────── */

#cta-section { margin-bottom: 48px; }

.cta-card { border-radius: 12px; padding: 32px; }

.cta-wp {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 2px solid #86efac;
}
.cta-generic {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
}

.cta-badge {
  display: inline-block;
  background: #fff;
  border: 1.5px solid #86efac;
  color: #166534;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.cta-card h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; }
.cta-card p  { color: #4b5563; font-size: 0.95rem; margin-bottom: 16px; line-height: 1.6; }
.cta-card p:last-child { margin-bottom: 0; }
.cta-card a  { color: #2563eb; }

.btn-primary {
  display: inline-block;
  padding: 13px 24px;
  background: #16a34a;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s;
  margin-bottom: 10px;
}
.btn-primary:hover { background: #15803d; color: #fff; text-decoration: none; }

.cta-note { font-size: 0.8rem; color: #6b7280; margin-top: 4px; margin-bottom: 0; }

/* ─── Email capture ──────────────────────────────── */

.email-section {
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 32px;
}
.email-section h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.email-section > p { color: #4b5563; font-size: 0.9rem; margin-bottom: 16px; }

.email-form { display: flex; gap: 8px; }

#email-input {
  flex: 1;
  padding: 11px 16px;
  font-size: 0.95rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}
#email-input:focus { border-color: #2563eb; }

#email-btn {
  padding: 11px 20px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
#email-btn:hover { background: #1d4ed8; }
#email-btn:disabled { background: #9ca3af; cursor: not-allowed; }

.email-sent  { font-size: 0.88rem; color: #059669; margin-top: 10px; }
.email-error { font-size: 0.88rem; color: #dc2626; margin-top: 10px; }

/* ─── Misc ───────────────────────────────────────── */

.btn-ghost {
  background: none;
  border: 1.5px solid #d1d5db;
  color: #4b5563;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover { border-color: #9ca3af; color: #1a1a1a; }

.rescan-wrap { text-align: center; padding-top: 8px; }

.error-section { padding: 100px 0; text-align: center; }
.error-msg { color: #dc2626; font-size: 1rem; margin-bottom: 20px; }

.hidden { display: none !important; }

/* ─── Footer ─────────────────────────────────────── */

.site-footer {
  background: #1a1a1a;
  color: #9ca3af;
  padding: 20px 0;
  font-size: 0.82rem;
}
.site-footer a { color: #d1d5db; }
.site-footer a:hover { color: #fff; }

/* ─── Responsive ─────────────────────────────────── */

@media (max-width: 600px) {
  .hero { padding: 48px 0 56px; }
  .hero h1 { font-size: 1.75rem; }
  .input-wrap { flex-direction: column; }
  .email-form { flex-direction: column; }
  .summary-card { padding: 24px 20px; }
  .waste-number { font-size: 2.4rem; }
  .cta-card { padding: 24px 20px; }
  .email-section { padding: 20px; }
  .col-filename { max-width: 160px; }
}
