/* Holiday Travels AI Chat Widget */

#hac-root {
  --hac-teal: #0D5C6B;
  --hac-teal-light: #CFE8EC;
  --hac-teal-hover: #0a4956;
  --hac-text: #1f2937;
  --hac-muted: #6b7280;
  --hac-border: #e5e7eb;
  --hac-bg: #ffffff;
  position: fixed;
  bottom: 20px;
  right: 10px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- Launcher bubble --- */
#hac-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--hac-teal);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, background 0.18s ease;
  padding: 0;
}
#hac-launcher:hover {
  background: var(--hac-teal-hover);
  transform: scale(1.05);
}
#hac-launcher svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

/* --- Panel --- */
#hac-panel {
  display: none;
  flex-direction: column;
  width: 370px;
  height: 540px;
  max-height: calc(100vh - 100px);
  background: var(--hac-bg);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
#hac-root.hac-open #hac-panel {
  display: flex;
}
#hac-root.hac-open #hac-launcher {
  display: none;
}

/* --- Header --- */
#hac-header {
  background: var(--hac-teal);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#hac-header-text strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}
#hac-header-text span {
  font-size: 12.5px;
  opacity: 0.85;
}
#hac-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  padding: 0 4px;
}
#hac-close:hover { opacity: 1; }

/* --- Messages --- */
#hac-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f9fafb;
}
.hac-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.hac-msg-bot {
  background: #fff;
  color: var(--hac-text);
  border: 1px solid var(--hac-border);
  border-bottom-left-radius: 4px;
  margin-right: auto;
}
.hac-msg-user {
  background: var(--hac-teal);
  color: #fff;
  border-bottom-right-radius: 4px;
  margin-left: auto;
}
.hac-msg-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  margin-right: auto;
  font-size: 13.5px;
}

/* --- Typing indicator --- */
#hac-typing {
  display: none;
  gap: 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--hac-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  margin-bottom: 10px;
}
#hac-typing.hac-show { display: flex; }
#hac-typing span {
  width: 7px;
  height: 7px;
  background: var(--hac-muted);
  border-radius: 50%;
  animation: hac-bounce 1.3s infinite;
}
#hac-typing span:nth-child(2) { animation-delay: 0.18s; }
#hac-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes hac-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* --- Conversation starters --- */
#hac-starters {
  padding: 0 16px 12px;
  background: #f9fafb;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.hac-starter {
  background: #fff;
  border: 1px solid var(--hac-teal-light);
  color: var(--hac-teal);
  border-radius: 16px;
  padding: 7px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}
.hac-starter:hover { background: var(--hac-teal-light); }

/* --- Input --- */
#hac-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--hac-border);
  background: #fff;
  flex-shrink: 0;
}
#hac-input {
  flex: 1;
  border: 1px solid var(--hac-border);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 90px;
  outline: none;
  line-height: 1.4;
}
#hac-input:focus { border-color: var(--hac-teal); }
#hac-send {
  background: var(--hac-teal);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
#hac-send:hover:not(:disabled) { background: var(--hac-teal-hover); }
#hac-send:disabled { opacity: 1; cursor: not-allowed; }
#hac-send svg { width: 17px; height: 17px; fill: #fff; }

#hac-footer {
  text-align: center;
  font-size: 10.5px;
  color: var(--hac-muted);
  padding: 0 12px 9px;
  background: #fff;
}

/* --- Mobile --- */
@media (max-width: 480px) {
  #hac-root { bottom: 16px; right: 16px; left: 16px; }
  #hac-panel {
    width: 100%;
    height: calc(100vh - 90px);
  }
  #hac-launcher { margin-left: auto; }
}

/* --- Teaser label beside the launcher --- */
#hac-teaser {
  position: absolute;
  bottom: 8px;
  right: 72px;
  background: #fff;
  color: var(--hac-text);
  border: 1px solid var(--hac-border);
  border-radius: 16px;
  padding: 9px 14px;
  font-size: 13.5px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 3px 14px rgba(0,0,0,0.14);
  cursor: pointer;
  animation: hac-teaser-in 0.4s ease both;
}
#hac-teaser:after {
  content: '';
  position: absolute;
  right: -6px; bottom: 13px;
  width: 0; height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid #fff;
}
#hac-teaser-close {
  position: absolute;
  top: -7px; right: -7px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: #9ca3af;
  color: #fff;
  border: none;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
#hac-teaser-close:hover { background: #6b7280; }
@keyframes hac-teaser-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}
#hac-root.hac-open #hac-teaser { display: none; }
@media (max-width: 480px) { #hac-teaser { display: none; } }

/* --- Human handoff panel --- */
#hac-handoff {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: #f9fafb;
  border-top: 1px solid var(--hac-border);
  overflow-y: auto;
}
#hac-root.hac-handoff-open #hac-handoff { display: flex; }
#hac-root.hac-handoff-open #hac-input-row,
#hac-root.hac-handoff-open #hac-starters,
#hac-root.hac-handoff-open #hac-footer { display: none; }

