/* ============================================
   ELOGIRO CHATBOT — WIDGET DE ASSISTENTE VIRTUAL
   Usa as variáveis já definidas em style.css
   ============================================ */

#eg-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--grad-primary);
  box-shadow: var(--shadow-btn);
  border: none;
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#eg-chat-launcher:hover {
  transform: scale(1.06);
  box-shadow: var(--shadow-glow);
}

#eg-chat-launcher.eg-pulse {
  animation: eg-launcher-pulse 1.8s ease-out infinite;
}

@keyframes eg-launcher-pulse {
  0% { box-shadow: var(--shadow-btn), 0 0 0 0 rgba(255, 136, 0, 0.5); }
  70% { box-shadow: var(--shadow-btn), 0 0 0 12px rgba(255, 136, 0, 0); }
  100% { box-shadow: var(--shadow-btn), 0 0 0 0 rgba(255, 136, 0, 0); }
}

#eg-chat-launcher svg {
  width: 26px;
  height: 26px;
  stroke: var(--white);
  fill: none;
}

#eg-chat-launcher .eg-chat-mascot-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

#eg-chat-launcher .eg-chat-close-icon {
  display: none;
}

#eg-chat-launcher.eg-open .eg-chat-mascot-icon {
  display: none;
}

#eg-chat-launcher.eg-open .eg-chat-close-icon {
  display: block;
}

#eg-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 140px);
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: var(--font-body);
  border: 1px solid var(--sand);
}

#eg-chat-window.eg-visible {
  display: flex;
  animation: eg-chat-fade-in 0.25s ease;
}

@keyframes eg-chat-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.eg-chat-header {
  background: var(--grad-hero);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.eg-chat-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  object-fit: cover;
  flex-shrink: 0;
}

.eg-chat-header-text {
  color: var(--white);
  line-height: 1.25;
}

.eg-chat-header-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.eg-chat-header-text span {
  font-size: 0.75rem;
  opacity: 0.9;
}

.eg-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--paper);
}

.eg-msg {
  max-width: 82%;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.45;
  word-wrap: break-word;
}

.eg-msg-bot {
  align-self: flex-start;
  background: var(--white);
  color: var(--ink);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.eg-msg-user {
  align-self: flex-end;
  background: var(--grad-primary);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.eg-msg-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 0.6rem 0.9rem;
  background: var(--white);
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.eg-msg-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--stone);
  opacity: 0.5;
  animation: eg-typing-bounce 1.2s infinite;
}

.eg-msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.eg-msg-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes eg-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.eg-chat-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem;
  border-top: 1px solid var(--sand);
  background: var(--white);
  flex-shrink: 0;
}

.eg-chat-input-row input {
  flex: 1;
  border: 1px solid var(--sand);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  outline: none;
  background: var(--paper);
  color: var(--ink);
}

.eg-chat-input-row input:focus {
  border-color: var(--orange);
}

.eg-chat-input-row button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--grad-primary);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.eg-chat-input-row button:disabled {
  opacity: 0.5;
  cursor: default;
}

.eg-chat-input-row button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.eg-chat-footer-note {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--stone);
  text-align: center;
  padding: 0.35rem 0.5rem 0.5rem;
  background: var(--white);
}

@media (max-width: 480px) {
  #eg-chat-window {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 90px;
  }
  #eg-chat-launcher {
    right: 16px;
    bottom: 16px;
  }
  #eg-chat-hint {
    right: 16px;
    bottom: 84px;
    max-width: calc(100vw - 32px);
  }
}

#eg-chat-hint {
  position: fixed;
  bottom: 96px;
  right: 24px;
  max-width: 240px;
  background: var(--white);
  color: var(--ink);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.35;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  z-index: 9997;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#eg-chat-hint::after {
  content: "";
  position: absolute;
  bottom: -7px;
  right: 22px;
  width: 14px;
  height: 14px;
  background: var(--white);
  transform: rotate(45deg);
  box-shadow: 3px 3px 6px rgba(0,0,0,0.04);
}

#eg-chat-hint.eg-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: eg-hint-pop 0.35s ease;
}

@keyframes eg-hint-pop {
  0% { transform: translateY(8px) scale(0.9); }
  60% { transform: translateY(-2px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

#eg-chat-hint.eg-dismissed {
  display: none;
}

#eg-chat-hint span {
  flex: 1;
}

#eg-chat-hint .eg-chat-hint-close {
  border: none;
  background: none;
  color: var(--stone);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

#eg-chat-hint .eg-chat-hint-close:hover {
  color: var(--ink);
}
