/* ═══════════════════════════════════════════════
   MIA — Assistente Virtual Teffe
═══════════════════════════════════════════════ */

/* ── Botão flutuante ── */
.mia-btn {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 5000;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #4C1D95;
  background-image: url('../assets/images/mia-avatar.png');
  background-size: cover;
  background-position: center top;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(76,29,149,.45);
  transition: box-shadow .25s;
  overflow: hidden;
}
/* Sem transform no hover — transform criaria containing block e quebraria o ::before fixed */
.mia-btn:hover {
  box-shadow: 0 6px 32px rgba(76,29,149,.7);
}
.mia-btn i {
  display: none;
}

/* Tooltip via ::before (position: fixed funciona pois pai não tem transform) */
.mia-btn::before {
  content: 'Fale com a Mia';
  position: fixed;
  bottom: 92px;
  left: 28px;
  background: #1A3F80;
  color: #fff;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: .5px;
  padding: 6px 12px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  white-space: nowrap;
  z-index: 5001;
}
.mia-btn:hover::before { opacity: 1; }

/* Shimmer — migrado para ::after para liberar ::before ao tooltip */
.mia-btn::after {
  content: '';
  position: absolute;
  top: -20%;
  left: -75%;
  width: 50%;
  height: 140%;
  background: linear-gradient(
    120deg,
    rgba(255,255,255,0)   0%,
    rgba(255,255,255,.35) 50%,
    rgba(255,255,255,0)   100%
  );
  transform: skewX(-20deg);
  animation: miaShimmer 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes miaShimmer {
  0%   { left: -75%; }
  60%  { left: 130%; }
  100% { left: 130%; }
}

.mia-btn-pulse {
  animation: miaBtnPulse 3s infinite;
}
@keyframes miaBtnPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(26,63,128,.45); }
  50%      { box-shadow: 0 4px 32px rgba(26,63,128,.7); }
}

/* ── Janela do chat ── */
.mia-chat {
  position: fixed;
  bottom: 100px;
  left: 28px;
  z-index: 5000;
  width: 340px;
  height: 500px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 48px rgba(26,63,128,.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.mia-chat.open {
  display: flex;
  animation: miaIn .3s ease;
}
@keyframes miaIn {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* ── Header ── */
.mia-header {
  background: #1A3F80;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mia-header-left {
  display: flex;
  align-items: center;
  gap: 11px;
}
.mia-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
}
.mia-header-name {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.mia-header-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 300;
  color: rgba(255,255,255,.6);
  margin-top: 2px;
}
.mia-online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
.mia-close {
  background: rgba(255,255,255,.12);
  border: none;
  color: rgba(255,255,255,.85);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background .2s;
  flex-shrink: 0;
}
.mia-close:hover { background: rgba(255,255,255,.25); }

/* ── Área de mensagens ── */
.mia-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #F5F7FA;
}
.mia-messages::-webkit-scrollbar { width: 4px; }
.mia-messages::-webkit-scrollbar-track { background: transparent; }
.mia-messages::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 4px; }

.mia-msg {
  display: flex;
  gap: 7px;
  align-items: flex-end;
  max-width: 88%;
}
.mia-msg-bot  { align-self: flex-start; }
.mia-msg-user { align-self: flex-end; flex-direction: row-reverse; }

.mia-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
}
.mia-msg-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.55;
}
.mia-msg-bot .mia-msg-bubble {
  background: #fff;
  color: #1A3F80;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(26,63,128,.07);
}
.mia-msg-user .mia-msg-bubble {
  background: #1A3F80;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.mia-typing .mia-msg-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 13px 16px;
}
.mia-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8896AB;
  animation: miaDot 1.2s infinite;
}
.mia-dot:nth-child(2) { animation-delay: .2s; }
.mia-dot:nth-child(3) { animation-delay: .4s; }
@keyframes miaDot {
  0%,60%,100% { transform: translateY(0); opacity: .4; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* ── Input ── */
.mia-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #EEF1F7;
  flex-shrink: 0;
}
.mia-input-area input {
  flex: 1;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 300;
  color: #1A3F80;
  background: #F5F7FA;
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .2s;
}
.mia-input-area input:focus {
  border-color: #2563C4;
  background: #fff;
}
.mia-input-area input::placeholder { color: #8896AB; }
.mia-input-area input:disabled { opacity: .5; cursor: not-allowed; }

.mia-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #E07820;
  border: none;
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .15s;
  flex-shrink: 0;
}
.mia-send:hover  { background: #F28C30; transform: scale(1.06); }
.mia-send:active { transform: scale(.96); }
.mia-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Responsivo ── */
/* ── Oculta Mia nos portais internos ── */
html.mia-oculta #mia-btn,
html.mia-oculta #mia-tooltip,
html.mia-oculta #mia-chat { display: none !important; }

@media (max-width: 480px) {
  .mia-chat {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 88px;
    height: 460px;
  }
  .mia-btn { bottom: 20px; left: 20px; }
}
