/* ================================================================
   VoyageNepal — AI Chat Widget
   Fixed bottom-right floating assistant
   ================================================================ */

/* ── Callout bubble ───────────────────────────────────────────── */
#vn-chat-callout {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9001;
  background: #fff;
  border-radius: 12px 12px 4px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text);
  font-family: var(--font-body);
  animation: vn-chat-in 0.3s ease;
  max-width: 220px;
}
#vn-chat-callout::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 18px;
  border: 8px solid transparent;
  border-top-color: #fff;
  border-bottom: none;
}
#vn-chat-callout.vn-hidden { display: none; }
#vn-chat-callout span { flex: 1; line-height: 1.4; }
#vn-chat-callout-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--mid-grey);
  font-size: 0.7rem;
  padding: 2px 4px;
  line-height: 1;
  flex-shrink: 0;
  border-radius: 4px;
}
#vn-chat-callout-close:hover { color: var(--text); }

/* ── Toggle button ────────────────────────────────────────────── */
#vn-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(200, 16, 46, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
#vn-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(200, 16, 46, 0.5);
}
#vn-chat-toggle svg { transition: opacity 0.15s; }
#vn-chat-toggle .vn-icon-chat { font-size: 1.5rem; line-height: 1; }
#vn-chat-toggle.vn-chat-open .vn-icon-chat { display: none; }
#vn-chat-toggle:not(.vn-chat-open) .vn-icon-close { display: none; }

.vn-chat-avatar { font-size: 1.2rem; line-height: 1; }

/* ── Panel ────────────────────────────────────────────────────── */
#vn-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9000;
  width: 360px;
  max-height: 520px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transform-origin: bottom right;
  animation: vn-chat-in 0.22s ease;
}
#vn-chat-panel[hidden] { display: none; }

@keyframes vn-chat-in {
  from { opacity: 0; transform: scale(0.88) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Header ───────────────────────────────────────────────────── */
.vn-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--dark-blue);
  color: #fff;
  flex-shrink: 0;
}
.vn-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vn-chat-header-text { flex: 1; min-width: 0; }
.vn-chat-title {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}
.vn-chat-subtitle {
  font-size: 0.72rem;
  opacity: 0.7;
  margin-top: 1px;
}
#vn-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}
#vn-chat-close:hover { color: #fff; }

/* ── Messages area ────────────────────────────────────────────── */
.vn-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.vn-chat-messages::-webkit-scrollbar { width: 4px; }
.vn-chat-messages::-webkit-scrollbar-thumb {
  background: var(--light-grey);
  border-radius: 4px;
}

/* Bubbles */
.vn-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.5;
  word-break: break-word;
}
.vn-msg-user {
  align-self: flex-end;
  background: var(--red);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.vn-msg-assistant {
  align-self: flex-start;
  background: #f1f3f5;
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.vn-msg-assistant a { color: var(--red); }

/* Typing indicator */
.vn-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #f1f3f5;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.vn-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mid-grey);
  animation: vn-bounce 1.2s infinite;
}
.vn-typing span:nth-child(2) { animation-delay: 0.2s; }
.vn-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes vn-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Suggested questions */
.vn-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.vn-suggestion-btn {
  text-align: left;
  background: #fff;
  border: 1px solid var(--light-grey);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 0.78rem;
  color: var(--dark-blue);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.vn-suggestion-btn:hover {
  border-color: var(--red);
  background: #fff5f6;
}

/* Error bubble */
.vn-msg-error {
  align-self: flex-start;
  background: #fff3f3;
  color: #c0392b;
  border: 1px solid #fcc;
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 10px;
}

/* ── Input area ───────────────────────────────────────────────── */
.vn-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--light-grey);
  flex-shrink: 0;
}
#vn-chat-input {
  flex: 1;
  border: 1px solid var(--light-grey);
  border-radius: 22px;
  padding: 8px 14px;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  color: var(--text);
}
#vn-chat-input:focus { border-color: var(--red); }
#vn-chat-input:disabled { opacity: 0.5; }

#vn-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
#vn-chat-send:hover { background: var(--red-dark); }
#vn-chat-send:active { transform: scale(0.93); }
#vn-chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Minimize button (mobile only) ────────────────────────────── */
#vn-chat-minimize {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}
#vn-chat-minimize:hover { color: #fff; }

/* ── Mobile — full screen with dynamic viewport height ─────────── */
@media (max-width: 640px) {
  #vn-chat-panel {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-height: 100% !important;
    height: 100vh;
    height: 100dvh;
    border-radius: 0 !important;
  }
  #vn-chat-minimize { display: flex; }
  #vn-chat-toggle { bottom: 16px; right: 16px; }
  #vn-chat-callout { right: 76px; bottom: 24px; }
  /* iOS Safari auto-zooms on focus when input font-size < 16px */
  #vn-chat-input { font-size: 16px; }
}
