/* Asistente Avi — diseño modoavion */
.avi-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--orange, #ff7a1a);
  color: #0b0c0e;
  border: 0;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.avi-launcher:hover { transform: translateY(-2px); box-shadow: 0 22px 46px rgba(255, 122, 26, 0.3); }
.avi-launcher svg { width: 26px; height: 26px; }

.avi-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 91;
  width: min(390px, calc(100vw - 32px));
  max-height: min(660px, calc(100vh - 130px));
  display: none;
  flex-direction: column;
  background: #101215;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.avi-panel.open { display: flex; }

.avi-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #14171b;
}
.avi-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 122, 26, 0.14);
  border: 1px solid rgba(255, 122, 26, 0.35);
  flex: none;
}
.avi-avatar svg { width: 20px; height: 20px; }
.avi-head-txt { flex: 1; min-width: 0; }
.avi-head-txt strong { display: block; font-size: 14px; font-weight: 700; }
.avi-head-txt span { display: block; font-size: 11.5px; color: var(--muted, #a3a7af); }
.avi-x {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  padding: 0;
  transition: background 0.2s ease;
}
.avi-x:hover { background: rgba(255, 255, 255, 0.18); }
.avi-x svg { width: 18px; height: 18px; }

.avi-wa {
  margin: 12px 14px 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.25);
}
.avi-wa p { font-size: 11.5px; color: #9fb3a8; margin-bottom: 8px; line-height: 1.45; }
.avi-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 0;
  background: #25d366;
  color: #062b14;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.avi-wa-btn svg { width: 17px; height: 17px; }
.avi-wa-btn.off { background: #23262b; color: #7c828b; cursor: not-allowed; }

.avi-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}
.avi-msg { display: flex; gap: 8px; max-width: 92%; }
.avi-msg.bot { align-self: flex-start; }
.avi-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.avi-bubble {
  padding: 10px 12px;
  border-radius: 13px;
  font-size: 13px;
  line-height: 1.55;
  color: #e6e8eb;
  background: #191d22;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.avi-msg.user .avi-bubble { background: var(--orange, #ff7a1a); color: #140a02; border-color: transparent; }
.avi-bubble p { margin: 0 0 6px; }
.avi-bubble p:last-child { margin-bottom: 0; }
.avi-bubble code { background: rgba(255, 255, 255, 0.1); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

.avi-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.avi-typing i { width: 6px; height: 6px; border-radius: 50%; background: #7c828b; animation: aviBlink 1s infinite ease-in-out; }
.avi-typing i:nth-child(2) { animation-delay: 0.15s; }
.avi-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes aviBlink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.avi-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #14171b;
}
.avi-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0d0f12;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
}
.avi-form input:focus { outline: none; border-color: rgba(255, 122, 26, 0.6); }
.avi-send {
  width: 42px;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: var(--orange, #ff7a1a);
  color: #140a02;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.avi-send svg { width: 18px; height: 18px; }
.avi-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 520px) {
  .avi-panel { right: 12px; left: 12px; bottom: 84px; width: auto; }
  .avi-launcher { right: 16px; bottom: 16px; }
}
