/* ConvertDoctor — Shopify Polaris-Native Embedded UI Styles */
:root {
  --bg-page: #f1f2f4;
  --bg-card: #ffffff;
  --border: #e2e5e9;
  --text-main: #18181b;
  --text-muted: #52525b;
  --emerald: #008060;
  --emerald-hover: #006e52;
  --emerald-soft: #ecfdf5;
  --critical: #dc2626;
  --critical-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --indigo: #4f46e5;
  --indigo-soft: #eef2ff;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.cd-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 20px 48px;
}

/* Topbar */
.cd-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.cd-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cd-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #008060, #059669);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.cd-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cd-title-row h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.cd-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.cd-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.lang-switch {
  display: inline-flex;
  background: #f4f4f5;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
}

.lang-btn.active {
  background: #fff;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Buttons */
.cd-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.cd-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cd-btn.primary {
  background: var(--emerald);
  color: #fff;
}
.cd-btn.primary:hover:not(:disabled) {
  background: var(--emerald-hover);
}

.cd-btn.secondary {
  background: #fff;
  border-color: #d4d4d8;
  color: var(--text-main);
}
.cd-btn.secondary:hover:not(:disabled) {
  background: #f8fafc;
}

.cd-btn.pro {
  background: linear-gradient(135deg, #111827, #312e81);
  color: #fff;
}
.cd-btn.pro:hover:not(:disabled) {
  opacity: 0.92;
}

.cd-btn.undo {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}

.cd-btn.danger {
  background: var(--critical);
  border-color: var(--critical);
  color: #fff;
}
.cd-btn.danger:hover:not(:disabled) {
  background: #b91c1c;
}

.cd-btn.danger-outline {
  background: #fff;
  border-color: #fca5a5;
  color: #b91c1c;
}
.cd-btn.danger-outline:hover:not(:disabled) {
  background: var(--critical-soft);
  border-color: #f87171;
}

.cd-btn-lg {
  padding: 11px 18px;
  font-size: 14px;
}

.full-width {
  width: 100%;
  justify-content: center;
}

/* Badges */
.cd-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.cd-badge.neutral { background: #f4f4f5; color: #3f3f46; border: 1px solid #e4e4e7; }
.cd-badge.pro { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

.cd-badge-btn {
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.cd-badge-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

/* KPI Grid */
.cd-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 900px) {
  .cd-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-card.highlight-leak {
  border-left: 4px solid var(--critical);
  background: linear-gradient(180deg, #fffafa 0%, #ffffff 100%);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
}

.highlight-leak .kpi-value {
  color: var(--critical);
}

.kpi-sub {
  font-size: 11.5px;
  color: #71717a;
}

/* Tabs */
.cd-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.cd-tab {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.cd-tab.active {
  background: #18181b;
  color: #fff;
  border-color: #18181b;
}

/* Product Cards */
.cd-products-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.prod-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.prod-card.leaky {
  border-left: 4px solid var(--critical);
}
.prod-card.healthy {
  border-left: 4px solid var(--emerald);
}

.prod-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.prod-info {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 260px;
  flex: 1;
}

.prod-thumb {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f8fafc;
  flex-shrink: 0;
}

.prod-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.prod-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  align-items: center;
}

.strike-price {
  text-decoration: line-through;
  color: #9ca3af;
}

.prod-score-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.missed-pill {
  background: var(--critical-soft);
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
}

.score-circle {
  min-width: 58px;
  height: 58px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
}
.score-circle small { font-size: 10px; font-weight: 600; opacity: 0.8; }
.score-low { background: var(--critical-soft); color: var(--critical); border: 1px solid #fecaca; }
.score-mid { background: var(--warning-soft); color: var(--warning); border: 1px solid #fde68a; }
.score-high { background: var(--emerald-soft); color: var(--emerald); border: 1px solid #a7f3d0; }

/* Funnel Strip */
.funnel-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 14px 0 12px;
}
@media (max-width: 720px) {
  .funnel-strip { grid-template-columns: repeat(2, 1fr); }
}

.f-step {
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  border-right: 1px dashed #cbd5e1;
}
.f-step:last-child { border-right: none; }
.f-step span { font-size: 11.5px; color: var(--text-muted); }
.f-step strong { font-size: 15px; font-weight: 700; margin-top: 2px; }

/* Diagnosis Banner */
.diag-banner {
  border-radius: 9px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.45;
}
.diag-banner.critical { background: var(--critical-soft); border: 1px solid #fecaca; color: #991b1b; }
.diag-banner.warning, .diag-banner.attention { background: var(--warning-soft); border: 1px solid #fde68a; color: #92400e; }
.diag-banner.success { background: var(--emerald-soft); border: 1px solid #a7f3d0; color: #065f46; }
.diag-banner strong { display: block; margin-bottom: 2px; font-size: 13.5px; }

/* Issues List */
.issues-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.issue-item {
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  padding: 10px 13px;
  background: #fafafa;
  font-size: 13px;
  line-height: 1.45;
}

.issue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.pts-tag {
  font-size: 11px;
  background: #fee2e2;
  color: #b91c1c;
  padding: 2px 7px;
  border-radius: 999px;
}

.issue-why { color: #4b5563; margin-bottom: 4px; }
.issue-todo { color: #047857; font-weight: 600; }

.prod-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

/* Theme App Embed & Plans Panels */
.cd-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
}

.embed-header h2, .plans-header h2 {
  margin: 8px 0 8px;
  font-size: 19px;
  color: var(--text-main);
}
.embed-header p, .plans-header p {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 820px;
}

.embed-pill {
  display: inline-block;
  background: var(--emerald-soft);
  color: #047857;
  border: 1px solid #a7f3d0;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.embed-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 820px) {
  .embed-steps-grid { grid-template-columns: 1fr; }
}

.embed-step-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
}
.embed-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--emerald);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.embed-step-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text-main);
}
.embed-step-card p {
  margin: 0;
  font-size: 12.8px;
  line-height: 1.5;
  color: var(--text-muted);
}

.embed-cta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}
.embed-safe-note {
  font-size: 12.5px;
  color: #047857;
  font-weight: 600;
}

/* Pricing Plans Grid */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 14px;
}
@media (max-width: 780px) {
  .plans-grid { grid-template-columns: 1fr; }
}

.plan-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.plan-card.active-plan-card {
  border: 2px solid var(--emerald);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 128, 96, 0.08);
}

.plan-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.plan-card-top h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
}
.plan-price strong {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
}
.plan-price span {
  font-size: 13px;
  color: var(--text-muted);
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.2px;
  color: #3f3f46;
}

.plan-card-footer {
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}
.pro-active-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pro-sub-ref {
  font-size: 11.5px;
  color: var(--text-muted);
  background: #f4f4f5;
  padding: 6px 10px;
  border-radius: 6px;
  word-break: break-all;
}
.plans-billing-note {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Custom In-App Confirmation Modal */
.cd-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}
.cd-modal {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  max-width: 460px;
  width: 100%;
  padding: 22px 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.18);
}
.cd-modal h3 {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--text-main);
}
.cd-modal p {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
}
.cd-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.cd-loading {
  text-align: center;
  padding: 48px 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--emerald);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cd-toast {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 13.5px;
  font-weight: 600;
  background: #065f46;
  color: #fff;
}
.cd-toast.error { background: #b91c1c; }
.hidden { display: none !important; }

/* Landing Page Outside Shopify */
.landing-body { background: #0f172a; color: #f8fafc; }
.landing-container { max-width: 960px; margin: 0 auto; padding: 32px 20px 64px; }
.landing-nav { display:flex; justify-content:space-between; align-items:center; margin-bottom:48px; }
.brand-row { display:flex; align-items:center; gap:10px; font-size:18px; }
.logo-mark { font-size:26px; }
.sub-brand { display:block; font-size:12px; color:#94a3b8; }
.landing-links a { color:#cbd5e1; text-decoration:none; margin-left:18px; font-size:14px; }
.landing-hero { text-align:center; }
.hero-pill { display:inline-block; background:rgba(16,185,129,0.15); color:#34d399; border:1px solid rgba(52,211,153,0.3); padding:5px 14px; border-radius:999px; font-size:13px; font-weight:600; margin-bottom:16px; }
.landing-hero h1 { font-size:38px; line-height:1.2; margin:0 0 16px; }
.landing-hero h1 span { color:#34d399; }
.landing-hero p { max-width:680px; margin:0 auto 36px; color:#cbd5e1; font-size:16px; line-height:1.6; }
.landing-features { display:grid; grid-template-columns:repeat(3, 1fr); gap:16px; text-align:left; margin-bottom:32px; }
@media (max-width:768px){ .landing-features{ grid-template-columns:1fr; } }
.lf-card { background:#1e293b; border:1px solid #334155; border-radius:14px; padding:20px; }
.lf-card h3 { margin:0 0 8px; font-size:16px; color:#f8fafc; }
.lf-card p { margin:0; font-size:14px; color:#94a3b8; }
.landing-footer-note { background:#1e293b; border:1px dashed #475569; padding:16px; border-radius:12px; color:#e2e8f0; font-size:14px; }
