/* ===== CHATBOT BUBBLE ===== */
#chat-bubble {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #2506ad, #7303a7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 4px 20px rgba(115, 3, 167, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: chatPulse 2.5s ease-in-out infinite;
}

#chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(115, 3, 167, 0.7);
  animation: none;
}

#chat-bubble i {
  font-size: 2.4rem;
  color: #fff;
}

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(115, 3, 167, 0.5); }
  50%       { box-shadow: 0 4px 32px rgba(115, 3, 167, 0.9), 0 0 0 8px rgba(115, 3, 167, 0.15); }
}

/* ===== NOTIFICATION BADGE ===== */
#chat-notif-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 2rem;
  height: 2rem;
  background: #ff3b3b;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Poppins', sans-serif;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

#chat-notif-badge.show {
  opacity: 1;
  transform: scale(1);
}

/* ===== TOOLTIP ===== */
#chat-tooltip {
  position: fixed;
  bottom: 8.5rem;
  right: 2rem;
  background: #fff;
  color: #0d0033;
  padding: 0.9rem 1.5rem;
  border-radius: 1.2rem 1.2rem 0.3rem 1.2rem;
  font-size: 1.3rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  z-index: 1002;
  opacity: 0;
  transform: translateY(6px) scale(0.95);
  transform-origin: bottom right;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

#chat-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ===== CHAT PANEL ===== */
#chat-panel {
  position: fixed;
  bottom: 8.5rem;
  right: 2rem;
  width: 360px;
  height: 520px;
  background: #0d0033;
  border-radius: 1.6rem;
  overflow: hidden;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  transform-origin: bottom right;
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.2s ease;
}

#chat-panel.open {
  transform: scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ===== HEADER ===== */
#chat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  background: linear-gradient(135deg, #2506ad, #7303a7);
  flex-shrink: 0;
}

.chat-avatar {
  width: 3.8rem;
  height: 3.8rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-avatar i {
  font-size: 1.8rem;
  color: #fff;
}

.chat-title {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-title span {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  font-family: 'Poppins', sans-serif;
}

.chat-title small {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.75);
  font-family: 'Nunito', sans-serif;
}

#chat-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: background 0.2s;
  flex-shrink: 0;
}

#chat-close:hover {
  background: rgba(255,255,255,0.3);
}

/* ===== MESSAGES AREA ===== */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
  width: 4px;
}
#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#chat-messages::-webkit-scrollbar-thumb {
  background: rgba(115, 3, 167, 0.4);
  border-radius: 4px;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  animation: msgSlideIn 0.3s ease forwards;
}

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

.msg-row.bot {
  justify-content: flex-start;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-icon {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #2506ad, #7303a7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg-icon i {
  font-size: 1.3rem;
  color: #fff;
}

.msg-bubble {
  max-width: 78%;
  padding: 0.9rem 1.2rem;
  border-radius: 1.4rem;
  font-size: 1.3rem;
  line-height: 1.55;
  font-family: 'Nunito', sans-serif;
  word-break: break-word;
}

.msg-row.bot .msg-bubble {
  background: linear-gradient(135deg, rgba(37, 6, 173, 0.8), rgba(115, 3, 167, 0.8));
  color: #fff;
  border-bottom-left-radius: 0.3rem;
}

.msg-row.user .msg-bubble {
  background: #2506ad;
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}

/* ===== TYPING INDICATOR ===== */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 1.2rem;
}

.typing-dots span {
  width: 0.7rem;
  height: 0.7rem;
  background: rgba(255,255,255,0.6);
  border-radius: 50%;
  display: inline-block;
  animation: dotBounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

/* ===== QUICK-REPLY CHIPS ===== */
#chat-suggestions {
  padding: 0.6rem 1.2rem 0.8rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}

#chat-suggestions::-webkit-scrollbar { display: none; }

.chip {
  white-space: nowrap;
  padding: 0.45rem 1.1rem;
  border-radius: 50px;
  border: 1px solid #7303a7;
  color: #d4aaff;
  background: transparent;
  font-size: 1.1rem;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.chip:hover {
  background: rgba(115, 3, 167, 0.3);
  color: #fff;
}

/* ===== INPUT ROW ===== */
#chat-input-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1.2rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50px;
  padding: 0.8rem 1.4rem;
  color: #fff;
  font-size: 1.3rem;
  font-family: 'Nunito', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

#chat-input::placeholder { color: rgba(255,255,255,0.4); }

#chat-input:focus {
  border-color: #7303a7;
}

#chat-send {
  width: 3.8rem;
  height: 3.8rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #2506ad, #7303a7);
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

#chat-send:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(115, 3, 167, 0.5);
}

/* ===== MOBILE ===== */
@media (max-width: 500px) {
  #chat-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    transform-origin: bottom center;
  }

  #chat-bubble {
    bottom: 1.5rem;
    right: 1.5rem;
  }
}
