:root {
  --nexa-chat-bg: #0f1115;
  --nexa-chat-panel: rgba(20, 22, 29, 0.92);
  --nexa-chat-panel-2: rgba(29, 32, 41, 0.92);
  --nexa-chat-text: #ffffff;
  --nexa-chat-muted: #9aa3b2;
  --nexa-chat-border: rgba(255, 255, 255, 0.08);
  --nexa-chat-bubble-user: #2e3440;
  --nexa-chat-bubble-bot: #171b23;
  --nexa-chat-accent-1: #87bfff;
  --nexa-chat-accent-2: #1f4f82;
  --nexa-chat-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);

  --accent_first_project: #9fd2ff;
  --accent_four_project: #07111f;
}

/* RESET BASE BOTTONE */
button.nexa-chat-toggle {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  outline: none;
  font: inherit;
}

/* BOTTONE TOGGLE */
button.btn_animate_border.nexa-chat-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: auto;
  top: auto;
  transform: none;
  color: var(--accent_first_project);
  background:
    linear-gradient(180deg, rgba(16, 31, 52, 0.96) 0%, rgba(7, 17, 31, 0.98) 100%);
  padding: 14px 24px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.42),
    0 0 18px rgba(135, 191, 255, 0.12);
  overflow: hidden;
  cursor: pointer;
  z-index: 999999;
  min-width: 188px;
  height: 56px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  backdrop-filter: blur(8px);
}

button.btn_animate_border.nexa-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow:
    0 22px 52px rgba(0, 0, 0, 0.5),
    0 0 22px rgba(135, 191, 255, 0.2);
  filter: brightness(1.04);
}

button.btn_animate_border.nexa-chat-toggle::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  bottom: 2px;
  width: 50%;
  background: linear-gradient(90deg, rgba(180, 220, 255, 0.16), rgba(180, 220, 255, 0.04));
  pointer-events: none;
}

button.btn_animate_border.nexa-chat-toggle span:nth-child(1) {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, rgba(7, 17, 31, 0), var(--accent_first_project));
  animation: animate1 2s linear infinite;
  animation-delay: 1s;
}

button.btn_animate_border.nexa-chat-toggle span:nth-child(2) {
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, rgba(7, 17, 31, 0), var(--accent_first_project));
  animation: animate2 2s linear infinite;
}

button.btn_animate_border.nexa-chat-toggle span:nth-child(3) {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to left, rgba(7, 17, 31, 0), var(--accent_first_project));
  animation: animate3 2s linear infinite;
  animation-delay: 1s;
}

button.btn_animate_border.nexa-chat-toggle span:nth-child(4) {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to top, rgba(7, 17, 31, 0), var(--accent_first_project));
  animation: animate4 2s linear infinite;
}

@keyframes animate1 {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes animate2 {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

@keyframes animate3 {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

@keyframes animate4 {
  0% { transform: translateY(100%); }
  100% { transform: translateY(-100%); }
}

/* CHAT BOX */
.nexa-chat {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: 390px;
  height: 620px;
  max-height: calc(100vh - 120px);
  background: var(--nexa-chat-panel);
  color: var(--nexa-chat-text);
  border: 1px solid var(--nexa-chat-border);
  border-radius: 22px;
  box-shadow: var(--nexa-chat-shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 999998;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

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

.nexa-chat.is-fullscreen {
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
}

.nexa-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(to bottom, rgba(21, 24, 31, 0.98), rgba(18, 20, 27, 0.95));
  border-bottom: 1px solid var(--nexa-chat-border);
}

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

.nexa-chat-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(135, 191, 255, 0.2), rgba(31, 79, 130, 0.22));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nexa-chat-brand-icon svg {
  width: 20px;
  height: 20px;
}

.nexa-chat-brand-text {
  min-width: 0;
}

.nexa-chat-brand-text h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1;
}

.nexa-chat-brand-text p {
  margin: 4px 0 0;
  color: var(--nexa-chat-muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nexa-chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nexa-chat-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--nexa-chat-border);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  padding: 0;
}

.nexa-chat-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.04);
}

.nexa-chat-icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

.nexa-chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top center, rgba(135, 191, 255, 0.08), transparent 28%), transparent;
}

.nexa-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.nexa-chat-messages::-webkit-scrollbar {
  width: 8px;
}

.nexa-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

.nexa-chat-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 14px;
}

.nexa-chat-suggestion {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  border-radius: 14px;
  padding: 12px;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.nexa-chat-suggestion:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(159, 210, 255, 0.28);
}

.nexa-chat-message-row {
  display: flex;
  width: 100%;
}

.nexa-chat-message-row.bot {
  justify-content: flex-start;
}

.nexa-chat-message-row.user {
  justify-content: flex-end;
}

.nexa-chat-message {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 0.92rem;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: nexaChatFadeIn 0.22s ease;
}

.nexa-chat-message.bot {
  background: var(--nexa-chat-bubble-bot);
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.nexa-chat-message.user {
  background: var(--nexa-chat-bubble-user);
  border-bottom-right-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.nexa-chat-typing {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 16px 14px;
  color: var(--nexa-chat-muted);
  font-size: 0.82rem;
}

.nexa-chat-typing.is-visible {
  display: flex;
}

.nexa-chat-typing-dots {
  display: inline-flex;
  gap: 4px;
}

.nexa-chat-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c8d0dd;
  display: inline-block;
  animation: nexaChatBounce 1s infinite ease-in-out;
}

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

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

.nexa-chat-footer {
  padding: 14px 14px 16px;
  border-top: 1px solid var(--nexa-chat-border);
  background: rgba(15, 17, 21, 0.86);
}

.nexa-chat-form {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--nexa-chat-panel-2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 8px;
}

.nexa-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--nexa-chat-text);
  font: inherit;
  padding: 10px 12px;
  outline: none;
}

.nexa-chat-input::placeholder {
  color: var(--nexa-chat-muted);
}

.nexa-chat-send {
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--nexa-chat-accent-1), var(--nexa-chat-accent-2));
  color: #fff;
  min-width: 92px;
  height: 42px;
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.nexa-chat-send:hover {
  transform: translateY(-1px);
}

.nexa-chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

@keyframes nexaChatFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes nexaChatBounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  button.btn_animate_border.nexa-chat-toggle {
    right: 12px;
    bottom: 12px;
    left: auto;
    min-width: 132px;
    height: 46px;
    padding: 10px 14px;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    border-radius: 10px;
  }

  button.btn_animate_border.nexa-chat-toggle::before {
    width: 42%;
  }

  .nexa-chat {
    right: 10px;
    bottom: 66px;
    width: calc(100vw - 20px);
    height: calc(100vh - 88px);
    max-height: calc(100vh - 88px);
  }

  .nexa-chat-suggestions {
    grid-template-columns: 1fr;
  }

  .nexa-chat-send {
    min-width: 78px;
  }
}