/* ============================================================
   Montgo Booking — Conversational Agent Styles v1.1.0
   Scoped under .montgo-chat-wrap. Matches the brand palette
   used by the classic booking form (cream / gold / brown).
   ============================================================ */

.montgo-chat-wrap {
  --mc-cream:      #F5EFE4;
  --mc-cream-dark: #EDE3D2;
  --mc-gold:       #A8863A;
  --mc-gold-light: #C4A050;
  --mc-sand:       #C4A882;
  --mc-brown:      #5C3D1E;
  --mc-brown-dark: #3A2410;
  --mc-text-muted: #9A7D5A;
  --mc-border:     rgba(168,134,58,0.25);
  --mc-error:      #c0392b;
  --mc-font-serif: 'Cormorant Garamond', Georgia, serif;
  --mc-font-sans:  'Jost', 'Helvetica Neue', sans-serif;
  --mc-transition: 0.2s ease;

  display: flex;
  flex-direction: column;
  max-width: 440px;
  height: 620px;
  max-height: 80vh;
  background: var(--mc-brown-dark);
  font-family: var(--mc-font-sans);
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--mc-border);
}

.montgo-chat-wrap *,
.montgo-chat-wrap *::before,
.montgo-chat-wrap *::after {
  box-sizing: border-box;
}

/* ── Theme isolation ─────────────────────────────────────────────
   Themes routinely style bare `button` / `[type="button"]` selectors
   (background, border, radius, uppercase…). An attribute selector such as
   `[type="button"]` scores the same as a single class, so on a tie the
   theme wins purely by load order. Neutralise those here; the scoped
   rules below re-apply the brand styling at a higher specificity. */
.montgo-chat-wrap button,
.montgo-chat-wrap input,
.montgo-chat-fab-root button {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  margin: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  text-shadow: none;
  text-transform: none;
  text-decoration: none;
  letter-spacing: normal;
  font-weight: 400;
  line-height: normal;
  min-width: 0;
  min-height: 0;
  width: auto;
  height: auto;
  outline: none;
}

/* Our icons are stroke-drawn; a theme `svg { fill: … }` would flood them. */
.montgo-chat-wrap svg,
.montgo-chat-fab-root svg {
  fill: none;
  display: block;
}

/* ── Header ─────────────────────────────────────────────────── */
.montgo-chat-wrap .montgo-chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--mc-brown);
  border-bottom: 1px solid var(--mc-border);
  flex-shrink: 0;
}

.montgo-chat-wrap .montgo-chat-avatar {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mc-gold-light);
  border: 1px solid var(--mc-border);
  border-radius: 50%;
  flex-shrink: 0;
}

.montgo-chat-wrap .montgo-chat-header-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.montgo-chat-wrap .montgo-chat-title {
  font-family: var(--mc-font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--mc-cream);
}

.montgo-chat-wrap .montgo-chat-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mc-sand);
}

.montgo-chat-wrap .montgo-chat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6fbf73;
  box-shadow: 0 0 0 0 rgba(111,191,115,0.6);
  animation: montgo-pulse 2s infinite;
}

@keyframes montgo-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(111,191,115,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(111,191,115,0); }
  100% { box-shadow: 0 0 0 0 rgba(111,191,115,0); }
}

/* ── Log ────────────────────────────────────────────────────── */
.montgo-chat-wrap .montgo-chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: var(--mc-gold) transparent;
}

.montgo-chat-wrap .montgo-chat-log::-webkit-scrollbar { width: 6px; }
.montgo-chat-wrap .montgo-chat-log::-webkit-scrollbar-thumb {
  background: var(--mc-gold);
  border-radius: 0;
}

/* ── Messages ───────────────────────────────────────────────── */
.montgo-chat-wrap .montgo-msg {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 88%;
  animation: montgo-fade-in 0.28s ease;
}

@keyframes montgo-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.montgo-chat-wrap .montgo-msg--bot  { align-self: flex-start; }
.montgo-chat-wrap .montgo-msg--user { align-self: flex-end; flex-direction: row-reverse; }

.montgo-chat-wrap .montgo-msg-avatar {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--mc-gold);
  color: var(--mc-brown-dark);
  font-family: var(--mc-font-serif);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.montgo-chat-wrap .montgo-msg-bubble {
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--mc-cream);
  background: var(--mc-brown);
  border: 1px solid var(--mc-border);
  word-wrap: break-word;
}

