/* ─── DraftGuard demo styles ──────────────────────────────────────────
   Two modes driven by body[data-mode="landing"|"tiktok"]:
     - landing: 16:9 cinematic, fits inside an iframe on the marketing site
     - tiktok : 9:16 vertical, designed to be screen-recorded at 1080×1920

   Everything in this file is pure CSS — no @imports, no external fonts.
─────────────────────────────────────────────────────────────────────── */

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

:root {
  --bg:           #0F172A;
  --bg-2:         #111A2E;
  --card:         #FFFFFF;
  --card-soft:    #F8FAFC;
  --text:         #0F172A;
  --text-soft:    #475569;
  --text-faint:   #94A3B8;
  --border:       #E2E8F0;
  --blue:         #2563EB;
  --blue-dark:    #1D4ED8;
  --green:        #059669;
  --green-dark:   #047857;
  --red:          #DC2626;
  --radius:       16px;
}

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: white;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

.demo-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 600px at 50% -10%, rgba(59,130,246,0.18), transparent 65%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 60%, #0F1B33 100%);
}

/* ─── Stage ──────────────────────────────────────────────────────── */

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

/* TikTok safe margins — top 10% / bottom 14% kept clear of UI chrome.
   We tightened from the original 15/20 because the persistent brand
   header now occupies the top zone explicitly. */
.demo-body[data-mode="tiktok"] .stage {
  padding: 10% 24px 14%;
}

/* ─── Persistent brand header (tiktok mode only) ──────────────────── */

.demo-brand {
  display: none;
}
.demo-body[data-mode="tiktok"] .demo-brand {
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 36px 28px 0;
  z-index: 100;
  pointer-events: none;
  justify-content: center;
  transition: opacity 0.4s ease;
}
/* The final scene shows its own large shield + "Type it once" headline —
   the persistent brand header would just be redundant noise on that
   slide, so we fade it out for the closing card only. */
.demo-body[data-mode="tiktok"]:has(.final-stage.visible) .demo-brand {
  opacity: 0;
}
.demo-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.demo-brand-shield {
  filter: drop-shadow(0 6px 14px rgba(59,130,246,0.35));
}
.demo-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.demo-brand-name {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: white;
}
.demo-brand-tag {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}

/* ─── Caption (big readable scene text) ─────────────────────────── */

.caption {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  bottom: 12%;
  padding: 12px 22px;
  background: rgba(15, 23, 42, 0.85);
  color: white;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-radius: 14px;
  opacity: 0;
  transition: opacity 0.32s ease, transform 0.32s ease;
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  max-width: calc(100% - 40px);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}
.caption.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.demo-body[data-mode="tiktok"] .caption {
  bottom: 6%;
  font-size: 38px;
  font-weight: 800;
  padding: 18px 32px;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.92);
}

/* ─── Canvas + browser frame ───────────────────────────────────── */

.canvas {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.45s ease;
}
.canvas.hidden { opacity: 0; pointer-events: none; }

.browser {
  position: relative;
  width: 100%;
  max-width: 920px;
  border-radius: 18px;
  background: white;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.06),
    0 30px 80px -20px rgba(0,0,0,0.55);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}

/* Vertical layout: phone-style card, narrower */
.demo-body[data-mode="tiktok"] .browser {
  max-width: 100%;
  border-radius: 22px;
}