#hac-handoff-intro {
  font-size: 13px;
  line-height: 1.45;
  color: var(--hac-muted);
  margin-bottom: 2px;
}
#hac-handoff input[type="text"],
#hac-handoff input[type="email"],
#hac-handoff textarea {
  width: 100%;
  border: 1px solid var(--hac-border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  resize: none;
  background: #fff;
}
#hac-handoff input:focus,
#hac-handoff textarea:focus { border-color: var(--hac-teal); }

/* Honeypot - hidden from humans, visible to naive bots */
#hac-hf-website {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}

#hac-hf-actions { display: flex; gap: 8px; margin-top: 2px; }
#hac-hf-submit {
  flex: 1;
  background: var(--hac-teal);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
#hac-hf-submit:hover:not(:disabled) { background: var(--hac-teal-hover); }
#hac-hf-submit:disabled { opacity: 0.6; cursor: not-allowed; }
#hac-hf-cancel {
  background: #fff;
  border: 1px solid var(--hac-border);
  color: var(--hac-muted);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
#hac-hf-cancel:hover { background: #f3f4f6; }
.hac-hf-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12.5px;
}

/* --- Footer "talk to a human" button --- */
#hac-footer {
  text-align: center;
  padding: 0 12px 10px;
  background: #fff;
}
#hac-human-btn {
  background: none;
  border: none;
  color: var(--hac-teal);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  padding: 2px 6px;
}
#hac-human-btn:hover { color: var(--hac-teal-hover); }

/* On mobile property pages the theme shows a full-width sticky booking bar
   (.mobile_booking_wrapper, position:fixed, bottom:0, width:100%).
   Lift the chat launcher above it so it never covers the reservation CTA. */
@media (max-width: 768px) {
  body.single-estate_property #hac-root {
    bottom: 88px;
  }
  /* Panel is full-height on mobile, so keep it clear of the bar too */
  body.single-estate_property #hac-panel {
    height: calc(100vh - 170px);
  }
  /* Slightly smaller launcher on mobile so it's less intrusive */
  #hac-launcher {
    width: 52px;
    height: 52px;
  }
  #hac-launcher svg {
    width: 24px;
    height: 24px;
  }
}




/* Scroll-to-top arrow on mobile: small, very translucent, properly centered.
   The theme centres its glyph with lopsided padding (14px 3px 0 14px) sized
   for a 50px circle - that breaks when we shrink it, so use flexbox instead. */
@media (max-width: 768px) {
  a.backtop,
  a.backtop.islive {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    font-size: 14px !important;
    opacity: 0.28;
    background-color: #484848 !important;
    transition: opacity 0.2s ease;
  }
  a.backtop.islive {
    right: 14px !important;
    bottom: 84px !important;
  }
  a.backtop:active { opacity: 0.75; }
}

/* Desktop: swap positions with the theme's scroll-to-top arrow.
   Chat launcher takes the corner (bottom:20px), arrow sits above it.
   Also shrink + fade the arrow and centre its glyph with flexbox, since
   the theme's default padding (14px 3px 0 14px) is tuned for a 50px circle. */
@media (min-width: 769px) {
  a.backtop,
  a.backtop.islive {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    font-size: 16px !important;
    opacity: 0.3;
    background-color: #484848 !important;
    transition: opacity 0.2s ease;
  }
  a.backtop.islive {
    right: 20px !important;
    bottom: 94px !important;
  }
  a.backtop:hover {
    opacity: 0.75;
    background-color: #484848 !important;
  }
}

/* Fix: the "Why guests book with us" HTML widget renders ~297px taller than
   its content (674px box, 377px content) leaving a large empty gap. Every
   other HTML widget on the page is fine. Changing the formatting context
   collapses it to its real content height. */
.elementor-element-3f6c144 {
  display: inline-block !important;
  width: 100% !important;
  vertical-align: top;
}

/* Wire transfer instructions modal (theme builds this in dashboard-control.js:1489
   and drops plain text into a bare <span>, which collapses newlines).
   Preserve line breaks and left-align so IBAN/SWIFT are readable. */
#direct_pay_modal .modal-body.listing-submit > span:not(.to_be_paid) {
  display: block;
  white-space: pre-line;
  text-align: left;
  line-height: 1.45;
  font-size: 14.5px;
  margin-top: 14px;
}
/* collapse the doubled gaps pre-line creates around blank source lines */
#direct_pay_modal .modal-body.listing-submit > span:not(.to_be_paid) br {
  display: none;
}
#direct_pay_modal .modal-body.listing-submit p {
  margin: 0 0 8px;
}
#direct_pay_modal .modal-body.listing-submit .to_be_paid {
  display: block;
  text-align: center;
  font-weight: 600;
  font-size: 17px;
  margin-bottom: 6px;
}
#direct_pay_modal .modal-body.listing-submit {
  padding: 20px 24px;
}
