/* FAQ chatbot for The Barn at White House Farm
   Colours match the site: green #2f5a46, gold #b48b57, cream #f7f2e8 */
.whf-chat-root {
  --whf-green: #2f5a46;
  --whf-green-dark: #214333;
  --whf-dark: #1f2b25;
  --whf-gold: #b48b57;
  --whf-cream: #f7f2e8;
  --whf-soft: #fffaf1;
  --whf-ink: #202421;
  --whf-muted: #66706a;
  --whf-white: #fff;
  --whf-launch: 70px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--whf-ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.whf-chat-root * { box-sizing: border-box; }

.whf-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10050;
  width: var(--whf-launch);
  height: var(--whf-launch);
  padding: 0;
  border: 3px solid var(--whf-gold);
  border-radius: 50%;
  background: var(--whf-green);
  box-shadow: 0 10px 28px rgba(31, 43, 37, 0.28);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--whf-cream);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.whf-chat-launcher:hover,
.whf-chat-launcher:focus-visible {
  background: var(--whf-green-dark);
  box-shadow: 0 14px 32px rgba(31, 43, 37, 0.36);
}

.whf-chat-launcher:hover .whf-chat-animal,
.whf-chat-launcher:focus-visible .whf-chat-animal {
  animation: whf-chat-bounce 0.7s ease-in-out;
}

.whf-chat-launcher:focus-visible {
  outline: 3px solid var(--whf-gold);
  outline-offset: 3px;
}

.whf-chat-launcher.is-open {
  background: var(--whf-dark);
}

.whf-chat-launcher svg,
.whf-chat-animal {
  width: 52px;
  height: 52px;
  display: block;
  overflow: visible;
  pointer-events: none;
}

@keyframes whf-chat-bounce {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-7px); }
  55% { transform: translateY(-3px); }
  75% { transform: translateY(-5px); }
}

.whf-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 102px;
  z-index: 10050;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  background: var(--whf-soft);
  border: 1px solid rgba(31, 43, 37, 0.1);
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(25, 33, 28, 0.22);
  overflow: hidden;
}

.whf-chat-panel[hidden] { display: none; }

.whf-chat-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: var(--whf-green);
  color: var(--whf-white);
}

.whf-chat-header-animal {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: var(--whf-green-dark);
  border: 2px solid var(--whf-gold);
  display: grid;
  place-items: center;
}

.whf-chat-header-animal svg {
  width: 30px;
  height: 30px;
  display: block;
}

.whf-chat-header h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: var(--whf-white);
}

.whf-chat-header p {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f0d8a8;
}

.whf-chat-header-text { flex: 1 1 auto; min-width: 0; }

.whf-chat-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--whf-white);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.whf-chat-close:hover,
.whf-chat-close:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.whf-chat-close:focus-visible {
  outline: 2px solid #f0d8a8;
  outline-offset: 2px;
}

.whf-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--whf-cream);
}

.whf-chat-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

.whf-chat-row.is-bot { align-self: stretch; }
.whf-chat-row.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.whf-chat-avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--whf-green);
  border: 1.5px solid var(--whf-gold);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.whf-chat-avatar svg {
  width: 22px;
  height: 22px;
  display: block;
}

.whf-chat-bubble {
  max-width: calc(100% - 36px);
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.whf-chat-row.is-bot .whf-chat-bubble {
  background: var(--whf-white);
  color: var(--whf-ink);
  border: 1px solid rgba(31, 43, 37, 0.08);
  border-bottom-left-radius: 6px;
  box-shadow: 0 6px 16px rgba(25, 33, 28, 0.05);
}

.whf-chat-row.is-user .whf-chat-bubble {
  background: var(--whf-green);
  color: var(--whf-white);
  border-bottom-right-radius: 6px;
}

.whf-chat-bubble p { margin: 0 0 0.55em; }
.whf-chat-bubble p:last-child { margin-bottom: 0; }

.whf-chat-bubble h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 6px;
  color: var(--whf-dark);
}

.whf-chat-bubble a {
  color: var(--whf-green);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.whf-chat-row.is-user .whf-chat-bubble a { color: #f0d8a8; }

.whf-chat-bubble ul {
  margin: 0.3em 0 0.2em;
  padding-left: 1.15em;
}

.whf-chat-bubble li { margin: 0.15em 0; }

.whf-chat-quick {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px 4px;
  background: var(--whf-soft);
  border-top: 1px solid rgba(31, 43, 37, 0.08);
}

.whf-chat-quick h3 {
  flex: 1 0 100%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--whf-dark);
}

.whf-chat-chip {
  appearance: none;
  border: 1px solid rgba(47, 90, 70, 0.28);
  background: var(--whf-white);
  color: var(--whf-green);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.whf-chat-chip:hover {
  background: var(--whf-green);
  color: var(--whf-white);
  border-color: var(--whf-green);
}

.whf-chat-chip:focus-visible {
  outline: 2px solid var(--whf-gold);
  outline-offset: 2px;
}

.whf-chat-form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px 14px;
  background: var(--whf-soft);
}

.whf-chat-form label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.whf-chat-form input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(31, 43, 37, 0.16);
  border-radius: 999px;
  background: var(--whf-white);
  color: var(--whf-ink);
  font: inherit;
  font-size: 14px;
  padding: 10px 14px;
}

.whf-chat-form input[type="text"]:focus {
  outline: 2px solid var(--whf-green);
  outline-offset: 1px;
  border-color: var(--whf-green);
}

.whf-chat-send {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: var(--whf-green);
  color: var(--whf-white);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  padding: 10px 16px;
  cursor: pointer;
}

.whf-chat-send:hover,
.whf-chat-send:focus-visible {
  background: var(--whf-green-dark);
}

.whf-chat-send:focus-visible {
  outline: 2px solid var(--whf-gold);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .whf-chat-launcher {
    right: 12px;
    bottom: 76px; /* sit above the mobile Check Availability button */
  }
  .whf-chat-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 156px;
    height: min(70vh, calc(100vh - 170px));
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .whf-chat-launcher,
  .whf-chat-launcher:hover .whf-chat-animal,
  .whf-chat-launcher:focus-visible .whf-chat-animal {
    animation: none;
    transition: none;
  }
}
