/* ── WIDGET LEIA (assistente virtual) ───────────────────────────────────── */
#leia-widget {
  position: fixed;
  right: 14px;
  bottom: 0;
  z-index: 9500;
  font-family: 'Source Sans 3', Arial, sans-serif;
}

/* ── Lançador (personagem de corpo inteiro + balão de fala) ── */
#leia-launcher {
  position: relative;
  display: flex;
  justify-content: center;
}
#leia-widget.leia-open #leia-launcher { display: none; }

#leia-toggle {
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 -4px;
  cursor: pointer;
  display: block;
  line-height: 0;
}
#leia-btn-canvas {
  display: block;
  height: 140px;
  width: auto;
  filter: drop-shadow(0 10px 14px rgba(10,35,81,.35));
  transition: transform .2s ease;
}
#leia-toggle:hover #leia-btn-canvas { transform: scale(1.04); }

.leia-bubble-fala {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translate(-50%, -100%);
  background: #fff;
  color: #0a2351;
  font-weight: 700;
  font-size: 10px;
  line-height: 1.3;
  padding: 7px 11px;
  border-radius: 14px;
  white-space: normal;
  width: max-content;
  max-width: 128px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(10,35,81,.28);
  border: 1.5px solid #c9a84c;
  animation: leia-flutuar 2.4s ease-in-out infinite;
  pointer-events: none;
}
.leia-bubble-fala::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 7px 6px 0 6px;
  border-style: solid;
  border-color: #c9a84c transparent transparent transparent;
}
@keyframes leia-flutuar {
  0%, 100% { transform: translate(-50%, -100%) translateY(0); }
  50%      { transform: translate(-50%, -100%) translateY(-9px); }
}

/* ── PAINEL DO CHAT ── */
#leia-chat {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 400px;
  height: 640px;
  max-height: 87vh;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(10,35,81,.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
#leia-widget.leia-open #leia-chat {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.leia-header-bar {
  background: linear-gradient(135deg, #0a2351 0%, #1a3f8f 100%);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.leia-header-info strong { color: #fff; font-size: 15px; display: block; font-family: 'Merriweather', serif; }
.leia-header-info span { color: #cddcf5; font-size: 11.5px; }
#leia-close {
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s;
}
#leia-close:hover { background: #c9a84c; color: #0a2351; }

.leia-header-character {
  flex-shrink: 0;
  background: linear-gradient(135deg, #eef2fb 0%, #dfe7f5 100%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  overflow: hidden;
}
.leia-header-avatar {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
}
.leia-header-avatar::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 12px;
  background: rgba(10,35,81,.16);
  border-radius: 50%;
  filter: blur(3px);
}
#leia-header-canvas {
  display: block;
  height: 78px;
  width: auto;
  position: relative;
  filter: drop-shadow(0 6px 8px rgba(10,35,81,.18));
}
.leia-header-texto {
  flex: 1;
  min-width: 0;
}
.leia-header-texto strong {
  display: block;
  color: #0a2351;
  font-family: 'Merriweather', serif;
  font-size: 12px;
  margin-bottom: 3px;
}
.leia-header-texto span {
  display: block;
  color: #3d4f6e;
  font-size: 10.5px;
  line-height: 1.35;
}

.leia-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f4f6fa;
}
.leia-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.leia-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: #1f2937;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 6px rgba(10,35,81,.08);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.leia-msg.bot .leia-msg-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 4%;
  flex-shrink: 0;
  margin-top: 1px;
}
.leia-msg.bot .leia-msg-text { flex: 1; }
.leia-msg.user {
  align-self: flex-end;
  background: #1a3f8f;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.leia-msg.erro { background: #fee2e2; color: #991b1b; }

.leia-typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.leia-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #9aa7bd;
  animation: leia-bounce 1.2s infinite ease-in-out;
}
.leia-typing span:nth-child(2) { animation-delay: .15s; }
.leia-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes leia-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.leia-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.leia-form input {
  flex: 1;
  border: 1.5px solid #d8dde6;
  border-radius: 26px;
  padding: 14px 20px;
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.leia-form input:focus {
  border-color: #2563c0;
  box-shadow: 0 0 0 3px rgba(37,99,192,.12);
}
.leia-form button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: #c9a84c;
  color: #0a2351;
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s;
}
.leia-form button:hover { background: #f0d080; }
.leia-form button:disabled { opacity: .5; cursor: default; }

@media (max-width: 480px) {
  #leia-chat {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    height: 82vh;
  }
  #leia-widget { right: 8px; }
  #leia-btn-canvas { height: 110px; }
  #leia-header-canvas { height: 64px; }
  .leia-header-texto strong { font-size: 11px; }
  .leia-header-texto span { font-size: 9.5px; }
}
