/* =========================================================
   MODO BESTIA — CHAT WIDGET
   Archivo aislado, namespaced con .mb-chat-*
   No modifica ni depende de styles.css
   ========================================================= */

.mb-chat-btn {
  position: fixed;
  bottom: 176px;
  right: 30px;
  z-index: 9999;
  display: flex;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #0D4AA6, #2B8AF6);
  color: #fff;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(13, 74, 166, 0.45);
  animation: mbChatFloat 3s ease-in-out infinite;
  animation-delay: 1s;
  padding: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mb-chat-btn:hover {
  transform: scale(1.15) translateY(-5px);
  box-shadow: 0 0 25px rgba(43, 138, 246, 0.8);
}

.mb-chat-btn svg {
  width: 26px;
  height: 26px;
}

@keyframes mbChatFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ---------------- PANEL ---------------- */
.mb-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 140px);
  background: #F5F7FA;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  font-family: 'Inter', sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.mb-chat-panel.mb-chat-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mb-chat-header {
  background: linear-gradient(135deg, #0D4AA6, #2B8AF6);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.mb-chat-header-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.mb-chat-header-subtitle {
  font-weight: 400;
  font-size: 0.75rem;
  opacity: 0.85;
}

.mb-chat-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mb-chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.mb-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mb-chat-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.mb-chat-msg-bot {
  align-self: flex-start;
  background: #fff;
  color: #111;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.mb-chat-msg-user {
  align-self: flex-end;
  background: #0D4AA6;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.mb-chat-msg-error {
  align-self: flex-start;
  background: #fdeaea;
  color: #a11;
  border-bottom-left-radius: 4px;
}

.mb-chat-typing {
  align-self: flex-start;
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.mb-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #888;
  animation: mbChatDot 1.2s infinite ease-in-out;
}

.mb-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.mb-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes mbChatDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ---------------- QUICK REPLIES ---------------- */
.mb-chat-quickreplies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.mb-chat-qr-btn {
  background: #fff;
  border: 1px solid #d7deea;
  color: #0D4AA6;
  font-size: 0.78rem;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.mb-chat-qr-btn:hover {
  background: #eaf1fd;
}

.mb-chat-qr-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mb-chat-telegram-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef0f3;
  border: 1px solid #d7deea;
  color: #9aa2ad;
  font-size: 0.78rem;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: not-allowed;
}

/* ---------------- INPUT ---------------- */
.mb-chat-inputbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e3e7ee;
  background: #fff;
  flex-shrink: 0;
}

.mb-chat-textarea {
  flex: 1;
  resize: none;
  border: 1px solid #d7deea;
  border-radius: 12px;
  padding: 9px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  line-height: 1.35;
  max-height: 90px;
  outline: none;
  color: #111;
}

.mb-chat-textarea:focus {
  border-color: #2B8AF6;
}

.mb-chat-send {
  background: #0D4AA6;
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.mb-chat-send:hover:not(:disabled) {
  background: #2B8AF6;
}

.mb-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------------- RESPONSIVE MOBILE ---------------- */
@media (max-width: 600px) {
  .mb-chat-btn { width: 45px; height: 45px; bottom: 146px; right: 20px; }
  .mb-chat-btn svg { width: 22px; height: 22px; }

  .mb-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}
