/* Zoe live demo (#demo/zoe, lib/ui/zoe-demo.js): settings beside an SMS thread with an iMessage look.
   The homeowner (Luke typing) is blue on the right, Zoe grey on the left. */

.zd { max-width: 64rem; margin: 0 auto; padding: 1rem 1rem 6rem; }
.zd-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.zd-title { font: var(--title-w) 1.35rem/1.2 var(--f-title); margin: 0; flex: 1; letter-spacing: var(--title-track); }
.zd-status { font-size: .85rem; padding: .25rem .7rem; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.zd-status::before { content: ''; display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; margin-right: .4rem; vertical-align: .05rem; }
.zd-status[data-s="online"] { color: var(--good); }
.zd-status[data-s="offline"] { color: var(--bad); }
.zd-offline { background: #fdecea; color: #7a1f17; border: 1px solid #f3c2bc; border-radius: 12px; padding: .7rem .9rem; margin-bottom: .75rem; font-size: .92rem; }

.zd-body { display: grid; grid-template-columns: 15rem minmax(0, 26rem); gap: 1.5rem; justify-content: center; align-items: start; }
.zd-settings { display: flex; flex-direction: column; gap: .7rem; }
.zd-field { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--ink-2); }
.zd-in { width: 100%; min-width: 0; box-sizing: border-box; font: inherit; font-size: 1rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .65rem; }
.zd-in:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.zd-hint { font-size: .8rem; color: var(--ink-3); margin: .25rem 0 0; }

.zd-phone {
  display: flex; flex-direction: column; height: min(44rem, calc(100vh - 9rem)); min-height: 26rem;
  background: #fff; border-radius: 36px; border: 10px solid #1c1c1e; box-shadow: var(--shadow); overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
}
.zd-contact { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .8rem .5rem .55rem; background: #f6f6f8; border-bottom: 1px solid #e3e3e6; }
.zd-avatar { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: linear-gradient(#a5abb8, #858b98); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1.15rem; }
.zd-who { font-size: .78rem; color: #1c1c1e; }

.zd-list { flex: 1; min-height: 0; overflow-y: auto; padding: .6rem .7rem; display: flex; flex-direction: column; gap: .3rem; overscroll-behavior: contain; }
.zd-row { display: flex; }
.zd-row.out { justify-content: flex-end; }
.zd-bubble { max-width: 78%; padding: .45rem .75rem; border-radius: 18px; font-size: .98rem; line-height: 1.32; white-space: pre-wrap; overflow-wrap: anywhere; }
.zd-row.in .zd-bubble { background: #e9e9eb; color: #000; border-bottom-left-radius: 5px; }
.zd-row.out .zd-bubble { background: #0a84ff; color: #fff; border-bottom-right-radius: 5px; }
.zd-row.out[data-status="new"] .zd-bubble { opacity: .85; }
.zd-note { align-self: center; font-size: .72rem; color: #8e8e93; text-align: center; margin: .35rem 0; }
.zd-day { margin-top: 0; }
.zd-flag { color: #8c5a10; background: #fff4e0; border-radius: 10px; padding: .25rem .6rem; }
.zd-err { color: #7a1f17; background: #fdecea; border-radius: 10px; padding: .25rem .6rem; }

.zd-typing .zd-bubble { display: flex; gap: .25rem; padding: .65rem .8rem; }
.zd-typing i { width: .45rem; height: .45rem; border-radius: 50%; background: #8e8e93; animation: zd-dot 1.2s infinite ease-in-out; }
.zd-typing i:nth-child(2) { animation-delay: .15s; }
.zd-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes zd-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .zd-typing i { animation: none; } }

.zd-compose { display: flex; align-items: flex-end; gap: .4rem; padding: .5rem .6rem .7rem; border-top: 1px solid #ececef; }
.zd-type { flex: 1; min-width: 0; resize: none; font: inherit; font-size: 1rem; border: 1px solid #d1d1d6; border-radius: 18px; padding: .45rem .8rem; max-height: 6rem; color: #000; background: #fff; }
.zd-type:focus { outline: none; border-color: #0a84ff; }
.zd-send { flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 0; background: #0a84ff; color: #fff; font-size: 1.1rem; font-weight: 700; cursor: pointer; }
.zd-send:disabled { background: #c7c7cc; cursor: default; }

@media (max-width: 720px) {
  .zd { padding: .6rem .5rem 6rem; }
  .zd-body { grid-template-columns: 1fr; gap: .8rem; }
  .zd-settings { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
  .zd-settings .zd-field:nth-child(3) { grid-column: 1 / -1; }
  .zd-settings .btn { grid-column: 1 / -1; }
  .zd-hint { grid-column: 1 / -1; }
  .zd-phone { border-width: 6px; border-radius: 26px; height: calc(100vh - 21rem); min-height: 22rem; }
}
