/* ═══════════════════════════════════════════════════════════
   Ecommerce Analysis Toolkit — Shared Styles
   ═══════════════════════════════════════════════════════════ */

:root {
  --primary:       #00FF88;
  --primary-hover: #00CC6E;
  --primary-light: rgba(0,255,136,.1);
  --primary-dark:  #00CC6E;
  --success:       #4ADE80;
  --success-light: rgba(74,222,128,.1);
  --warning:       #FBBF24;
  --warning-light: rgba(251,191,36,.1);
  --error:         #F87171;
  --error-light:   rgba(248,113,113,.1);
  --gray-50:  #161F30;
  --gray-100: #0A0F1C;
  --gray-200: #1E293B;
  --gray-300: #334155;
  --gray-400: #475569;
  --gray-500: #64748B;
  --gray-600: #94A3B8;
  --gray-700: #CBD5E1;
  --gray-800: #E2E8F0;
  --gray-900: #F1F5F9;
  --radius:    12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow:    0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.5), 0 2px 4px -1px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.5), 0 4px 6px -2px rgba(0,0,0,.4);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.page { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  background: #fff;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-500);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  transition: background .15s, color .15s;
}
.header-back:hover { background: var(--gray-100); color: var(--primary); }

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.header-logo svg { flex-shrink: 0; }
.header-logo h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}
.header-logo .badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 100px;
}

