/* Neona Chat Widget — Character-Driven Design */

/* === Floating Bubble === */
.neona-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: none;
  border: 3px solid rgba(206, 79, 205, 0.5);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(206, 79, 205, 0.35), 0 0 0 0 rgba(206, 79, 205, 0);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  animation: neona-float 3s ease-in-out infinite;
}

.neona-bubble:hover {
  transform: scale(1.1);
  border-color: #CE4FCD;
  box-shadow: 0 6px 32px rgba(206, 79, 205, 0.5), 0 0 12px rgba(206, 79, 205, 0.3);
  animation: none;
}

.neona-bubble:active {
  transform: scale(0.95);
}

.neona-bubble-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.neona-bubble-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #0A0B0F;
  pointer-events: none;
}

@keyframes neona-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* === Greeting Tooltip === */
.neona-greeting {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9998;
  background: #1a1b22;
  border: 1px solid rgba(206, 79, 205, 0.3);
  border-radius: 12px;
  padding: 10px 16px;
  max-width: 220px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 12px rgba(206, 79, 205, 0.1);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.neona-greeting.neona-greeting-show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  cursor: pointer;
}

.neona-greeting-text {
  font-family: 'Urbanist', sans-serif;
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.4;
}

.neona-greeting-text strong {
  color: #CE4FCD;
}

.neona-greeting-arrow {
  position: absolute;
  bottom: -6px;
  right: 28px;
  width: 12px;
  height: 12px;
  background: #1a1b22;
  border-right: 1px solid rgba(206, 79, 205, 0.3);
  border-bottom: 1px solid rgba(206, 79, 205, 0.3);
  transform: rotate(45deg);
}

.neona-greeting-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 18px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  line-height: 1;
}

.neona-greeting-close:hover {
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.05);
}

/* === Idle Nudge Tooltip === */
.neona-nudge {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9998;
  background: #1a1b22;
  border: 1px solid rgba(206, 79, 205, 0.2);
  border-radius: 10px;
  padding: 8px 14px;
  max-width: 200px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 8px rgba(206, 79, 205, 0.08);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  cursor: pointer;
}

.neona-nudge.neona-nudge-show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.neona-nudge-text {
  font-family: 'Urbanist', sans-serif;
  font-size: 12px;
  color: #d1d5db;
  line-height: 1.4;
  font-style: italic;
}

/* === Chat Panel === */
.neona-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9998;
  width: 380px;
  max-height: 540px;
  background: #111318;
  border: 1px solid rgba(206, 79, 205, 0.2);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 0 24px rgba(206, 79, 205, 0.08);
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.neona-panel.neona-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* === Header === */
.neona-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(206, 79, 205, 0.08) 0%, rgba(206, 79, 205, 0.02) 100%);
  flex-shrink: 0;
}

.neona-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(206, 79, 205, 0.3);
}

.neona-header-info {
  flex: 1;
  min-width: 0;
}

.neona-header-name {
  font-family: 'Urbanist', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.neona-header-tagline {
  font-family: 'Urbanist', sans-serif;
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.2;
  margin-top: 1px;
}

.neona-header-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.neona-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.neona-clear-btn {
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s;
}

.neona-clear-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.neona-clear-btn svg {
  width: 14px;
  height: 14px;
  stroke: #6b7280;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.neona-clear-btn:hover svg {
  stroke: #ef4444;
}

.neona-close {
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s;
  flex-shrink: 0;
}

.neona-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.neona-close svg {
  width: 16px;
  height: 16px;
  stroke: #9ca3af;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* === Empty State === */
.neona-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 16px;
  text-align: center;
  flex: 1;
  min-height: 100%;
}

.neona-empty-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(206, 79, 205, 0.3);
  margin-bottom: 14px;
}

.neona-empty-name {
  font-family: 'Urbanist', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.neona-empty-subtitle {
  font-family: 'Urbanist', sans-serif;
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 24px;
}

.neona-empty-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 240px;
}

.neona-chip {
  font-family: 'Urbanist', sans-serif;
  font-size: 13px;
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  text-align: left;
}

.neona-chip:hover {
  background: rgba(206, 79, 205, 0.08);
  border-color: rgba(206, 79, 205, 0.3);
  color: #fff;
}

/* === Messages === */
.neona-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(206, 79, 205, 0.15) transparent;
}

.neona-messages::-webkit-scrollbar {
  width: 4px;
}

.neona-messages::-webkit-scrollbar-track {
  background: transparent;
}

.neona-messages::-webkit-scrollbar-thumb {
  background: rgba(206, 79, 205, 0.15);
  border-radius: 4px;
}

/* Message rows */
.neona-msg {
  max-width: 85%;
  display: flex;
  gap: 8px;
}

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

.neona-msg-assistant {
  align-self: flex-start;
}

.neona-msg-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}

.neona-msg-body {
  display: flex;
  flex-direction: column;
}

