/* Chatbot Widget Styles */
:root {
  --chat-primary: #9333ea; /* purple-600 */
  --chat-primary-hover: #7e22ce; /* purple-700 */
  --chat-bg: #1f2937; /* gray-800 */
  --chat-text: #f3f4f6; /* gray-100 */
  --chat-input-bg: #111827; /* gray-900 */
  --chat-border: #374151; /* gray-700 */
}

/* Floating Button */
.chatbot-toggler {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: var(--chat-primary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chatbot-toggler:hover {
  background: var(--chat-primary-hover);
  transform: scale(1.1);
}

.chatbot-toggler span {
  position: absolute;
  color: #fff;
  font-size: 1.5rem;
  transition: all 0.3s ease;
}

.chatbot-toggler span:last-child {
  opacity: 0;
}

.show-chatbot .chatbot-toggler span:first-child {
  opacity: 0;
  transform: rotate(90deg);
}

.show-chatbot .chatbot-toggler span:last-child {
  opacity: 1;
  transform: rotate(90deg);
}

/* Chat Window */
.chatbot {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 350px;
  background: var(--chat-bg);
  border-radius: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5);
  transform-origin: bottom right;
  transition: all 0.3s ease;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.show-chatbot .chatbot {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Header */
.chatbot header {
  background: var(--chat-primary);
  padding: 16px;
  text-align: center;
  position: relative;
}

.chatbot header h2 {
  color: #fff;
  font-size: 1.2rem;
  margin: 0;
  font-weight: 600;
}

.chatbot header span {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  cursor: pointer;
  display: none; /* Hidden on desktop, shown on mobile if needed */
}

/* Chatbox (Messages) */
.chatbot .chatbox {
  height: 350px;
  overflow-y: auto;
  padding: 15px 20px;
  background: var(--chat-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--chat-border) var(--chat-bg);
}

.chatbot .chatbox::-webkit-scrollbar {
  width: 6px;
}
.chatbot .chatbox::-webkit-scrollbar-track {
  background: var(--chat-bg);
}
.chatbot .chatbox::-webkit-scrollbar-thumb {
  background: var(--chat-border);
  border-radius: 3px;
}

.chatbox .chat {
  display: flex;
  list-style: none;
  margin-bottom: 15px;
}

.chatbox .chat p {
  white-space: pre-wrap;
  padding: 10px 14px;
  border-radius: 10px;
  max-width: 85%;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
}

/* Outgoing (User) */
.chatbox .chat.outgoing {
  justify-content: flex-end;
}

.chatbox .chat.outgoing p {
  background: var(--chat-primary);
  color: #fff;
  border-bottom-right-radius: 0;
}

/* Incoming (Bot) */
.chatbox .chat.incoming {
  justify-content: flex-start;
  align-items: flex-end;
}

.chatbox .chat.incoming span {
  width: 32px;
  height: 32px;
  color: #fff;
  background: var(--chat-primary);
  text-align: center;
  line-height: 32px;
  border-radius: 50%;
  margin-right: 10px;
  font-size: 1.2rem;
  align-self: flex-end;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbox .chat.incoming p {
  background: var(--chat-border);
  color: var(--chat-text);
  border-bottom-left-radius: 0;
}

/* Input Area */
.chatbot .chat-input {
  display: flex;
  gap: 5px;
  padding: 10px 15px;
  border-top: 1px solid var(--chat-border);
  background: var(--chat-bg);
}

.chat-input textarea {
  height: 45px;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: var(--chat-input-bg);
  color: var(--chat-text);
  font-size: 0.95rem;
  padding: 12px 15px;
  border-radius: 20px;
  overflow-y: hidden; /* Hide scrollbar for single line */
}

.chat-input span {
  align-self: flex-end;
  color: var(--chat-primary);
  cursor: pointer;
  height: 45px;
  width: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  transition: color 0.2s;
  background: none;
  border: none;
}

.chat-input span:hover {
  color: var(--chat-primary-hover);
}

/* Contact Form inside Chat */
.chat-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--chat-border);
  padding: 15px;
  border-radius: 10px;
  margin-top: 5px;
}

.chat-form input, .chat-form textarea {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #4b5563;
  background: var(--chat-input-bg);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
}

.chat-form button {
  padding: 8px;
  background: var(--chat-primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.chat-form button:hover {
  background: var(--chat-primary-hover);
}

/* Mobile Responsiveness */
@media (max-width: 490px) {
  .chatbot {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  
  .chatbot .chatbox {
    height: calc(100% - 120px);
  }
  
  .chatbot header span {
    display: block;
  }
}

