.ve-chatbot {
  position: fixed;
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  z-index: 160;
  font-family: Inter, system-ui, sans-serif;
}

.ve-chat-toggle {
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(135deg, var(--orange), var(--brown));
  color: var(--white);
  box-shadow: 0 8px 28px rgba(134, 81, 49, 0.35);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
}

.ve-chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 32px rgba(134, 81, 49, 0.45);
}

.ve-chat-toggle svg {
  width: 26px;
  height: 26px;
}

.ve-chatbot--open .ve-chat-toggle {
  transform: scale(0.95);
}

.ve-chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100svh - 120px));
  max-height: calc(100dvh - 100px);
  background: var(--white);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(44, 36, 32, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.ve-chat-panel.is-open {
  display: flex;
}

.ve-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--brown), #6a3f28);
  color: var(--white);
}

.ve-chat-header img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.ve-chat-header-text strong {
  display: block;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 20px;
  line-height: 1.2;
}

.ve-chat-header-text span {
  font-size: 12px;
  opacity: 0.85;
}

.ve-chat-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: var(--white);
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  touch-action: manipulation;
}

.ve-chat-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.ve-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--cream);
}

.ve-chat-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
}

.ve-chat-msg--bot {
  align-self: flex-start;
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.ve-chat-msg--bot a {
  color: var(--orange);
  font-weight: 600;
  text-decoration: underline;
}

.ve-chat-msg--user {
  align-self: flex-end;
  background: var(--brown);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.ve-chat-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
}

.ve-chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: veChatBounce 1.2s infinite ease-in-out;
}

.ve-chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.ve-chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes veChatBounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

.ve-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--white);
  max-height: 88px;
  overflow-y: auto;
}

.ve-chat-chip {
  border: 1px solid var(--border);
  background: var(--cream2);
  color: var(--brown);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ve-chat-chip:hover {
  background: var(--white);
  border-color: var(--orange);
  color: var(--orange);
}

.ve-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--white);
}

.ve-chat-form input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.ve-chat-form input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(228, 144, 78, 0.2);
}

.ve-chat-send {
  border: none;
  background: var(--orange);
  color: var(--white);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  touch-action: manipulation;
}

.ve-chat-send:hover {
  background: var(--brown);
}

.ve-chat-send svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .ve-chatbot {
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
  }

  .ve-chat-panel {
    bottom: 68px;
    width: calc(100vw - 28px);
    height: min(72svh, calc(100dvh - 96px));
    max-height: calc(100dvh - 88px);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .ve-chat-panel {
    height: min(85svh, calc(100dvh - 80px));
    bottom: 64px;
  }

  .ve-chat-chips {
    max-height: 64px;
  }
}
