/* ============================================================
   P10 Chatbot — Página 10
   ============================================================ */

/* --- Wrapper: posición intercambiada con el botón "ir arriba" --- */
#p10-chatbot-wrapper {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
}

/* --- Mover el botón "ir arriba" a donde estaba el chatbot --- */
#to_top_scrollup {
  bottom: 84px !important;
}

/* --- Botón flotante --- */
#p10-chat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgb(247, 13, 40);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 20px 13px 15px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(247, 13, 40, 0.42);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

#p10-chat-toggle:hover {
  background: rgb(210, 10, 33);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(247, 13, 40, 0.52);
}

#p10-chat-toggle svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

#p10-icon-close {
  display: none;
}

/* --- Ventana del chatbot --- */
#p10-chat-window {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 320px;
  max-height: min(510px, calc(100vh - 200px));
  background: rgb(255, 241, 229);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.16);
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#p10-chat-window.p10-active {
  opacity: 1;
  transform: translateY(0);
}

/* --- Cabecera --- */
#p10-chat-header {
  background: #1c1c1c;
  color: #fff;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

#p10-chat-header-dot {
  width: 9px;
  height: 9px;
  background: #4caf50;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

#p10-chat-header-info strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

#p10-chat-header-info span {
  font-size: 11px;
  opacity: 0.7;
  font-weight: 400;
}

/* --- Cuerpo del chat (columna flex para burbujas) --- */
#p10-chat-body {
  padding: 14px 14px 8px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  scroll-behavior: smooth;
}

#p10-chat-body::-webkit-scrollbar {
  width: 4px;
}
#p10-chat-body::-webkit-scrollbar-track {
  background: transparent;
}
#p10-chat-body::-webkit-scrollbar-thumb {
  background: #e2c9b5;
  border-radius: 4px;
}

/* --- Animación de entrada para cada elemento nuevo --- */
@keyframes p10FadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* --- Burbuja del bot (izquierda) --- */
.p10-msg {
  background: #fff;
  border-radius: 12px 12px 12px 4px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13.5px;
  line-height: 1.65;
  color: #2c2c2c;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.07);
  animation: p10FadeUp 0.2s ease;
  align-self: flex-start;
  max-width: 100%;
}

.p10-msg strong {
  color: rgb(247, 13, 40);
}

/* --- Burbuja del usuario (derecha) --- */
.p10-user-bubble {
  background: rgb(247, 13, 40);
  color: #fff;
  border-radius: 12px 12px 4px 12px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 500;
  align-self: flex-end;
  max-width: 82%;
  text-align: right;
  animation: p10FadeUp 0.2s ease;
}

/* --- Contenedor de botones --- */
.p10-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  align-self: stretch;
  animation: p10FadeUp 0.2s ease;
}

/* --- Botón base --- */
.p10-btn {
  display: block;
  width: 100%;
  background: #fff;
  border: 1.5px solid #e2cdb8;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  color: #2c2c2c;
  text-decoration: none;
  line-height: 1.4;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.p10-btn:hover,
.p10-btn:focus {
  background: rgb(255, 241, 229);
  border-color: #c8a898;
  transform: translateX(3px);
  text-decoration: none;
  color: #2c2c2c;
  outline: none;
}

/* --- Botón WhatsApp --- */
.p10-btn-wa {
  background: #25d366;
  color: #fff !important;
  border-color: #25d366;
  text-align: center;
  font-weight: 600;
  margin-top: 4px;
}

.p10-btn-wa:hover,
.p10-btn-wa:focus {
  background: #1ebe5d;
  border-color: #1ebe5d;
  color: #fff !important;
  transform: none;
  text-decoration: none;
}

/* --- Botón enlace al sitio --- */
.p10-btn-link {
  background: #1c1c1c;
  color: #fff !important;
  border-color: #1c1c1c;
  text-align: center;
  font-weight: 600;
}

.p10-btn-link:hover,
.p10-btn-link:focus {
  background: #333;
  border-color: #333;
  color: #fff !important;
  transform: none;
  text-decoration: none;
}

/* --- Botón correo --- */
.p10-btn-email {
  text-align: center;
}

/* --- Pie del chatbot --- */
#p10-chat-footer {
  padding: 8px 16px;
  text-align: center;
  font-size: 10px;
  color: #b8a49a;
  border-top: 1px solid #edd9c8;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* --- Responsive móvil --- */
@media (max-width: 600px) {
  #to_top_scrollup {
    bottom: 72px !important;
  }

  #p10-chatbot-wrapper {
    bottom: 16px;
    right: 16px;
  }

  #p10-chat-window {
    width: calc(100vw - 32px);
    right: 0;
    max-height: calc(100vh - 160px);
  }

  #p10-btn-label {
    display: none;
  }

  #p10-chat-toggle {
    border-radius: 50%;
    padding: 14px;
  }
}
