:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #332a3c;
  --color-muted: #6b7280;
  --color-accent: #5968b0;
  --radius: 1rem;
  --radius-sm: 0.75rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.header-inner {
  max-width: 32rem;
  margin: 0 auto;
  padding: 14px 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.125rem;
}

.header-logo {
  display: flex;
  align-items: center;
  line-height: 0;
}

.header-logo img {
  height: 36px;
  width: auto;
  display: block;
  margin: 0;
  vertical-align: top;
}

.header a.ext-link {
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.header a.ext-link:hover {
  color: var(--color-text);
}

.main {
  flex: 1;
  max-width: 32rem;
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem 1rem 3rem;
}

.hero h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.hero p.sub {
  color: var(--color-muted);
  font-size: 0.875rem;
  margin: 0 0 1.5rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input-row {
  position: relative;
}

.input-row input[type="url"] {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 1rem;
  padding-right: 5.5rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  background: white;
  font-size: 1rem;
}

.input-row input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.input-row input::placeholder {
  color: #9ca3af;
}

.btn-analyze {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: 0.5rem;
  background: var(--color-text);
  color: white;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.btn-analyze:hover:not(:disabled) {
  background: #374151;
}

.btn-analyze:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.input-group input[type="text"] {
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
  background: white;
  font-size: 0.875rem;
}

.hint {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.hint code {
  padding: 0.125rem 0.25rem;
  background: #f3f4f6;
  border-radius: 0.25rem;
  color: var(--color-accent);
}

.error-msg {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #dc2626;
}

.loading-section {
  margin-bottom: 2rem;
}

.loading-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.loading-step.done {
  opacity: 0.6;
}

.step-num {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
}

.step-num.done {
  background: var(--color-accent);
  color: white;
}

.step-num.active {
  background: rgba(37, 99, 235, 0.2);
  color: var(--color-accent);
}

.step-num.pending {
  background: #f3f4f6;
  color: #9ca3af;
}

.result-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 2.5rem;
  padding: 1.75rem 1.25rem 1.5rem;
  background: #eef1f5;
  border-radius: var(--radius);
}

.result-section h2,
.result-product-name {
  font-size: 1.35rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.5rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.result-section h2:first-child,
.result-product-name:first-child {
  margin-top: 0;
}

.recent-links {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.recent-links-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.5rem;
}

.recent-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-links-list li {
  margin: 0.25rem 0;
}

.recent-links-list a {
  font-size: 0.875rem;
  color: var(--color-accent);
  text-decoration: none;
  word-break: break-all;
}

.recent-links-list a:hover {
  text-decoration: underline;
}

.recent-links-footer {
  margin: 0.5rem 0 0;
  text-align: right;
}

.recent-clear-link {
  font-size: 0.75rem;
  color: var(--color-muted);
  text-decoration: none;
}

.recent-clear-link:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.seekshop-co-hint {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(to bottom right, #f1f5f9, #e2e8f0);
  border: 1px solid rgba(89, 104, 176, 0.2);
  border-radius: var(--radius);
}

.seekshop-co-hint-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  margin-bottom: 0.35rem;
}

.seekshop-co-hint-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.45;
}

.seekshop-co-hint code {
  font-size: inherit;
  font-weight: 500;
  padding: 0.15em 0.35em;
  background: #fff;
  border-radius: 3px;
  color: var(--color-accent);
}

/* SmartScore – match toolbar .rating-container */
.rating-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 15px;
  background: linear-gradient(to bottom right, #f8fafc, #f3f4f6);
  padding: 16px;
  border-radius: 12px;
  border: 2px solid #5968b0;
  align-items: center;
  text-align: center;
  line-height: 1.1;
}

.smart-score-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.smart-score-title svg {
  width: 18px;
  height: 18px;
  fill: #5968b0;
  display: inline-block;
  vertical-align: middle;
  margin-top: -2px;
}

.rating-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.stars-wrap {
  position: relative;
  display: inline-flex;
  font-size: 24px;
  color: #e2e8f0;
  letter-spacing: 2px;
  line-height: 1;
}

.stars-filled {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  color: #f59e0b;
  white-space: nowrap;
}

.rating-value {
  font-size: 20px;
  font-weight: 600;
  color: #1a202c;
}

.sources-line {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.4;
  font-style: italic;
  text-align: center;
}

/* Customer Insights – match toolbar .insights-bubble */
.insights-card {
  margin: 15px 0;
}

.insights-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.insights-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a202c;
  letter-spacing: -0.2px;
}

.insights-bubble {
  background: white;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
}

.insight-block {
  margin-bottom: 16px;
}

.insight-block:last-child {
  margin-bottom: 0;
}

.insight-block + .insight-block {
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
}

.insight-label {
  font-size: 12px;
  font-weight: 600;
  color: #6366f1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.insight-content {
  color: #4a5568;
  font-size: 14px;
  line-height: 1.6;
}

.insight-content.quote {
  font-style: italic;
  color: #374151;
  border-left: 3px solid #6366f1;
  padding-left: 12px;
  margin-left: 0;
}

.insight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insight-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
  font-size: 14px;
  color: #4a5568;
}

.insight-bullet {
  color: #6366f1;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

/* Potential Savings – match toolbar .deals-section */
.deals-section {
  margin: 12px 0 25px 0;
}

.deals-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #1a202c;
  letter-spacing: -0.2px;
}

.deal-card {
  background: linear-gradient(to bottom right, #ffffff, #f8fafc);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.deal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.deal-card:last-child {
  margin-bottom: 0;
}

.deal-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.deal-description {
  font-size: 13px;
  color: #4a5568;
  margin-bottom: 14px;
  line-height: 1.5;
}

.apply-coupon-btn {
  display: inline-block;
  background: linear-gradient(to right, #3b82f6, #2563eb);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
  letter-spacing: 0.2px;
  text-align: center;
}

.apply-coupon-btn:hover {
  background: linear-gradient(to right, #2563eb, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
  color: white;
}

.disclaimer {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.75rem;
}

.footer-links a {
  color: var(--color-muted);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.json-dump-wrap {
  margin-top: 1.5rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.75rem;
}

.json-dump-wrap summary {
  cursor: pointer;
  font-weight: 600;
  color: #475569;
  user-select: none;
}

.json-dump {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 6px;
  overflow: auto;
  max-height: 400px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.4;
}