.montgo-chat-wrap .montgo-msg--user .montgo-msg-bubble {
  background: var(--mc-gold);
  color: var(--mc-brown-dark);
  border-color: var(--mc-gold);
}

.montgo-chat-wrap .montgo-msg-bubble strong { color: var(--mc-gold-light); font-weight: 600; }
.montgo-chat-wrap .montgo-msg--user .montgo-msg-bubble strong { color: var(--mc-brown-dark); }

/* Secondary line under a bot question, e.g. "or type a specific date". */
.montgo-chat-wrap .montgo-msg-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--mc-sand);
  opacity: 0.85;
}

/* ── Typing indicator ───────────────────────────────────────── */
.montgo-chat-wrap .montgo-dots { display: inline-flex; gap: 4px; align-items: center; }
.montgo-chat-wrap .montgo-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mc-sand);
  animation: montgo-bounce 1.2s infinite ease-in-out;
}
.montgo-chat-wrap .montgo-dots i:nth-child(2) { animation-delay: 0.15s; }
.montgo-chat-wrap .montgo-dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes montgo-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* ── Summary card ───────────────────────────────────────────── */
.montgo-chat-wrap .montgo-summary p { margin: 0 0 0.5rem; }
.montgo-chat-wrap .montgo-summary table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.4rem 0;
}
.montgo-chat-wrap .montgo-summary th,
.montgo-chat-wrap .montgo-summary td {
  text-align: left;
  padding: 0.28rem 0;
  font-size: 0.82rem;
  vertical-align: top;
  border-bottom: 1px solid var(--mc-border);
}
.montgo-chat-wrap .montgo-summary th {
  color: var(--mc-sand);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.64rem;
  width: 38%;
  padding-right: 0.5rem;
}
.montgo-chat-wrap .montgo-summary-q { margin-top: 0.6rem; font-weight: 500; }

/* ── Done state ─────────────────────────────────────────────── */
.montgo-chat-wrap .montgo-done {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.montgo-chat-wrap .montgo-done-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #6fbf73;
  color: #fff;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* ── Quick replies ──────────────────────────────────────────── */
.montgo-chat-wrap .montgo-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.25rem;
  flex-shrink: 0;
}
.montgo-chat-wrap .montgo-chat-quick:not(:empty) { padding-bottom: 0.75rem; }

.montgo-chat-wrap .montgo-chip {
  font-family: var(--mc-font-sans);
  font-size: 0.8rem;
  color: var(--mc-gold-light);
  background: transparent;
  border: 1px solid var(--mc-gold);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: all var(--mc-transition);
  letter-spacing: 0.03em;
}
.montgo-chat-wrap .montgo-chip:hover {
  background: var(--mc-gold);
  color: var(--mc-brown-dark);
}

/* ── Input ──────────────────────────────────────────────────── */
.montgo-chat-wrap .montgo-chat-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--mc-brown);
  border-top: 1px solid var(--mc-border);
  flex-shrink: 0;
}

.montgo-chat-wrap .montgo-chat-input input {
  flex: 1 1 auto;
  font-family: var(--mc-font-sans);
  font-size: 0.9rem;
  color: var(--mc-cream);
  background: var(--mc-brown-dark);
  border: 1px solid var(--mc-border);
  padding: 0.6rem 0.85rem;
  outline: none;
  transition: border-color var(--mc-transition);
}
.montgo-chat-wrap .montgo-chat-input input::placeholder { color: var(--mc-text-muted); }
.montgo-chat-wrap .montgo-chat-input input:focus { border-color: var(--mc-gold); }

.montgo-chat-wrap .montgo-chat-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  flex-shrink: 0;
  color: var(--mc-brown-dark);
  background: var(--mc-gold);
  border: none;
  cursor: pointer;
  transition: background var(--mc-transition);
}
.montgo-chat-wrap .montgo-chat-send:hover { background: var(--mc-gold-light); }

/* ── Responsive ─────────────────────────────────────────────── */
@media ( max-width: 480px ) {
  .montgo-chat-wrap {
    max-width: 100%;
    height: 560px;
    max-height: 78vh;
  }
  .montgo-chat-wrap .montgo-msg { max-width: 92%; }
}

