:root {
  --necta-primary: #fa6432;
  --necta-primary-hover: #e85526;
  --necta-primary-light: #fff0ea;
  --necta-bg: #ffffff;
  --necta-text: #1a1a2e;
  --necta-text-light: #6b7280;
  --necta-border: #e5e7eb;
  --necta-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  --necta-radius: 12px;
  --necta-bot-bg: #fff5f0;
  --necta-user-bg: #f3f4f6;
  --necta-user-text: #1a1a2e;
}

.necta-ai-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--necta-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(250, 100, 50, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: transform 0.2s, box-shadow 0.2s;
}

.necta-ai-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(250, 100, 50, 0.45);
}

.necta-ai-btn svg {
  width: 26px;
  height: 26px;
}

.necta-ai-tooltip {
  position: absolute;
  right: 64px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--necta-text);
  color: #fff;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.necta-ai-btn:hover .necta-ai-tooltip {
  opacity: 1;
}

.necta-ai-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--necta-bg);
  border-radius: var(--necta-radius);
  box-shadow: var(--necta-shadow);
  z-index: 1001;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: necta-slide-up 0.3s ease-out;
}

.necta-ai-panel.open {
  display: flex;
}

@keyframes necta-slide-up {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.necta-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--necta-primary);
  color: #fff;
  border-radius: var(--necta-radius) var(--necta-radius) 0 0;
  flex-shrink: 0;
}

.necta-ai-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.necta-ai-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.necta-ai-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.necta-ai-header .necta-ai-status {
  font-size: 11px;
  opacity: 0.85;
  display: block;
  margin-top: -1px;
}

.necta-ai-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.85;
  transition: opacity 0.2s;
  line-height: 1;
}

.necta-ai-close:hover {
  opacity: 1;
}

.necta-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.necta-ai-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.necta-ai-msg.bot {
  align-self: flex-start;
  background: var(--necta-bot-bg);
  color: var(--necta-text);
  border-bottom-left-radius: 4px;
}

.necta-ai-msg.user {
  align-self: flex-end;
  background: var(--necta-user-bg);
  color: var(--necta-user-text);
  border-bottom-right-radius: 4px;
}

.necta-ai-msg.error {
  align-self: center;
  background: #fef2f2;
  color: #dc2626;
  font-size: 13px;
  text-align: center;
  max-width: 90%;
}

.necta-ai-msg.admin,
.necta-ai-msg.agent {
  align-self: flex-start;
  background: #e8f4f8;
  color: var(--necta-text);
  border-bottom-left-radius: 4px;
}

.necta-ai-msg.system {
  align-self: center;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 13px;
  text-align: center;
  max-width: 90%;
  border-radius: 8px;
}

.necta-ai-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--necta-bot-bg);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.necta-ai-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--necta-primary);
  animation: necta-bounce 1.4s infinite ease-in-out;
}

.necta-ai-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.necta-ai-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes necta-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.necta-ai-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--necta-border);
  background: var(--necta-bg);
  flex-shrink: 0;
}

.necta-ai-input {
  flex: 1;
  border: 1px solid var(--necta-border);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.necta-ai-input:focus {
  border-color: var(--necta-primary);
}

.necta-ai-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--necta-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.necta-ai-send:hover {
  background: var(--necta-primary-hover);
}

.necta-ai-send:active {
  transform: scale(0.92);
}

.necta-ai-send:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  transform: none;
}

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

.necta-ai-new-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
}

.necta-ai-new-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 480px) {
  .necta-ai-panel {
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .necta-ai-header {
    border-radius: 0;
  }

  .necta-ai-btn {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
  }
}
