/* FM Chatbot Plus 1.9.5 - widget del chat (verde corporativo, a la derecha, no bloquea la pagina) */
#fm-chatplus,
#fm-chatplus-web,
.fm-chatplus-panel {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Launcher bubble (bottom-right, above cookies banner) */
#fm-chatplus,
#fm-chatplus-web {
  position: fixed !important;
  right: 20px !important;
  left: auto !important;
  bottom: 24px !important;
  z-index: 9998;
}

.fm-chatplus-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  background: #1e4d2b;
  color: #fff;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  transition: transform .2s, background .2s;
}
.fm-chatplus-bubble:hover { background: #2a6b3c; transform: scale(1.04); }
.fm-chatplus-icon { font-size: 20px; }
.fm-chatplus-label { font-size: 14px; letter-spacing: .3px; }

/* Backdrop disabled: non-blocking so user keeps using the page */
.fm-chatplus-backdrop { display: none !important; }

/* Panel - fixed to the RIGHT, never fullscreen on desktop */
.fm-chatplus-panel {
  position: fixed !important;
  right: 20px !important;
  left: auto !important;
  bottom: 90px !important;
  top: auto !important;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 160px);
  background: #fff;
  border: 1px solid #d4e0d7;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}
.fm-chatplus-panel.is-open { display: flex; }

.fm-chatplus-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e4d2b;
  color: #fff;
  padding: 14px 18px;
}
.fm-chatplus-header-copy strong { display: block; font-size: 16px; font-weight: 700; }
.fm-chatplus-header-copy small { display: block; margin-top: 3px; opacity: .85; font-size: 11px; }

.fm-chatplus-close {
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.fm-chatplus-close:hover { background: rgba(255, 255, 255, 0.32); }

.fm-chatplus-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f7f9f7;
}
.fm-chatplus-msg { display: flex; margin-bottom: 10px; }
.fm-chatplus-msg.user { justify-content: flex-end; }
.fm-chatplus-msg.bot { justify-content: flex-start; }
.fm-chatplus-msg-bubble {
  max-width: 84%;
  border-radius: 14px;
  padding: 10px 13px;
  border: 1px solid #d9e4dc;
  background: #fff;
  color: #2b2b2b;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.45;
}
.fm-chatplus-msg.user .fm-chatplus-msg-bubble {
  background: #1e4d2b;
  color: #fff;
  border-color: #1e4d2b;
}

.fm-chatplus-helper-text { display: none; }