.app-main { flex: 1; padding: 40px 48px; max-width: 1100px; margin: 0 auto; width: 100%; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card h2 { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.card .subtitle { color: var(--gray-500); font-size: 14px; margin-bottom: 24px; }

/* ── Form elements ──────────────────────────────────────────────────────── */
.input-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.input-row input[type="text"],
.input-row input[type="url"] {
  flex: 1;
  min-width: min(280px, 100%);
  padding: 14px 18px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color .2s;
  outline: none;
}
.input-row input:focus { border-color: var(--primary); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-ghost     { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ── Status badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.badge-good      { background: var(--success-light);  color: #065f46; }
.badge-improve   { background: var(--warning-light);  color: #92400e; }
.badge-missing   { background: var(--error-light);    color: #991b1b; }
.badge-high      { background: #fee2e2; color: #991b1b; }
.badge-medium    { background: #fef3c7; color: #92400e; }
.badge-low       { background: var(--primary-light); color: var(--primary-dark); }

/* ── Loading spinner ────────────────────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(99,102,241,.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px;
  text-align: center;
  color: var(--gray-500);
}
.loading-state .spinner { width: 40px; height: 40px; border-width: 4px; }
.loading-state p { font-size: 15px; }

/* ── Alert / error box ──────────────────────────────────────────────────── */
.alert {
  display: none;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error { background: var(--error-light); color: #991b1b; border-left: 4px solid var(--error); }
.alert-success { background: var(--success-light); color: #065f46; border-left: 4px solid var(--success); }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: #0E1520;
  border: 1px solid #1E293B;
  border-left: 4px solid var(--success);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  animation: slideIn .3s ease;
  z-index: 999;
}
.toast.hidden   { display: none; }
.toast.error    { border-color: var(--error); border-left-color: var(--error); }
.toast-icon     { font-size: 18px; color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast-message  { font-size: 14px; font-weight: 600; color: #F1F5F9; }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--gray-500); font-size: 13px; }

/* ═══════════════════════════════
   INDEX PAGE
   ═══════════════════════════════ */

.hero {
  text-align: center;
  padding: 64px 24px 48px;
}
.hero-icon {
  width: 72px; height: 72px;
  background: var(--primary-light);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: var(--primary);
}
.hero h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}
.hero p {
  font-size: 17px;
  color: var(--gray-500);
  max-width: 480px;
  margin: 0 auto 8px;
}
.hero-divider {
  font-size: 14px;
  color: var(--gray-400);
  margin-top: 8px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.tool-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.tool-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.tool-card-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.tool-icon-scraper  { background: #ede9fe; color: #7c3aed; }
.tool-icon-cro      { background: #fce7f3; color: #db2777; }

.tool-card h2 { font-size: 20px; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.tool-card p  { font-size: 14px; color: var(--gray-500); line-height: 1.6; margin-bottom: 20px; }

.tool-features {
  list-style: none;
  margin-bottom: 28px;
}
.tool-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-600);
  padding: 4px 0;
}
.tool-features li::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.tool-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

/* ═══════════════════════════════
   SHOPIFY SCRAPER PAGE
   ═══════════════════════════════ */

.results-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--success-light);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  color: #065f46;
  font-weight: 500;
}
.results-meta strong { font-size: 20px; font-weight: 700; }

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.product-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow .2s, transform .15s;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.product-img-wrap {
  position: relative;
  width: 100%;
  padding-top: 100%; /* square */
  background: var(--gray-100);
  overflow: hidden;
}
.product-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-300);
}

.discount-tag {
  position: absolute;
  top: 8px; left: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
}
.oos-tag {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--gray-700);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
}

.product-body { padding: 14px; }
.product-vendor { font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.product-title  { font-size: 14px; font-weight: 600; color: var(--gray-900); margin-bottom: 8px; line-height: 1.4; }
.product-title a { color: inherit; text-decoration: none; }
.product-title a:hover { color: var(--primary); }

.product-price  { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.price-current  { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.price-compare  { font-size: 13px; color: var(--gray-400); text-decoration: line-through; }

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
}
.meta-pill {
  background: var(--gray-100);
  border-radius: 100px;
  padding: 2px 8px;
}

.product-desc {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.5;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scraper-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
}
.filter-input:focus { border-color: var(--primary); }

/* ═══════════════════════════════
   CRO REPORT PAGE
   ═══════════════════════════════ */

.score-hero {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  padding: 28px 32px;
  background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.score-circle {
  width: 100px; height: 100px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  border: 5px solid var(--primary);
}
.score-circle .score-num  { font-size: 28px; line-height: 1; color: var(--primary); }
.score-circle .score-unit { font-size: 12px; color: var(--gray-500); }

.score-info h2    { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.score-info .grade-label { font-size: 15px; color: var(--gray-500); margin-bottom: 10px; }
.score-summary-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.score-pill {
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
}
.pill-good    { background: var(--success-light); color: #065f46; }
.pill-improve { background: var(--warning-light); color: #92400e; }
.pill-missing { background: var(--error-light);   color: #991b1b; }

/* Sections accordion */
.cro-sections { display: flex; flex-direction: column; gap: 12px; }

.section-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.section-header:hover { background: var(--gray-50); }

.section-score-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-name   { font-weight: 600; font-size: 14px; color: var(--gray-900); min-width: 200px; }
.section-bar    { flex: 1; height: 6px; background: var(--gray-200); border-radius: 100px; overflow: hidden; }
.section-bar-fill { height: 100%; border-radius: 100px; transition: width .4s; }
.fill-good    { background: var(--success); }
.fill-improve { background: var(--warning); }
.fill-missing { background: var(--error); }
.section-score-num { font-size: 14px; font-weight: 700; color: var(--gray-700); min-width: 36px; text-align: right; }
.section-chevron { color: var(--gray-400); transition: transform .2s; }
.section-header.open .section-chevron { transform: rotate(180deg); }

.section-body { display: none; padding: 0 20px 20px; border-top: 1px solid var(--gray-100); }
.section-body.open { display: block; }

.check-lists  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.check-list h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-500); margin-bottom: 8px; }
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
}
.check-item.found   { color: var(--gray-700); }
.check-item.missing { color: var(--gray-400); text-decoration: line-through; }
.check-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-found   { background: var(--success); }
.dot-missing { background: var(--gray-300); }

.issues-list { margin: 12px 0; }
.issues-list h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--error); margin-bottom: 8px; }
.issue-item {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-700);
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-100);
}
.issue-item:last-child { border: none; }
.issue-item::before { content: "!"; width: 18px; height: 18px; border-radius: 50%; background: var(--error-light); color: var(--error); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.recs-list { margin: 12px 0; }
.recs-list h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--primary); margin-bottom: 8px; }
.rec-item {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-700);
  padding: 6px 0;
  line-height: 1.5;
  border-bottom: 1px solid var(--gray-100);
}
.rec-item:last-child { border: none; }
.rec-item::before { content: "→"; color: var(--primary); font-weight: 700; flex-shrink: 0; }

/* Summary panels */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.summary-panel {
  background: #fff;
  border: 1px solid #e0e7ff;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 2px 12px rgba(99,102,241,.06);
  overflow: hidden;
}

.summary-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f4ff;
}

.summary-panel-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.panel-icon-red   { background: #fee2e2; color: #dc2626; }
.panel-icon-green { background: #d1fae5; color: #059669; }

.summary-panel-header h3 {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  margin: 0;
}

.panel-title-red   { color: #dc2626; }
.panel-title-green { color: #059669; }

.summary-panel-body { padding: 12px 16px; }

.top-issue-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  border-left: 3px solid transparent;
  background: #0A0F1C;
  font-size: 13px;
  transition: background .15s;
}
.top-issue-item:last-child { margin-bottom: 0; }
.top-issue-item:hover { background: rgba(255,255,255,.03); }

.top-issue-item.impact-high   { border-left-color: #ef4444; }
.top-issue-item.impact-medium { border-left-color: #f59e0b; }
.top-issue-item.impact-low    { border-left-color: #6366f1; }

.issue-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #1E293B;
  color: rgba(241,245,249,.6);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.issue-text-block { flex: 1; min-width: 0; }
.issue-section-name {
  font-weight: 700;
  color: #F1F5F9;
  font-size: 13px;
  margin-bottom: 2px;
}
.issue-detail-text {
  color: rgba(241,245,249,.55);
  font-size: 12.5px;
  line-height: 1.5;
}

.badge-high   { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); border-radius: 100px; padding: 2px 9px; font-size: 10.5px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.badge-medium { background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.3); border-radius: 100px; padding: 2px 9px; font-size: 10.5px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.badge-low    { background: rgba(99,102,241,.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,.3); border-radius: 100px; padding: 2px 9px; font-size: 10.5px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }

.quick-win-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: rgba(0,255,136,.06);
  border-left: 3px solid #00FF88;
  font-size: 13px;
  line-height: 1.5;
  transition: background .15s;
}
.quick-win-item:last-child { margin-bottom: 0; }
.quick-win-item:hover { background: rgba(0,255,136,.1); }

.win-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #00FF88;
  color: #0A0F1C;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.win-section-name { font-weight: 700; color: #00FF88; font-size: 13px; margin-bottom: 2px; }
.win-action-text  { color: rgba(241,245,249,.65); font-size: 12.5px; line-height: 1.5; }

.conv-impact-box {
  padding: 12px 16px;
  background: rgba(0,255,136,.06);
  border: 1px solid rgba(0,255,136,.2);
  border-radius: 10px;
  font-size: 13px;
  color: #00FF88;
  font-weight: 500;
  margin: 10px 16px 12px;
}

/* ── A/B Testing panel ───────────────────────────────────────────────────── */
.ab-test-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 12px;
  background: #0A0F1C;
  transition: box-shadow .15s, border-color .15s;
}
.ab-test-item:hover { box-shadow: 0 4px 16px rgba(0,255,136,.08); border-color: rgba(0,255,136,.25); }
.ab-test-item:last-child { margin-bottom: 0; }

.ab-test-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.ab-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ab-test-title  { font-weight: 600; font-size: 14px; color: var(--gray-900); margin-bottom: 4px; }
.ab-test-section { font-size: 12px; color: var(--gray-500); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.ab-test-detail {
  font-size: 13px; color: var(--gray-600); line-height: 1.6;
  padding-left: 38px;  /* align under title */
  border-top: 1px solid var(--gray-100);
  padding-top: 10px; margin-top: 4px;
}

/* ── App Audit ───────────────────────────────────────────────────────────── */
.app-audit-section { margin-top: 24px; }

.perf-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
}
.perf-good    { background: rgba(0,255,136,.12); color: #00FF88; }
.perf-warn    { background: rgba(245,158,11,.12); color: #fcd34d; }
.perf-bad     { background: rgba(239,68,68,.12); color: #fca5a5; }

.audit-table-wrap { overflow-x: auto; margin-top: 16px; }
.audit-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.audit-table th {
  background: var(--gray-50); padding: 10px 14px; text-align: left;
  font-weight: 600; color: var(--gray-600); border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.audit-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--gray-100);
  vertical-align: top; color: var(--gray-700);
}
.audit-table tr:hover td { background: var(--gray-50); }

.badge-keep    { background: rgba(0,255,136,.12); color: #00FF88; }
.badge-remove  { background: rgba(239,68,68,.12); color: #fca5a5; }
.badge-replace { background: rgba(245,158,11,.12); color: #fcd34d; }

.redundancy-list { margin-top: 16px; }
.redundancy-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.25);
  border-radius: var(--radius-sm); margin-bottom: 8px;
  font-size: 13px; color: #fcd34d;
}
.redundancy-item svg { flex-shrink: 0; margin-top: 2px; }

.no-apps-msg {
  padding: 24px; text-align: center; color: var(--gray-400);
  font-size: 14px;
}

/* ── Generate Report button ──────────────────────────────────────────────── */
.generate-report-bar {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 12px; margin-top: 24px; padding: 16px 0;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE  —  Desktop → Tablet → Mobile → Small mobile
   Breakpoints:  1024px  |  768px  |  540px  |  380px
   ══════════════════════════════════════════════════════════════ */

/* ── Tablet  (≤ 1024px) ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .app-main { padding: 32px 28px; }
  .section-name { min-width: 160px; }
}

/* ── Tablet narrow  (≤ 900px) ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-main { padding: 24px 20px; }
  .tools-grid { padding: 0 20px 60px; }
  .check-lists { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .section-name { min-width: 150px; }
  /* export buttons wrap on narrow tablet */
  .generate-report-bar { flex-wrap: wrap; justify-content: flex-end; }
}

/* ── Mobile  (≤ 640px) ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Header */
  .app-header { padding: 10px 14px; gap: 10px; }
  .header-logo h1 { font-size: 15px; }
  .header-logo .badge { display: none; }
  .header-logo svg { width: 22px; height: 22px; flex-shrink: 0; }

  /* Layout */
  .app-main { padding: 14px; }
  .card { padding: 18px; }

  /* Hero */
  .hero { padding: 40px 16px 28px; }
  .hero h1 { font-size: 24px; }
  .tools-grid { grid-template-columns: 1fr; padding: 0 14px 60px; }
  .tool-card { padding: 24px 20px; }

  /* Input */
  .input-row { flex-direction: column; }
  .input-row input[type="url"],
  .input-row input[type="text"] { min-width: auto; width: 100%; }
  .btn-lg { padding: 14px 20px; font-size: 15px; width: 100%; }

  /* Score hero */
  .score-hero {
    flex-direction: column;
    text-align: center;
    padding: 20px 18px;
    gap: 16px;
  }
  .score-summary-pills { justify-content: center; }

  /* Section accordion header — reflow to 2 rows on mobile */
  .section-header {
    padding: 12px 14px;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }
  /* Row 1: status badge + name + chevron */
  .section-header .badge:first-child { order: 1; }
  .section-score-bar-wrap            { order: 2; flex: 1; min-width: 0; flex-wrap: wrap; gap: 4px; }
  .section-header .section-chevron   { order: 3; }
  /* Row 2 detail: impact badge tucks after name */
  .section-header > .badge:not(:first-child):not(.section-chevron) { order: 4; margin: 0; }

  /* Inside the bar wrap: name full width, bar hidden, score inline */
  .section-name  { min-width: 0; flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .section-bar   { display: none; }           /* hide bar — too narrow */
  .section-score-num { font-size: 13px; min-width: auto; }

  /* Summary panels */
  .summary-panel { padding: 14px; }

  /* Export bar stacks vertically */
  .generate-report-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 0;
  }
  .generate-report-bar .btn { width: 100%; justify-content: center; }

  /* App audit table — force horizontal scroll */
  .audit-table-wrap { -webkit-overflow-scrolling: touch; }
  .audit-table      { min-width: 580px; }

  /* Scraper results meta — stack CSV button */
  .results-meta { flex-wrap: wrap; }
  .results-meta > div[style] { margin-left: 0 !important; width: 100%; display: flex; justify-content: flex-start; }

  /* Scraper controls full width */
  .filter-input { min-width: 100%; }

  /* Pagination tighter */
  #paginationBar { gap: 10px; font-size: 13px; }

  /* Toast goes full-width at bottom */
  .toast {
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    font-size: 13px;
    padding: 12px 16px;
  }
}

/* ── Small mobile  (≤ 380px) ────────────────────────────────────────────── */
@media (max-width: 380px) {
  .header-logo h1 { font-size: 13px; }
  .app-main { padding: 10px; }
  .card { padding: 14px; }
  .score-pill { font-size: 11px; padding: 4px 8px; }
  .score-circle { width: 80px; height: 80px; }
  .score-circle .score-num { font-size: 22px; }
  .tool-card { padding: 20px 16px; }
  .hero h1 { font-size: 20px; }
  .section-name { font-size: 12px; }
  .badge { font-size: 11px; padding: 2px 7px; }
}

/* ── Print / PDF export ──────────────────────────────────────────────────── */
@media print {
  /* hide interactive chrome */
  .app-header,
  .card:has(#pdpUrl),
  #loadingState,
  .generate-report-bar,
  .toast { display: none !important; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .page { min-height: auto; }
  .app-main { padding: 0; max-width: 100%; }

  /* open all section bodies */
  .section-body { display: block !important; max-height: none !important; overflow: visible !important; }

  /* score hero compact */
  .score-hero { flex-direction: row; gap: 24px; margin-bottom: 16px; }
  .score-circle { width: 80px; height: 80px; font-size: 22pt; }

  /* no shadows / backgrounds for cleaner print */
  .card, .summary-panel, .section-card { box-shadow: none; border: 1px solid #e5e7eb; }

  /* summary side by side */
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* avoid page breaks inside a section card or A/B test item */
  .section-card, .ab-test-item { page-break-inside: avoid; break-inside: avoid; }

  /* table borders for print */
  .audit-table th, .audit-table td { border: 1px solid #d1d5db !important; }

  a { color: inherit; text-decoration: none; }

  /* site overview banner simplified for print */
  .site-overview { background: var(--gray-100) !important; color: var(--gray-900) !important; }
  .site-score-big { color: var(--gray-900) !important; }
}

/* ── Site overview banner ───────────────────────────────────────────────── */
.site-overview {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.site-score-big {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}
.site-score-unit { font-size: 22px; font-weight: 600; opacity: .75; }
.site-overview-info { flex: 1; min-width: 200px; }
.site-overview-info h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; color: #fff; }
.site-overview-info p { opacity: .85; font-size: 14px; margin-bottom: 14px; }
.site-pages-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.site-page-chip {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.site-page-chip .chip-score { opacity: .8; margin-left: 4px; }

/* ── Page tabs ──────────────────────────────────────────────────────────── */
.page-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 20px;
  padding-bottom: 2px;
}
.page-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
  box-shadow: var(--shadow);
}
.page-tab:hover { border-color: var(--primary); color: var(--primary); }
.page-tab.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}
.tab-score {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--gray-100);
  color: var(--gray-600);
}
.page-tab.active .tab-score {
  background: var(--primary);
  color: #fff;
}

/* ── Page panels ────────────────────────────────────────────────────────── */
.page-panel { display: none; }
.page-panel.active { display: block; }

/* ── Mode toggle ────────────────────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
  margin-bottom: 18px;
}
.mode-btn {
  padding: 8px 22px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: #fff;
  color: var(--gray-500);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mode-btn.active { background: var(--primary); color: #fff; }
.mode-btn:not(.active):hover { background: var(--gray-100); color: var(--gray-700); }
