/* ==========================================================================
   WGF, LDA — Chat de Dúvidas e Perguntas Widget Stylesheet
   ========================================================================== */

:root {
  --wgf-chat-accent: #b31b00;
  --wgf-chat-accent-hover: #d32200;
  --wgf-chat-bg-dark: #0f141c;
  --wgf-chat-surface: #18202c;
  --wgf-chat-surface-hover: #222b3a;
  --wgf-chat-border: rgba(255, 255, 255, 0.1);
  --wgf-chat-text: #f0f4f8;
  --wgf-chat-text-muted: #94a3b8;
  --wgf-chat-bot-bubble: #1e293b;
  --wgf-chat-user-bubble: #b31b00;
  --wgf-chat-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

/* --------------------------------------------------------------------------
   1. Botão Flutuante (Toggle)
   -------------------------------------------------------------------------- */
.wgf-chat-toggle {
  position: fixed;
  bottom: 70px;
  right: 15px;
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--wgf-chat-accent);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(179, 27, 0, 0.45);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.wgf-chat-toggle:hover {
  background: var(--wgf-chat-accent-hover);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 28px rgba(179, 27, 0, 0.6);
}

.wgf-chat-toggle-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.wgf-chat-toggle-icon .icon-close {
  display: none;
  font-size: 20px;
}

.wgf-chat-toggle.active .icon-open {
  display: none;
}

.wgf-chat-toggle.active .icon-close {
  display: block;
}

.wgf-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #22c55e;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  animation: pulse-badge 2s infinite;
}

.wgf-chat-badge.d-none {
  display: none !important;
}

.wgf-chat-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