.browser-chrome {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  background: linear-gradient(180deg, #F3F4F6, #E5E7EB);
  border-bottom: 1px solid #D1D5DB;
}

.browser-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.browser-dots span {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.browser-dots span:nth-child(1) { background: #FF5F57; }
.browser-dots span:nth-child(2) { background: #FEBC2E; }
.browser-dots span:nth-child(3) { background: #28C840; }

.browser-tabs {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  flex-shrink: 0;
}
.browser-tab {
  background: white;
  color: var(--text);
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: 8px 8px 0 0;
  font-weight: 500;
  letter-spacing: -0.005em;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.35s ease;
}

.browser-addr {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid #D1D5DB;
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 12.5px;
  color: #6B7280;
}
.browser-lock { color: #6B7280; flex-shrink: 0; }
.browser-url {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.3s ease;
}

/* On vertical, hide the dots/tabs to save horizontal space */
.demo-body[data-mode="tiktok"] .browser-tabs { display: none; }
.demo-body[data-mode="tiktok"] .browser-chrome { padding: 18px 22px; }
.demo-body[data-mode="tiktok"] .browser-addr { font-size: 19px; padding: 10px 18px; }
.demo-body[data-mode="tiktok"] .browser-dots span { width: 16px; height: 16px; }

/* ─── Form body ────────────────────────────────────────────────── */

.form {
  padding: 28px 28px 32px;
  background: white;
  color: var(--text);
  min-height: 320px;
}

.demo-body[data-mode="tiktok"] .form {
  padding: 44px 34px 48px;
  min-height: 760px;
}

.form-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
  color: var(--text);
  transition: opacity 0.35s ease;
}

.form-title::before {
  content: attr(data-eyebrow);
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 6px;
  transition: color 0.35s ease;
}

.demo-body[data-mode="tiktok"] .form-title { font-size: 32px; margin-bottom: 8px; }
.demo-body[data-mode="tiktok"] .form-title::before { font-size: 15px; margin-bottom: 10px; }

.form-rows {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: -0.005em;
}

.form-field-input,
.form-field-textarea {
  background: var(--card-soft);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  line-height: 1.45;
  min-height: 38px;
  white-space: pre-wrap;
  word-wrap: break-word;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.form-field-textarea {
  min-height: 96px;
  line-height: 1.55;
}

.demo-body[data-mode="tiktok"] .form-field-label    { font-size: 18px; margin-bottom: 8px; }
.demo-body[data-mode="tiktok"] .form-field-input    { font-size: 22px; min-height: 60px; padding: 14px 16px; }
.demo-body[data-mode="tiktok"] .form-field-textarea { font-size: 22px; min-height: 200px; padding: 16px; }

/* Field-restored green flash (matches the real DraftGuard restore behavior) */
.form-field-input.flash,
.form-field-textarea.flash {
  animation: greenFlash 0.95s ease-out;
}
@keyframes greenFlash {
  0%   { background: var(--card-soft); border-color: var(--border); box-shadow: 0 0 0 0 rgba(16,185,129,0); }
  12%  { background: #ECFDF5; border-color: #10B981; box-shadow: 0 0 0 4px rgba(16,185,129,0.18); }
  100% { background: var(--card-soft); border-color: var(--border); box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* Variant (scene 3) — different visual identity to read as "a different site" */
.form.variant .form-title::before { color: #8B5CF6; }
.form.variant .form-field-input,
.form.variant .form-field-textarea { border-color: #E9D5FF; }

/* ─── DraftGuard bars (recovery + autofill) ────────────────────── */

.dg-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: white;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transform: translateY(-110%);
  transition: transform 0.36s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 30;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.dg-bar.visible { transform: translateY(0); }
.dg-bar-recovery { background: linear-gradient(135deg, #2563EB, #1D4ED8); }
.dg-bar-autofill { background: linear-gradient(135deg, #059669, #047857); }

.demo-body[data-mode="tiktok"] .dg-bar {
  height: 78px;
  font-size: 20px;
  padding: 0 24px;
}

.dg-bar-icon  { flex-shrink: 0; }
.dg-bar-text  { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dg-bar-btn {
  background: white;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease;
}
.dg-bar-btn.pressed { transform: scale(0.94); }
.dg-bar-recovery .dg-bar-btn-primary { color: #2563EB; }
.dg-bar-autofill .dg-bar-btn-primary { color: #059669; }
.dg-bar-btn-secondary {
  background: transparent;
  color: rgba(255,255,255,0.75);
  padding: 5px 8px;
  font-weight: 500;
}

.demo-body[data-mode="tiktok"] .dg-bar-btn { font-size: 17px; padding: 9px 18px; border-radius: 8px; }

/* ─── Session-expired modal (scene 1 end) ───────────────────────── */

.session-expired {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  z-index: 40;
}
.session-expired.visible { opacity: 1; }

.session-expired-card {
  background: white;
  border: 1px solid var(--border);
  border-top: 4px solid var(--red);
  border-radius: 12px;
  padding: 22px 28px;
  text-align: center;
  min-width: 280px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  transform: scale(0.94);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.session-expired.visible .session-expired-card { transform: scale(1); }

.session-expired-icon  { font-size: 28px; margin-bottom: 6px; }
.session-expired-title { font-size: 16px; font-weight: 800; color: var(--red); letter-spacing: -0.01em; margin-bottom: 4px; }
.session-expired-body  { font-size: 13px; color: var(--text-soft); }

.demo-body[data-mode="tiktok"] .session-expired-title { font-size: 20px; }
.demo-body[data-mode="tiktok"] .session-expired-body  { font-size: 15px; }

/* ─── Toast (scene 2) ──────────────────────────────────────────── */

.dg-toast {
  position: absolute;
  bottom: 16px;
  right: 16px;
  padding: 10px 14px;
  background: #0F172A;
  color: white;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 10px;
  border-left: 3px solid #10B981;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  z-index: 35;
  box-shadow: 0 10px 26px rgba(0,0,0,0.32);
}
.dg-toast.visible { opacity: 1; transform: translateY(0); }

.demo-body[data-mode="tiktok"] .dg-toast { font-size: 15px; padding: 12px 18px; }

/* ─── Scene 4: Privacy ─────────────────────────────────────────── */

.privacy-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 64px 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
  z-index: 60;
  background:
    radial-gradient(900px 600px at 50% 0%, rgba(59,130,246,0.18), transparent 65%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 60%, #0F1B33 100%);
}
.privacy-stage.visible { opacity: 1; pointer-events: auto; }

.privacy-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  max-width: 760px;
  width: 100%;
}

.privacy-badge {
  flex: 1 1 200px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.85);
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-width: 0;
}

.privacy-badge svg { color: rgba(255,255,255,0.72); }

.privacy-badge-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.privacy-subtext {
  font-size: 14.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.01em;
  text-align: center;
}

.demo-body[data-mode="tiktok"] .privacy-badges  { flex-direction: column; gap: 18px; max-width: 520px; }
.demo-body[data-mode="tiktok"] .privacy-badge   { flex: 0 0 auto; padding: 26px 22px; gap: 16px; }
.demo-body[data-mode="tiktok"] .privacy-badge svg { width: 36px; height: 36px; }
.demo-body[data-mode="tiktok"] .privacy-badge-label { font-size: 26px; }
.demo-body[data-mode="tiktok"] .privacy-subtext { font-size: 22px; margin-top: 8px; }

/* ─── Scene 5: Final card ──────────────────────────────────────── */

.final-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 56px 28px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 70;
  background:
    radial-gradient(1100px 700px at 50% 0%, rgba(59,130,246,0.22), transparent 65%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 60%, #0F1B33 100%);
}
.final-stage.visible { opacity: 1; pointer-events: auto; }

.final-shield {
  transform: scale(0.78);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.45s ease;
}
.final-stage.visible .final-shield { transform: scale(1); opacity: 1; }

.final-headline {
  font-size: 34px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.03em;
  line-height: 1.1;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}
.final-stage.visible .final-headline { opacity: 1; transform: translateY(0); }

.final-subtitle {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  opacity: 0;
  transition: opacity 0.5s ease 0.45s;
}
.final-stage.visible .final-subtitle { opacity: 1; }

.final-cta {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--blue);
  color: white;
  padding: 13px 26px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.005em;
  opacity: 0;
  transition: opacity 0.5s ease 0.7s, transform 0.15s ease;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.15) inset,
    0 10px 30px -8px rgba(37, 99, 235, 0.55);
}
.final-stage.visible .final-cta { opacity: 1; }

.demo-body[data-mode="tiktok"] .final-shield svg { width: 140px; height: 154px; }
.demo-body[data-mode="tiktok"] .final-headline { font-size: 68px; line-height: 1.05; }
.demo-body[data-mode="tiktok"] .final-subtitle { font-size: 26px; letter-spacing: 0.18em; }
.demo-body[data-mode="tiktok"] .final-cta      { font-size: 26px; padding: 22px 44px; border-radius: 16px; }

/* ─── Persistent UI: progress bar + replay button ──────────────── */

.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.08);
  z-index: 100;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #60A5FA, #2563EB);
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.6);
}

.replay-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(15, 23, 42, 0.55);
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  z-index: 110;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.replay-btn:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(255,255,255,0.3);
}
.demo-body[data-mode="tiktok"] .replay-btn {
  width: 44px;
  height: 44px;
  bottom: 24px;
  right: 24px;
}

/* Small accessibility/edge-case: respect reduced motion for non-essential
   shimmer; the demo's main animations still play (it's the whole point). */
@media (prefers-reduced-motion: reduce) {
  .progress-fill,
  .final-cta,
  .replay-btn { transition: none !important; }
}
