/* FewoSpezis AI chat widget. --cbw-primary is set inline per-instance from
   chatbot_settings.primary_color (falls back to the site's own green here
   if that never loads for some reason). */
.cbw-root {
  --cbw-primary: #3CB145;
  --cbw-accent: #F5A623;
  --cbw-size: 68px;
  position: fixed;
  bottom: 100px;
  z-index: 99998;
  font-family: "Poppins", sans-serif;
}

.cbw-root.cbw-pos-right { right: 20px; }
.cbw-root.cbw-pos-left { left: 20px; }

.cbw-toggle {
  position: relative;
  width: var(--cbw-size);
  height: var(--cbw-size);
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(4, 56, 76, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  margin-left: auto;
  padding: 5px;
}

.cbw-toggle svg { width: 100%; height: 100%; }
.cbw-toggle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.cbw-pos-left .cbw-toggle { margin-left: 0; margin-right: auto; }

.cbw-toggle:hover { transform: scale(1.06); }
.cbw-toggle.cbw-toggle-open svg,
.cbw-toggle.cbw-toggle-open img { display: none; }
.cbw-toggle.cbw-toggle-open {
  background: #04384C;
  font-size: 1.6rem;
}
.cbw-toggle.cbw-toggle-open::before { content: "\2715"; color: #fff; }

/* Eye-catching but tasteful: the ring pulses in the warm accent color
   (deliberately different from the green bubble, so it pops instead of
   blending in) while the bubble itself gently bobs/scales in sync. */
.cbw-toggle-pulse {
  animation: cbw-bob 2.4s ease-in-out infinite;
}

.cbw-toggle-pulse::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  box-shadow: 0 0 0 0 var(--cbw-accent);
  animation: cbw-pulse-ring 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes cbw-bob {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.09); }
}

@keyframes cbw-pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(var(--cbw-accent-rgb, 245, 166, 35), 0.6); }
  70% { box-shadow: 0 0 0 18px rgba(var(--cbw-accent-rgb, 245, 166, 35), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--cbw-accent-rgb, 245, 166, 35), 0); }
}