@keyframes pulse-badge {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* --------------------------------------------------------------------------
   2. Janela Principal do Chat
   -------------------------------------------------------------------------- */
.wgf-chat-window {
  position: fixed;
  bottom: 130px;
  right: 15px;
  z-index: 100001;
  width: 380px;
  max-width: calc(100vw - 30px);
  height: 600px;
  max-height: calc(100vh - 150px);
  background: var(--wgf-chat-bg-dark);
  border: 1px solid var(--wgf-chat-border);
  border-radius: 20px;
  box-shadow: var(--wgf-chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.wgf-chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* --------------------------------------------------------------------------
   3. Cabeçalho
   -------------------------------------------------------------------------- */
.wgf-chat-header {
  background: linear-gradient(135deg, #18202c 0%, #0d1218 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--wgf-chat-border);
}

.wgf-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wgf-chat-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--wgf-chat-accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(179, 27, 0, 0.4);
}

.wgf-chat-avatar .status-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--wgf-chat-surface);
}

.btn-chat-action {
  background: transparent;
  border: none;
  color: var(--wgf-chat-text-muted);
  font-size: 18px;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-chat-action:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* --------------------------------------------------------------------------
   4. Barra de Busca
   -------------------------------------------------------------------------- */
.wgf-chat-search {
  padding: 10px 16px;
  background: var(--wgf-chat-surface);
  border-bottom: 1px solid var(--wgf-chat-border);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--wgf-chat-text-muted);
  font-size: 14px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 8px 32px 8px 34px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: var(--wgf-chat-text);
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}

.search-input-wrapper input:focus {
  border-color: var(--wgf-chat-accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(179, 27, 0, 0.2);
}

.btn-search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--wgf-chat-text-muted);
  font-size: 16px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   5. Tópicos (Chips)
   -------------------------------------------------------------------------- */
.wgf-chat-topics-wrapper {
  background: #0b0e14;
  padding: 8px 12px;
  border-bottom: 1px solid var(--wgf-chat-border);
}

.wgf-chat-topics {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.wgf-chat-topics::-webkit-scrollbar {
  display: none;
}

.topic-chip {
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--wgf-chat-text-muted);
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.topic-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.topic-chip.active {
  background: var(--wgf-chat-accent);
  color: #ffffff;
  border-color: var(--wgf-chat-accent);
}

/* --------------------------------------------------------------------------
   6. Corpo de Mensagens
   -------------------------------------------------------------------------- */
.wgf-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.wgf-chat-body::-webkit-scrollbar {
  width: 5px;
}

.wgf-chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

/* Mensagens */
.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
}

.chat-msg.bot-msg {
  align-self: flex-start;
}

.chat-msg.user-msg {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--wgf-chat-accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.user-msg .msg-avatar {
  background: #3b82f6;
}

.msg-content {
  background: var(--wgf-chat-bot-bubble);
  color: var(--wgf-chat-text);
  padding: 12px 14px;
  border-radius: 16px;
  border-top-left-radius: 4px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-msg .msg-content {
  background: var(--wgf-chat-user-bubble);
  color: #ffffff;
  border-radius: 16px;
  border-top-right-radius: 4px;
}

.msg-text {
  margin-bottom: 6px;
}

.msg-text:last-child {
  margin-bottom: 0;
}

.msg-time {
  font-size: 10px;
  color: var(--wgf-chat-text-muted);
  text-align: right;
  margin-top: 4px;
}

.user-msg .msg-time {
  color: rgba(255, 255, 255, 0.7);
}

/* Sugestões Rápidas */
.chat-quick-questions {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 12px;
  margin-top: 4px;
}

.quick-q-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--wgf-chat-text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-quick-q {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--wgf-chat-text);
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.btn-quick-q:last-child {
  margin-bottom: 0;
}

.btn-quick-q:hover {
  background: rgba(179, 27, 0, 0.15);
  border-color: var(--wgf-chat-accent);
  color: #ffffff;
  transform: translateX(3px);
}

.btn-quick-q .arrow {
  font-size: 11px;
  color: var(--wgf-chat-text-muted);
  transition: transform 0.2s;
}

.btn-quick-q:hover .arrow {
  color: var(--wgf-chat-accent);
  transform: translateX(2px);
}

/* Indicador de Digitação */
.wgf-chat-typing {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wgf-chat-accent);
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

.typing-text {
  font-size: 11px;
  color: var(--wgf-chat-text-muted);
  font-style: italic;
}

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Botões de Ação na Resposta do Bot */
.bot-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-bot-action {
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff !important;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-bot-action:hover {
  background: var(--wgf-chat-accent);
  border-color: var(--wgf-chat-accent);
}

.btn-bot-action.btn-whatsapp {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80 !important;
}

.btn-bot-action.btn-whatsapp:hover {
  background: #22c55e;
  color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   7. Rodapé / Formulário
   -------------------------------------------------------------------------- */
.wgf-chat-footer {
  background: var(--wgf-chat-surface);
  padding: 12px 16px;
  border-top: 1px solid var(--wgf-chat-border);
}

.wgf-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wgf-chat-form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 10px 16px;
  color: var(--wgf-chat-text);
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s;
}

.wgf-chat-form input:focus {
  border-color: var(--wgf-chat-accent);
  box-shadow: 0 0 0 3px rgba(179, 27, 0, 0.2);
  background: rgba(255, 255, 255, 0.09);
}

.btn-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wgf-chat-accent);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-chat-send:hover {
  background: var(--wgf-chat-accent-hover);
  transform: scale(1.05);
}

.wgf-chat-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
}

.wgf-chat-footer-links .footer-link {
  color: var(--wgf-chat-text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.wgf-chat-footer-links .footer-link:hover {
  color: #ffffff;
}

.wgf-chat-footer-links .dot {
  color: var(--wgf-chat-text-muted);
  font-size: 10px;
}

/* --------------------------------------------------------------------------
   8. Responsividade Móvel
   -------------------------------------------------------------------------- */
@media (max-width: 576px) {
  .wgf-chat-toggle {
    bottom: 65px;
    right: 15px;
    padding: 10px 16px;
  }
  
  .wgf-chat-window {
    bottom: 115px;
    right: 15px;
    left: 15px;
    width: auto;
    max-width: none;
    height: calc(100vh - 130px);
  }
}
