/* Website assistant: the mosaic orb, its nudge bubble and the chat panel with the booking card.
   The orb can be dragged; it settles on the left or right edge. assistant.js sets the side (.is-left), whether the
   bubble and panel open below it (.is-below, when the orb sits in the upper half) and --as-top / --as-bottom / --as-room. */

.as-root {
  position: fixed;
  z-index: 60;
  right: 20px;
  bottom: var(--as-bottom, 20px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}
.as-root > * { pointer-events: auto; }
.as-root.is-left { right: auto; left: 20px; align-items: flex-start; }
.as-root.is-below { bottom: auto; top: var(--as-top); flex-direction: column-reverse; }

/* ---------- The orb ---------- */
.as-orb {
  --lx: 0px;
  --ly: 0px;
  position: relative;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 12px 22px rgba(13, 14, 19, 0.35));
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.25s ease;
}
.as-orb:hover { transform: scale(1.07); }
.as-root.is-dragging .as-orb { cursor: grabbing; transform: scale(1.12); filter: drop-shadow(0 20px 32px rgba(13, 14, 19, 0.42)); }
.as-orb:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.as-orb-body {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a2d3a, #0d0e13 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 0 3px color-mix(in srgb, var(--chip-5) 35%, transparent);
  animation: as-breathe 4.5s ease-in-out infinite;
}
.as-tiles {
  position: absolute;
  inset: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  transform: translate(calc(var(--lx) * 0.35), calc(var(--ly) * 0.35));
  transition: transform 0.3s ease;
}
.as-tiles i { border-radius: 2px; opacity: 0.45; animation: as-twinkle 3.2s ease-in-out infinite; animation-delay: var(--d, 0s); }
.as-tiles .t1 { background: var(--chip-1); }
.as-tiles .t2 { background: var(--chip-2); }
.as-tiles .t3 { background: var(--chip-3); }
.as-tiles .t4 { background: var(--chip-4); }
.as-tiles .t5 { background: var(--chip-5); }
.as-orb:hover .as-tiles i { opacity: 0.9; }
.as-shine {
  position: absolute;
  top: 24%;
  left: 30%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 70%);
  transform: translate(var(--lx), var(--ly));
  transition: transform 0.25s ease;
}
.as-orb.is-hopping { animation: as-hop 0.9s cubic-bezier(0.3, 1.4, 0.5, 1); }
.as-orb.is-wiggling { animation: as-wiggle 0.8s ease-in-out; }
.as-root.is-open .as-orb { transform: scale(0.92); }

