/* ══════════════════════════════════════════════════════════════
   MOVA Studio Dental — Chatbot Widget
   Paleta y fuentes del sistema de diseño existente
   ══════════════════════════════════════════════════════════════ */

/* ── Botón flotante ── */
.mova-chat-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #2C1810;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(44,24,16,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
  outline: none;
}

.mova-chat-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(44,24,16,.45);
}

.mova-chat-trigger:focus-visible {
  outline: 3px solid var(--green-ink, #856640);
  outline-offset: 3px;
}

.mova-chat-trigger svg {
  width: 26px;
  height: 26px;
  fill: #F5F0E6;
  transition: opacity .2s;
}

.mova-chat-trigger .icon-close {
  display: none;
}

.mova-chat-open .icon-chat  { display: none; }
.mova-chat-open .icon-close { display: block; }

/* Badge de notificación */
.mova-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green-ink, #856640);
  border: 2px solid #F5F0E6;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', system-ui, sans-serif;
  animation: mova-pulse 2s ease-in-out infinite;
  transition: opacity .3s;
}

@keyframes mova-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}

/* ── Panel del chat ── */
.mova-chat-panel {
  position: fixed;
  bottom: 102px;
  right: 28px;
  z-index: 8999;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: 560px;
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(44,24,16,.20), 0 4px 16px rgba(44,24,16,.10);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #2C1810;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .28s cubic-bezier(.2,.8,.2,1),
              transform .28s cubic-bezier(.2,.8,.2,1);
}

.mova-chat-panel.mova-chat-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Cabecera ── */
.mova-chat-header {
  background: #2C1810;
  color: #F5F0E6;
  padding: 18px 20px 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mova-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(184,149,106,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.mova-chat-header-info {
  flex: 1;
  min-width: 0;
}

.mova-chat-header-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mova-chat-header-status {
  font-size: 12px;
  color: rgba(245,240,230,.65);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.mova-chat-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6FCF97;
  flex-shrink: 0;
}

/* ── Mensajes ── */
.mova-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.mova-chat-messages::-webkit-scrollbar { width: 4px; }
.mova-chat-messages::-webkit-scrollbar-track { background: transparent; }
.mova-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(44,24,16,.15);
  border-radius: 2px;
}

/* Burbuja */
.mova-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  animation: mova-msg-in .22s ease both;
}

@keyframes mova-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mova-msg-bot {
  background: #F5F0E6;
  color: #2C1810;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.mova-msg-user {
  background: #2C1810;
  color: #F5F0E6;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.mova-msg-typing {
  background: #F5F0E6;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mova-msg-typing span {
  width: 7px;
  height: 7px;
  background: rgba(44,24,16,.4);
  border-radius: 50%;
  display: inline-block;
  animation: mova-typing 1.2s ease-in-out infinite;
}

.mova-msg-typing span:nth-child(2) { animation-delay: .15s; }
.mova-msg-typing span:nth-child(3) { animation-delay: .30s; }

@keyframes mova-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* Sugerencias rápidas */
.mova-chat-suggestions {
  padding: 4px 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mova-suggestion {
  background: transparent;
  border: 1.5px solid rgba(44,24,16,.18);
  color: #2C1810;
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 12.5px;
  font-family: 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .15s;
  line-height: 1.4;
}

.mova-suggestion:hover {
  background: #F5F0E6;
  border-color: var(--green-ink, #856640);
  transform: translateY(-1px);
}

/* ── Footer con input ── */
.mova-chat-footer {
  border-top: 1px solid rgba(44,24,16,.08);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: #fff;
}

.mova-chat-input {
  flex: 1;
  border: 1.5px solid rgba(44,24,16,.14);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #2C1810;
  background: #F5F0E6;
  resize: none;
  outline: none;
  transition: border-color .18s;
  max-height: 100px;
  min-height: 40px;
  line-height: 1.45;
}

.mova-chat-input::placeholder { color: rgba(44,24,16,.45); }

.mova-chat-input:focus { border-color: var(--green-ink, #856640); }

.mova-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: #2C1810;
  color: #F5F0E6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .18s, transform .15s;
}

.mova-chat-send:hover { background: #3d2416; transform: scale(1.05); }
.mova-chat-send:disabled { background: rgba(44,24,16,.25); cursor: not-allowed; transform: none; }

.mova-chat-send svg { width: 17px; height: 17px; fill: currentColor; }

/* ── Nota legal ── */
.mova-chat-legal {
  text-align: center;
  font-size: 10.5px;
  color: rgba(44,24,16,.38);
  padding: 6px 16px 10px;
  line-height: 1.4;
}

/* ── Mobile ajustes ── */
@media (max-width: 480px) {
  .mova-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    max-height: 85dvh;
    border-radius: 24px 24px 0 0;
  }

  .mova-chat-trigger {
    bottom: 20px;
    right: 20px;
  }
}
