/* Assistente LeiUP — home (fase 1) */
.leiup-chat-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 45;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--blue, #17356f), var(--blue-dark, #0e2248));
  color: #fff;
  box-shadow: 0 4px 14px rgba(15, 34, 72, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.leiup-chat-fab:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 18px rgba(15, 34, 72, 0.28);
}

.leiup-chat-fab:focus-visible {
  outline: 2px solid var(--gold, #c7a64b);
  outline-offset: 2px;
}

.leiup-chat-fab svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.leiup-chat-fab[aria-expanded='true'] {
  opacity: 0.92;
}

.leiup-chat-panel {
  position: fixed;
  right: 18px;
  bottom: 72px;
  z-index: 44;
  width: min(360px, calc(100vw - 28px));
  max-height: min(520px, calc(100vh - 100px));
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line, #e4e9f2);
  box-shadow: 0 12px 40px rgba(15, 34, 72, 0.14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events: none;
}

.leiup-chat-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.leiup-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--blue, #17356f), var(--blue-dark, #0e2248));
  color: #fff;
}

.leiup-chat-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.leiup-chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 4px;
}

.leiup-chat-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.leiup-chat-title {
  min-width: 0;
}

.leiup-chat-title strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.leiup-chat-title small {
  display: block;
  font-size: 10px;
  opacity: 0.85;
  margin-top: 2px;
}

.leiup-chat-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.leiup-chat-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.leiup-chat-body {
  flex: 1;
  min-height: 200px;
  max-height: 340px;
  overflow-y: auto;
  padding: 12px;
  background: #f8fafc;
}

.leiup-chat-msg {
  max-width: 92%;
  margin-bottom: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.leiup-chat-msg.bot {
  background: #fff;
  color: var(--text, #1f2b3d);
  border: 1px solid var(--line, #e4e9f2);
  border-bottom-left-radius: 4px;
  text-align: justify;
  white-space: normal;
}

.leiup-chat-msg.bot strong {
  font-weight: 700;
  color: inherit;
}

.leiup-chat-pdf-wrap {
  margin-top: 10px;
}

.leiup-chat-pdf-btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  background: #2a4b6d;
  color: #fff !important;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(42, 75, 109, 0.2);
}

.leiup-chat-pdf-btn:hover {
  background: #17356f;
  text-decoration: none;
}

.leiup-chat-msg.user {
  margin-left: auto;
  background: var(--blue, #17356f);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.leiup-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.leiup-chat-quick button {
  padding: 5px 10px;
  font-size: 11px;
  font-family: inherit;
  border-radius: 999px;
  border: 1px solid rgba(23, 53, 111, 0.18);
  background: #fff;
  color: var(--blue, #17356f);
  cursor: pointer;
}

.leiup-chat-quick button:hover {
  background: rgba(23, 53, 111, 0.06);
}

.leiup-chat-quick.is-hidden {
  display: none;
}

.leiup-chat-typing {
  display: none;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.leiup-chat-typing.is-visible {
  display: flex;
  gap: 4px;
  align-items: center;
}

.leiup-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted, #627089);
  animation: leiup-chat-dot 1.2s infinite ease-in-out;
}

.leiup-chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.leiup-chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes leiup-chat-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.leiup-chat-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line, #e4e9f2);
  background: #fff;
}

.leiup-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.leiup-chat-input-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--line, #e4e9f2);
  border-radius: 10px;
}

.leiup-chat-input-row input:focus {
  outline: none;
  border-color: var(--blue, #17356f);
  box-shadow: 0 0 0 2px rgba(23, 53, 111, 0.1);
}

.leiup-chat-input-row input:disabled {
  opacity: 0.65;
  background: #f1f5f9;
}

.leiup-chat-send {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: var(--blue, #17356f);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.leiup-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.leiup-chat-send svg {
  width: 16px;
  height: 16px;
}

.leiup-chat-note {
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted, #627089);
  text-align: center;
}

@media (max-width: 480px) {
  .leiup-chat-fab {
    right: 14px;
    bottom: 14px;
    width: 42px;
    height: 42px;
  }

  .leiup-chat-panel {
    right: 14px;
    bottom: 64px;
    width: calc(100vw - 28px);
  }
}
