/* ===== Floating Chat Button ===== */
.chat-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #00c853, #00e676);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 200, 83, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.chat-btn:hover { transform: scale(1.1); box-shadow: 0 6px 30px rgba(0, 200, 83, 0.5); }
.chat-btn svg { width: 28px; height: 28px; fill: white; }
.chat-btn .pulse {
  position: absolute;
  width: 100%; height: 100%;
  background: rgba(0, 200, 83, 0.3);
  border-radius: 50%;
  animation: chatPulse 2s infinite;
}
@keyframes chatPulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ===== Chat Modal ===== */
.chat-modal {
  position: fixed;
  bottom: 110px;
  right: 30px;
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 160px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9000;
  animation: chatSlideUp 0.3s ease;
}
.chat-modal.active { display: flex; }
@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Chat Header ===== */
.chat-header {
  background: linear-gradient(135deg, #0d2137, #1a3a5c);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-header .chat-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #00c853, #00e676);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-header .chat-avatar svg { width: 22px; height: 22px; fill: #fff; }
.chat-header .chat-info h3 { font-size: 0.95rem; margin-bottom: 2px; }
.chat-header .chat-info p { font-size: 0.72rem; opacity: 0.8; }
.chat-close {
  margin-left: auto;
  background: rgba(255,255,255,0.1);
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.chat-close:hover { background: rgba(255,255,255,0.2); }
.chat-close svg { width: 14px; height: 14px; fill: #fff; }

/* ===== Chat Messages ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: #f5f7fa;
}
.chat-msg {
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  animation: chatFadeIn 0.3s ease;
}
@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot { padding-right: 35px; }
.chat-msg.user { flex-direction: row-reverse; padding-left: 35px; }
.chat-msg .mini-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-msg.bot .mini-avatar { background: linear-gradient(135deg, #00c853, #00e676); }
.chat-msg.user .mini-avatar { background: #0d2137; }
.chat-msg .mini-avatar svg { width: 16px; height: 16px; fill: #fff; }
.chat-bubble {
  max-width: 85%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-msg.bot .chat-bubble {
  background: #fff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}
.chat-msg.user .chat-bubble {
  background: #0d2137;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg .chat-bubble strong { font-weight: 600; }

/* ===== Quick Reply Buttons ===== */
.quick-replies {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.quick-reply-btn {
  padding: 9px 16px;
  border: 2px solid #0d2137;
  background: transparent;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  color: #0d2137;
}
.quick-reply-btn:hover { background: #0d2137; color: #fff; }
.quick-reply-btn.selected { background: #0d2137; color: #fff; }

/* ===== Text Input ===== */
.chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #e8e8e8;
}
.chat-input-wrap input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 24px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input-wrap input:focus { border-color: #00c853; }
.chat-input-wrap .chat-send-btn {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #00c853, #00e676);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.chat-input-wrap .chat-send-btn:hover { transform: scale(1.08); }
.chat-input-wrap .chat-send-btn svg { width: 18px; height: 18px; fill: #fff; }

/* ===== Input Hint ===== */
.chat-input-hint {
  padding: 8px 14px;
  background: #fff;
  text-align: center;
  font-size: 0.78rem;
  color: #999;
  border-top: 1px solid #f0f0f0;
}

/* ===== Typing Indicator ===== */
.typing-wrap {
  display: flex;
  gap: 10px;
  padding-right: 35px;
  animation: chatFadeIn 0.3s ease;
}
.typing-wrap .mini-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00c853, #00e676);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.typing-wrap .mini-avatar svg { width: 16px; height: 16px; fill: #fff; }
.typing-dots {
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.typing-dots span {
  width: 7px; height: 7px;
  background: #aaa;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ===== PPI Box ===== */
.ppi-box {
  background: #fffbe6;
  border: 1.5px solid #f5c518;
  border-radius: 12px;
  padding: 14px;
  margin: 10px 0;
}
.ppi-box h4 {
  color: #b8860b;
  font-size: 0.85rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ppi-box h4 svg { width: 16px; height: 16px; fill: #b8860b; }
.ppi-box p { font-size: 0.82rem; color: #555; line-height: 1.5; margin-bottom: 10px; }
.ppi-check { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: #333; margin-bottom: 12px; }
.ppi-check input { width: 16px; height: 16px; accent-color: #00c853; }

/* ===== Route Button ===== */
.route-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #00c853, #00e676);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.route-btn:hover { transform: scale(1.02); box-shadow: 0 4px 15px rgba(0,200,83,0.35); }
.route-btn svg { width: 18px; height: 18px; fill: #fff; }

/* ===== Success Screen ===== */
.chat-success {
  text-align: center;
  padding: 30px 20px;
}
.chat-success .ok-icon {
  width: 56px; height: 56px;
  background: #00c853;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  animation: okPop 0.4s ease;
}
@keyframes okPop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
.chat-success .ok-icon svg { width: 28px; height: 28px; fill: #fff; }
.chat-success h3 { color: #0d2137; font-size: 1.1rem; margin-bottom: 8px; }
.chat-success p { color: #666; font-size: 0.85rem; line-height: 1.6; }
.chat-success .next-msg {
  margin-top: 14px;
  padding: 10px;
  background: #e8f5e9;
  border-radius: 8px;
  color: #2e7d32;
  font-size: 0.82rem;
  font-weight: 500;
}

/* ===== Mobile ===== */
@media (max-width: 480px) {
  .chat-btn { bottom: 20px; right: 20px; width: 52px; height: 52px; }
  .chat-modal { bottom: 90px; right: 16px; width: calc(100vw - 32px); }
  .chat-messages { padding: 14px; }
}