/* =========================================================
   ASISTENTE VIRTUAL CORONITA IA (POWERED BY DEEPSEEK)
   Estilos universales para Abarrotes La Corona
   ========================================================= */

.btn-corona-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 1000;
  background: linear-gradient(135deg, #047857 0%, #064e3b 60%, #b45309 100%);
  color: #ffffff;
  border: 2px solid #fbbf24;
  border-radius: 50px;
  padding: 12px 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(4, 120, 87, 0.45), 0 0 15px rgba(251, 191, 36, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.btn-corona-chat-trigger:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 16px 36px rgba(4, 120, 87, 0.6), 0 0 20px rgba(251, 191, 36, 0.5);
  border-color: #fef08a;
}

.btn-corona-chat-trigger .chat-trigger-icon {
  font-size: 20px;
  line-height: 1;
  animation: crownBounce 3s ease-in-out infinite;
}

@keyframes crownBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px) scale(1.1); }
}

.btn-corona-chat-trigger .chat-trigger-pulse {
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* VENTANA FLOTANTE DEL CHAT */
.corona-chat-window {
  position: fixed;
  bottom: 92px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(85vh - 40px);
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 25px 60px -12px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

.corona-chat-window.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* HEADER DEL CHAT */
.corona-chat-header {
  background: linear-gradient(135deg, #047857 0%, #064e3b 100%);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #d97706;
}

.corona-chat-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.corona-chat-avatar {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2px solid #fbbf24;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.corona-chat-title h3 {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  color: #ffffff;
  margin: 0;
}

.corona-chat-title p {
  font-size: 11px;
  color: #6ee7b7;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  margin-bottom: 0;
}

.corona-chat-title p .dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
}

.corona-chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.corona-chat-btn-action {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.corona-chat-btn-action:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* CUERPO DEL CHAT / MENSAJES */
.corona-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.45;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: msgPop 0.25s ease-out;
}

@keyframes msgPop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
  align-self: flex-start;
}

.chat-msg.user {
  align-self: flex-end;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  position: relative;
  word-break: break-word;
}

.chat-msg.bot .chat-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, #047857 0%, #064e3b 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(4, 120, 87, 0.3);
}

.chat-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  padding: 0 4px;
}

.chat-msg.user .chat-time {
  align-self: flex-end;
}

/* CHIPS DE PREGUNTAS RÁPIDAS */
.corona-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chat-chip {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-chip:hover {
  background: #047857;
  color: #ffffff;
  border-color: #047857;
  transform: translateY(-1px);
}

/* INDICADOR DE ESCRIBIENDO */
.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.chat-typing span {
  width: 6px;
  height: 6px;
  background: #047857;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* FOOTER / INPUT DEL CHAT */
.corona-chat-footer {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.corona-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.corona-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 50px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #f8fafc;
}

.corona-chat-input:focus {
  background: #ffffff;
  border-color: #047857;
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.15);
}

.corona-chat-btn-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #047857 0%, #064e3b 100%);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.35);
}

.corona-chat-btn-send:hover {
  transform: scale(1.06);
  background: #047857;
}

.corona-chat-badge-powered {
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  margin-top: 6px;
  font-weight: 600;
}

.corona-chat-badge-powered span {
  color: #047857;
  font-weight: 800;
}

/* OCULTAR COMPLETAMENTE CORONITA IA EN CELULARES Y DISPOSITIVOS MÓVILES (PANTALLAS <= 992px) */
@media (max-width: 992px) {
  .btn-corona-chat-trigger,
  #btnCoronaChatTrigger,
  .corona-chat-window,
  #coronaChatWindow {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

@media (max-width: 640px) {
  .btn-corona-chat-trigger,
  #btnCoronaChatTrigger,
  .corona-chat-window,
  #coronaChatWindow {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
  .btn-scroll-top-floating {
    bottom: 24px;
    right: 14px;
    width: 42px;
    height: 42px;
  }
}
