/* CHATBOT DARK THEME COLORS */
:root {
  --chat-purple: hsl(250, 60%, 60%);
  --chat-bg: hsl(250, 30%, 8%);
  --chat-bubble-user: hsl(250, 30%, 20%);
  --chat-bubble-bot: hsl(250, 30%, 25%);
  --chat-text: #fff;
  --chat-border: hsl(250, 30%, 30%);
}

.chatbot {
  position: fixed;
  right: 30px;
  bottom: 100px;
  width: 360px;
  max-height: 520px;
  background: var(--chat-bg);
  border-radius: 20px;
  overflow: hidden;
  transform: scale(0.5);
  transform-origin: bottom right;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

body.show-chatbot .chatbot {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

.chatbot-toggler {
  position: fixed;
  bottom: 30px;
  right: 35px;
  height: 50px;
  width: 50px;
  border-radius: 50%;
  border: none;
  background: var(--chat-purple);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.chatbot-toggler span {
  color: white;
  font-size: 28px;
  transition: opacity 0.2s ease;
  position: absolute;
}

body.show-chatbot .chatbot-toggler span:first-child {
  opacity: 0;
}

body.show-chatbot .chatbot-toggler span:last-child {
  opacity: 1;
}

.chatbot header {
  padding: 16px;
  background: var(--chat-purple);
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  position: relative;
}

.chatbot header span.close-btn {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  font-size: 20px;
  cursor: pointer;
}

.chatbox {
  padding: 20px 15px 90px;
  height: 360px;
  overflow-y: auto;
}

.chatbox::-webkit-scrollbar {
  width: 6px;
}
.chatbox::-webkit-scrollbar-thumb {
  background: var(--chat-border);
  border-radius: 5px;
}

.chat {
  display: flex;
  align-items: flex-start;
  margin: 10px 0;
}

.chat.incoming span {
  margin-right: 10px;
  width: 28px;
  height: 28px;
  background: var(--chat-purple);
  color: white;
  font-size: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat p {
  background: var(--chat-bubble-user);
  color: var(--chat-text);
  padding: 12px 16px;
  border-radius: 14px 14px 0 14px;
  max-width: 75%;
  font-size: 0.95rem;
  word-wrap: break-word;
  line-height: 1.4;
}

.chat.incoming p {
  background: var(--chat-bubble-bot);
  border-radius: 14px 14px 14px 0;
}
.chat.outgoing {
  justify-content: flex-end;
}

.chat.outgoing p {
  background: var(--chat-bubble-user);
  color: var(--chat-text);
  border-radius: 14px 14px 14px 0;
  text-align: right;
}

.chat-input {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: var(--chat-bg);
  display: flex;
  padding: 12px 16px;
  border-top: 1px solid var(--chat-border);
  gap: 8px;
  align-items: center;
}

.chat-input textarea {
  resize: none;
  width: 100%;
  height: 44px;
  max-height: 120px;
  font-size: 0.95rem;
  color: var(--chat-text);
  background: transparent;
  border: none;
  outline: none;
  padding: 10px;
  line-height: 1.4;
}

.chat-input span {
  color: var(--chat-purple);
  font-size: 22px;
  cursor: pointer;
  user-select: none;
  visibility: hidden;
}

.chat-input textarea:valid ~ span {
  visibility: visible;
}

/* Responsive */
@media (max-width: 500px) {
  .chatbot {
    width: 100%;
    right: 0;
    bottom: 0;
    max-height: 100%;
    border-radius: 0;
  }

  .chatbox {
    height: 80vh;
    padding-bottom: 90px;
  }
}