.cbw-panel {
  position: absolute;
  bottom: calc(var(--cbw-size) + 14px);
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 500px;
  max-height: 70vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(4, 56, 76, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cbw-pos-right .cbw-panel { right: 0; }
.cbw-pos-left .cbw-panel { left: 0; }

/* Don't rely on the host page's own reset (e.g. Bootstrap's reboot) to
   make the [hidden] attribute actually hide this - the widget must work
   correctly even on a page that doesn't load Bootstrap. */
.cbw-panel[hidden] { display: none; }

.cbw-header {
  position: relative;
  background: linear-gradient(135deg, var(--cbw-primary) 0%, var(--cbw-primary) 55%, #FDC55B 160%);
  color: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  overflow: hidden;
}

/* small warm decorative touch - a soft sun glow in the corner, nothing heavy */
.cbw-header::after {
  content: "";
  position: absolute;
  top: -30px;
  right: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(253, 197, 91, 0.55) 0%, rgba(253, 197, 91, 0) 70%);
  pointer-events: none;
}

.cbw-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 1.1rem;
  padding: 2px;
}

.cbw-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.cbw-avatar svg { width: 100%; height: 100%; }

.cbw-header-text { flex: 1; min-width: 0; }
.cbw-bot-name { font-weight: 600; font-size: 0.95rem; }
.cbw-status { font-size: 0.75rem; opacity: 0.85; }

.cbw-reset,
.cbw-close {
  border: none;
  background: transparent;
  color: #fff;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

.cbw-reset:hover,
.cbw-close:hover {
  opacity: 1;
}

.cbw-close { font-size: 1.4rem; }
.cbw-reset { font-size: 0.95rem; padding: 4px; }

.cbw-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f7f8fa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cbw-msg { max-width: 82%; }
.cbw-msg p { margin: 0; padding: 11px 16px; border-radius: 18px; font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

.cbw-msg-assistant { align-self: flex-start; }
.cbw-msg-assistant p { background: #fff; color: #222; border-bottom-left-radius: 5px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.cbw-msg-user { align-self: flex-end; }
.cbw-msg-user p { background: var(--cbw-primary); color: #fff; border-bottom-right-radius: 5px; }

.cbw-typing p { display: none; }
.cbw-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 16px; background: #fff; border-radius: 18px; border-bottom-left-radius: 5px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.cbw-typing span { width: 6px; height: 6px; border-radius: 50%; background: #aaa; animation: cbw-bounce 1.2s infinite ease-in-out; }
.cbw-typing span:nth-child(2) { animation-delay: 0.15s; }
.cbw-typing span:nth-child(3) { animation-delay: 0.3s; }

/* Real listing cards returned by the search_listings tool - rendered
   alongside the assistant's text reply, never instead of it. */
.cbw-listings {
  align-self: flex-start;
  max-width: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cbw-listing-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 8px;
  text-decoration: none;
  color: #222;
  transition: box-shadow 0.15s ease;
}

.cbw-listing-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.16); }

.cbw-listing-photo {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #eef0f2;
}

.cbw-listing-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cbw-listing-photo-empty::after {
  content: "🏡";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.4rem;
}

.cbw-listing-info { flex: 1; min-width: 0; }
.cbw-listing-name { font-weight: 600; font-size: 0.85rem; line-height: 1.3; }
.cbw-listing-city { font-size: 0.75rem; color: #666; margin-top: 1px; }
.cbw-listing-price { font-size: 0.8rem; color: var(--cbw-primary); font-weight: 600; margin-top: 3px; }

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

.cbw-footer {
  border-top: 1px solid #eee;
  padding: 10px;
  flex-shrink: 0;
  background: #fff;
}

.cbw-input-form { display: flex; gap: 8px; }

.cbw-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
}

.cbw-input:focus { border-color: var(--cbw-primary); }

.cbw-send {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--cbw-primary);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cbw-send:disabled, .cbw-input:disabled { opacity: 0.6; }

.cbw-consent {
  margin: auto 0;
  text-align: center;
  padding: 10px;
}

.cbw-consent p { font-size: 0.825rem; color: #444; line-height: 1.5; margin-bottom: 16px; }

.cbw-consent-btn {
  border: none;
  background: var(--cbw-primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.cbw-choices { display: flex; flex-direction: column; gap: 8px; }

.cbw-choice-btn {
  border: 2px solid var(--cbw-primary);
  background: #fff;
  color: var(--cbw-primary);
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cbw-choice-btn:hover { background: var(--cbw-primary); color: #fff; }
.cbw-choice-btn:disabled { opacity: 0.6; cursor: default; }

/* Dark, high-contrast treatment (site's dark teal brand color) so this
   pops against the page instead of blending into it like a plain white
   tooltip would. */
.cbw-teaser {
  position: absolute;
  bottom: calc(var(--cbw-size) + 24px);
  width: 220px;
  max-width: calc(100vw - 40px);
  background: #04384C;
  color: #fff;
  padding: 13px 32px 13px 16px;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(4, 56, 76, 0.4);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  animation: cbw-teaser-in 0.25s ease;
}

.cbw-pos-right .cbw-teaser { right: 0; }
.cbw-pos-left .cbw-teaser { left: 0; }

.cbw-teaser p { margin: 0; }

/* small pointer aimed down at the avatar bubble */
.cbw-teaser::after {
  content: "";
  position: absolute;
  bottom: -8px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid #04384C;
}

.cbw-pos-right .cbw-teaser::after { right: 22px; }
.cbw-pos-left .cbw-teaser::after { left: 22px; }

.cbw-teaser-dismiss {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.cbw-teaser-dismiss:hover { color: #fff; }

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

@media (max-width: 600px) {
  .cbw-root { bottom: 90px; }
  .cbw-root.cbw-pos-right { right: 14px; }
  .cbw-root.cbw-pos-left { left: 14px; }
  .cbw-panel {
    width: calc(100vw - 28px);
    height: 65vh;
  }
}

/* Inline enquiry (lead-capture) card, shown via the open_enquiry_form
   tool - appended into the message flow (.cbw-body), not the footer, so
   the visitor can still keep chatting while it's up. */
.cbw-enquiry-card {
  align-self: flex-start;
  max-width: 100%;
  width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cbw-enquiry-title { font-weight: 600; font-size: 0.85rem; color: #222; margin-bottom: 2px; }

.cbw-enquiry-field { display: flex; flex-direction: column; gap: 3px; }
.cbw-enquiry-field label { font-size: 0.72rem; color: #666; }
.cbw-enquiry-field input {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}
.cbw-enquiry-field input:focus { border-color: var(--cbw-primary); }

.cbw-enquiry-submit {
  border: none;
  border-radius: 20px;
  padding: 9px 14px;
  background: var(--cbw-primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 2px;
}
.cbw-enquiry-submit:disabled { opacity: 0.6; cursor: default; }

.cbw-enquiry-msg { font-size: 0.78rem; }
.cbw-enquiry-msg-error { color: #d9534f; }

.cbw-enquiry-card-done {
  align-items: center;
  padding: 18px;
}
.cbw-enquiry-done {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cbw-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.cbw-enquiry-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.75rem;
  color: #444;
  line-height: 1.35;
  cursor: pointer;
  margin-top: 2px;
}
.cbw-enquiry-consent-label input { margin-top: 2px; flex-shrink: 0; }

/* Desktop-only manual resize handle, top corner opposite the widget's
   anchored corner (see chatbot-widget.js for the left/right logic) - a
   small "L" bracket drawn in white since it overlaps the colored header. */
.cbw-resize-handle {
  position: absolute;
  top: 0;
  width: 18px;
  height: 18px;
  z-index: 5;
  touch-action: none;
}
.cbw-pos-right .cbw-resize-handle { left: 0; cursor: nwse-resize; }
.cbw-pos-left .cbw-resize-handle { right: 0; cursor: nesw-resize; }

.cbw-resize-handle::before {
  content: "";
  position: absolute;
  top: 6px;
  width: 8px;
  height: 8px;
}
.cbw-pos-right .cbw-resize-handle::before { left: 6px; border-top: 2px solid rgba(255,255,255,0.65); border-left: 2px solid rgba(255,255,255,0.65); }
.cbw-pos-left .cbw-resize-handle::before { right: 6px; border-top: 2px solid rgba(255,255,255,0.65); border-right: 2px solid rgba(255,255,255,0.65); }

@media (max-width: 600px) {
  .cbw-resize-handle { display: none; }
}

/* jQuery UI appends its one shared #ui-datepicker-div directly to <body>.
   style.css already pins it to z-index:9999 !important via the selector
   "div#ui-datepicker-div" (for the homepage search fields) - that sits
   BELOW .cbw-root's stacking context (z-index: 99998), so opening the
   Anreise/Abreise picker from inside the chat panel renders the calendar
   underneath the (opaque) widget panel, invisible and unclickable. Match
   that selector's specificity ("div#id") so this later-loaded rule wins
   the tie-break and bumps it above the widget everywhere; harmless on the
   rest of the site since it's the same shared singleton popup. */
div#ui-datepicker-div {
  z-index: 999999 !important;
}
