/* Global Chat Window */

.global-chat-window {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 400px;
  height: 500px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  z-index: 10100; /* Above tester toolbar (9998) and admin bar (9999) */
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.global-chat-window.hidden {
  transform: translateY(600px);
  opacity: 0;
  pointer-events: none;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border-bottom: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 16px 16px 0 0;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e0e7ff;
  font-size: 1rem;
  font-weight: 600;
}

.chat-title svg {
  width: 16px;
  height: 16px;
  color: #a5b4fc;
}

.chat-online-count {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 400;
  margin-left: 0.5rem;
  padding: 0.125rem 0.5rem;
  background: rgba(16, 185, 129, 0.2);
  border-radius: 8px;
}

.chat-close-btn {
  background: none;
  border: none;
  color: #a5b4fc;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.chat-close-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #fff;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.5);
  border-radius: 3px;
}

.chat-welcome {
  text-align: center;
  padding: 2rem 1rem;
  color: #94a3b8;
  font-size: 0.9rem;
}

.chat-message {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 0.75rem;
  animation: messageSlideIn 0.2s ease;
}

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

.chat-message.own-message {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  margin-left: 2rem;
}

.chat-message.system-message {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
  text-align: center;
  padding: 0.5rem;
}

.chat-message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.375rem;
}

.chat-username {
  color: #a5b4fc;
  font-size: 0.85rem;
  font-weight: 600;
}

.chat-timestamp {
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 400;
}

.chat-message-content {
  color: #e0e7ff;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.system-message .chat-message-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  color: #94a3b8;
  font-size: 0.8rem;
}

.system-message svg {
  width: 14px;
  height: 14px;
  color: #3b82f6;
}

.chat-input-container {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 0 0 16px 16px;
}

#chat-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  color: #e0e7ff;
  padding: 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

#chat-input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(0, 0, 0, 0.4);
}

#chat-input::placeholder {
  color: #64748b;
}

.chat-send-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: #fff;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
}

.chat-send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.chat-send-btn:active {
  transform: translateY(0);
}

.chat-send-btn svg {
  width: 20px;
  height: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .global-chat-window {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 10px;
    height: 400px;
  }

  .chat-message.own-message {
    margin-left: 1rem;
  }
}

@media (max-width: 480px) {
  .global-chat-window {
    height: 350px;
  }

  .chat-header {
    padding: 0.75rem 1rem;
  }

  .chat-title {
    font-size: 0.9rem;
  }

  .chat-online-count {
    display: none;
  }

  .chat-messages {
    padding: 0.75rem;
  }
}
