/* ===== Asistente virtual AUTOMYN (chat amigable) ===== */
#asistente-widget {
  position: fixed; bottom: 22px; right: 22px; z-index: 1060;
  font-family: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
}

/* ---------- Burbuja flotante ---------- */
.asist-burbuja {
  width: 62px; height: 62px; border-radius: 50%;
  background: linear-gradient(135deg, var(--naranja-automyn) 0%, #ffc04d 100%);
  border: none; cursor: pointer;
  color: var(--azul-automyn); font-size: 1.7rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(244, 163, 0, 0.45);
  transition: transform .25s ease, box-shadow .25s ease;
}
.asist-burbuja:hover { transform: scale(1.1) rotate(6deg); box-shadow: 0 10px 30px rgba(244,163,0,0.55); }
.asist-burbuja .bi { animation: asist-latido 2.2s ease-in-out infinite; }
@keyframes asist-latido {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* ---------- Panel ---------- */
.asist-panel {
  display: none;
  width: 390px; max-width: calc(100vw - 40px);
  height: 540px; max-height: calc(100vh - 40px);
  background: #fff; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(13, 71, 161, 0.35);
  overflow: hidden;
  flex-direction: column;
  animation: asist-aparecer .25s ease;
}
@keyframes asist-aparecer {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.asist-panel.abierto { display: flex; }
.asist-panel.abierto + .asist-burbuja { display: none; }

/* ---------- Cabecera ---------- */
.asist-cabecera {
  background: linear-gradient(135deg, var(--azul-automyn) 0%, var(--azul-automyn-hover) 100%);
  color: #fff;
  padding: 16px; display: flex; align-items: center; gap: 12px;
  border-bottom: 3px solid var(--naranja-automyn);
  position: relative;
}
.asist-cabecera::after {
  content: ""; position: absolute; bottom: -3px; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--naranja-automyn) 0%, #ffe0a3 100%);
}
.asist-cabecera .asist-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--naranja-automyn); color: var(--azul-automyn);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  border: 2px solid #fff;
}
.asist-cabecera strong { font-family: 'Poppins', sans-serif; font-size: 0.95rem; color: #fff; }
.asist-cabecera small { color: #d9ecff; display: block; line-height: 1.2; }
.asist-cabecera .asist-estado {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.7rem; font-weight: 600; color: #aef2b8; margin-top: 2px;
}
.asist-cabecera .asist-estado::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #4cd964; display: inline-block;
  animation: asist-punto 1.6s ease infinite;
}
@keyframes asist-punto { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.asist-cabecera .btn-close { font-size: 0.7rem; filter: brightness(0) invert(1); }

/* ---------- Tabs ---------- */
.asist-tabs {
  display: flex; background: var(--azul-claro); padding: 6px;
  gap: 6px;
}
.asist-tabs button {
  flex: 1; border: none; background: transparent; color: var(--texto-suave);
  padding: 8px; font-size: 0.78rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; transition: all .2s ease;
}
.asist-tabs button.activo {
  background: #fff; color: var(--azul-automyn);
  box-shadow: 0 2px 8px rgba(13,71,161,0.15);
}

/* ---------- Mensajes ---------- */
.asist-mensajes {
  flex: 1; overflow-y: auto; padding: 16px 14px;
  background: #f6f8fb; display: flex; flex-direction: column; gap: 10px;
}
.asist-mensaje {
  max-width: 85%; padding: 10px 14px; border-radius: 16px;
  font-size: 0.875rem; line-height: 1.5; white-space: pre-line; word-wrap: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  animation: asist-mensaje .2s ease;
}
@keyframes asist-mensaje {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.asist-mensaje.usuario {
  align-self: flex-end; background: var(--azul-automyn); color: #fff;
  border-bottom-right-radius: 4px;
}
.asist-mensaje.bot {
  align-self: flex-start; background: #fff; color: var(--texto);
  border-bottom-left-radius: 4px;
}
.asist-mensaje.bot strong { color: var(--azul-automyn); }

/* ---------- Acciones y productos ---------- */
.asist-accion {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; background: #fff; color: var(--azul-automyn);
  border: 1px solid #c8d6e5; border-radius: 22px;
  padding: 6px 14px; font-size: 0.8rem; font-weight: 600;
  text-decoration: none; transition: all .2s ease;
}
.asist-accion:hover { background: var(--azul-automyn); color: #fff; border-color: var(--azul-automyn); }

.asist-precio {
  color: var(--azul-automyn); font-weight: 700; font-size: 0.95rem; margin: 4px 0;
}

.asist-producto {
  display: flex; gap: 10px; background: #fff; border: 1px solid #e3e9f0;
  border-radius: 14px; padding: 10px; margin-top: 10px; align-items: center;
  transition: box-shadow .2s ease, transform .2s ease;
}
.asist-producto:hover { box-shadow: 0 4px 14px rgba(13,71,161,0.15); transform: translateY(-1px); }
.asist-producto img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex-shrink: 0;
}
.asist-producto .asist-prod-info { flex: 1; min-width: 0; }
.asist-producto .asist-prod-nombre {
  font-weight: 600; font-size: 0.83rem; color: var(--texto);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.asist-producto .asist-prod-marca { font-size: 0.75rem; color: #4b5563; }
.asist-producto a { font-size: 0.78rem; white-space: nowrap; }

/* ---------- Chips ---------- */
.asist-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 14px; border-top: 1px solid #eef1f5;
  background: #fff; max-height: 110px; overflow-y: auto;
}
.asist-chip {
  border: 1px solid #c8d6e5; background: #fff; color: var(--azul-automyn);
  border-radius: 50rem; padding: 5px 13px; font-size: 0.75rem; font-weight: 500;
  cursor: pointer; transition: all .2s ease;
}
.asist-chip:hover { background: var(--azul-automyn); color: #fff; border-color: var(--azul-automyn); }

/* ---------- Entrada ---------- */
.asist-entrada {
  display: flex; gap: 8px; padding: 12px 14px;
  border-top: 1px solid #eef1f5; background: #fff;
}
.asist-entrada input {
  flex: 1; border: 1px solid #c8d6e5; border-radius: 24px;
  padding: 9px 16px; font-size: 0.85rem; outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.asist-entrada input:focus { border-color: var(--azul-automyn); box-shadow: 0 0 0 3px rgba(13,71,161,0.12); }
.asist-entrada button {
  border: none; background: var(--naranja-automyn); color: var(--azul-automyn);
  width: 42px; height: 42px; border-radius: 50%; font-size: 1rem;
  cursor: pointer; font-weight: 700; flex-shrink: 0;
  transition: background .2s ease, transform .2s ease;
}
.asist-entrada button:hover { background: var(--naranja-automyn-hover); color: #fff; transform: scale(1.05); }
.asist-entrada button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Escribiendo (puntos animados) ---------- */
.asist-escribiendo {
  align-self: flex-start; background: #fff; color: var(--texto-suave);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 12px 16px; border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.asist-escribiendo .punto {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--azul-automyn); display: inline-block;
  animation: asist-punto-brinca 1.2s ease infinite;
}
.asist-escribiendo .punto:nth-child(2) { animation-delay: .15s; }
.asist-escribiendo .punto:nth-child(3) { animation-delay: .3s; }
@keyframes asist-punto-brinca {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 480px) {
  #asistente-widget { bottom: 12px; right: 12px; }
  .asist-panel { width: calc(100vw - 24px); height: 70vh; }
}