/* ============================================================
   AgileFast — ASISTENTE (diseño)
   Los colores vienen de css/tema.css.
   ============================================================ */

.chat { position: fixed; right: 22px; bottom: 22px; z-index: 1200; font-family: var(--letra); }

/* ---------- Botón flotante ---------- */
.chat-lanzador { position: relative; width: 62px; height: 62px; border-radius: 50%; background: linear-gradient(135deg, #FF8A2B, var(--naranja) 55%, var(--naranja-oscuro)); color: var(--blanco); display: flex; align-items: center; justify-content: center; font-size: 28px; box-shadow: 0 10px 26px rgba(242, 106, 15, .45), 0 2px 6px rgba(16, 16, 16, .2); transition: transform .18s ease, box-shadow .18s ease; margin-left: auto; }
.chat-lanzador:hover { transform: translateY(-2px) scale(1.04); }
.chat-lanzador::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--naranja); animation: chatOnda 2.6s ease-out infinite; pointer-events: none; }
@keyframes chatOnda { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(1.45); opacity: 0; } }
.chat-lanzador .icono { position: absolute; transition: opacity .18s ease, transform .22s ease; }
.chat-lanzador__cerrar { opacity: 0; transform: rotate(-80deg) scale(.6); }
.chat.abierto .chat-lanzador__abrir { opacity: 0; transform: rotate(80deg) scale(.6); }
.chat.abierto .chat-lanzador__cerrar { opacity: 1; transform: none; }
.chat.abierto .chat-lanzador::after { display: none; }

.chat-invitacion { position: absolute; right: 74px; bottom: 12px; white-space: nowrap; background: var(--blanco); color: var(--tinta); font-size: 13.5px; font-weight: 500; padding: 10px 14px; border-radius: 14px 14px 4px 14px; box-shadow: var(--sombra-fuerte); animation: chatEntra .3s ease; }

/* ---------- Ventana ---------- */
.chat-ventana { position: absolute; right: 0; bottom: 76px; width: 384px; max-width: calc(100vw - 32px); height: min(600px, calc(100vh - 120px)); background: var(--blanco); border-radius: 22px; box-shadow: 0 24px 60px rgba(16, 16, 16, .28), 0 2px 10px rgba(16, 16, 16, .1); display: flex; flex-direction: column; overflow: hidden; opacity: 0; visibility: hidden; transform: translateY(14px) scale(.97); transform-origin: bottom right; transition: opacity .2s ease, transform .22s cubic-bezier(.2, .9, .3, 1.1), visibility 0s linear .22s; }
.chat.abierto .chat-ventana { opacity: 1; visibility: visible; transform: none; transition: opacity .2s ease, transform .22s cubic-bezier(.2, .9, .3, 1.1); }

.chat-cabeza { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; color: var(--blanco); background: linear-gradient(120deg, var(--negro) 0%, #2a1a10 60%, #6b2f08 100%); }
.chat-cabeza__icono { width: 40px; height: 40px; border-radius: 13px; background: linear-gradient(135deg, #FF8A2B, var(--naranja)); display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.chat-cabeza__texto { flex: 1; min-width: 0; line-height: 1.25; }
.chat-cabeza__texto b { display: block; font-size: 15px; font-weight: 600; }
.chat-cabeza__texto small { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255, 255, 255, .75); }
.chat-cabeza__texto small::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #34d399; }
.chat-cabeza__boton { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, .85); font-size: 18px; transition: background .15s ease; }
.chat-cabeza__boton:hover { background: rgba(255, 255, 255, .14); color: var(--blanco); }

.chat-mensajes { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(180deg, #faf7f4, var(--fondo)); scrollbar-width: thin; }
.chat-globo { max-width: 86%; padding: 10px 14px; font-size: 14px; line-height: 1.45; border-radius: 18px; animation: chatEntra .22s ease; white-space: pre-line; overflow-wrap: anywhere; }
.chat-globo--bot { align-self: flex-start; background: var(--blanco); color: var(--tinta); border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(16, 16, 16, .07); }
.chat-globo--yo { align-self: flex-end; background: linear-gradient(135deg, #FF7A1A, var(--naranja)); color: var(--blanco); border-bottom-right-radius: 6px; font-weight: 500; }
@keyframes chatEntra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.chat-escribiendo { display: inline-flex; gap: 5px; padding: 14px 16px; }
.chat-escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: var(--gris-400); animation: chatPunto 1s ease-in-out infinite; }
.chat-escribiendo i:nth-child(2) { animation-delay: .15s; }
.chat-escribiendo i:nth-child(3) { animation-delay: .3s; }
@keyframes chatPunto { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ---------- Tarjetas de restaurante dentro del chat ---------- */
.chat-grupo { display: flex; flex-direction: column; gap: 8px; animation: chatEntra .25s ease; }
.chat-tarjeta { display: flex; gap: 10px; background: var(--blanco); border-radius: 16px; padding: 8px; box-shadow: 0 1px 2px rgba(16, 16, 16, .07); }
.chat-tarjeta img { width: 74px; height: 74px; border-radius: 12px; object-fit: cover; background: var(--gris-200); flex: none; }
.chat-tarjeta__info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chat-tarjeta__info b { font-size: 14px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-tarjeta__info span { font-size: 12px; color: var(--gris-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-tarjeta__botones { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.chat-boton { font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px; border: 1.5px solid var(--gris-300); color: var(--tinta); background: var(--blanco); transition: border-color .15s ease, background .15s ease; }
.chat-boton:hover { border-color: var(--naranja); color: var(--naranja-oscuro); }
.chat-boton--fuerte { background: var(--naranja); border-color: var(--naranja); color: var(--blanco); }
.chat-boton--fuerte:hover { background: var(--naranja-oscuro); border-color: var(--naranja-oscuro); color: var(--blanco); }

/* ---------- Respuestas rápidas y campo de texto ---------- */
.chat-fichas { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 14px 10px; background: var(--fondo); }
.chat-fichas:empty { padding: 0; }
.chat-ficha { font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: 999px; background: var(--blanco); color: var(--naranja-oscuro); border: 1.5px solid var(--naranja-borde); transition: background .15s ease, border-color .15s ease, transform .08s ease; }
.chat-ficha:hover { background: var(--naranja-claro); border-color: var(--naranja); }
.chat-ficha:active { transform: scale(.96); }

.chat-escribir { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--blanco); border-top: 1px solid var(--gris-200); }
.chat-escribir input { flex: 1; min-width: 0; border: 1.5px solid var(--gris-200); border-radius: 999px; padding: 10px 16px; font-size: 14px; outline: 0; background: var(--gris-100); transition: border-color .15s ease, background .15s ease; }
.chat-escribir input:focus { border-color: var(--naranja); background: var(--blanco); }
.chat-escribir button { width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--negro); color: var(--blanco); display: flex; align-items: center; justify-content: center; font-size: 18px; transition: background .15s ease; }
.chat-escribir button:hover { background: var(--naranja); }

/* ---------- Celular: ocupa toda la pantalla ---------- */
@media (max-width: 640px) {
  .chat { right: 14px; bottom: 14px; }
  .chat-lanzador { width: 56px; height: 56px; font-size: 25px; }
  .chat-ventana { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; border-radius: 0; transform-origin: bottom center; }
  .chat.abierto .chat-lanzador { display: none; }
  .chat-invitacion { right: 66px; bottom: 8px; max-width: calc(100vw - 100px); white-space: normal; }
  .chat-escribir input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-lanzador::after, .chat-escribiendo i { animation: none; }
}
