/*
 * WMC Assistant widget, Figma v0.2 (file SNUXZ9BkqAK7lOP9cmDRNZ).
 * Inter, navy #0B3A79, AI purple #A30BE0, text #0A1F44 / #3D4B63 / #5B6A82,
 * borders #DDE3EE, 400×800 desktop panel bottom-right, full-screen sheet on mobile.
 * No font files are bundled: Inter is used when the page has it, else the system stack.
 * Colour pairs meet WCAG AA (4.5:1 for text).
 */

/* ---------------------------------------------------------------- page level */

.wmc-assistant-launcher,
.wmc-assistant-prompt {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}

.wmc-assistant-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  width: 56px;
  height: 56px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0b3a79;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(10, 31, 68, 0.3);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.wmc-assistant-launcher:hover {
  background: #0a2f63;
  transform: translateY(-1px);
}

.wmc-assistant-launcher:focus-visible {
  outline: 3px solid #a30be0;
  outline-offset: 3px;
}

.wmc-assistant-chat {
  width: 26px;
  height: 26px;
  display: block;
}

.wmc-assistant-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #a30be0;
  border: 2px solid #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.wmc-assistant-badge-icon {
  width: 12px;
  height: 12px;
  display: block;
}

/* Figma D02: the open panel takes the launcher's place; it comes back on close. */
[data-wmc-assistant][data-opened="true"] .wmc-assistant-launcher {
  display: none;
}

.wmc-assistant-prompt {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 2147483000;
  width: 320px;
  max-width: calc(100vw - 32px);
  padding: 14px 16px 16px;
  color: #0a1f44;
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(10, 31, 68, 0.22);
  animation: wmc-assistant-rise 0.25s ease-out;
}

@keyframes wmc-assistant-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wmc-assistant-prompt { animation: none; }
  .wmc-assistant-launcher { transition: none; }
}

.wmc-assistant-prompt-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wmc-assistant-prompt-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #a30be0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.wmc-assistant-prompt-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.wmc-assistant-prompt-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: #3d4b63;
}