.neona-msg-text {
  font-family: 'Urbanist', sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  padding: 10px 14px;
  border-radius: 14px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.neona-msg-user .neona-msg-text {
  background: rgba(206, 79, 205, 0.15);
  color: #e5e7eb;
  border-bottom-right-radius: 4px;
}

.neona-msg-assistant .neona-msg-text {
  background: rgba(255, 255, 255, 0.05);
  color: #d1d5db;
  border-bottom-left-radius: 4px;
}

.neona-msg-text a {
  color: #CE4FCD;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.neona-msg-text strong {
  color: #fff;
  font-weight: 600;
}

/* === Prax Correction Messages === */
.neona-msg-prax {
  align-self: flex-start;
}

.neona-prax-avatar {
  border: 1.5px solid rgba(206, 79, 205, 0.4) !important;
}

.neona-prax-label {
  font-family: 'Urbanist', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #CE4FCD;
  margin-bottom: 3px;
  letter-spacing: 0.03em;
}

.neona-prax-text {
  background: rgba(206, 79, 205, 0.08) !important;
  color: #e5e7eb !important;
  border-left: 2px solid rgba(206, 79, 205, 0.4);
}

.neona-prax-text strong {
  color: #CE4FCD !important;
}

/* === Thinking Indicator === */
.neona-thinking {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  align-self: flex-start;
}

.neona-thinking-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  animation: neona-think-pulse 1.5s ease-in-out infinite;
}

@keyframes neona-think-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.neona-thinking-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.neona-thinking-label {
  font-family: 'Urbanist', sans-serif;
  font-size: 12px;
  color: #CE4FCD;
  font-style: italic;
  transition: opacity 0.5s ease;
  min-width: 160px;
}

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

.neona-thinking-dot {
  width: 5px;
  height: 5px;
  background: #CE4FCD;
  border-radius: 50%;
  animation: neona-bounce 1.2s infinite;
}

.neona-thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.neona-thinking-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes neona-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* No streaming cursor — typewriter effect is sufficient */

/* === Term Links in Messages === */
.neona-term-link {
  color: #CE4FCD;
  text-decoration: none;
  border-bottom: 1px dotted rgba(206, 79, 205, 0.4);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.neona-term-link:hover {
  color: #e070df;
  border-bottom-color: rgba(206, 79, 205, 0.8);
}

/* === Page Highlight Animation (when scrolled to from Neona) === */
@keyframes neona-highlight-pulse {
  0% { box-shadow: 0 0 0 0 rgba(206, 79, 205, 0.5); }
  40% { box-shadow: 0 0 0 6px rgba(206, 79, 205, 0.25); }
  70% { box-shadow: 0 0 0 10px rgba(206, 79, 205, 0.1); }
  100% { box-shadow: 0 0 0 0 rgba(206, 79, 205, 0); }
}

.neona-highlight {
  animation: neona-highlight-pulse 1.1s ease-out 2;
  outline: 2px solid rgba(206, 79, 205, 0.5);
  outline-offset: 4px;
  border-radius: 12px;
  transition: outline 0.3s ease;
}

/* === Input Area === */
.neona-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.neona-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 9px 14px;
  font-family: 'Urbanist', sans-serif;
  font-size: 13.5px;
  color: #e5e7eb;
  outline: none;
  resize: none;
  min-height: 38px;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color 0.15s;
}

.neona-input::placeholder {
  color: #6b7280;
}

.neona-input:focus {
  border-color: rgba(206, 79, 205, 0.4);
}

.neona-send {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #CE4FCD, #B22DB1);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
}

.neona-send:disabled {
  opacity: 0.3;
  cursor: default;
}

.neona-send:not(:disabled):hover {
  transform: scale(1.06);
}

.neona-send:not(:disabled):active {
  transform: scale(0.94);
}

.neona-send svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: white;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* === Footer === */
.neona-footer {
  text-align: center;
  padding: 6px;
  font-family: 'Urbanist', sans-serif;
  font-size: 10px;
  color: #4b5563;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  flex-shrink: 0;
}

.neona-footer a {
  color: #CE4FCD;
  text-decoration: none;
}

/* === Pulse ring on bubble (first visit) === */
.neona-bubble-pulse {
  animation: neona-pulse-ring 2s ease-out 1;
}

@keyframes neona-pulse-ring {
  0% { box-shadow: 0 4px 24px rgba(206, 79, 205, 0.35), 0 0 0 0 rgba(206, 79, 205, 0.4); }
  70% { box-shadow: 0 4px 24px rgba(206, 79, 205, 0.35), 0 0 0 16px rgba(206, 79, 205, 0); }
  100% { box-shadow: 0 4px 24px rgba(206, 79, 205, 0.35), 0 0 0 0 rgba(206, 79, 205, 0); }
}

/* === Mobile === */
@media (max-width: 480px) {
  .neona-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .neona-panel.neona-open ~ .neona-bubble {
    display: none;
  }

  .neona-bubble {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .neona-greeting {
    right: 16px;
    bottom: 84px;
    max-width: 200px;
  }

  .neona-nudge {
    right: 16px;
    bottom: 84px;
    max-width: 180px;
  }
}
