/* ============================================
   Chatbot & WhatsApp Widget - Madorsoft
   ============================================ */

/* --- WhatsApp Float Button --- */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background-color: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.45);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 22px rgba(37, 211, 102, 0.55);
}

.whatsapp-float svg {
  width: 30px;
  height: 30px;
  fill: #fff;
}

/* --- Chatbot Toggle Button --- */
.chatbot-toggle {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 56px;
  height: 56px;
  background-color: #0d6efd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  box-shadow: 0 4px 16px rgba(13, 110, 253, 0.4);
  border: none;
  cursor: pointer;
  color: white;
  font-size: 1.4rem;
  transition: transform 0.2s ease;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
}

/* Notification badge */
#chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.68rem;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.25); }
}

/* --- Chatbot Window --- */
.chatbot-window {
  position: fixed;
  bottom: 160px;
  right: 24px;
  width: 340px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  z-index: 1049;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

.chatbot-window.chatbot-hidden {
  display: none !important;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.chatbot-header {
  background: #0d6efd;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatbot-avatar {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 5px;
  flex-shrink: 0;
}

.chatbot-avatar img {
  width: 100%;
  filter: brightness(0) invert(1);
}

.chatbot-header-name {
  font-weight: 700;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.2;
}

.chatbot-header-status {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.chatbot-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}

.chatbot-close-btn:hover {
  color: #fff;
}

/* Messages area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  background: #f8f9fa;
}

.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 2px; }

/* Message bubbles */
.msg-bot, .msg-user {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.45;
  word-break: break-word;
}

.msg-bot {
  background: #fff;
  color: #212529;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.msg-user {
  background: #0d6efd;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Typing indicator */
.msg-typing {
  background: #fff;
  padding: 10px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  display: flex;
  gap: 5px;
  align-items: center;
}

.msg-typing span {
  width: 8px;
  height: 8px;
  background: #adb5bd;
  border-radius: 50%;
  animation: typing-dot 1.2s infinite;
}

.msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* Input area */
.chatbot-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e9ecef;
  background: #fff;
  flex-shrink: 0;
}

/* Option buttons */
.chatbot-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chatbot-option-btn {
  background: #fff;
  border: 1.5px solid #0d6efd;
  color: #0d6efd;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  line-height: 1.4;
}

.chatbot-option-btn:hover {
  background: #0d6efd;
  color: #fff;
}

/* Text input row */
.chatbot-text-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chatbot-text-input {
  flex: 1;
  border: 1.5px solid #dee2e6;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

.chatbot-text-input:focus {
  border-color: #0d6efd;
}

.chatbot-send-btn {
  background: #0d6efd;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.chatbot-send-btn:hover { background: #0b5ed7; }

/* WhatsApp CTA button */
.chatbot-wa-btn {
  width: 100%;
  background: #25D366;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s;
  text-decoration: none;
}

.chatbot-wa-btn:hover {
  background: #1da851;
  color: white;
}

/* Responsive */
@media (max-width: 400px) {
  .chatbot-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 150px;
  }
}
