/* ===== CHATBOT WIDGET ===== */

/* ---------- Floating Button ---------- */
.chatbot-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a96e, #b8860b);
  border: none;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(201, 169, 110, 0.5);
  transition: transform 0.3s ease;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
}

.chatbot-toggle i {
  font-size: 26px;
  color: #fff;
  transition: transform 0.3s ease;
}

.chatbot-toggle.open i.fa-comments {
  display: none;
}

.chatbot-toggle.open i.fa-times {
  display: inline-block;
}

.chatbot-toggle:not(.open) i.fa-times {
  display: none;
}

/* Pulse ring animation */
.chatbot-toggle::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(201, 169, 110, 0.4);
  animation: chatbot-pulse 2s ease-out infinite;
  z-index: -1;
}

.chatbot-toggle::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(201, 169, 110, 0.25);
  animation: chatbot-pulse 2s ease-out infinite 0.6s;
  z-index: -1;
}

@keyframes chatbot-pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* Bounce the icon */
.chatbot-toggle i.fa-comments {
  animation: chatbot-bounce 2.5s ease-in-out infinite;
}

@keyframes chatbot-bounce {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-4px) rotate(-5deg); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-3px) rotate(5deg); }
}

/* ---------- Chat Panel ---------- */
.chatbot-panel {
  position: fixed;
  bottom: 110px;
  right: 30px;
  width: 370px;
  max-height: 520px;
  background: #FAF7F2;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  transform: scale(0) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  pointer-events: none;
}

.chatbot-panel.visible {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chatbot-header {
  background: linear-gradient(135deg, #c9a96e, #b8860b);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-header-icon {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.chatbot-header-text h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Cormorant Garamond', serif;
  letter-spacing: 0.5px;
}

.chatbot-header-text p {
  margin: 2px 0 0;
  font-size: 11px;
  opacity: 0.85;
}

/* Messages area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
  max-height: 340px;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(201, 169, 110, 0.4);
  border-radius: 2px;
}

/* Bubbles */
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: chatFadeIn 0.3s ease;
}

@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #c9a96e, #b8860b);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: #c9a96e;
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Category buttons */
.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chat-options button {
  padding: 7px 14px;
  border: 1.5px solid #c9a96e;
  background: transparent;
  color: #8B7355;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12.5px;
  transition: all 0.25s ease;
  font-family: inherit;
}

.chat-options button:hover {
  background: #c9a96e;
  color: #fff;
}

/* Input area */
.chatbot-input {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid rgba(201, 169, 110, 0.2);
  background: #fff;
  gap: 8px;
}

.chatbot-input input {
  flex: 1;
  border: 1.5px solid rgba(201, 169, 110, 0.3);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13px;
  outline: none;
  background: #FAF7F2;
  transition: border-color 0.3s ease;
  font-family: inherit;
}

.chatbot-input input:focus {
  border-color: #c9a96e;
}

.chatbot-input button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #c9a96e, #b8860b);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.chatbot-input button:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 10px rgba(201, 169, 110, 0.4);
}

.chatbot-input button i {
  font-size: 15px;
}

/* Summary card */
.chat-summary {
  background: #fff;
  border: 1.5px solid rgba(201, 169, 110, 0.3);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #555;
  align-self: flex-start;
  max-width: 90%;
  animation: chatFadeIn 0.3s ease;
}

.chat-summary strong {
  color: #8B7355;
}

/* Restart link */
.chat-restart {
  align-self: center;
  margin-top: 4px;
  animation: chatFadeIn 0.3s ease;
}

.chat-restart button {
  background: none;
  border: none;
  color: #c9a96e;
  cursor: pointer;
  font-size: 12.5px;
  text-decoration: underline;
  font-family: inherit;
}

.chat-restart button:hover {
  color: #b8860b;
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .chatbot-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 100px;
    max-height: 70vh;
  }
  .chatbot-toggle {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }
  .chatbot-toggle i {
    font-size: 22px;
  }
}
