/* ═══════════════════════════════════════════════
   ASISTENTE VIRTUAL — Widget flotante de chat
   Navia Comunicaciones y Servicios Ltda.
   Archivo independiente: css/asistente.css
═══════════════════════════════════════════════ */

/* ── Botón flotante de apertura ── */
.ast-fab {
  position: fixed;
  bottom: 160px;
  right: 28px;
  z-index: 490;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--red);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(204,0,0,0.40);
  transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s;
  animation: astPulse 3s ease-in-out infinite;
  color: #fff;
}
.ast-fab:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 32px rgba(204,0,0,0.55);
  animation-play-state: paused;
}
.ast-fab.open {
  transform: scale(0.9) rotate(90deg);
  animation: none;
  box-shadow: 0 4px 16px rgba(204,0,0,0.3);
}
.ast-fab svg { flex-shrink: 0; transition: opacity .2s; }
@keyframes astPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(204,0,0,0.40); }
  50%      { box-shadow: 0 4px 28px rgba(204,0,0,0.65), 0 0 0 8px rgba(204,0,0,0.10); }
}

/* Notificación burbuja sobre el FAB */
.ast-fab-bubble {
  position: absolute;
  bottom: 62px;
  right: 0;
  background: #111;
  color: #fff;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 12px;
  padding: 7px 13px;
  border-radius: 10px 10px 0 10px;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s, transform .3s;
}
.ast-fab-bubble.show {
  opacity: 1;
  transform: translateY(0);
}
.ast-fab-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 14px;
  border: 6px solid transparent;
  border-top-color: #111;
  border-bottom: none;
}

/* ── Overlay ── */
.ast-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.4);
  backdrop-filter: blur(4px);
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.ast-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Panel principal ── */
.ast-panel {
  position: fixed;
  bottom: 160px;
  right: 28px;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: 560px;
  background: #fff;
  border-radius: 18px;
  z-index: 601;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 60px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform .35s cubic-bezier(.22,1,.36,1), opacity .3s;
  overflow: hidden;
}
.ast-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
.ast-header {
  background: var(--red);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}
.ast-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.ast-header-info { flex: 1; }
.ast-header-name {
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.3px;
  line-height: 1.1;
}
.ast-header-status {
  font-size: 11px;
  color: rgba(255,255,255,0.80);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.ast-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4cef7a;
  flex-shrink: 0;
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
.ast-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .18s, transform .18s;
  flex-shrink: 0;
}
.ast-close:hover { background: rgba(255,255,255,0.28); transform: rotate(90deg); }

/* ── Cuerpo del chat ── */
.ast-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.ast-body::-webkit-scrollbar { width: 3px; }
.ast-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Mensajes ── */
.ast-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: msgIn .28s cubic-bezier(.22,1,.36,1);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.ast-msg.bot { justify-content: flex-start; }
.ast-msg.user { justify-content: flex-end; }

.ast-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 12px;
  margin-bottom: 2px;
}

.ast-bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  font-family: 'Source Sans 3', sans-serif;
}
.ast-msg.bot .ast-bubble {
  background: #f4f4f4;
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.ast-msg.user .ast-bubble {
  background: var(--red);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ── Typing indicator ── */
.ast-typing .ast-bubble {
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.ast-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #aaa;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.ast-typing-dot:nth-child(2) { animation-delay: .2s; }
.ast-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* ── Opciones / botones ── */
.ast-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 4px 36px;
  animation: msgIn .32s cubic-bezier(.22,1,.36,1);
}
.ast-opt {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all .18s;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}
.ast-opt:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
  transform: translateX(3px);
}
.ast-opt-icon { font-size: 15px; flex-shrink: 0; }

/* ── Footer del panel ── */
.ast-footer {
  padding: 10px 14px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ast-back-btn {
  background: #f5f5f5;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .18s;
  flex-shrink: 0;
}
.ast-back-btn:hover { background: var(--border); color: var(--text); }
.ast-back-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ast-restart-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-family: 'Source Sans 3', sans-serif;
  transition: color .18s;
  padding: 4px;
  margin-left: auto;
}
.ast-restart-btn:hover { color: var(--red); }

/* ── Responsive ── */
@media (max-width: 480px) {
  .ast-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    max-height: 75vh;
    border-radius: 18px 18px 0 0;
  }
  .ast-fab {
    bottom: 80px;
    right: 20px;
  }
  .ast-fab-bubble {
    bottom: 64px;
  }
}
