/* ============================================================
   TravelBajetAntarabangsa — AI Chatbot
   Farafisyah Travel & Tours
   ============================================================ */

.chatbot {
  position: fixed;
  bottom: 100px;
  right: 26px;
  z-index: 1000;
  font-family: var(--font-main);
}

.chatbot-toggle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--grad);
  color: var(--white);
  font-size: 1.6rem;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 28px rgba(14, 124, 123, 0.45);
  transition: all 0.3s ease;
  position: relative;
  animation: botPulse 2s infinite;
}

@keyframes botPulse {
  0% { box-shadow: 0 0 0 0 rgba(14, 124, 123, 0.45); }
  70% { box-shadow: 0 0 0 18px rgba(14, 124, 123, 0); }
  100% { box-shadow: 0 0 0 0 rgba(14, 124, 123, 0); }
}

.chatbot-toggle:hover { transform: scale(1.1); }
.chatbot-toggle .fa-xmark { display: none; }
.chatbot.open .chatbot-toggle { animation: none; background: var(--dark); }
.chatbot.open .chatbot-toggle .fa-robot { display: none; }
.chatbot.open .chatbot-toggle .fa-xmark { display: block; }

.chatbot-panel {
  position: absolute;
  bottom: 78px;
  right: 0;
  width: 370px;
  max-width: calc(100vw - 40px);
  height: min(540px, calc(100vh - 180px));
  background: var(--white);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  transition: all 0.3s ease;
}

.chatbot.open .chatbot-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chatbot-header {
  background: var(--grad);
  color: var(--white);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.chatbot-header-info { flex: 1; line-height: 1.3; }
.chatbot-header-info strong { font-size: 1rem; display: block; }
.chatbot-status { font-size: 0.78rem; opacity: 0.9; }
.chatbot-status i { font-size: 0.55rem; margin-right: 4px; vertical-align: middle; }

.chatbot-close {
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.chatbot-close:hover { opacity: 1; }

.chatbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}

.chatbot-msg {
  max-width: 85%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chatbot-msg.bot {
  align-self: flex-start;
  background: var(--white);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}

.chatbot-msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.chatbot-msg .chatbot-wa {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  background: var(--wa);
  color: var(--white);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: 999px;
  transition: background 0.3s ease;
}
.chatbot-msg .chatbot-wa:hover { background: var(--wa-dark); }

.chatbot-msg .chatbot-em {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 10px;
}

.chatbot-typing {
  align-self: flex-start;
  background: var(--white);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  display: inline-flex;
  gap: 5px;
}

.chatbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.4;
  animation: botBlink 1.2s infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes botBlink {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.chatbot-quick {
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--white);
  border-top: 1px solid var(--bg-alt);
}

.chatbot-quick button {
  border: 1.5px solid var(--primary-light);
  background: transparent;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-main);
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.chatbot-quick button:hover { background: var(--primary); color: var(--white); }

.chatbot-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--white);
  border-top: 1px solid var(--bg-alt);
}

.chatbot-input input {
  flex: 1;
  border: 1.5px solid var(--bg-alt);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 0.9rem;
  font-family: var(--font-main);
  color: var(--text);
  outline: none;
  background: var(--bg);
  transition: border-color 0.25s;
}
.chatbot-input input:focus { border-color: var(--primary-light); }

.chatbot-input button {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: var(--grad);
  color: var(--white);
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.chatbot-input button:hover { transform: scale(1.08); }

@media (max-width: 640px) {
  .chatbot { bottom: 92px; right: 16px; }
  .chatbot-panel {
    right: 0;
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    height: min(520px, calc(100vh - 140px));
  }
  .chatbot-msg { max-width: 88%; }
}
