/* WASHME Assistant - floating chat widget.
   Self-contained: every rule is scoped under .wa- so it cannot collide with
   the host page's styles. Light black (charcoal), gold and white; 18px base text that scales
   with the chosen size (Small, Medium, Large, Full). */

.wa-root {
  --wa-black: #1e1e21;
  --wa-black-2: #2a2a2e;
  --wa-black-3: #3a3a3f;
  --wa-gold: #e0b43a;
  --wa-gold-2: #f3d063;
  --wa-white: #ffffff;
  --wa-ink: #09090b;
  --wa-muted: #d4d4d8;
  --wa-danger: #ffb4b4;
  --wa-radius: 18px;
  --wa-scale: 1;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: calc(18px * var(--wa-scale));
  line-height: 1.55;
  color: var(--wa-white);
}

.wa-root *,
.wa-root *::before,
.wa-root *::after { box-sizing: border-box; }

.wa-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Launcher ---------- */
/* The WASHME TV seal is the button; a gold label beside it keeps "Ask WASHME" readable. */
.wa-launcher {
  position: fixed;
  right: 20px;
  bottom: var(--wa-launcher-bottom, 20px);
  z-index: 2147483000;
  display: flex; align-items: center; gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}
.wa-launcher-logo {
  display: block;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 3px solid var(--wa-gold);
  background: #000;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 0 4px rgba(224, 180, 58, 0.18);
  transition: transform 0.15s ease;
}
.wa-launcher-label {
  padding: 8px 13px;
  border: 2px solid var(--wa-gold);
  border-radius: 999px;
  background: var(--wa-black);
  color: var(--wa-white);
  font-size: 15px; font-weight: 800; line-height: 1.1;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.wa-launcher:hover .wa-launcher-logo { transform: translateY(-2px) scale(1.04); }
.wa-launcher:hover .wa-launcher-label { background: var(--wa-black-3); }
.wa-launcher[aria-expanded="true"] { display: none; }

.wa-header-logo {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--wa-gold);
  background: #000;
  object-fit: cover;
}

.wa-root :focus-visible {
  outline: 3px solid var(--wa-gold-2);
  outline-offset: 2px;
}

/* ---------- Panel ---------- */
.wa-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483001;
  display: flex; flex-direction: column;
  width: min(460px, calc(100vw - 40px));
  height: min(720px, calc(100vh - 40px));
  height: min(720px, calc(100dvh - 40px));
  background: var(--wa-black);
  border: 2px solid var(--wa-gold);
  border-radius: var(--wa-radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.wa-panel[hidden] { display: none; }

/* Size presets. The choice is stored per device; Medium is the default. */
.wa-root[data-size="small"] { --wa-scale: 0.89; }
.wa-root[data-size="large"], .wa-root[data-size="full"] { --wa-scale: 1.11; }
.wa-panel[data-size="small"] {
  width: min(360px, calc(100vw - 40px));
  height: min(560px, calc(100vh - 40px));
  height: min(560px, calc(100dvh - 40px));
}
.wa-panel[data-size="large"] {
  width: min(640px, calc(100vw - 40px));
  height: min(960px, calc(100vh - 40px));
  height: min(960px, calc(100dvh - 40px));
}
.wa-panel[data-size="full"] {
  top: 20px; left: 20px;
  width: auto; height: auto;
}

/* ---------- Size picker ---------- */
.wa-sizebar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: var(--wa-black);
  border-bottom: 1px solid rgba(224, 180, 58, 0.35);
}
.wa-sizebar-label { font-size: calc(13px * var(--wa-scale)); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--wa-gold-2); margin-right: 2px; }
.wa-size-btn {
  min-height: 36px; min-width: 44px;
  padding: 4px 10px;
  border: 1px solid rgba(224, 180, 58, 0.55);
  border-radius: 999px;
  background: transparent;
  color: var(--wa-white);
  font: inherit; font-size: calc(14px * var(--wa-scale)); font-weight: 600;
  cursor: pointer;
}
.wa-size-btn:hover { background: var(--wa-black-3); }
.wa-size-btn[aria-checked="true"] { background: var(--wa-gold); border-color: var(--wa-gold); color: var(--wa-ink); font-weight: 800; }

