/* TourTheTropics site chat widget */
#ttt-site-chat-root {
  --ttt-chat-navy: #083a80;
  --ttt-chat-navy-dark: #062952;
  position: fixed;
  right: 2.5rem;
  bottom: 2.5rem;
  z-index: 1080;
  font-family: Poppins, system-ui, sans-serif;
}

#ttt-site-chat-launcher {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  border: none;
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  box-shadow: 0 8px 24px rgba(13, 110, 253, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

#ttt-site-chat-launcher:hover {
  background: var(--bs-link-hover-color, #0b5ed7);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(13, 110, 253, 0.42);
}

#ttt-site-chat-launcher svg {
  width: 1.55rem;
  height: 1.55rem;
}

/* Convention: chat stays in the corner; scroll-to-top stacks above it. */
body:has(#ttt-site-chat-root) .back-top {
  bottom: calc(2.5rem + 3.5rem + 0.75rem);
  right: 2.5rem;
}

@media (max-width: 767.98px) {
  #ttt-site-chat-root {
    right: 0.625rem;
    bottom: 0.625rem;
  }

  #ttt-site-chat-panel {
    width: min(360px, calc(100vw - 1.25rem));
    height: min(680px, calc(100vh - 4.5rem));
    max-height: calc(100vh - 4.5rem);
    margin-bottom: 0.35rem;
  }

  body:has(#ttt-site-chat-root) .back-top {
    bottom: calc(0.625rem + 3.5rem + 0.625rem);
    right: 0.625rem;
    width: 2.25rem;
    height: 2.25rem;
    line-height: 2.25rem;
  }
}

#ttt-site-chat-panel {
  display: none;
  width: min(360px, calc(100vw - 2rem));
  /* Sit closer to the launcher and use more of the viewport for messages. */
  height: min(640px, calc(100vh - 5.25rem));
  max-height: calc(100vh - 5.25rem);
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  flex-direction: column;
  margin-bottom: 0.4rem;
}

#ttt-site-chat-root.is-open #ttt-site-chat-panel {
  display: flex;
}

#ttt-site-chat-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: var(--ttt-chat-navy);
  color: #fff;
  position: relative;
}

.ttt-chat-header__avatar-wrap {
  flex-shrink: 0;
}

.ttt-chat-header__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ttt-site-chat-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: none;
  color: #fff;
  opacity: 0.9;
  cursor: pointer;
  line-height: 1;
}

#ttt-site-chat-close:hover,
#ttt-site-chat-close:focus {
  opacity: 1;
  outline: none;
}

.ttt-chat-avatar--header {
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.2);
}

.ttt-chat-avatar--header img {
  width: 100%;
  height: 100%;
}

.ttt-chat-avatar--header .ttt-chat-avatar__initials {
  color: #fff;
  font-size: 0.85rem;
}

#ttt-site-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #f8fafc;
}

.ttt-chat-msg {
  margin-bottom: 0.75rem;
  max-width: 88%;
  clear: both;
}

.ttt-chat-msg.is-visitor {
  margin-left: auto;
  margin-right: 0;
  text-align: right;
}

.ttt-chat-msg.is-staff {
  margin-right: auto;
  margin-left: 0;
  text-align: left;
  max-width: 92%;
}

.ttt-chat-msg__row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.ttt-chat-msg__content {
  min-width: 0;
  flex: 1;
}

.ttt-chat-avatar {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ttt-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ttt-chat-avatar__initials {
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  line-height: 1;
}

.ttt-chat-admin-staff-row {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 92%;
  text-align: left;
}

.ttt-chat-admin-staff-row__body {
  min-width: 0;
}

.ttt-chat-bubble {
  display: inline-block;
  padding: 0.55rem 0.75rem;
  border-radius: 0.85rem;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}

.ttt-chat-msg.is-visitor .ttt-chat-bubble {
  background: var(--ttt-chat-navy);
  color: #fff;
}

.ttt-chat-msg.is-staff .ttt-chat-bubble {
  background: #f0f2f5;
  color: #0f172a;
}

.ttt-chat-bubble__name {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.85;
  margin-bottom: 0.2rem;
}

.ttt-chat-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-width: 3rem;
  padding: 0.65rem 0.85rem;
}

.ttt-chat-typing-bubble span {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: #94a3b8;
  animation: ttt-chat-typing 1.2s infinite ease-in-out;
}

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

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

@keyframes ttt-chat-typing {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.ttt-chat-bubble__meta {
  font-size: 0.65rem;
  color: #64748b;
  text-align: right;
  margin-top: 0.35rem;
  line-height: 1.2;
}

.ttt-chat-meta {
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 0.2rem;
}

#ttt-site-chat-email-gate,
#ttt-site-chat-compose {
  border-top: 1px solid #e2e8f0;
  padding: 0.85rem 1rem;
  background: #fff;
}

#ttt-site-chat-email-gate p {
  font-size: 0.8rem;
  margin: 0 0 0.65rem;
  color: #475569;
}

#ttt-site-chat-root input[type="text"],
#ttt-site-chat-root input[type="email"],
#ttt-site-chat-root input[type="tel"],
#ttt-site-chat-root input[type="number"],
#ttt-site-chat-root textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

#ttt-site-chat-root textarea {
  resize: vertical;
  min-height: 4.5rem;
}