.fm-chatplus-msg-bubble a { color: inherit; text-decoration: underline; }
.fm-chatplus-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.fm-chatplus-card {
  display: flex; gap: 10px; align-items: center;
  background: #fff; border: 1px solid #d9e4dc; border-radius: 12px;
  padding: 8px; text-decoration: none; color: #2b2b2b;
  transition: box-shadow .2s, transform .2s;
}
.fm-chatplus-card:hover { box-shadow: 0 4px 14px rgba(30,77,43,.18); transform: translateY(-1px); }
.fm-chatplus-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: 0 0 64px; }
.fm-chatplus-card-body { flex: 1; min-width: 0; }
.fm-chatplus-card-name { font-weight: 600; font-size: 13px; color: #1e4d2b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-chatplus-card-price { font-size: 13px; color: #2a6b3c; margin-top: 2px; }
.fm-chatplus-msg.user .fm-chatplus-msg-bubble a { color: #e8f3ec; }

.fm-chatplus-input-wrap {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #d9e4dc;
}
#fm-chatplus-input {
  flex: 1;
  border: 1px solid #d9e4dc;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  outline: none;
}
#fm-chatplus-input:focus { border-color: #1e4d2b; }
.fm-chatplus-input-wrap button {
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: #1e4d2b;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.fm-chatplus-input-wrap button:hover { background: #2a6b3c; }
.fm-chatplus-input-wrap button:disabled { background: #9db5a4; cursor: not-allowed; }

.fm-chatplus-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 14px 12px;
  background: #fff;
}
.fm-chatplus-footer button,
.fm-chatplus-footer a {
  border: 1px solid #1e4d2b;
  border-radius: 999px;
  padding: 6px 12px;
  background: #fff;
  color: #1e4d2b;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.fm-chatplus-footer a { background: #e8f3ec; }
.fm-chatplus-footer button:hover,
.fm-chatplus-footer a:hover { background: #1e4d2b; color: #fff; }

.fm-chatplus-order {
  padding: 14px;
  border-top: 1px solid #d9e4dc;
  background: #fff;
  overflow-y: auto;
}
.fm-chatplus-order-title { font-weight: 700; margin-bottom: 12px; color: #1e4d2b; }
#fm-chatplus-order-form { display: flex; flex-direction: column; gap: 10px; }
#fm-chatplus-order-form input {
  border: 1px solid #d9e4dc;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  outline: none;
}
#fm-chatplus-order-form input:focus { border-color: #1e4d2b; }
#fm-chatplus-order-form button {
  border: 0;
  border-radius: 10px;
  padding: 10px;
  background: #1e4d2b;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.fm-chatplus-order-back {
  background: transparent;
  border: 0;
  padding: 0;
  margin-bottom: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #1e4d2b;
}
#fm-chatplus-order-result { margin-top: 12px; font-size: 13px; color: #2b2b2b; }
#fm-chatplus-order-result ul { margin: 6px 0 0 18px; padding: 0; }

@media (max-width: 640px) {
  #fm-chatplus, #fm-chatplus-web { right: 12px !important; bottom: 16px !important; }
  .fm-chatplus-panel {
    right: 12px !important;
    left: 12px !important;
    width: auto;
    bottom: 80px !important;
    height: calc(100vh - 140px);
  }
}


/* [v1.8.25] Burbuja en modo WhatsApp directo */
.fm-chatplus-bubble--wa {
  background: #25d366;
  color: #fff;
  text-decoration: none;
}
.fm-chatplus-bubble--wa:hover {
  background: #1ebe5d;
  color: #fff;
  text-decoration: none;
  transform: scale(1.04);
}
.fm-chatplus-bubble--wa .fm-chatplus-icon { display: flex; align-items: center; }

/* [v1.9.0] Indicador de «escribiendo» */
.fm-chatplus-typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; }
.fm-chatplus-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #9db5a4;
  animation: fm-chatplus-blink 1.2s infinite ease-in-out both;
}
.fm-chatplus-typing span:nth-child(2) { animation-delay: .2s; }
.fm-chatplus-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes fm-chatplus-blink {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .fm-chatplus-typing span { animation: none; opacity: .7; }
}

/* [v1.9.0] Botones dentro de una respuesta: WhatsApp, pedido, enlace a categoria */
.fm-chatplus-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fm-chatplus-action {
  display: inline-block;
  border: 1px solid #1e4d2b;
  border-radius: 999px;
  padding: 7px 13px;
  background: #fff;
  color: #1e4d2b !important;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none !important;
  cursor: pointer;
  white-space: normal;
}
.fm-chatplus-action:hover { background: #1e4d2b; color: #fff !important; }
.fm-chatplus-action--wa { background: #25d366; border-color: #25d366; color: #fff !important; }
.fm-chatplus-action--wa:hover { background: #1ebe5d; border-color: #1ebe5d; }
.fm-chatplus-card-price { white-space: normal; }
.fm-chatplus-text { white-space: normal; }

/* [v1.9.0] Nombre de la tarjeta en dos lineas como mucho (antes se cortaba en una) */
.fm-chatplus-card-name {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}
/* [v1.9.0] Las tarjetas y los botones son enlaces, pero sin subrayado */
.fm-chatplus-msg-bubble a.fm-chatplus-card,
.fm-chatplus-msg-bubble a.fm-chatplus-card:hover,
.fm-chatplus-msg-bubble a.fm-chatplus-action,
.fm-chatplus-msg-bubble a.fm-chatplus-action:hover { text-decoration: none; }
.fm-chatplus-msg-bubble a.fm-chatplus-card { color: #2b2b2b; }

/* [v1.9.4] Las tarjetas y los botones salen donde el asistente los pone, entre parrafos */
.fm-chatplus-msg-bubble > .fm-chatplus-text + .fm-chatplus-text,
.fm-chatplus-msg-bubble > .fm-chatplus-cards + .fm-chatplus-text,
.fm-chatplus-msg-bubble > .fm-chatplus-actions + .fm-chatplus-text { margin-top: 10px; }
.fm-chatplus-msg-bubble > .fm-chatplus-cards:first-child,
.fm-chatplus-msg-bubble > .fm-chatplus-actions:first-child { margin-top: 0; }

/* [v1.9.4] Conversacion a medias: punto en la burbuja del chat */
.fm-chatplus-bubble.has-chat { position: relative; }
.fm-chatplus-bubble.has-chat::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #e8a33d;
  border: 2px solid #fff;
}
