/* Widget de chat - Tech You (bot de regras simples) */

.chatbot-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 20px 0 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #0B0E18;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(56, 198, 235, 0.32);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.chatbot-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px rgba(56, 198, 235, 0.4);
}

.chatbot-launcher svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.chatbot-launcher .chatbot-launcher-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #FF5C5C;
  border: 2px solid var(--bg);
}

.chatbot-launcher[hidden] {
  display: none;
}

.chatbot-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  width: min(360px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-family: "Manrope", sans-serif;
  transform-origin: bottom right;
  animation: chatbot-pop 220ms ease;
}

.chatbot-panel[hidden] {
  display: none;
}

@keyframes chatbot-pop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.chatbot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  color: #FFFFFF;
}

.chatbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex: none;
}

.chatbot-header-text {
  flex: 1;
  min-width: 0;
}

.chatbot-header-text strong {
  display: block;
  font-size: 0.95rem;
}

.chatbot-header-text span {
  display: block;
  font-size: 0.78rem;
  opacity: 0.9;
}

.chatbot-close {
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex: none;
  transition: background 150ms ease;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}

.chatbot-msg {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-line;
}

.chatbot-msg-bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chatbot-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #0B0E18;
  font-weight: 600;
  border-bottom-right-radius: 4px;
}

.chatbot-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  border-bottom-left-radius: 4px;
}

.chatbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.6;
  animation: chatbot-blink 1.1s infinite ease-in-out;
}

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

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

@keyframes chatbot-blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 0.9; transform: translateY(-2px); }
}

.chatbot-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  background: var(--bg);
}

.chatbot-option {
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.chatbot-option:hover {
  border-color: var(--accent-deep);
  background: var(--accent);
  color: #0B0E18;
}

.chatbot-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-alt);
}

.chatbot-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.88rem;
  background: var(--surface);
  color: var(--text);
}

.chatbot-input:focus {
  outline: none;
  border-color: var(--accent-deep);
}

.chatbot-send {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #0B0E18;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 150ms ease;
}

.chatbot-send:hover {
  transform: scale(1.06);
}

.chatbot-send svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .chatbot-panel {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }

  .chatbot-launcher {
    right: 14px;
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-panel {
    animation: none;
  }

  .chatbot-typing span {
    animation: none;
  }
}