/* ============================================================
   Floating launcher (FAB) + popup panel — site-wide chat
   ============================================================ */

.montgo-chat-fab-root {
  --mc-cream:      #F5EFE4;
  --mc-gold:       #A8863A;
  --mc-gold-light: #C4A050;
  --mc-brown:      #5C3D1E;
  --mc-brown-dark: #3A2410;
  --mc-border:     rgba(168,134,58,0.25);
  --mc-font-serif: 'Cormorant Garamond', Georgia, serif;
  --mc-font-sans:  'Jost', 'Helvetica Neue', sans-serif;

  position: fixed;
  bottom: 24px;
  z-index: 99990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.montgo-chat-fab-root--right { right: 24px; align-items: flex-end; }
.montgo-chat-fab-root--left  { left: 24px;  align-items: flex-start; }

/* ── The bubble button ──────────────────────────────────────── */
/* Scoped to the root (and the element) so these beat theme rules such as
   `[type="button"]`, which would otherwise tie on specificity and win. */
.montgo-chat-fab-root button.montgo-chat-fab {
  order: 2;
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: var(--mc-gold);
  color: var(--mc-brown-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 22px rgba(0,0,0,0.28);
  transition: transform 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
  position: relative;
}

.montgo-chat-fab-root button.montgo-chat-fab:hover {
  background: var(--mc-gold-light);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.34);
}

.montgo-chat-fab-root button.montgo-chat-fab:focus-visible {
  outline: 2px solid var(--mc-cream);
  outline-offset: 3px;
}

.montgo-chat-fab-icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.montgo-chat-fab-icon--close { opacity: 0; transform: rotate(-45deg) scale(0.6); }
.montgo-chat-fab-icon--open  { opacity: 1; transform: rotate(0) scale(1); }

.montgo-chat-fab-root.is-open .montgo-chat-fab-icon--open  { opacity: 0; transform: rotate(45deg) scale(0.6); }
.montgo-chat-fab-root.is-open .montgo-chat-fab-icon--close { opacity: 1; transform: rotate(0) scale(1); }

/* Gentle attention pulse on the resting bubble */
.montgo-chat-fab-root .montgo-chat-fab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(168,134,58,0.5);
  animation: montgo-fab-pulse 2.6s infinite;
}
.montgo-chat-fab-root.is-open .montgo-chat-fab::after { animation: none; }

@keyframes montgo-fab-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(168,134,58,0.45); }
  70%  { box-shadow: 0 0 0 14px rgba(168,134,58,0); }
  100% { box-shadow: 0 0 0 0 rgba(168,134,58,0); }
}

/* ── The popup panel ────────────────────────────────────────── */
.montgo-chat-panel {
  order: 1;
  width: 400px;
  max-width: calc(100vw - 48px);
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.24s ease, transform 0.24s ease;
  pointer-events: none;
  box-shadow: 0 16px 50px rgba(0,0,0,0.4);
}
.montgo-chat-fab-root--left .montgo-chat-panel { transform-origin: bottom left; }

.montgo-chat-fab-root.is-open .montgo-chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Inside the panel, the chat fills the popup */
.montgo-chat-panel .montgo-chat-wrap {
  max-width: 100%;
  height: 560px;
  max-height: min(70vh, 620px);
  border: 1px solid var(--mc-border);
}

/* ── Minimize (–) button in floating header ─────────────────── */
.montgo-chat-wrap button.montgo-chat-min {
  margin-left: auto;
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--mc-cream);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}
.montgo-chat-wrap button.montgo-chat-min:hover { opacity: 1; }

/* ── Mobile: near full-screen panel ─────────────────────────── */
@media ( max-width: 480px ) {
  .montgo-chat-fab-root { bottom: 16px; }
  .montgo-chat-fab-root--right { right: 16px; }
  .montgo-chat-fab-root--left  { left: 16px; }

  .montgo-chat-panel {
    position: fixed;
    bottom: 88px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }
  .montgo-chat-panel .montgo-chat-wrap {
    height: auto;
    max-height: calc(100vh - 120px);
    min-height: 420px;
  }
}

/* Respect reduced-motion preferences */
@media ( prefers-reduced-motion: reduce ) {
  .montgo-chat-fab,
  .montgo-chat-fab-icon,
  .montgo-chat-panel { transition: none; }
  .montgo-chat-fab::after { animation: none; }
}
