/* =====================================================
   Villa Augflor — Booking Chat Widget
   Luxury-minimal aesthetic, matching main design system
   ===================================================== */

/* --- Urgency Banner --- */
.urgency-bar {
  position: sticky;
  top: 0;
  z-index: 900;
  background: linear-gradient(90deg, #3d7a8a 0%, #2d6878 100%);
  color: #fff;
  font-family: var(--sans, "Inter", sans-serif);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 0.55rem 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.urgency-bar__pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff6b5b;
  animation: urgency-pulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes urgency-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}
.urgency-bar__cta {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.5);
  cursor: pointer;
  white-space: nowrap;
}
.urgency-bar__close {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem;
}

/* --- Chat Widget Container --- */
#va-chat-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  font-family: var(--sans, "Inter", -apple-system, sans-serif);
  font-size: 0.9rem;
}

/* --- Trigger Button --- */
.va-chat-trigger {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3d7a8a, #2d6878);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(45,104,120,0.45), 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.va-chat-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(45,104,120,0.55), 0 3px 12px rgba(0,0,0,0.18);
}
.va-chat-trigger svg { pointer-events: none; }
.va-chat-trigger__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #ff6b5b;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  animation: badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badge-pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* --- Proactive Bubble --- */
.va-proactive-bubble {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 260px;
  background: #fff;
  border-radius: 16px 16px 4px 16px;
  padding: 0.85rem 1rem;
  box-shadow: 0 8px 32px rgba(58,52,46,0.14), 0 2px 8px rgba(0,0,0,0.08);
  animation: bubble-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}
.va-proactive-bubble::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 20px;
  border: 8px solid transparent;
  border-top-color: #fff;
  border-bottom: none;
}
@keyframes bubble-in {
  from { opacity: 0; transform: scale(0.85) translateY(8px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.va-proactive-bubble__close {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  line-height: 1;
}
.va-proactive-bubble p {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.4;
  color: #3A342E;
}
.va-proactive-bubble strong { color: #3d7a8a; }

/* --- Chat Panel --- */
.va-chat-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 2rem);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 60px rgba(58,52,46,0.16), 0 4px 20px rgba(0,0,0,0.10);
  overflow: hidden;
  display: none;
  flex-direction: column;
  max-height: min(520px, calc(100vh - 120px));
}
.va-chat-panel.is-open {
  display: flex;
  animation: panel-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes panel-in {
  from { opacity: 0; transform: scale(0.92) translateY(12px); transform-origin: bottom right; }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* --- Panel Header --- */
.va-chat-header {
  background: linear-gradient(135deg, #3d7a8a, #2d6878);
  color: #fff;
  padding: 1rem 1.1rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.va-chat-header__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.va-chat-header__info { flex: 1; min-width: 0; }
.va-chat-header__name { font-weight: 600; font-size: 0.88rem; }
.va-chat-header__status { font-size: 0.73rem; opacity: 0.85; display: flex; align-items: center; gap: 0.35rem; }
.va-chat-header__dot { width: 7px; height: 7px; background: #7ced7c; border-radius: 50%; }
.va-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.25rem;
  flex-shrink: 0;
}

/* --- Messages Area --- */
.va-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}
.va-chat-messages::-webkit-scrollbar { width: 4px; }
.va-chat-messages::-webkit-scrollbar-track { background: transparent; }
.va-chat-messages::-webkit-scrollbar-thumb { background: #e0d8ce; border-radius: 2px; }

/* --- Message Bubbles --- */
.va-msg {
  max-width: 85%;
  padding: 0.6rem 0.85rem;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.45;
}
.va-msg--agent {
  background: #f0f4f5;
  color: #3A342E;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.va-msg--user {
  background: linear-gradient(135deg, #3d7a8a, #2d6878);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.va-msg--typing {
  background: #f0f4f5;
  align-self: flex-start;
  padding: 0.75rem 1rem;
  border-bottom-left-radius: 4px;
}
.va-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 16px;
}
.va-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7A7268;
  animation: typing-dot 1.2s ease-in-out infinite;
}
.va-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.va-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* --- Quick Reply Chips --- */
.va-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.75rem;
}
.va-qr-btn {
  background: #fff;
  border: 1.5px solid #3d7a8a;
  color: #3d7a8a;
  border-radius: 20px;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.va-qr-btn:hover { background: #3d7a8a; color: #fff; }

/* --- Action Button (CTA inside chat) --- */
.va-chat-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #25d366, #20bd5a);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 0.5rem;
  font-family: inherit;
  text-align: left;
  transition: opacity 0.15s;
}
.va-chat-action-btn:hover { opacity: 0.9; }
.va-chat-action-btn svg { flex-shrink: 0; }

/* --- Input Area --- */
.va-chat-input-area {
  border-top: 1px solid #f0ebe3;
  padding: 0.75rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.va-chat-input {
  flex: 1;
  border: 1.5px solid #e2d8c8;
  border-radius: 22px;
  padding: 0.5rem 0.9rem;
  font-family: inherit;
  font-size: 0.84rem;
  color: #3A342E;
  background: #fcf8f2;
  resize: none;
  outline: none;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.va-chat-input:focus { border-color: #3d7a8a; }
.va-chat-input::placeholder { color: #aaa; }
.va-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3d7a8a;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.va-chat-send:hover { background: #2d6878; }
.va-chat-send:disabled { background: #ccc; cursor: default; }

/* --- Exit Intent Overlay --- */
#va-exit-intent {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(58,52,46,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
}
#va-exit-intent.is-visible { display: flex; }
.va-exit-modal {
  background: #fcf8f2;
  border-radius: 20px;
  padding: 2.2rem 2rem 2rem;
  max-width: 420px;
  width: 100%;
  position: relative;
  box-shadow: 0 24px 80px rgba(58,52,46,0.22);
  text-align: center;
  animation: exit-modal-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes exit-modal-in {
  from { opacity: 0; transform: scale(0.9) translateY(-20px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.va-exit-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #7A7268;
  cursor: pointer;
}
.va-exit-modal h2 {
  font-family: var(--serif, Georgia, serif);
  font-size: 1.5rem;
  color: #3A342E;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}
.va-exit-modal p {
  color: #544D44;
  font-size: 0.88rem;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}
.va-exit-form { display: flex; flex-direction: column; gap: 0.6rem; }
.va-exit-form input {
  border: 1.5px solid #e2d8c8;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  font-family: inherit;
  font-size: 0.88rem;
  background: #fff;
  outline: none;
  color: #3A342E;
  transition: border-color 0.2s;
}
.va-exit-form input:focus { border-color: #3d7a8a; }
.va-exit-submit {
  background: linear-gradient(135deg, #3d7a8a, #2d6878);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.va-exit-submit:hover { opacity: 0.9; }
.va-exit-skip {
  background: none;
  border: none;
  color: #7A7268;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  margin-top: 0.25rem;
}
.va-exit-success {
  color: #3d7a8a;
  font-weight: 600;
  font-size: 0.9rem;
  display: none;
  padding: 1rem 0 0;
}

/* --- Mobile adjustments --- */
@media (max-width: 480px) {
  #va-chat-widget { bottom: 1rem; right: 1rem; }
  .va-chat-panel { width: calc(100vw - 2rem); right: -1rem; }
  .va-proactive-bubble { width: calc(100vw - 5rem); }
}
