/* ════════════════════════════════════════════════════════
   STELLA — Estilo visual
   Widget flutuante global + notas contextuais + avatar vivo
═════════════════════════════════════════════════════════ */

#stellaWidget { position: fixed; z-index: 999; right: 0; bottom: 0; }

/* ── FAB (botão flutuante) ── */
.stella-fab {
  position: fixed;
  right: 24px; bottom: 24px;
  width: 64px; height: 64px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.95), rgba(0,242,254,.15) 38%, rgba(2,6,23,.92) 72%);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px rgba(0,242,254,.35), 0 18px 46px rgba(0,242,254,.28), 0 6px 18px rgba(0,0,0,.5);
  transition: transform .25s ease, box-shadow .25s ease;
  z-index: 1000;
}
.stella-fab:hover { transform: translateY(-3px) scale(1.04); }
.stella-fab-orb {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #00f2fe 45%, #2563eb 100%);
  box-shadow: 0 0 18px rgba(0,242,254,.85);
  animation: stellaBreathe 2.6s ease-in-out infinite;
}
@keyframes stellaBreathe { 0%,100% { transform: scale(1); opacity: 1 } 50% { transform: scale(1.18); opacity: .85 } }
.stella-fab-pulse {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 1.5px solid rgba(0,242,254,.45);
  animation: stellaPulseRing 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes stellaPulseRing {
  0% { transform: scale(.85); opacity: .9 }
  100% { transform: scale(1.55); opacity: 0 }
}
.stella-fab.attention { animation: stellaShake 0.6s ease 2; }
.stella-fab.hide-pulse .stella-fab-pulse { display: none; }
@keyframes stellaShake {
  0%,100% { transform: rotate(0deg) }
  25% { transform: rotate(-8deg) }
  75% { transform: rotate(8deg) }
}

/* ── PANEL ── */
.stella-panel {
  position: fixed;
  right: 24px; bottom: 100px;
  width: 380px; max-width: calc(100vw - 32px);
  height: 540px; max-height: calc(100vh - 140px);
  background: linear-gradient(165deg, rgba(8,15,30,.97), rgba(2,6,23,.99));
  border: 1px solid rgba(0,242,254,.22);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6), 0 0 60px rgba(0,242,254,.08);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .28s ease, transform .28s ease;
  z-index: 999;
  overflow: hidden;
}
.stella-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.stella-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid rgba(0,242,254,.14);
  background: rgba(0,242,254,.03);
}
.stella-head-id { display: flex; align-items: center; gap: .75rem; }
.stella-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.9), rgba(0,242,254,.2) 45%, rgba(2,6,23,.9) 80%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px rgba(0,242,254,.3);
  flex-shrink: 0;
}
.stella-avatar-core {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle, #fff, #00f2fe);
  box-shadow: 0 0 12px rgba(0,242,254,.9);
  animation: stellaBreathe 2.6s ease-in-out infinite;
}
.stella-head-id strong { display: block; font-size: .95rem; font-weight: 800; color: #fff; letter-spacing: .02em; }
.stella-status { display: flex; align-items: center; gap: .4rem; font-size: .68rem; color: #7dd3fc; font-weight: 600; letter-spacing: .02em; }
.stella-status i { width: 6px; height: 6px; border-radius: 50%; background: #19e6b0; box-shadow: 0 0 8px rgba(25,230,176,.8); display: inline-block; }
.stella-close {
  background: none; border: none; color: #7dd3fc; font-size: 1.4rem;
  cursor: pointer; line-height: 1; padding: .25rem .5rem; border-radius: 8px; transition: background .2s;
}
.stella-close:hover { background: rgba(0,242,254,.1); }

.stella-log {
  flex: 1; overflow-y: auto;
  padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; gap: .75rem;
}
.stella-msg {
  max-width: 86%;
  padding: .7rem 1rem;
  border-radius: 14px;
  font-size: .85rem;
  line-height: 1.55;
  font-weight: 400;
}
.stella-msg.bot {
  align-self: flex-start;
  background: rgba(0,242,254,.07);
  border: 1px solid rgba(0,242,254,.14);
  color: #dff8ff;
  border-bottom-left-radius: 4px;
}
.stella-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #00b8d9);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.stella-msg.typing { display: flex; gap: 4px; align-items: center; padding: .9rem 1.1rem; }
.stella-msg.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #00f2fe; opacity: .5;
  animation: stellaTyping 1.2s infinite;
}
.stella-msg.typing span:nth-child(2) { animation-delay: .2s; }
.stella-msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes stellaTyping { 0%,100% { opacity: .3; transform: translateY(0) } 50% { opacity: 1; transform: translateY(-3px) } }

.stella-quick {
  display: flex; gap: .5rem; flex-wrap: wrap;
  padding: 0 1.25rem .9rem;
}
.stella-quick button {
  background: rgba(0,242,254,.06);
  border: 1px solid rgba(0,242,254,.2);
  color: #9eefff;
  font-size: .72rem; font-weight: 600;
  padding: .4rem .8rem; border-radius: 999px;
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.stella-quick button:hover { background: rgba(0,242,254,.14); border-color: rgba(0,242,254,.4); }

.stella-form {
  display: flex; gap: .6rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(0,242,254,.12);
}
.stella-form input {
  flex: 1;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(0,242,254,.18);
  border-radius: 999px;
  padding: .65rem 1.1rem;
  color: #fff; font-size: .85rem;
}
.stella-form input:focus { outline: none; border-color: rgba(0,242,254,.55); }
.stella-form input::placeholder { color: #5a7a92; }
.stella-form button {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #2563eb, #00f2fe);
  border: none; color: #fff; font-size: 1.1rem; font-weight: 700;
  cursor: pointer; transition: transform .2s;
}
.stella-form button:hover { transform: scale(1.08); }

/* ── TOAST CONTEXTUAL ── */
.stella-toast {
  position: fixed; left: 24px; bottom: 24px;
  z-index: 998;
  display: flex; align-items: center; gap: .7rem;
  background: linear-gradient(135deg, rgba(8,15,30,.96), rgba(2,6,23,.98));
  border: 1px solid rgba(0,242,254,.25);
  border-radius: 999px;
  padding: .7rem 1.2rem .7rem .7rem;
  box-shadow: 0 16px 50px rgba(0,0,0,.5), 0 0 30px rgba(0,242,254,.1);
  max-width: min(360px, calc(100vw - 48px));
  opacity: 0; transform: translateY(12px);
  transition: opacity .4s ease, transform .4s ease;
}
.stella-toast.show { opacity: 1; transform: translateY(0); }
.stella-toast-orb {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #fff, #00f2fe 50%, #2563eb 100%);
  box-shadow: 0 0 14px rgba(0,242,254,.7);
}
.stella-toast span:last-child { font-size: .8rem; color: #dff8ff; line-height: 1.4; font-weight: 500; }

@media (max-width: 640px) {
  .stella-fab { right: 16px; bottom: 16px; width: 56px; height: 56px; }
  .stella-panel { right: 8px; left: 8px; width: auto; bottom: 84px; height: min(520px, 70vh); }
  .stella-toast { left: 16px; right: 16px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .stella-fab-pulse, .stella-fab-orb, .stella-avatar-core { animation: none; }
}

/* ════════════════════════════════════════════════════════
   STELLA v2 — Onboarding, microfone, CTA WhatsApp no chat
═════════════════════════════════════════════════════════ */

/* ── ONBOARDING ── */
.stella-onboard {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(2,6,23,.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  opacity: 1; transition: opacity .4s ease;
}
.stella-onboard.closing { opacity: 0; }
.stella-onboard-card {
  max-width: 440px; width: 100%;
  background: linear-gradient(165deg, rgba(8,15,30,.97), rgba(2,6,23,.99));
  border: 1px solid rgba(0,242,254,.25);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,.6), 0 0 80px rgba(0,242,254,.1);
}
.stella-orb-mini { width: 64px; height: 64px; margin: 0 auto 1.5rem; position: relative; }
.stella-orb-mini span {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #00f2fe 45%, #2563eb 100%);
  box-shadow: 0 0 40px rgba(0,242,254,.7);
  animation: stellaBreathe 2.4s ease-in-out infinite;
}
.stella-onboard-card h2 { font-size: 1.5rem; font-weight: 800; color: #fff; margin-bottom: .85rem; letter-spacing: -.01em; }
.stella-onboard-card p { font-size: .92rem; color: #9fb3c8; line-height: 1.7; margin-bottom: 1.75rem; }
.stella-onboard-actions { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.25rem; }
.stella-onboard-actions .btn { width: 100%; justify-content: center; }
.stella-onboard-card small { color: #5a7a92; font-size: .72rem; }

/* ── MIC BUTTON NO FORM ── */
.stella-mic-btn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: rgba(0,242,254,.08);
  border: 1px solid rgba(0,242,254,.25);
  cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.stella-mic-btn:hover { background: rgba(0,242,254,.16); }
.stella-mic-btn.listening {
  background: rgba(239,68,68,.18);
  border-color: rgba(239,68,68,.5);
  animation: micPulse 1.1s ease-in-out infinite;
}
@keyframes micPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4) }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0) }
}

/* ── VOICE TOGGLE NO HEADER ── */
.stella-head-actions { display: flex; align-items: center; gap: .4rem; }
.stella-icon-btn {
  background: none; border: none; font-size: 1rem; cursor: pointer;
  padding: .3rem .4rem; border-radius: 8px; transition: background .2s;
  line-height: 1;
}
.stella-icon-btn:hover { background: rgba(0,242,254,.1); }

/* ── WHATSAPP CTA DENTRO DO CHAT ── */
.stella-wa-cta {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  background: #25D366; color: #fff; text-decoration: none;
  font-size: .85rem; font-weight: 700;
  padding: .75rem 1rem; border-radius: 14px;
  margin-top: .3rem; align-self: stretch;
  transition: all .2s;
  box-shadow: 0 8px 20px rgba(37,211,102,.25);
}
.stella-wa-cta:hover { background: #1aad52; transform: translateY(-1px); }

@media (max-width: 480px) {
  .stella-onboard-card { padding: 2rem 1.5rem; }
}