@keyframes as-breathe { 50% { transform: scale(1.04); } }
@keyframes as-twinkle { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes as-hop {
  0% { transform: translateY(0) scale(1, 1); }
  25% { transform: translateY(-16px) scale(0.94, 1.06); }
  55% { transform: translateY(0) scale(1.08, 0.92); }
  75% { transform: translateY(-5px) scale(0.98, 1.02); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes as-wiggle { 25% { transform: rotate(-9deg); } 50% { transform: rotate(7deg); } 75% { transform: rotate(-4deg); } }

/* ---------- Nudge bubble ---------- */
.as-nudge {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 270px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 4px 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
  animation: as-pop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* The small corner points at the orb. */
.as-root.is-left .as-nudge { border-radius: 16px 16px 16px 4px; }
.as-root.is-below .as-nudge { border-radius: 16px 4px 16px 16px; }
.as-root.is-left.is-below .as-nudge { border-radius: 4px 16px 16px 16px; }
.as-nudge p { margin: 0; }
@keyframes as-pop { from { opacity: 0; transform: translateY(8px) scale(0.96); } }

.as-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.as-x:hover { color: var(--ink); }

/* ---------- Chat panel ---------- */
.as-panel {
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 32px));
  height: min(600px, var(--as-room, calc(100dvh - 120px)));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  animation: as-pop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.as-panel[hidden] { display: none; }
.as-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--line); }
.as-head-orb {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a2d3a, #0d0e13 70%);
}
.as-head-orb .as-tiles { inset: 7px; gap: 1px; transform: none; }
.as-panel.is-thinking .as-head-orb .as-tiles i { animation-duration: 0.9s; }
.as-title { display: grid; flex: 1; min-width: 0; }
.as-title b { font-family: var(--font-display); font-size: 15px; }
.as-title small { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.as-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px; overscroll-behavior: contain; }
.as-msg { max-width: 88%; padding: 9px 12px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.as-msg.is-assistant { align-self: flex-start; background: var(--bg-soft); border-end-start-radius: 4px; }
.as-msg.is-user { align-self: flex-end; background: var(--btn-bg); color: var(--btn-fg); border-end-end-radius: 4px; }
.as-text p { margin: 0 0 6px; }
.as-text p:last-child { margin-bottom: 0; }
.as-text ul { margin: 4px 0 6px; padding-inline-start: 18px; }
.as-text a { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
/* While a reply types out: empty lines and list points wait for their text, links and buttons for the end. */
.as-msg.is-typing-out { cursor: pointer; }
.as-msg.is-typing-out .as-text p:empty, .as-msg.is-typing-out .as-text li:empty { display: none; }
.as-msg.is-typing-out .as-link-btn { visibility: hidden; }
.as-msg .as-caret::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-inline-start: 2px;
  vertical-align: -2px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.45;
  animation: as-caret 0.9s steps(2) infinite;
}
@keyframes as-caret { 50% { opacity: 0; } }
.as-chips > * { animation: as-pop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.as-chips > :nth-child(2) { animation-delay: 0.06s; }
.as-link-btn { display: inline-block; margin-top: 8px; padding: 6px 12px; border-radius: 999px; background: var(--btn-bg); color: var(--btn-fg); font-size: 13px; font-weight: 600; }

.as-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.as-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: as-dot 1.1s ease-in-out infinite; }
.as-dots i:nth-child(2) { animation-delay: 0.15s; }
.as-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes as-dot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Answers to tap as one tidy block (two to a row when they are short); booking the call is the separate,
   full-width action below them. */
.as-chips { display: grid; gap: 6px; padding: 4px 14px 12px; }
.as-chips:empty { display: none; }
.as-options { display: grid; gap: 6px; }
.as-options.is-paired { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.as-options.is-paired > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.as-chips button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.35;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.as-chips button:hover { border-color: var(--line-strong); background: var(--bg-soft); }
.as-chips .i { flex: none; width: 14px; height: 14px; color: var(--ink-3); }
.as-chips .is-book { justify-content: center; gap: 8px; margin-top: 4px; background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); font-weight: 600; }
.as-chips .is-book:hover { background: var(--btn-bg); border-color: var(--btn-bg); opacity: 0.9; }
.as-chips .is-book .i { color: currentColor; }

.as-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.as-form[hidden] { display: none; }
.as-form textarea {
  flex: 1;
  height: 40px;
  min-height: 40px;
  max-height: 120px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  line-height: 20px;
  /* No scroll bars while the text fits; assistant.js allows vertical scrolling only past the maximum height. */
  overflow: hidden;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
  resize: none;
  outline: none;
}
.as-form textarea:focus { border-color: var(--line-strong); }
.as-send { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--btn-bg); color: var(--btn-fg); cursor: pointer; }
.as-send .i { width: 16px; height: 16px; }
[dir="rtl"] .as-send .i { scale: -1 1; }
.as-notice { margin: 0; padding: 0 14px 10px; font-size: 11.5px; color: var(--ink-3); }
.as-notice a { text-decoration: underline; }

/* ---------- Booking card ---------- */
.as-card { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.as-card-title { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; font-size: 14px; }
.as-card-title .i { width: 16px; height: 16px; }
.as-days { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.as-days button, .as-times button {
  flex: none;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.as-days button.is-on { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); }
.as-times { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.as-times button:hover { border-color: var(--ink); }
.as-more { font-size: 12.5px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.as-book-form { display: grid; gap: 8px; }
.as-book-form input:not([type="checkbox"]), .as-book-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
.as-trap { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.as-consent { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.as-consent input { margin-top: 3px; }
.as-error { margin: 0; min-height: 0; color: var(--err); font-size: 12.5px; }
.as-error:empty { display: none; }
.as-book { padding: 10px 14px; border: 0; border-radius: 12px; background: var(--btn-bg); color: var(--btn-fg); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.as-book:disabled { opacity: 0.6; cursor: progress; }
.as-back { justify-self: start; padding: 0; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }

/* ---------- Phones: above the booking bar; the panel becomes a sheet ---------- */
@media (max-width: 760px) {
  .as-root { right: 14px; }
  .as-root.is-left { left: 14px; }
  .as-orb { width: 54px; height: 54px; }
  .as-tiles { inset: 10px; }
  .as-root.is-open { inset: 8px; flex-direction: column; align-items: stretch; }
  .as-root.is-open .as-orb { display: none; }
  .as-panel { width: auto; height: auto; flex: 1; max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  .as-orb-body, .as-tiles i, .as-dots i, .as-nudge, .as-panel { animation: none !important; }
  .as-orb, .as-shine, .as-tiles { transition: none; }
}
