/*
 * Chloe chat widget.
 *
 * This stylesheet is injected into a third-party marketing page that we do not
 * control, so every rule is namespaced under .chloe- and every element resets the
 * properties a host page is most likely to have set globally (box-sizing, line
 * height, font). Nothing here selects a bare element.
 *
 * Colours mirror the tokens in app/styles.css so the widget matches the
 * diagnostic app: navy #0f2438, ink #13253a, amber #d97706.
 */

.chloe-root {
  --chloe-navy: #0f2438;
  --chloe-navy-ink: #13253a;
  --chloe-accent: #d97706;
  --chloe-accent-soft: rgba(217, 119, 6, 0.08);
  --chloe-card-bg: #f7f8fa;
  --chloe-border: #e5e8ec;
  --chloe-text: #13253a;
  --chloe-muted: #5b6b7c;

  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--chloe-text);
}

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

/* ---------- Launcher ---------- */

.chloe-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 12px 16px;
  border: none;
  border-radius: 999px;
  background: var(--chloe-navy);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 36, 56, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chloe-launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 36, 56, 0.34);
}

.chloe-launcher:focus-visible {
  outline: 3px solid var(--chloe-accent);
  outline-offset: 2px;
}

.chloe-launcher-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--chloe-accent);
  color: var(--chloe-navy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.chloe-root[data-chloe-open='true'] .chloe-launcher {
  display: none;
}

/* ---------- Panel ---------- */

.chloe-panel {
  display: none;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 40px);
  border: 1px solid var(--chloe-border);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 36, 56, 0.26);
}

.chloe-root[data-chloe-open='true'] .chloe-panel {
  display: flex;
}

.chloe-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--chloe-navy);
  color: #fff;
}

.chloe-header-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--chloe-accent);
  color: var(--chloe-navy);
  font-size: 14px;
  font-weight: 700;
}

.chloe-header-text {
  flex: 1;
  min-width: 0;
}

.chloe-header-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.chloe-header-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.chloe-close {
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chloe-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.chloe-close:focus-visible {
  outline: 2px solid var(--chloe-accent);
}

/* ---------- Transcript ---------- */

.chloe-log {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  background: var(--chloe-card-bg);
}

.chloe-msg {
  max-width: 86%;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chloe-msg-chloe {
  border: 1px solid var(--chloe-border);
  border-bottom-left-radius: 4px;
  background: #fff;
}

.chloe-msg-visitor {
  margin-left: auto;
  border-bottom-right-radius: 4px;
  background: var(--chloe-navy);
  color: #fff;
}

.chloe-msg-error {
  border: 1px solid rgba(180, 35, 24, 0.25);
  background: rgba(180, 35, 24, 0.06);
  color: #8c1d18;
  font-size: 14px;
}

/* Three-dot thinking indicator. */
.chloe-typing {
  display: inline-flex;
  gap: 4px;
  padding: 2px 0;
}

.chloe-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chloe-muted);
  animation: chloe-bounce 1.2s infinite ease-in-out;
}

.chloe-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.chloe-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chloe-bounce {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chloe-typing span {
    animation: none;
  }
  .chloe-launcher {
    transition: none;
  }
}

/* ---------- Booking CTA ---------- */

.chloe-cta {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid rgba(217, 119, 6, 0.32);
  border-radius: 14px;
  background: var(--chloe-accent-soft);
}

.chloe-cta-reason {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--chloe-navy-ink);
}

.chloe-cta-button {
  display: inline-block;
  padding: 11px 18px;
  border-radius: 10px;
  background: var(--chloe-accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.chloe-cta-button:hover {
  background: #b45f05;
}

.chloe-cta-button:focus-visible {
  outline: 3px solid var(--chloe-navy);
  outline-offset: 2px;
}

.chloe-cta-secondary {
  display: block;
  margin-top: 10px;
  color: var(--chloe-navy);
  font-size: 13px;
}

/* ---------- Composer ---------- */

.chloe-composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--chloe-border);
  background: #fff;
}

.chloe-input {
  flex: 1;
  max-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--chloe-border);
  border-radius: 10px;
  font: inherit;
  color: inherit;
  resize: none;
}

.chloe-input:focus {
  outline: none;
  border-color: var(--chloe-accent);
  box-shadow: 0 0 0 3px var(--chloe-accent-soft);
}

.chloe-send {
  align-self: flex-end;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: var(--chloe-navy);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.chloe-send:disabled {
  opacity: 0.5;
  cursor: default;
}

.chloe-send:focus-visible {
  outline: 3px solid var(--chloe-accent);
  outline-offset: 2px;
}

.chloe-disclaimer {
  padding: 0 12px 12px;
  margin: 0;
  background: #fff;
  color: var(--chloe-muted);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 480px) {
  .chloe-root {
    right: 12px;
    bottom: 12px;
  }

  .chloe-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
  }
}