@media (max-width: 640px) {
  .wa-panel, .wa-panel[data-size] {
    inset: 0;
    width: 100vw; height: 100vh; height: 100dvh; max-height: none;
    border: 0; border-radius: 0;
  }
  .wa-launcher { right: 14px; }
  /* Phones are always full screen, so the picker only changes text size there. */
  .wa-launcher-logo { width: 52px; height: 52px; }
  .wa-launcher-label { font-size: calc(14px * var(--wa-scale)); padding: 7px 11px; }
}

/* ---------- Header ---------- */
.wa-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--wa-black-2);
  border-bottom: 2px solid var(--wa-gold);
  padding-top: max(12px, env(safe-area-inset-top));
}
.wa-title {
  flex: 1; margin: 0;
  font-size: calc(20px * var(--wa-scale)); font-weight: 800; letter-spacing: 0.01em;
  color: var(--wa-white);
}
.wa-title span { color: var(--wa-gold); }

.wa-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; min-height: 44px;
  padding: 6px 10px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--wa-white);
  font: inherit; font-size: calc(16px * var(--wa-scale)); font-weight: 600;
  cursor: pointer;
}
.wa-icon-btn:hover { background: var(--wa-black-3); }
.wa-icon-btn svg { width: 24px; height: 24px; flex-shrink: 0; }
.wa-icon-btn[aria-pressed="true"] { border-color: var(--wa-gold); color: var(--wa-gold-2); }

/* ---------- Messages ---------- */
.wa-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 14px;
  overscroll-behavior: contain;
}

.wa-welcome h3 { margin: 0 0 6px; font-size: calc(22px * var(--wa-scale)); color: var(--wa-gold-2); }
.wa-welcome p { margin: 0 0 14px; color: var(--wa-muted); }

.wa-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wa-chip {
  padding: 7px 12px;
  min-height: 38px;
  border: 2px solid var(--wa-gold);
  border-radius: 999px;
  background: transparent;
  color: var(--wa-white);
  font: inherit; font-size: calc(15px * var(--wa-scale)); font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.wa-chip:hover { background: var(--wa-gold); color: var(--wa-ink); }

.wa-msg { max-width: 100%; }
.wa-msg-user {
  align-self: flex-end;
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--wa-white);
  color: var(--wa-ink);
  font-weight: 500;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.wa-msg-bot {
  align-self: stretch;
  padding: 12px 14px;
  border-radius: 16px 16px 16px 4px;
  background: var(--wa-black-2);
  border-left: 4px solid var(--wa-gold);
}
.wa-msg-error { border-left-color: var(--wa-danger); color: var(--wa-danger); }

.wa-md { overflow-wrap: anywhere; }
.wa-md > :first-child { margin-top: 0; }
.wa-md > :last-child { margin-bottom: 0; }
.wa-md p { margin: 0 0 10px; }
.wa-md h1, .wa-md h2, .wa-md h3, .wa-md h4 { margin: 14px 0 6px; line-height: 1.3; color: var(--wa-gold-2); }
.wa-md h1 { font-size: calc(22px * var(--wa-scale)); } .wa-md h2 { font-size: calc(21px * var(--wa-scale)); } .wa-md h3, .wa-md h4 { font-size: calc(19px * var(--wa-scale)); }
.wa-md ul, .wa-md ol { margin: 0 0 10px; padding-left: 26px; }
.wa-md li { margin-bottom: 4px; }
.wa-md strong { color: var(--wa-white); font-weight: 800; }
.wa-md a { color: var(--wa-gold-2); text-decoration: underline; text-underline-offset: 3px; }
.wa-md code {
  padding: 1px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em;
}
.wa-md pre { margin: 0 0 10px; padding: 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); overflow-x: auto; }
.wa-md pre code { padding: 0; background: none; }
.wa-md blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 3px solid var(--wa-gold); color: var(--wa-muted); }
.wa-md hr { border: 0; border-top: 1px solid rgba(224, 180, 58, 0.4); margin: 12px 0; }
.wa-table-wrap { overflow-x: auto; margin: 0 0 10px; }
.wa-md table { border-collapse: collapse; width: 100%; font-size: calc(16px * var(--wa-scale)); }
.wa-md th, .wa-md td { border: 1px solid rgba(224, 180, 58, 0.45); padding: 6px 8px; text-align: left; vertical-align: top; }
.wa-md th { background: rgba(224, 180, 58, 0.16); color: var(--wa-gold-2); }

