/* Smart Fill homepage demo — visual language borrowed 1:1 from styles.css.
   Every color falls back to PharmCalc's tokens when embedded in the app,
   and to the same literal values when previewed standalone. */

.sfdemo{
  --sfd-navy:var(--navy, #0d243f);
  --sfd-gold:var(--gold, #d4a017);
  --sfd-card:var(--card, #ffffff);
  --sfd-text:var(--text, #0d243f);
  --sfd-muted:var(--muted, #667085);
  --sfd-line:var(--line, #d9d6cc);
  --sfd-soft:var(--soft, #f3f0e8);
  --sfd-input:var(--input, #ffffff);

  max-width:560px;
  margin:0 auto;
  font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--sfd-text);
  background:var(--sfd-card);
  border:1px solid var(--sfd-line);
  border-radius:14px;
  padding:16px;
  box-shadow:0 6px 18px rgba(13,36,63,.08);
}

.sfdemo-label{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  font-size:.78rem;
  font-weight:700;
  letter-spacing:.02em;
  color:var(--sfd-muted);
  margin-bottom:6px;
}
.sfdemo-label .sfdemo-live{
  font-weight:600;
  font-size:.7rem;
  color:var(--sfd-gold);
}

.sfdemo-sig{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
  font-size:.9rem;
  line-height:1.45;
  background:var(--sfd-input);
  border:1px solid var(--sfd-line);
  border-radius:10px;
  padding:10px 12px;
  min-height:64px;
  white-space:pre-wrap;
  word-break:break-word;
}
.sfdemo-caret{
  display:inline-block;
  width:2px;
  height:1.1em;
  vertical-align:text-bottom;
  background:var(--sfd-gold);
  margin-left:1px;
  animation:sfdemoBlink 1s steps(1) infinite;
}
@keyframes sfdemoBlink{ 50%{opacity:0;} }

.sfdemo-status{
  min-height:20px;
  margin:10px 0 2px;
  font-size:.78rem;
  color:var(--sfd-muted);
}
.sfdemo-status.reading::after{
  content:"";
  display:inline-block;
  width:1.2em;
  text-align:left;
  animation:sfdemoDots 1s steps(4) infinite;
}
@keyframes sfdemoDots{
  0%{content:"";} 25%{content:".";} 50%{content:"..";} 75%{content:"...";}
}

.sfdemo-result{
  border:1px solid var(--sfd-line);
  border-radius:10px;
  background:var(--sfd-soft);
  padding:12px;
  margin-top:8px;
  opacity:0;
  transform:translateY(4px);
  transition:opacity .35s ease, transform .35s ease;
}
.sfdemo-result.show{ opacity:1; transform:translateY(0); }

.sfdemo-result-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.sfdemo-route{
  font-weight:800;
  font-size:.95rem;
  line-height:1.3;
}
.sfdemo-route small{
  display:block;
  font-weight:600;
  font-size:.72rem;
  color:var(--sfd-muted);
}

/* Confidence badge — mirrors .smart-fill-confidence tones */
.sfdemo-conf{
  flex:none;
  display:inline-flex;
  flex-direction:column;
  align-items:flex-end;
  padding:5px 8px;
  border-radius:8px;
  border:1px solid transparent;
  font-weight:800;
  font-size:.78rem;
  white-space:nowrap;
}
.sfdemo-conf small{ font-weight:700; font-size:.66rem; color:var(--sfd-muted); }
.sfdemo-conf.auto{ border-color:rgba(19,126,57,.35); background:rgba(19,126,57,.08); color:#137e39; }
.sfdemo-conf.review{ border-color:rgba(216,168,51,.45); background:rgba(216,168,51,.12); color:#8a5a00; }
.sfdemo-conf.manual{ border-color:rgba(174,42,35,.35); background:rgba(174,42,35,.09); color:#ae2a23; }

.sfdemo-fields{ list-style:none; margin:0; padding:0; }
.sfdemo-fields li{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:5px 0;
  border-top:1px dashed var(--sfd-line);
  font-size:.82rem;
  opacity:0;
  transform:translateY(3px);
  transition:opacity .3s ease, transform .3s ease;
}
.sfdemo-fields li.show{ opacity:1; transform:translateY(0); }
.sfdemo-fields li:first-child{ border-top:0; }
.sfdemo-fields .k{ color:var(--sfd-muted); font-weight:600; flex:none; }
.sfdemo-fields .v{ text-align:right; font-weight:700; word-break:break-word; }

.sfdemo-why{
  margin-top:9px;
  font-size:.78rem;
  color:var(--sfd-muted);
  line-height:1.45;
  opacity:0;
  transition:opacity .35s ease;
}
.sfdemo-why.show{ opacity:1; }
.sfdemo-why strong{ color:var(--sfd-text); }

/* Dark mode: inherit the app's tokens when body.dark redefines them.
   Standalone fallbacks for badge tones follow the app's dark values. */
body.dark .sfdemo{ box-shadow:0 6px 18px rgba(0,0,0,.35); }
body.dark .sfdemo-conf.auto{ background:rgba(74,222,128,.12); border-color:rgba(74,222,128,.32); color:#86efac; }
body.dark .sfdemo-conf.review{ background:rgba(247,216,120,.12); border-color:rgba(247,216,120,.35); color:#fde68a; }
body.dark .sfdemo-conf.manual{ background:rgba(248,113,113,.12); border-color:rgba(248,113,113,.32); color:#fca5a5; }

@media (max-width:560px){
  .sfdemo{ border-radius:12px; padding:12px; }
  .sfdemo-result-header{ display:grid; }
  .sfdemo-conf{ align-items:flex-start; }
}

@media (prefers-reduced-motion: reduce){
  .sfdemo-caret{ animation:none; }
  .sfdemo-result, .sfdemo-fields li, .sfdemo-why{ transition:none; }
}
