:root {
  --aq-chat-bg: rgba(3, 8, 22, 0.96);
  --aq-chat-panel: rgba(6, 12, 32, 0.96);
  --aq-chat-accent: var(--accent, #46f0ff);
  --aq-chat-accent-soft: rgba(70, 240, 255, 0.18);
  --aq-chat-text: var(--text-main, #f5f7ff);
  --aq-chat-muted: var(--text-muted, #9aa3c4);
  --aq-chat-border: rgba(70, 240, 255, 0.28);
  --aq-chat-shadow: 0 20px 45px rgba(0, 0, 0, 0.55);
  --aq-chat-danger: #ff6b81;
  --aq-chat-success: #35ffb0;
}

.aq-chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 340px;
  max-width: calc(100vw - 36px);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--aq-chat-text);
  z-index: 999;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.aq-chat-launcher {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(70, 240, 255, 0.5);
  background: radial-gradient(circle at 30% 30%, rgba(140, 255, 240, 0.95), rgba(5, 18, 36, 0.95));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 18px rgba(70, 240, 255, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.aq-chat-launcher-label {
  position: absolute;
  right: 58px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(5, 14, 30, 0.9);
  border: 1px solid rgba(70, 240, 255, 0.35);
  color: var(--aq-chat-text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.aq-chat-launcher-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--aq-chat-accent);
  box-shadow: 0 0 10px rgba(70, 240, 255, 0.8);
}

.aq-chat-launcher:hover {
  border-color: rgba(70, 240, 255, 0.85);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 22px rgba(70, 240, 255, 0.6);
}

.aq-chat-panel {
  background: var(--aq-chat-panel);
  border-radius: 18px;
  border: 1px solid var(--aq-chat-border);
  box-shadow: var(--aq-chat-shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.aq-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  background: linear-gradient(135deg, rgba(7, 16, 38, 0.95), rgba(4, 11, 28, 0.92));
  border-bottom: 1px solid rgba(70, 240, 255, 0.2);
}

.aq-chat-title {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aq-chat-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.aq-chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.aq-chat-btn {
  border: 1px solid rgba(70, 240, 255, 0.35);
  background: rgba(5, 14, 30, 0.75);
  color: var(--aq-chat-text);
  font-size: 12px;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}

.aq-chat-btn:hover {
  border-color: rgba(70, 240, 255, 0.65);
}

.aq-chat-body {
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 330px;
  overflow: hidden;
}

.aq-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
}

.aq-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.aq-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(70, 240, 255, 0.2);
  border-radius: 999px;
}

.aq-chat-msg {
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.aq-chat-msg.user {
  align-self: flex-end;
  background: rgba(70, 240, 255, 0.12);
  border: 1px solid rgba(70, 240, 255, 0.35);
}

.aq-chat-msg.assistant {
  align-self: flex-start;
  background: rgba(7, 14, 32, 0.9);
  border: 1px solid rgba(110, 150, 255, 0.18);
}

.aq-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.aq-chat-suggestion {
  border: 1px solid rgba(70, 240, 255, 0.3);
  background: rgba(5, 14, 30, 0.8);
  color: var(--aq-chat-text);
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.aq-chat-suggestion:hover {
  border-color: rgba(70, 240, 255, 0.6);
}

.aq-chat-typing {
  font-size: 11px;
  color: var(--aq-chat-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.aq-chat-typing span {
  display: inline-flex;
  gap: 3px;
}

.aq-chat-typing span i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--aq-chat-accent);
  display: inline-block;
  animation: aq-chat-bounce 1.2s infinite;
}

.aq-chat-typing span i:nth-child(2) { animation-delay: 0.15s; }
.aq-chat-typing span i:nth-child(3) { animation-delay: 0.3s; }

@keyframes aq-chat-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-3px); opacity: 1; }
}

.aq-chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 0 12px 12px;
}

.aq-chat-input textarea {
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(110, 150, 255, 0.2);
  background: rgba(3, 10, 24, 0.85);
  color: var(--aq-chat-text);
  font-size: 12px;
  line-height: 1.5;
}

.aq-chat-input textarea:focus {
  outline: 1px solid rgba(70, 240, 255, 0.6);
}

.aq-chat-send {
  border: 1px solid rgba(70, 240, 255, 0.55);
  background: rgba(5, 18, 36, 0.95);
  color: var(--aq-chat-text);
  font-size: 12px;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.aq-chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.aq-chat-footer {
  padding: 0 12px 10px;
  font-size: 10px;
  color: var(--aq-chat-muted);
}

.aq-chat-footer a {
  color: var(--aq-chat-accent);
  text-decoration: none;
}

.aq-chat-footer a:hover {
  text-decoration: underline;
}

.aq-chat.is-minimized .aq-chat-body,
.aq-chat.is-minimized .aq-chat-input,
.aq-chat.is-minimized .aq-chat-footer {
  display: none;
}

.aq-chat.is-minimized .aq-chat-panel {
  display: none;
}

.aq-chat.is-minimized .aq-chat-launcher {
  display: flex;
}

.aq-chat:not(.is-minimized) .aq-chat-launcher {
  display: none;
}

.aq-chat.is-minimized {
  width: auto;
  max-width: none;
}

.aq-chat.is-hidden {
  opacity: 0.6;
}

@media (max-width: 620px) {
  .aq-chat {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-width: none;
  }

  .aq-chat-body {
    max-height: 300px;
  }

  .aq-chat-launcher {
    margin-right: 6px;
  }

  .aq-chat-launcher-label {
    right: 54px;
    font-size: 10px;
    padding: 5px 8px;
  }
}