.wa-msg-actions { display: flex; gap: 8px; margin-top: 8px; }
.wa-small-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid rgba(224, 180, 58, 0.6);
  border-radius: 10px;
  background: transparent;
  color: var(--wa-white);
  font: inherit; font-size: calc(15px * var(--wa-scale)); font-weight: 600;
  cursor: pointer;
}
.wa-small-btn:hover { background: var(--wa-black-3); }
.wa-small-btn svg { width: 18px; height: 18px; }

/* Typing indicator */
.wa-typing { display: inline-flex; gap: 6px; align-items: center; padding: 4px 0; }
.wa-typing span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--wa-gold);
  animation: wa-bounce 1.2s infinite ease-in-out;
}
.wa-typing span:nth-child(2) { animation-delay: 0.15s; }
.wa-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes wa-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-6px); opacity: 1; }
}

.wa-cursor::after {
  content: "";
  display: inline-block;
  width: 9px; height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--wa-gold);
  animation: wa-blink 0.9s steps(1) infinite;
}
@keyframes wa-blink { 50% { opacity: 0; } }

/* ---------- Composer ---------- */
.wa-composer {
  padding: 10px 12px 8px;
  background: var(--wa-black-2);
  border-top: 2px solid var(--wa-gold);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.wa-input-row { display: flex; align-items: flex-end; gap: 8px; }
.wa-input {
  flex: 1;
  min-height: 52px; max-height: 160px;
  padding: 12px 14px;
  border: 2px solid var(--wa-muted);
  border-radius: 14px;
  background: var(--wa-white);
  color: var(--wa-ink);
  font: inherit; font-size: calc(18px * var(--wa-scale));
  resize: none;
}
.wa-input:focus { border-color: var(--wa-gold); outline: none; box-shadow: 0 0 0 3px rgba(224, 180, 58, 0.45); }
.wa-input::placeholder { color: #52525b; }

.wa-mic, .wa-send {
  width: 52px; height: 52px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 14px;
  cursor: pointer;
}
.wa-mic { border: 2px solid var(--wa-gold); background: transparent; color: var(--wa-gold-2); }
.wa-mic[aria-pressed="true"] { background: #c62828; border-color: #ffcdd2; color: var(--wa-white); animation: wa-pulse 1.3s infinite; }
.wa-send { border: 0; background: var(--wa-gold); color: var(--wa-ink); }
.wa-send:disabled { opacity: 0.5; cursor: not-allowed; }
.wa-mic svg, .wa-send svg { width: 26px; height: 26px; }
@keyframes wa-pulse {
  0% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(198, 40, 40, 0); }
  100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0); }
}

.wa-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: calc(14px * var(--wa-scale)); color: var(--wa-muted); }
.wa-meta .wa-over { color: var(--wa-danger); font-weight: 700; }
.wa-voice-note { margin: 6px 0 0; font-size: calc(15px * var(--wa-scale)); color: var(--wa-gold-2); }
.wa-footer { margin: 6px 0 0; font-size: calc(14px * var(--wa-scale)); color: var(--wa-muted); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .wa-root * { animation: none !important; transition: none !important; }
}
