/* ============================================
   PROMPT Band — Chat Widget Styles
   ============================================ */

/* Chat toggle button */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(139, 92, 246, 0.6);
  background: rgba(10, 10, 15, 0.9);
  color: #8b5cf6;
  cursor: pointer;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.chat-toggle:hover {
  border-color: rgba(139, 92, 246, 0.9);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
  transform: scale(1.05);
}

.chat-toggle.active {
  border-color: rgba(255, 0, 102, 0.6);
  color: #ff0066;
  box-shadow: 0 0 20px rgba(255, 0, 102, 0.2);
}

.chat-toggle svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Notification dot */
.chat-toggle .chat-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff0066;
  border: 2px solid #0a0a0f;
  animation: chatDotPulse 2s ease-in-out infinite;
}

@keyframes chatDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

.chat-toggle.active .chat-dot { display: none; }

/* Chat panel */
.chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  max-height: 520px;
  background: #0a0a0f;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  z-index: 9991;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 40px rgba(139, 92, 246, 0.1);
}

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

/* Header */
.chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(18, 18, 26, 0.8);
}

.chat-member-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.chat-member-info {
  flex: 1;
  min-width: 0;
}

.chat-member-name {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
  letter-spacing: 0.02em;
}

.chat-member-role {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.chat-close {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 18px;
  transition: color 0.2s;
}

.chat-close:hover { color: #e0e0e0; }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 340px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 2px;
}

/* Message bubbles */
.chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.assistant {
  align-self: flex-start;
  background: rgba(18, 18, 26, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #c8c8d4;
  border-bottom-left-radius: 4px;
}

.chat-message.user {
  align-self: flex-end;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: #d4d4e8;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .msg-sender {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  opacity: 0.6;
}

/* Typing indicator */
.chat-typing {
  display: none;
  align-self: flex-start;
  padding: 10px 14px;
  background: rgba(18, 18, 26, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.chat-typing.visible { display: flex; gap: 4px; align-items: center; }

.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.5);
  animation: chatTyping 1.4s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatTyping {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

/* Input area */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
  background: rgba(18, 18, 26, 0.5);
}

.chat-input {
  flex: 1;
  padding: 8px 12px;
  background: rgba(10, 10, 15, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 80px;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: rgba(139, 92, 246, 0.5);
}

.chat-input::placeholder { color: #555; }

.chat-send {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(139, 92, 246, 0.2);
  color: #8b5cf6;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #a78bfa;
}

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

.chat-send svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Loading state */
.chat-panel.loading .chat-messages::after {
  content: 'Connecting...';
  text-align: center;
  color: #555;
  font-size: 12px;
  padding: 20px;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .chat-panel {
    right: 8px;
    left: 8px;
    bottom: 80px;
    width: auto;
    max-height: 70vh;
  }

  .chat-toggle {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
}

/* Apply member color dynamically */
.chat-panel[data-member-color] .chat-member-indicator {
  background-color: var(--member-color);
  box-shadow: 0 0 8px var(--member-color);
}

.chat-panel[data-member-color] .chat-message.assistant {
  border-left: 2px solid var(--member-color);
}

.chat-panel[data-member-color] .chat-message.user {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.15);
}

.chat-panel[data-member-color] .chat-input:focus {
  border-color: var(--member-color);
}

.chat-panel[data-member-color] .chat-send {
  background: rgba(139, 92, 246, 0.15);
}

.chat-panel[data-member-color] .chat-typing span {
  background: var(--member-color);
}
