/* BespaarAI — mobile-first homepage */
:root {
  --bg: #ffffff;
  --fg: #1e1233;
  --muted: #6b5b73;
  --border: #f3d6e7;
  --primary: #E11D8C;
  --primary-hover: #BE185D;
  --primary-fg: #ffffff;
  --primary-soft: #FDF2F8;
  --primary-glow: rgba(225, 29, 140, 0.28);
  --header: #E11D8C;
  --header-fg: #ffffff;
  --card: #FDF2F8;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(190, 24, 93, 0.08);
  --max: 720px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--primary-hover);
}

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.site-header {
  border-bottom: none;
  background: var(--header);
  padding: 0.85rem 0;
  box-shadow: 0 4px 18px rgba(190, 24, 93, 0.18);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.logo-on-brand {
  display: block;
  filter: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1024;
    --fg: #fce7f3;
    --muted: #d8b4c8;
    --border: #4a2c3d;
    --card: #2a1830;
    --primary-soft: #2a1830;
  }

  .site-footer {
    background: #140c1c;
  }

  .alert-ok { background: #064e3b; color: #a7f3d0; border-color: #065f46; }
  .alert-error { background: #450a0a; color: #fecaca; border-color: #7f1d1d; }
}

.badge-beta {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  background: var(--card);
}

.hero {
  padding: 3.5rem 0 2.5rem;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 5vw, 2.35rem);
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0 0 1.75rem;
  font-size: 1.075rem;
  color: var(--muted);
  max-width: 38ch;
}

.cta-wrap {
  margin: 0 0 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.35rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: 1rem;
  border: none;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--primary-fg);
}

.privacy-line {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.privacy-line li {
  position: relative;
  padding-left: 1.35rem;
}

.privacy-line li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.85;
}

