/* Messages with the host (public/stay-chat.js): a button in the corner, a panel above it on desks, a full sheet on
   phones. Beach palette, matching the site; the button sits above the phone's "Book" bar (--s-bar-h, set by stay.css). */

#s-chat {
  --c-sea: #0F766E;
  --c-sea-dark: #0B5A54;
  --c-sea-wash: #E6F3F1;
  --c-coral: #E8674A;
  --c-sand: #FBF8F3;
  --c-ink: #16262B;
  --c-muted: #5B6B70;
  --c-line: #E7DFD3;
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--c-ink);
}
#s-chat button, #s-chat input, #s-chat textarea { font-family: inherit; }

.c-launch {
  position: fixed; right: 16px; bottom: calc(var(--s-bar-h, 0px) + 16px + env(safe-area-inset-bottom)); z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px; background: var(--c-sea); color: #fff; font-weight: 600; font-size: 0.95rem;
  box-shadow: 0 10px 30px rgba(15, 118, 110, 0.35); cursor: pointer; transition: transform 0.2s ease, background 0.2s;
}
.c-launch:hover { background: var(--c-sea-dark); transform: translateY(-1px); }
.c-launch svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.c-dot { position: absolute; top: 8px; right: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--c-coral); box-shadow: 0 0 0 2px #fff; }
#s-chat.is-open .c-launch { display: none; }

.c-panel {
  position: fixed; inset: 0; z-index: 60; display: grid; grid-template-rows: auto 1fr auto;
  background: var(--c-sand); box-shadow: 0 20px 60px rgba(22, 38, 43, 0.25);
}
.c-panel[hidden] { display: none; }
.c-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; background: #fff; border-bottom: 1px solid var(--c-line); }
.c-head h2 { margin: 0; font-size: 1.02rem; font-weight: 600; }
.c-head p { margin: 2px 0 0; font-size: 0.85rem; color: var(--c-muted); }
.c-head > div { flex: 1; min-width: 0; }
.c-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; background: url("/stay/logo.svg") center / cover, var(--c-sand); }
.c-close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; font-size: 1.7rem; line-height: 1; color: var(--c-muted); cursor: pointer; }
.c-close:hover { background: var(--c-sea-wash); color: var(--c-ink); }

.c-body { overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
.c-intro { margin: 0 0 12px; font-size: 1rem; }
.c-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.c-chip { min-height: 40px; padding: 0 14px; border: 1px solid var(--c-line); border-radius: 999px; background: #fff; font-weight: 500; font-size: 0.88rem; color: var(--c-ink); cursor: pointer; }
.c-chip:hover { border-color: var(--c-sea); color: var(--c-sea); }
.c-note { margin: 12px 0; padding: 10px 12px; border-radius: 12px; background: var(--c-sea-wash); color: var(--c-sea-dark); font-size: 0.9rem; }
.c-booking { margin: 0 0 12px; padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--c-line); font-size: 0.88rem; color: var(--c-muted); }
.c-booking b { color: var(--c-ink); font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.04em; }

.c-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.c-day { align-self: center; margin: 8px 0 2px; font-size: 0.78rem; color: var(--c-muted); }
.c-day span { padding: 3px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--c-line); }
.c-msg { max-width: 82%; }
.c-msg p { margin: 0; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.c-msg time { display: block; margin-top: 3px; font-size: 0.74rem; color: var(--c-muted); }
.c-msg.is-mine { align-self: flex-end; text-align: right; }
.c-msg.is-mine p { background: var(--c-sea); color: #fff; border-bottom-right-radius: 6px; text-align: left; }
.c-msg.is-host { align-self: flex-start; }
.c-msg.is-host p { background: #fff; border: 1px solid var(--c-line); border-bottom-left-radius: 6px; }
.c-link { display: block; margin: 16px auto 0; min-height: 44px; border: 0; background: none; color: var(--c-muted); font-weight: 500; font-size: 0.85rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.c-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--c-line); }
.c-foot:empty { display: none; }
.c-start { display: grid; gap: 10px; }
.c-start label { display: grid; gap: 4px; font-size: 0.82rem; font-weight: 600; color: var(--c-muted); }
.c-row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.c-start input, .c-start textarea, .c-compose textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #C9BFB1; border-radius: 12px; background: #fff;
  font-weight: 400; font-size: 1rem; color: var(--c-ink); resize: vertical;
}
.c-start input:focus, .c-start textarea:focus, .c-compose textarea:focus { outline: 2px solid var(--c-sea); outline-offset: 1px; border-color: var(--c-sea); }
.c-send-btn { min-height: 48px; border: 0; border-radius: 12px; background: var(--c-coral); color: #fff; font-weight: 600; font-size: 1rem; cursor: pointer; }
.c-send-btn:hover { filter: brightness(0.94); }
.c-send-btn:disabled { opacity: 0.6; }
.c-compose { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.c-compose textarea { resize: none; max-height: 140px; border-radius: 22px; padding: 11px 16px; }
.c-send { width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--c-coral); color: #fff; cursor: pointer; display: grid; place-items: center; }
.c-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-send:disabled { opacity: 0.6; }
.c-compose .c-error { grid-column: 1 / -1; }
.c-error { margin: 0; color: #A12A2A; font-size: 0.88rem; }
.c-hp, .c-sr { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#s-chat :focus-visible { outline: 3px solid var(--c-sea); outline-offset: 2px; }

@media (max-width: 420px) { .c-row { grid-template-columns: 1fr; } .c-launch span { display: none; } .c-launch { padding: 0 15px; } }
@media (min-width: 640px) {
  .c-panel { inset: auto 20px 20px auto; width: 390px; height: min(620px, calc(100dvh - 40px)); border-radius: 22px; overflow: hidden; border: 1px solid var(--c-line); }
  .c-launch { right: 24px; bottom: calc(var(--s-bar-h, 0px) + 24px); }
}
@media (prefers-reduced-motion: reduce) { .c-launch { transition: none; } }
/* Signing in inside the panel (the .a-* styles live in stay.css) and who is writing */
#s-chat .c-auth { padding-top: 4px; }
.c-who { margin: 0 0 10px; font-size: 0.85rem; color: var(--c-muted); }
.c-link-inline { min-height: 32px; color: var(--c-sea); }