#ttt-site-chat-root button.ttt-chat-primary {
  width: 100%;
  border: none;
  border-radius: 0.5rem;
  background: var(--ttt-chat-navy);
  color: #fff;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
}

#ttt-site-chat-root button.ttt-chat-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#ttt-site-chat-availability {
  border-top: 1px solid #e2e8f0;
  padding: 0.85rem 1rem 1rem;
  background: #fff;
  flex-shrink: 0;
}

/* Expanded request form: take remaining panel space and scroll fully. */
#ttt-site-chat-panel.is-requesting-availability #ttt-site-chat-compose {
  display: none;
}

#ttt-site-chat-panel.is-requesting-availability #ttt-site-chat-messages {
  flex: 0 1 28%;
  min-height: 4.5rem;
}

#ttt-site-chat-panel.is-requesting-availability #ttt-site-chat-availability {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#ttt-site-chat-availability-form {
  padding-bottom: 0.35rem;
}

#ttt-site-chat-availability-form textarea {
  min-height: 3.25rem;
}

#ttt-site-chat-availability-form .ttt-chat-primary {
  margin-top: 0.15rem;
  margin-bottom: 0.25rem;
}

.ttt-chat-field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  margin: 0.35rem 0 0.2rem;
}

#ttt-site-chat-availability-form .ttt-chat-field-label:first-of-type {
  margin-top: 0;
}

#ttt-site-chat-root button.ttt-chat-secondary-btn {
  width: 100%;
  border: 1px solid var(--ttt-chat-navy);
  border-radius: 0.5rem;
  background: #fff;
  color: var(--ttt-chat-navy);
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.ttt-chat-availability-intro {
  font-size: 0.78rem;
  color: #475569;
  margin: 0 0 0.65rem;
}

#ttt-site-chat-promoted {
  border-top: 1px solid #e2e8f0;
  padding: 1rem;
  background: #f0fdf4;
}

.ttt-chat-promoted-text {
  margin: 0;
  font-size: 0.85rem;
  color: #166534;
  line-height: 1.45;
}

.ttt-chat-promo-video-wrap,
.ttt-chat-tour-card-wrap {
  text-align: left;
}

.ttt-chat-tour-card {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(8, 58, 128, 0.08);
  min-width: min(100%, 280px);
  max-width: 320px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ttt-chat-tour-card:hover {
  border-color: #083a80;
  box-shadow: 0 8px 22px rgba(8, 58, 128, 0.14);
  color: inherit;
}

.ttt-chat-tour-card__media {
  flex: 0 0 96px;
  background: #eef2f7;
}

.ttt-chat-tour-card__media img {
  display: block;
  width: 96px;
  height: 100%;
  min-height: 72px;
  object-fit: cover;
}

.ttt-chat-tour-card__body {
  flex: 1;
  padding: 0.65rem 0.7rem 0.65rem 0;
  min-width: 0;
}

.ttt-chat-tour-card__name {
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.3;
  color: #083a80;
  margin-bottom: 0.15rem;
}

.ttt-chat-tour-card__location {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.35;
  margin-bottom: 0.45rem;
}

.ttt-chat-tour-card__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.35rem;
}

.ttt-chat-tour-card__days {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7a8a9a;
  width: 100%;
}

.ttt-chat-tour-card__amount {
  font-size: 1.15rem;
  font-weight: 700;
  color: #083a80;
  line-height: 1;
}

.ttt-chat-tour-card__pp {
  font-size: 0.72rem;
  color: #475569;
}

.ttt-chat-tour-card__cta {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #083a80;
}

.ttt-chat-msg.is-staff .ttt-chat-tour-card-wrap,
.ttt-chat-msg.is-staff .ttt-chat-promo-video-wrap {
  margin-left: 0;
}

#siteChatThread .text-end .ttt-chat-tour-card-wrap,
#siteChatThread .text-end .ttt-chat-promo-video-wrap {
  margin-left: auto;
}

.ttt-chat-msg .ttt-chat-tour-card {
  max-width: 100%;
}

.ttt-chat-promo-video {
  display: block;
  width: 100%;
  min-width: min(100%, 280px);
  max-width: 320px;
  padding: 0;
  border: 1px solid #dbe3ef;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 18px rgba(8, 58, 128, 0.08);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ttt-chat-promo-video:hover {
  border-color: #083a80;
  box-shadow: 0 8px 22px rgba(8, 58, 128, 0.14);
}

.ttt-chat-promo-video__media {
  position: relative;
  height: 151px;
  overflow: hidden;
  background: #eef2f7;
}

.ttt-chat-promo-video__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ttt-chat-promo-video__badge {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  z-index: 1;
  max-width: calc(100% - 1.1rem);
  padding: 0.35rem 0.55rem;
  border-radius: 0.375rem;
  background: #fff;
  color: #1f2937;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.ttt-chat-promo-video__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
}

.ttt-chat-msg.is-staff .ttt-chat-promo-video-wrap,
#siteChatThread .text-end .ttt-chat-promo-video-wrap {
  margin-left: auto;
}

.ttt-chat-msg .ttt-chat-promo-video {
  max-width: 100%;
}

#ttt-site-chat-status {
  font-size: 0.72rem;
  color: #64748b;
  padding: 0 1rem 0.65rem;
}

@media (max-width: 480px) {
  #ttt-site-chat-root {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  #ttt-site-chat-panel {
    height: min(520px, calc(100vh - 5rem));
  }
}