.scan-placeholder {
  padding: 0 0 3.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  border-top: 3px solid var(--primary);
  padding: 2rem 0 2.5rem;
  background: var(--primary-soft);
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-inner p {
  margin: 0 0 0.65rem;
}

.footer-brand {
  color: var(--fg);
}

.footer-product {
  margin-top: 1rem !important;
  color: var(--fg);
}

.footer-copy {
  margin-top: 0.75rem !important;
  font-size: 0.82rem;
}

.card code {
  font-size: 0.9em;
}

@media (min-width: 640px) {
  .logo {
    height: 48px;
    max-width: 180px;
  }

  .hero {
    padding: 5rem 0 3rem;
  }

  .card {
    padding: 1.75rem 1.75rem;
  }
}

/* MVP additions */
.nav-links { display: flex; gap: 1rem; font-size: 0.95rem; }
.nav-links a { color: rgba(255,255,255,0.92); text-decoration: none; font-weight: 600; }
.nav-links a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.hero.compact { padding: 2rem 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.steps { margin: 0 0 1.25rem; padding-left: 1.25rem; color: var(--muted); }
.steps li { margin-bottom: 0.4rem; }
.upload-form label, .confirm-form label { display: block; margin-bottom: 0.85rem; font-weight: 600; color: var(--fg); }
.upload-form input[type="file"],
.confirm-form input[type="text"],
.confirm-form input[type="number"],
.confirm-form input[type="password"],
.confirm-form input[type="date"],
.confirm-form select,
.admin-table + * input,
form input[type="text"],
form input[type="number"],
form input[type="password"],
form input[type="date"],
form select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
.file-label { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.25rem; background: var(--bg); cursor: pointer; }
.file-label-title { display: block; margin-bottom: 0.75rem; }
.grid-2 { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
fieldset { border: 1px solid var(--border); border-radius: 12px; margin: 1rem 0; padding: 1rem; }
legend { font-weight: 700; padding: 0 0.35rem; }
.card-nested { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.85rem; margin-bottom: 0.75rem; }
.btn-secondary { background: transparent; color: var(--primary); border: 1px solid var(--primary); border-radius: 999px; padding: 0.6rem 1.1rem; font-weight: 650; cursor: pointer; }
.alert { padding: 0.85rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.savings-headline { font-size: 1.35rem; }
.offer-card { margin: 1rem 0; }
.offer-card h3 { margin: 0 0 0.35rem; }
.reasons { color: var(--muted); }
.footer-links { margin-top: 1rem !important; }
.prose h2 { margin-top: 1.75rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 1rem 0 2rem; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--border); padding: 0.55rem 0.4rem; text-align: left; }
.badge { font-size: 0.7rem; border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.45rem; color: var(--muted); }
.kpi-grid .card { text-align: center; }
.ask-mobile { display: flex !important; align-items: flex-start; gap: 0.5rem; font-weight: 500 !important; margin: 1rem 0; }
.ask-mobile input { width: auto !important; margin-top: 0.25rem; }
.totals { margin: 1rem 0; padding: 0.85rem; background: var(--bg); border-radius: 10px; border: 1px solid var(--border); }
.card p { margin: 0 0 0.65rem; }

.file-label:hover { border-color: var(--primary); background: var(--primary-soft); }
.badge-beta { color: var(--primary); border-color: #f9a8d4; background: var(--primary-soft); }
input:focus, select:focus { outline: 2px solid rgba(225, 29, 140, 0.35); border-color: var(--primary); }
.savings-headline { color: var(--primary); }

/* —— Async processing / futuristic loader —— */
.processing-page {
  position: relative;
  min-height: calc(100vh - 8rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 0 3.5rem;
  overflow: hidden;
  isolation: isolate;
}
.processing-glow {
  position: absolute;
  inset: -20% -10% auto;
  height: 70%;
  background:
    radial-gradient(ellipse 50% 60% at 50% 40%, rgba(225, 29, 140, 0.28), transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(244, 114, 182, 0.18), transparent 70%),
    radial-gradient(ellipse 35% 40% at 85% 30%, rgba(190, 24, 93, 0.16), transparent 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(8px);
}
.processing-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(225, 29, 140, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(225, 29, 140, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}
.processing-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 420px;
}
.processing-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
}
.processing-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  line-height: 1.25;
}
.processing-sub {
  margin: 0 0 1.75rem;
  min-height: 1.5em;
}
.processing-ring-wrap {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 0 auto 1.75rem;
}
.processing-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 12px rgba(225, 29, 140, 0.45));
}
.processing-ring-track {
  fill: none;
  stroke: rgba(225, 29, 140, 0.12);
  stroke-width: 8;
}
.processing-ring-value {
  fill: none;
  stroke: #E11D8C;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.05s linear;
}
.processing-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.05em;
  font-size: 2rem;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -0.03em;
}
.processing-pct small {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 0.35em;
}
.processing-steps {
  list-style: none;
  margin: 0 auto 1.25rem;
  padding: 0;
  text-align: left;
  max-width: 280px;
}
.processing-steps li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 550;
  opacity: 0.55;
  transition: opacity 0.25s ease, color 0.25s ease;
}
.processing-steps li.is-active,
.processing-steps li.is-done {
  opacity: 1;
  color: var(--fg);
}
.processing-steps li.is-active .processing-step-label {
  font-weight: 700;
  color: var(--primary);
}
.processing-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(225, 29, 140, 0.2);
  box-shadow: 0 0 0 2px rgba(225, 29, 140, 0.12);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.processing-steps li.is-active .processing-step-dot {
  background: #E11D8C;
  box-shadow: 0 0 0 4px rgba(225, 29, 140, 0.22), 0 0 14px rgba(225, 29, 140, 0.55);
  animation: processing-pulse 1.4s ease-in-out infinite;
}
.processing-steps li.is-done .processing-step-dot {
  background: #E11D8C;
  box-shadow: 0 0 0 2px rgba(225, 29, 140, 0.25);
  animation: none;
}
.processing-stall {
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}
.processing-error {
  margin-top: 1.25rem;
}
.processing-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}
@keyframes processing-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}
@media (prefers-reduced-motion: reduce) {
  .processing-steps li.is-active .processing-step-dot { animation: none; }
  .processing-ring-value { transition: none; }
  .processing-glow { filter: none; }
}
@media (prefers-color-scheme: dark) {
  .processing-ring-track { stroke: rgba(244, 114, 182, 0.15); }
  .processing-grid {
    background-image:
      linear-gradient(rgba(244, 114, 182, 0.07) 1px, transparent 1px),
      linear-gradient(90deg, rgba(244, 114, 182, 0.07) 1px, transparent 1px);
  }
}
