/* Chat-specific styles */
/* Make chat view fill the output container like CombatLog */
#chatOutput.output {
  display: none;
}

#chatOutput.output.active {
  display: flex;
  flex-direction: column;
}

.chat-messages {
  /* Fill remaining space in the output container */
  flex: 1 1 auto;
  min-height: 0; /* allow flex child to shrink for scrolling */
  overflow-y: auto;
  padding: 10px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  margin-bottom: 10px;
  position: relative;
}

.chat-message {
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  word-wrap: break-word;
  transition: all 0.2s ease;
}

.chat-message.own {
  background: rgba(96, 165, 250, 0.3);
  margin-left: 20%;
}

.chat-message.other {
  background: rgba(255, 255, 255, 0.1);
  margin-right: 20%;
}

.chat-message.system {
  background: rgba(255, 193, 7, 0.2);
  text-align: center;
  font-style: italic;
  margin-left: 10%;
  margin-right: 10%;
}

.chat-message.error {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fee2e2;
  text-align: center;
  font-weight: 600;
}

.chat-message.party {
  border: 1px solid rgba(96, 165, 250, 0.45);
  background: rgba(96, 165, 250, 0.22);
}

/* Whisper messages appear in pink */
.chat-message.whisper {
  background: rgba(236, 72, 153, 0.25); /* pink-500 @ 25% */
  border: 1px solid rgba(236, 72, 153, 0.4);
}

.chat-message .message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.chat-message .character-name {
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: all 0.2s ease;
}

.chat-message .character-name:hover {
  color: #63b3ed;
  text-decoration-color: #63b3ed;
}

.chat-message .timestamp {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
}

.chat-message .message-content {
  color: #ffffff;
  line-height: 1.4;
}

.chat-input-container {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input {
  flex: 1;
  display: flex;
  gap: 8px;
}

#chatMessageInput {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

#chatMessageInput:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.8);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

#chatMessageInput::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.chat-send-btn {
  background: rgba(96, 165, 250, 0.8);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  font-weight: 500;
}

.chat-send-btn:hover {
  background: rgba(96, 165, 250, 1);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(96, 165, 250, 0.3);
}

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

.chat-send-btn:disabled {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.chat-scope-selector select {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 8px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chat-scope-selector select:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.8);
  background: rgba(255, 255, 255, 0.15);
}

.chat-scope-selector select.chat-scope-disabled {
  cursor: not-allowed;
  opacity: 0.6;
  border-style: dashed;
}

.chat-scope-selector select.chat-scope-disabled:focus {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.chat-scope-selector select option {
  background: #333;
  color: white;
}

.chat-filters {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin: -4px 0 10px;
}

.chat-filter-btn {
  background: rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 14px;
  padding: 4px 11px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-filter-btn:hover {
  border-color: rgba(96, 165, 250, 0.7);
  color: #bae6fd;
}

.chat-filter-btn.active {
  background: rgba(96, 165, 250, 0.35);
  border-color: rgba(96, 165, 250, 0.8);
  color: white;
}

/* Auto-scroll indicator */
.auto-scroll-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 193, 7, 0.9);
  color: #000;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  z-index: 10;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Context menu for player names */
.player-context-menu {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 150px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.player-context-menu-item {
  padding: 8px 16px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.player-context-menu-item:hover {
  background: rgba(96, 165, 250, 0.3);
  color: #63b3ed;
}

.player-context-menu-item:first-child {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.player-context-menu-item:last-child {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* Chat connection status */
.chat-connection-status {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  z-index: 10;
}

.chat-connection-status.connected {
  background: rgba(34, 197, 94, 0.9);
  color: white;
}

.chat-connection-status.disconnected {
  background: rgba(239, 68, 68, 0.9);
  color: white;
}

.chat-connection-status.connecting {
  background: rgba(255, 193, 7, 0.9);
  color: #000;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .chat-messages {
    height: 250px;
  }
  
  .chat-input-container {
    flex-direction: column;
    gap: 8px;
  }
  
  .chat-input {
    width: 100%;
  }
  
  .chat-scope-selector {
    width: 100%;
  }
  
  .chat-scope-selector select {
    width: 100%;
  }
  
  .chat-message.own {
    margin-left: 10%;
  }
  
  .chat-message.other {
    margin-right: 10%;
  }
  
  .chat-filters {
    justify-content: center;
  }
}