.wmc-assistant-prompt-close {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.wmc-assistant-prompt-close:hover { background: #f2f3f9; }

.wmc-assistant-prompt-text {
  margin: 10px 0 14px;
  font-size: 14px;
  line-height: 20px;
  color: #0a1f44;
}

.wmc-assistant-prompt-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wmc-assistant-prompt-primary,
.wmc-assistant-prompt-secondary {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 36px;
  border: 1px solid #0b3a79;
  cursor: pointer;
}

.wmc-assistant-prompt-primary { background: #0b3a79; color: #ffffff; }
.wmc-assistant-prompt-secondary { background: #ffffff; color: #0b3a79; }

.wmc-assistant-prompt button:focus-visible,
.wmc-assistant-prompt-close:focus-visible {
  outline: 3px solid #a30be0;
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- shadow DOM */

:host {
  all: initial;
}

.wmc-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483001;
  display: flex;
  flex-direction: column;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 800px;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  box-sizing: border-box;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: #0a1f44;
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(10, 31, 68, 0.28);
}

.wmc-panel[hidden] { display: none; }
.wmc-panel *, .wmc-panel *::before, .wmc-panel *::after { box-sizing: border-box; }
.wmc-panel [hidden] { display: none !important; }

.wmc-icon { display: block; flex: none; }

.wmc-panel :where(button) { font-family: inherit; font-size: inherit; line-height: inherit; cursor: pointer; }
.wmc-panel :where(button:disabled) { cursor: default; }
.wmc-panel .wmc-input:focus-visible,
.wmc-panel .wmc-text:focus-visible {
  outline: none;
  border-color: #0b3a79;
  box-shadow: 0 0 0 3px rgba(163, 11, 224, 0.35);
}

.wmc-panel button:focus-visible,
.wmc-panel input[type="checkbox"]:focus-visible,
.wmc-panel input[type="radio"]:focus-visible,
.wmc-panel select:focus-visible,
.wmc-panel a:focus-visible {
  outline: 3px solid #a30be0;
  outline-offset: 2px;
}

/* Header */
.wmc-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 6px 12px 12px;
  background: #0b3a79;
  color: #ffffff;
  flex: none;
}

.wmc-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #a30be0, #4b9cd0);
}

.wmc-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.wmc-header-avatar .wmc-icon { width: 20px; height: 20px; }

.wmc-titles {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.wmc-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
  font-size: 16px;
  line-height: 20px;
  font-weight: 600;
  color: #ffffff;
}

.wmc-ai-badge {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  color: #ffffff;
  background: #a30be0;
  border-radius: 36px;
}

.wmc-ai-badge .wmc-icon { width: 11px; height: 11px; }

.wmc-person {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  flex: none;
  color: #ffffff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 36px;
  white-space: nowrap;
}

.wmc-person:hover { background: rgba(255, 255, 255, 0.12); }
.wmc-person .wmc-icon { width: 13px; height: 13px; }

.wmc-icon-button {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  flex: none;
}

.wmc-icon-button:hover { background: rgba(255, 255, 255, 0.14); }
.wmc-icon-button .wmc-icon { width: 18px; height: 18px; }

/* Conversation */
.wmc-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  .wmc-log { scroll-behavior: auto; }
}

.wmc-today {
  align-self: center;
  padding: 2px 10px;
  font-size: 11px;
  line-height: 16px;
  color: #5b6a82;
  background: #f2f3f9;
  border-radius: 36px;
}

.wmc-with-icon { display: flex; align-items: center; gap: 6px; }

.wmc-row { display: flex; gap: 8px; align-items: flex-start; }
.wmc-row-visitor { justify-content: flex-end; }
.wmc-column { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: calc(100% - 36px); }
.wmc-row-visitor .wmc-column { align-items: flex-end; max-width: 85%; }
.wmc-row-assistant .wmc-column { flex: 1; align-items: flex-start; }

.wmc-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #a30be0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.wmc-avatar .wmc-icon { width: 16px; height: 16px; }

.wmc-msg {
  padding: 10px 12px;
  font-size: 14px;
  line-height: 20px;
  overflow-wrap: anywhere;
}

.wmc-msg-assistant {
  color: #0a1f44;
  background: #f2f3f9;
  border-radius: 4px 16px 16px 16px;
}

.wmc-msg-visitor {
  color: #ffffff;
  background: #0b3a79;
  border-radius: 16px 4px 16px 16px;
  white-space: pre-wrap;
}

.wmc-meta { font-size: 11px; line-height: 14px; color: #5b6a82; }

.wmc-md p { margin: 0 0 8px; }
.wmc-md p:last-child { margin-bottom: 0; }
.wmc-md ul, .wmc-md ol { margin: 4px 0 8px; padding-left: 20px; }
.wmc-md li { margin: 2px 0; }
.wmc-md a, .wmc-link { color: #0b3a79; font-weight: 600; text-decoration: underline; }
.wmc-md code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: #e6e9f2; padding: 0 4px; border-radius: 4px; }

.wmc-fade-in { animation: wmc-fade 0.25s ease-out; }
@keyframes wmc-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wmc-fade-in { animation: none; } }

.wmc-typing { display: inline-flex; gap: 4px; align-items: center; min-height: 40px; }
.wmc-typing span { width: 6px; height: 6px; border-radius: 50%; background: #5b6a82; animation: wmc-dot 1.2s infinite ease-in-out; }
.wmc-typing span:nth-child(2) { animation-delay: 0.15s; }
.wmc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes wmc-dot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .wmc-typing span { animation: none; opacity: 0.7; } }

.wmc-label {
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #3d4b63;
}

.wmc-suggested { margin-top: 4px; }

.wmc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wmc-chips:not(.wmc-choices) { flex-direction: column; align-items: flex-start; }

.wmc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  color: #0b3a79;
  background: #ffffff;
  border: 1px solid #0b3a79;
  border-radius: 36px;
  text-align: left;
}

.wmc-chip:hover { background: #eef2f9; }
.wmc-chip-selected, .wmc-chip-selected:hover { color: #ffffff; background: #0b3a79; }
.wmc-chip-tick { width: 14px; height: 14px; }
.wmc-chip-done { color: #ffffff; background: #a30be0; border-color: #a30be0; }
.wmc-chip-done:hover { background: #8f09c5; }
.wmc-chip-done:disabled { opacity: 0.45; }
.wmc-locked .wmc-chip:not(.wmc-chip-selected) { opacity: 0.55; }
.wmc-locked .wmc-chip { cursor: default; }

/* Cards (D05 to D11) */
.wmc-card {
  position: relative;
  width: 100%;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wmc-card.wmc-locked { opacity: 0.7; pointer-events: none; }
.wmc-card-title { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: #0a1f44; }
.wmc-card-head { display: flex; align-items: center; justify-content: space-between; }
.wmc-card .wmc-with-icon .wmc-icon { width: 16px; height: 16px; }

.wmc-field { display: flex; flex-direction: column; gap: 4px; }
.wmc-field-label { font-size: 12px; font-weight: 600; color: #0a1f44; }
.wmc-hint { font-size: 11px; line-height: 15px; color: #5b6a82; }

.wmc-text, .wmc-zone-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  color: #0a1f44;
  background: #ffffff;
  border: 1px solid #7c8ba1;
  border-radius: 8px;
}

.wmc-small { margin: 0; font-size: 11px; line-height: 16px; color: #3d4b63; }
.wmc-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 11px; line-height: 16px; color: #3d4b63; }
.wmc-check { margin: 2px 0 0; width: 16px; height: 16px; flex: none; accent-color: #0b3a79; }
.wmc-error { margin: 0; font-size: 12px; color: #b42318; }

.wmc-primary, .wmc-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 36px;
  border: 1px solid #0b3a79;
}

.wmc-primary { color: #ffffff; background: #0b3a79; }
.wmc-primary:hover { background: #0a2f63; }
.wmc-primary:disabled { opacity: 0.6; }
.wmc-secondary { color: #0b3a79; background: #ffffff; }
.wmc-primary .wmc-icon { width: 16px; height: 16px; }
.wmc-actions { display: flex; gap: 8px; justify-content: flex-end; }

.wmc-kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.wmc-kv dt { color: #5b6a82; }
.wmc-kv dd { margin: 0; color: #0a1f44; font-weight: 500; overflow-wrap: anywhere; }

.wmc-link-button {
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: #0b3a79;
  background: none;
  border: 0;
  text-decoration: underline;
}

.wmc-zone {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 15px;
  color: #3d4b63;
  background: #f6f7fb;
  border-radius: 8px;
}

.wmc-zone .wmc-icon { width: 14px; height: 14px; }
.wmc-zone-text { flex: 1; min-width: 0; }
.wmc-zone-text strong { color: #0a1f44; }
.wmc-zone-select { height: 34px; font-size: 13px; }

.wmc-days { display: flex; align-items: center; gap: 4px; }
.wmc-day-nav { width: 24px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; }
.wmc-day-nav:disabled { opacity: 0.35; }
.wmc-day-tabs { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wmc-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  font-size: 11px;
  line-height: 14px;
  color: #3d4b63;
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 8px;
}

.wmc-day strong { font-size: 13px; line-height: 18px; color: #0a1f44; }
.wmc-day-selected { background: #eef2f9; border: 2px solid #0b3a79; }

.wmc-slot-list { display: flex; flex-direction: column; gap: 6px; }
.wmc-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 8px 14px;
  color: #0a1f44;
  background: #ffffff;
  border: 1px solid #7c8ba1;
  border-radius: 20px;
}

.wmc-slot strong { font-size: 14px; }
.wmc-slot-uk { font-size: 11px; color: #5b6a82; }
.wmc-slot:hover { border-color: #0b3a79; background: #f6f8fc; }
.wmc-slot-selected, .wmc-slot-selected:hover { color: #ffffff; background: #0b3a79; border-color: #0b3a79; }
.wmc-slot-selected .wmc-slot-uk { color: #dbe4f3; }
.wmc-slot-suggested { border-color: #a30be0; box-shadow: 0 0 0 1px #a30be0 inset; }
.wmc-slot-hint { margin-left: auto; font-size: 12px; font-weight: 600; color: #7a0aa8; }
.wmc-slot-selected .wmc-slot-hint { color: #ffffff; }
.wmc-meta-line { margin: 0; font-size: 11px; color: #5b6a82; }
.wmc-none { align-self: center; }


.wmc-pending {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 10px;
  line-height: 15px;
  font-weight: 700;
  color: #5c4400;
  background: #ffe58f;
  border: 1px dashed #b98900;
  border-radius: 4px;
  vertical-align: middle;
}

.wmc-date-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: #f2f3f9;
  border-radius: 8px;
}

.wmc-date-box .wmc-icon { width: 16px; height: 16px; margin-top: 2px; }
.wmc-date-lines { display: flex; flex-direction: column; font-size: 12px; line-height: 16px; color: #3d4b63; }
.wmc-date-lines strong { font-size: 14px; line-height: 20px; color: #0a1f44; }

.wmc-booked { border: 1.5px solid #137a3f; }
.wmc-booked-head { display: flex; align-items: center; gap: 8px; }
.wmc-tick { width: 24px; height: 24px; border-radius: 50%; background: #137a3f; display: inline-flex; align-items: center; justify-content: center; }
.wmc-tick .wmc-icon { width: 16px; height: 16px; }
.wmc-ae { display: flex; align-items: center; gap: 10px; }
.wmc-ae-photo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid #dde3ee; background: #e8eef7; }
.wmc-ae-initials { display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; color: #ffffff; background: #0b3a79; border: 0; }
.wmc-ae-text { display: flex; flex-direction: column; font-size: 12px; line-height: 16px; color: #3d4b63; }
.wmc-ae-text strong { font-size: 14px; line-height: 20px; color: #0a1f44; }
.wmc-facts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 12px; line-height: 16px; color: #3d4b63; }
.wmc-facts .wmc-icon { width: 14px; height: 14px; }
.wmc-facts strong { color: #0a1f44; }

.wmc-radio { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: #0a1f44; }
.wmc-radio input { width: 16px; height: 16px; margin: 0; accent-color: #0b3a79; }
.wmc-radio .wmc-icon { width: 16px; height: 16px; }

/* Footer */
.wmc-footer { flex: none; padding: 10px 12px 10px; border-top: 1px solid #eef0f5; background: #ffffff; }
.wmc-form { display: flex; align-items: center; gap: 8px; }
/* Booking steps and follow-up form: composer hidden, a Cancel bar instead. */
.wmc-step-bar { display: flex; align-items: center; justify-content: flex-start; min-height: 44px; }
.wmc-step-cancel {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  font: inherit; font-size: 14px; font-weight: 600; color: #0b3a79; background: #ffffff;
  border: 1px solid #c9d3e6; border-radius: 22px; cursor: pointer;
}
.wmc-step-cancel:hover { background: #f3f6fb; }
.wmc-step-cancel:focus-visible { outline: 2px solid #a30be0; outline-offset: 2px; }
.wmc-step-cancel:disabled { opacity: 0.5; cursor: default; }
.wmc-step-cancel .wmc-icon { width: 16px; height: 16px; }
.wmc-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.wmc-inline-label { flex-basis: 100%; font-size: 13px; font-weight: 600; color: #1f2a44; }
.wmc-inline-input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; font: inherit; font-size: 16px;
  color: #1f2a44; background: #ffffff; border: 1px solid #c9d3e6; border-radius: 10px;
}
.wmc-inline-input:focus { outline: 2px solid #a30be0; outline-offset: 1px; border-color: #a30be0; }
.wmc-inline-go { min-height: 44px; }
.wmc-inline.wmc-locked { opacity: 0.7; }
.wmc-step-next { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; }
.wmc-step-next .wmc-next { min-height: 44px; min-width: 96px; }
.wmc-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  color: #0a1f44;
  background: #ffffff;
  border: 1px solid #7c8ba1;
  border-radius: 24px;
}

.wmc-input::placeholder { color: #5b6a82; }
.wmc-send {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #a30be0;
  border: 0;
  border-radius: 50%;
  flex: none;
}

.wmc-send:hover { background: #8f09c5; }
.wmc-send:disabled { opacity: 0.55; }
.wmc-send .wmc-icon { width: 18px; height: 18px; }
.wmc-note { margin: 6px 0 0; font-size: 11px; line-height: 15px; color: #3d4b63; text-align: center; }
.wmc-note .wmc-link { font-weight: 500; }

/* Mobile: full-screen sheet (Figma M01 to M05). */
@media (max-width: 480px) {
  .wmc-panel {
    inset: 0;
    width: 100vw;
    max-width: none;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .wmc-minimise { display: none; }
  .wmc-title { font-size: 17px; }
  .wmc-header { padding: 14px 12px 12px 16px; gap: 10px; }
  .wmc-footer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .wmc-assistant-prompt { right: 16px; left: 16px; width: auto; bottom: 88px; }
  .wmc-assistant-launcher { right: 16px; bottom: 16px; }
}
