/* ============ CHATBOT WIDGET ============ */
.chatbot-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #3B5BDB;
  border: none;
  box-shadow: 0 8px 32px rgba(59, 91, 219, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.chatbot-toggle:hover {
  transform: scale(1.08);
}
.chatbot-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid #3B5BDB;
  border-radius: 50%;
  animation: chatbot-pulse-ring 2.5s ease-out infinite;
  pointer-events: none;
}
.chatbot-toggle.seen::before {
  display: none;
}
@keyframes chatbot-pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}
.chatbot-toggle-icon {
  display: flex;
}
.chatbot-toggle-icon-close {
  display: none;
}
.chatbot-toggle.open .chatbot-toggle-icon-chat {
  display: none;
}
.chatbot-toggle.open .chatbot-toggle-icon-close {
  display: flex;
}
.chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #DC2626;
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chatbot-badge.hidden {
  display: none;
}

.chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 9999;
  width: 360px;
  height: 520px;
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(15, 30, 74, 0.18), 0 4px 16px rgba(15, 30, 74, 0.1);
  border: 1px solid #E8EAF0;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  transform: scaleY(0);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.chatbot-window.open {
  transform: scaleY(1);
  opacity: 1;
  pointer-events: auto;
}

.chatbot-header {
  background: #0F1E4A;
  border-radius: 20px 20px 0 0;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.chatbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3B5BDB;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chatbot-header-text {
  flex: 1;
}
.chatbot-header-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--white);
}
.chatbot-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.chatbot-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  flex-shrink: 0;
}
.chatbot-header-status span {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}
.chatbot-close-btn {
  background: none;
  border: none;
  padding: 4px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}
.chatbot-close-btn:hover {
  color: var(--white);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: #E8EAF0 transparent;
}
.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}
.chatbot-messages::-webkit-scrollbar-thumb {
  background: #E8EAF0;
  border-radius: 10px;
}

.chatbot-msg-bot {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.chatbot-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chatbot-bubble {
  background: var(--off-white);
  border-radius: 4px 16px 16px 16px;
  padding: 12px 16px;
  max-width: 260px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--blue-ink);
  line-height: 1.5;
}
.chatbot-bubble a {
  color: #3B5BDB;
  font-weight: 500;
  text-decoration: none;
}
.chatbot-bubble a:hover {
  text-decoration: underline;
}
.chatbot-msg-user {
  display: flex;
  justify-content: flex-end;
}
.chatbot-msg-user .chatbot-bubble {
  background: #3B5BDB;
  border-radius: 16px 4px 16px 16px;
  color: var(--white);
  max-width: 260px;
}

.chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--off-white);
  border-radius: 4px 16px 16px 16px;
  width: fit-content;
}
.chatbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9CA3AF;
  animation: chatbot-bounce 1.2s ease-in-out infinite;
}
.chatbot-typing span:nth-child(1) { animation-delay: 0s; }
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatbot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chatbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  margin-left: 36px;
}
.chatbot-chip {
  background: var(--white);
  border: 1px solid #E8EAF0;
  border-radius: 50px;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  color: #3B5BDB;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.chatbot-chip:hover {
  background: var(--blue-light);
  border-color: #3B5BDB;
}

.chatbot-input-area {
  border-top: 1px solid #E8EAF0;
  padding: 14px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.chatbot-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--blue-ink);
}
.chatbot-input::placeholder {
  color: #9CA3AF;
}
.chatbot-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3B5BDB;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.chatbot-send-btn:hover {
  background: #2D4BC4;
}
.chatbot-send-btn:disabled {
  background: #E8EAF0;
  cursor: not-allowed;
}
.chatbot-send-btn:disabled svg {
  stroke: #9CA3AF;
}

@media (max-width: 768px) {
  .chatbot-window {
    width: calc(100vw - 32px);
    height: 60vh;
    right: 16px;
    bottom: 80px;
    border-radius: 16px;
  }
  .chatbot-header {
    border-radius: 16px 16px 0 0;
  }
  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
  }
}
