/* =============================================
   ChatBot Widget Styles
   ============================================= */

/* Toggle Button */
.chatbot-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #84bed6, #5ba3c4);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Move back-to-top button up when chatbot toggle is visible */
body:has(.chatbot-toggle) .back-to-top {
  bottom: 85px;
}

/* Chat Panel */
.chatbot-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 999;
  width: 380px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.chatbot-header {
  background: linear-gradient(135deg, #84bed6, #5ba3c4);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatbot-avatar {
  font-size: 28px;
}

.chatbot-header-title {
  font-weight: 600;
  font-size: 15px;
}

.chatbot-header-status {
  font-size: 12px;
  opacity: 0.85;
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chatbot-header-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.chatbot-header-btn:hover {
  opacity: 1;
}

/* Messages */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Message Bubbles */
.chatbot-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chatbot-msg-user {
  align-self: flex-end;
  background: #84bed6;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-msg-assistant {
  align-self: flex-start;
  background: #f0f2f5;
  color: #333;
  border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.chatbot-typing {
  align-self: flex-start;
  padding: 12px 16px;
}

.chatbot-typing-dots {
  display: flex;
  gap: 4px;
}

.chatbot-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bbb;
  animation: chatbot-bounce 1.4s infinite ease-in-out;
}

.chatbot-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.chatbot-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes chatbot-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
  }
  40% {
    transform: scale(1);
  }
}

/* Suggested Replies */
.chatbot-suggestions {
  padding: 0 16px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chatbot-suggestion-btn {
  background: #e8f4f8;
  border: 1px solid #84bed6;
  color: #333;
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.chatbot-suggestion-btn:hover {
  background: #d0eaf2;
}

/* Input Area */
.chatbot-input-area {
  border-top: 1px solid #e8e8e8;
  padding: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
}

.chatbot-input:focus {
  border-color: #84bed6;
}

.chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #84bed6;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.chatbot-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.chatbot-send:not(:disabled):hover {
  background: #5ba3c4;
}

/* RTL Support */
[dir="rtl"] .chatbot-toggle {
  right: auto;
  left: 20px;
}

[dir="rtl"] .chatbot-panel {
  right: auto;
  left: 20px;
}

[dir="rtl"] .chatbot-msg-user {
  border-bottom-right-radius: 16px;
  border-bottom-left-radius: 4px;
}

[dir="rtl"] .chatbot-msg-assistant {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 4px;
}

[dir="rtl"] body:has(.chatbot-toggle) .back-to-top {
  left: 85px;
  right: auto;
}

/* Mobile (full-screen panel) */
@media (max-width: 576px) {
  .chatbot-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }

  [dir="rtl"] .chatbot-panel {
    right: 0;
    left: 0;
  }
}
