/* ==========================================================
   Virtual Emile — Chatbot Widget
   Matches site design system: khaki accent, glass surfaces,
   Playfair/Inter type, subtle ease transitions.
   ========================================================== */

:root {
  --vbot-surface: #1a2332;
  --vbot-surface-2: #2a3847;
  --vbot-accent: #c3b091;
  --vbot-text: #f5f5f3;
  --vbot-text-dim: rgba(245, 245, 243, 0.7);
  --vbot-user-bubble: #565656;
  --vbot-radius: 1.2rem;
}

/* ---------- Launcher bubble ---------- */
.vbot-launcher {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1060;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--vbot-surface);
  color: var(--vbot-accent);
  font-size: 1.4rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
}
.vbot-launcher:hover,
.vbot-launcher:focus-visible {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}
.vbot-launcher .vbot-launcher-close { display: none; }
.vbot-launcher.is-open .vbot-launcher-chat { display: none; }
.vbot-launcher.is-open .vbot-launcher-close { display: inline; }

/* Gentle attention pulse, runs a few times then stops (JS removes it) */
@keyframes vbot-pulse {
  0%   { box-shadow: 0 6px 20px rgba(0,0,0,0.35), 0 0 0 0 rgba(195, 176, 145, 0.45); }
  70%  { box-shadow: 0 6px 20px rgba(0,0,0,0.35), 0 0 0 14px rgba(195, 176, 145, 0); }
  100% { box-shadow: 0 6px 20px rgba(0,0,0,0.35), 0 0 0 0 rgba(195, 176, 145, 0); }
}
.vbot-launcher.vbot-pulsing { animation: vbot-pulse 2.4s ease-in-out 3; }

/* ---------- Teaser bubble ---------- */
.vbot-teaser {
  position: fixed;
  right: 1.25rem;
  bottom: 6.4rem;
  z-index: 1059;
  max-width: 230px;
  background: var(--vbot-surface);
  color: var(--vbot-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  line-height: 1.4;
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(195, 176, 145, 0.35);
  border-radius: 0.9rem;
  border-bottom-right-radius: 0.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.35s ease-in-out, transform 0.35s ease-in-out;
}
.vbot-teaser strong { color: var(--vbot-accent); font-weight: 600; }
.vbot-teaser::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 20px;
  width: 12px;
  height: 12px;
  background: var(--vbot-surface);
  border-right: 1px solid rgba(195, 176, 145, 0.35);
  border-bottom: 1px solid rgba(195, 176, 145, 0.35);
  transform: rotate(45deg);
}
.vbot-teaser.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
@media (max-width: 480px) {
  .vbot-teaser {
    right: 0.9rem;
    bottom: 5.6rem;
    max-width: 200px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .vbot-teaser { transition: opacity 0.35s ease-in-out; transform: none; }
  .vbot-teaser.is-visible { transform: none; }
}

/* ---------- Panel ---------- */
.vbot-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 6.25rem;
  z-index: 1060;
  width: min(380px, calc(100vw - 2rem));
  height: min(540px, calc(100dvh - 8rem));
  display: flex;
  flex-direction: column;
  border-radius: var(--vbot-radius);
  overflow: hidden;
  background: var(--vbot-surface);
  color: var(--vbot-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}
.vbot-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- Header ---------- */
.vbot-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(195, 176, 145, 0.25);
  flex: 0 0 auto;
}
.vbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--vbot-surface-2);
  color: var(--vbot-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex: 0 0 auto;
  border: 1px solid rgba(195, 176, 145, 0.4);
  overflow: hidden;
}
.vbot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.vbot-header-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}
.vbot-header-status {
  font-size: 0.72rem;
  color: var(--vbot-text-dim);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.vbot-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b8e6f;
}

/* ---------- Messages ---------- */
.vbot-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(195, 176, 145, 0.4) transparent;
}
.vbot-msg {
  max-width: 85%;
  padding: 0.6rem 0.85rem;
  border-radius: 0.9rem;
  font-size: 0.88rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px);
  animation: vbot-msg-in 0.35s ease-in-out forwards;
}
@keyframes vbot-msg-in {
  to { opacity: 1; transform: translateY(0); }
}
.vbot-msg--bot {
  align-self: flex-start;
  background: var(--vbot-surface-2);
  border: 1px solid rgba(195, 176, 145, 0.18);
  border-bottom-left-radius: 0.25rem;
}
.vbot-msg--user {
  align-self: flex-end;
  background: var(--vbot-user-bubble);
  color: var(--vbot-accent);
  border-bottom-right-radius: 0.25rem;
}
.vbot-msg a {
  color: var(--vbot-accent);
  text-decoration: underline;
}
.vbot-msg strong { color: var(--vbot-accent); font-weight: 600; }

/* Typing indicator */
.vbot-typing {
  display: inline-flex;
  gap: 4px;
  padding: 0.75rem 0.9rem;
}
.vbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--vbot-accent);
  opacity: 0.4;
  animation: vbot-blink 1.2s ease-in-out infinite;
}
.vbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.vbot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes vbot-blink {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- Suggestion chips ---------- */
.vbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.6rem;
  flex: 0 0 auto;
}
.vbot-chip {
  border: 1px solid rgba(195, 176, 145, 0.45);
  background: transparent;
  color: var(--vbot-accent);
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.vbot-chip:hover,
.vbot-chip:focus-visible {
  background: var(--vbot-accent);
  color: var(--vbot-surface);
  transform: translateY(-1px);
}

/* ---------- Input ---------- */
.vbot-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(195, 176, 145, 0.2);
  flex: 0 0 auto;
}
.vbot-input {
  flex: 1 1 auto;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(195, 176, 145, 0.3);
  border-radius: 999px;
  color: var(--vbot-text);
  font-size: 0.88rem;
  padding: 0.55rem 1rem;
  outline: none;
  transition: border-color 0.2s ease-in-out;
}
.vbot-input::placeholder { color: var(--vbot-text-dim); }
.vbot-input:focus { border-color: var(--vbot-accent); }
.vbot-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--vbot-accent);
  color: var(--vbot-surface);
  font-size: 0.95rem;
  cursor: pointer;
  flex: 0 0 auto;
  transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out;
}
.vbot-send:hover,
.vbot-send:focus-visible {
  transform: scale(1.08);
  background: #d4c4a8;
}

/* ---------- Mobile & motion prefs ---------- */
@media (max-width: 480px) {
  .vbot-panel {
    right: 0.75rem;
    bottom: 5.5rem;
    width: calc(100vw - 1.5rem);
    height: min(70dvh, 520px);
  }
  .vbot-launcher {
    right: 0.9rem;
    bottom: 0.9rem;
    width: 54px;
    height: 54px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .vbot-launcher,
  .vbot-panel,
  .vbot-msg,
  .vbot-chip,
  .vbot-send {
    transition: none;
    animation: none;
  }
  .vbot-msg { opacity: 1; transform: none; }
}
