/* The demo on ehtii.fi: a customer's phone and the owner's, playing a
   scripted conversation. The chat parts look like the booking page and
   the app (server/web/static/ehtii.css). */

.demo { margin: 40px 0 8px; }
.demo [hidden] { display: none !important; }
.demo-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 14px; }
/* What plays: a dot per scene, its name and "next"; the customer's
   language is one button. The demo runs by itself, so the controls stay quiet. */
.demo-now { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.demo-dots { display: flex; gap: 5px; }
.demo-dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .25; }
.demo-dots i.on { background: var(--accent); opacity: 1; }
.demo-scene { display: inline-grid; font-weight: 600; }
.demo-scene span { grid-area: 1 / 1; visibility: hidden; }
.demo-scene span.on { visibility: visible; }
.demo button { font: inherit; color: inherit; cursor: pointer; }
.demo .demo-next { border: 0; background: none; padding: 4px 2px; font-size: 13px; color: var(--muted); }
.demo .demo-next:hover, .demo .demo-next:focus-visible { text-decoration: underline; }
.demo .demo-lang { border: 1px solid #d9d3de; border-radius: 999px; background: none; padding: 4px 10px; font-size: 13px; color: var(--muted); }

.demo-stage { display: flex; justify-content: center; gap: 28px; }
.demo-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.demo-who { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.phone {
  position: relative; width: 290px; height: 560px; overflow: hidden;
  border: 9px solid #1f1d22; border-radius: 38px; background: #faf9fb; color: #2b2730;
  box-shadow: 0 18px 40px rgba(43, 39, 48, .18);
  display: flex; flex-direction: column; font-size: 14px; line-height: 1.45;
}
.phone-status { display: flex; justify-content: space-between; padding: 8px 18px 4px; font-size: 11px; font-weight: 600; }
.phone-top { padding: 4px 14px 10px; border-bottom: 1px solid #e7e3ea; background: #fff; }
.phone-top .url { margin: 0 auto 6px; width: fit-content; padding: 2px 10px; border-radius: 999px; background: #f0edf2; color: var(--muted); font-size: 11px; }
.phone-top strong { display: block; font-size: 15px; }
.phone-top span { color: var(--muted); font-size: 12px; }
.phone-body { flex: 1; overflow: hidden; padding: 12px 10px; display: flex; flex-direction: column; gap: 7px; }
.phone-body > :first-child { margin-top: auto; }
.phone-foot { display: flex; gap: 6px; padding: 8px 10px 14px; border-top: 1px solid #e7e3ea; background: #fff; }
/* The field grows to three lines as the text is typed, like a phone's,
   so the newest words always show. */
.phone-foot { align-items: flex-end; }
.phone-foot .field {
  flex: 1; min-width: 0; max-height: calc(3 * 1.45em + 16px); padding: 8px 12px; border: 1px solid #e7e3ea; border-radius: 18px;
  color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden;
}
.phone-foot .send { min-height: 37px; }
.phone-foot .field:empty::before { content: attr(data-placeholder); color: #a49dab; }
/* Send is a round arrow, as on the booking page and in the app. */
.phone-foot .send { flex: none; width: 37px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }

.d-msg { margin: 0; max-width: 86%; padding: 8px 12px; border-radius: 15px; white-space: pre-wrap; overflow-wrap: anywhere; animation: d-in .25s ease-out; }
.d-msg.bot { align-self: flex-start; background: #f3f0f6; border-bottom-left-radius: 4px; }
.d-msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.d-msg.typing { display: flex; gap: 4px; align-items: center; padding: 12px 13px; }
.d-msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: d-dots 1.2s infinite ease-in-out; }
.d-msg.typing i:nth-child(2) { animation-delay: .15s; }
.d-msg.typing i:nth-child(3) { animation-delay: .3s; }
.d-msg.typing span { margin-left: 4px; color: var(--muted); font-size: 12px; }
@keyframes d-dots { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes d-in { from { opacity: 0; transform: translateY(6px); } }

.d-options { display: flex; flex-direction: column; margin: 6px -6px -2px; white-space: normal; }
.d-option { display: flex; justify-content: space-between; gap: 10px; padding: 7px 6px; border-top: 1px solid #e7e3ea; border-radius: 6px; transition: background .2s, opacity .3s; }
.d-option b { color: var(--accent); font-weight: 600; }
.d-option small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.d-options.picked .d-option:not(.chosen) { opacity: .5; }
.d-option.chosen { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.d-option.chosen b::after { content: " ✓"; }

.d-card { align-self: stretch; padding: 9px 11px; border: 1px solid #e7e3ea; border-left: 4px solid var(--accent); border-radius: 11px; background: #fff; animation: d-in .3s ease-out; }
.d-card.done { background: color-mix(in srgb, var(--accent) 8%, #fff); }
.d-card strong { display: block; }
.d-card dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; font-size: 13px; }
.d-card dt { color: var(--muted); }
.d-card dd { margin: 0; }
.d-chips { display: flex; flex-wrap: wrap; gap: 6px; animation: d-in .3s ease-out; }
.d-chip { border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 4px 11px; font-size: 13px; transition: background .2s, color .2s, opacity .3s; }
.d-chip.chosen { background: var(--accent); color: #fff; }
.d-chips.picked .d-chip:not(.chosen) { opacity: .4; }

.d-day { align-self: stretch; padding: 9px; border: 1px solid #e7e3ea; border-radius: 12px; background: #fff; animation: d-in .3s ease-out; }
.d-day header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.d-day header span { color: var(--muted); font-size: 11px; }
.d-day ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.d-day li { border: 1px solid #e7e3ea; border-left: 4px solid var(--accent); border-radius: 8px; padding: 4px 8px; font-size: 12px; }
.d-day li b { display: block; }
.d-day li span { color: var(--muted); }
.d-day li.free { border-style: dashed; border-left-style: solid; border-left-color: #e7e3ea; color: #a49dab; }
.d-day li.new { animation: d-new 2.4s ease-out; }
@keyframes d-new {
  0% { opacity: 0; transform: scale(.9); background: color-mix(in srgb, var(--accent) 30%, #fff); }
  20% { opacity: 1; transform: none; }
  100% { background: #fff; }
}
.d-day footer { margin-top: 6px; text-align: right; font-weight: 600; font-size: 12px; }

.d-banner {
  position: absolute; z-index: 2; top: 30px; left: 8px; right: 8px; padding: 9px 11px;
  border-radius: 14px; background: rgba(255, 255, 255, .97); box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  display: flex; gap: 9px; align-items: flex-start; font-size: 12px; line-height: 1.35;
  transform: translateY(calc(-100% - 40px)); transition: transform .45s cubic-bezier(.2, .9, .3, 1.2);
}
.d-banner.show { transform: none; }
.d-banner img { width: 26px; height: 26px; border-radius: 7px; flex: none; }
.d-banner b { display: block; }

.d-tap { position: absolute; z-index: 3; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgba(43, 39, 48, .25); pointer-events: none; animation: d-tap .6s ease-out forwards; }
@keyframes d-tap { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

/* The gift card shop on the booking page */
.d-shop { display: flex; flex-direction: column; gap: 8px; animation: d-in .3s ease-out; }
.d-shop h3 { margin: 0; font-size: 15px; }
.d-shop .gift { display: flex; justify-content: space-between; align-items: center; padding: 12px; border: 1px solid #e7e3ea; border-radius: 12px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.d-shop .gift b { font-size: 18px; color: var(--accent); }
.d-shop .gift.chosen { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.d-shop label { display: block; font-size: 12px; color: var(--muted); }
.d-shop .input { min-height: 34px; padding: 7px 10px; border: 1px solid #e7e3ea; border-radius: 9px; background: #fff; }
.d-shop .pay { align-self: stretch; padding: 10px; border-radius: 11px; background: var(--accent); color: #fff; font-weight: 600; text-align: center; }
.d-sheet {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 16px 16px 22px;
  border-radius: 18px 18px 0 0; background: #fff; box-shadow: 0 -8px 24px rgba(0, 0, 0, .15);
  transform: translateY(105%); transition: transform .4s ease-out;
}
.d-sheet.show { transform: none; }
.d-sheet .total { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 10px; }
.d-sheet .way { padding: 9px 10px; border: 1px solid #e7e3ea; border-radius: 10px; margin-bottom: 6px; }
.d-sheet .way.chosen { border-color: var(--accent); }
.d-sheet .state { margin-top: 10px; text-align: center; color: var(--muted); min-height: 22px; }
.d-sheet .state.ok { color: var(--accent); font-weight: 600; }
.d-giftcard {
  align-self: stretch; padding: 14px; border-radius: 14px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #24453e); animation: d-in .4s ease-out;
}
.d-giftcard small { display: block; opacity: .8; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.d-giftcard .sum { font-size: 28px; font-weight: 700; margin: 2px 0 6px; }
.d-giftcard p { margin: 0 0 4px; }
.d-giftcard code { font: 600 13px/1 ui-monospace, monospace; background: rgba(255, 255, 255, .18); padding: 3px 6px; border-radius: 5px; }

/* The owner's phone is the app, in its night look (app/lib/src/ui/theme.dart). */
.phone.owner { --accent: #7ee0c3; --muted: #8fa39d; background: #0e1412; color: #e4efeb; border-color: #000; }
.phone.owner .phone-top, .phone.owner .phone-foot { background: #0e1412; border-color: #1f2a27; }
.phone.owner .phone-top { text-align: center; }
.phone.owner .phone-foot .field { border: 1.5px solid var(--accent); border-radius: 14px; color: #e4efeb; }
.phone.owner .phone-foot .field:empty::before { color: #6f817c; }
.phone.owner .phone-foot .send, .phone.owner .d-msg.me, .phone.owner .d-chip.chosen {
  background: linear-gradient(135deg, #7ee0c3, #b9f3e0); color: #0b1714;
}
.phone.owner .d-msg.bot { background: #1b2422; }
.phone.owner .d-card, .phone.owner .d-day { background: #141c1a; border-color: #25312e; }
.phone.owner .d-card { border-left-color: var(--accent); }
.phone.owner .d-card.done { background: #16221f; }
.phone.owner .d-day li { border-color: #25312e; border-left-color: var(--accent); }
.phone.owner .d-day li.free { border-left-color: #25312e; color: #6f817c; }
.phone.owner .d-day li.new { animation-name: d-new-night; }
@keyframes d-new-night {
  0% { opacity: 0; transform: scale(.9); background: rgba(126, 224, 195, .3); }
  20% { opacity: 1; transform: none; }
  100% { background: transparent; }
}
.phone.owner .d-option { border-color: #25312e; }
.phone.owner .d-banner { background: rgba(32, 40, 38, .97); color: #e4efeb; }
.phone.owner .d-tap { background: rgba(126, 224, 195, .3); }

.demo-caption { min-height: 28px; margin: 16px 0 0; text-align: center; font-size: 18px; font-weight: 600; color: var(--accent); transition: opacity .3s; }
.demo-caption.fade { opacity: 0; }
.demo-foot { display: flex; justify-content: center; gap: 10px; margin-top: 6px; }
.demo-foot button { border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; }

/* On a phone the two phones take turns. */
@media (max-width: 700px) {
  .demo-stage { gap: 0; }
  .demo-side { display: none; }
  .demo-side.focus { display: flex; animation: d-in .35s ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  .demo *, .demo *::before { animation: none !important; transition: none !important; }
}

/* Scene changes fade rather than jump (demo.js adds "out"). */
.demo-rush, .demo-stage, .demo-caption { transition: opacity .35s ease; }
.demo-rush.out, .demo-stage.out, .demo-caption.out { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .demo-rush, .demo-stage, .demo-caption { transition: none; }
}
