/* Chat Message Styles */
.chat-message {
  background-color: var(--bg-tertiary);
  border-radius: 8px;
  padding: 0.75em;
  margin-bottom: 0.75em;
  border: 1px solid var(--border-color);
  transition: border-color 0.2s;
}

.chat-message:hover {
  border-color: #3A3F50;
}

.chat-msg-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.4em;
  gap: 0.5em;
}

.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-author {
  font-weight: 600;
  color: var(--accent-primary);
  margin-right: 0.5em;
  font-size: 0.9em;
}

.chat-time {
  color: #666;
  font-size: 0.8em;
  margin-left: auto;
}

/* Group of messages from same author */
.chat-text-group {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

/* Wrapper for individual message and its reactions */
.chat-message-wrapper {
  display: flex;
  flex-direction: column;
}

.chat-text {
  color: var(--text-secondary);
  line-height: 1.4;
  word-wrap: break-word;
  font-size: 0.9em;
}

.chat-mention {
  color: var(--accent-primary);
  background-color: rgba(126, 196, 255, 0.1);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-weight: 500;
}

/* Chat Input Styles */
.chat-search {
  width: 100%;
  padding: 0.6em 1em;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: #161a24;
  color: white;
  box-sizing: border-box;
  margin-bottom: 1em;
}

.chat-container {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1em;
  background-color: rgba(22, 26, 36, 0.5);
}

.chat-input-container {
  display: flex;
  gap: 0.75em;
  margin-top: 1em;
}

.chat-message-input {
  flex: 1;
  padding: 0.6em;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: #161a24;
  color: white;
  font-size: 0.9em;
}

.chat-message-input:focus,
.chat-search:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Chat Controls */
.chat-controls {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
}

/* League Info in Chat */
.chat-league-info {
  display: flex;
  align-items: center;
  gap: 1em;
  flex: 1;
}

.chat-league-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
}

.chat-league-name {
  color: var(--accent-primary);
  font-weight: bold;
}

/* My Message Variant */
.chat-message.my-message {
  background-color: rgba(126, 196, 255, 0.1);
  border-color: rgba(126, 196, 255, 0.3);
}

.chat-message.my-message .chat-author {
  color: #00dfc4;
}

/* Empty State */
.setup-card {
  background-color: var(--bg-secondary);
  border-radius: 12px;
  padding: 2em;
  text-align: center;
}

.setup-card h2 {
  color: var(--accent-primary);
  margin-bottom: 1em;
}

/* Transaction Embeds */
.transaction-embed {
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-primary);
  border-radius: 6px;
  margin-top: 0.5em;
  overflow: hidden;
}

.transaction-header {
  padding: 0.5em 0.75em;
  background: var(--bg-tertiary);
  font-weight: 600;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.transaction-body {
  padding: 0.75em;
  position: relative;
}

.transaction-row {
  display: flex;
  align-items: center;
  gap: 0.75em;
  margin-bottom: 0.5em;
}

.transaction-row:last-child {
  margin-bottom: 0;
}

.transaction-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2em;
  border-radius: 4px;
}

.transaction-row.add .transaction-icon {
  color: var(--accent-success);
  background: rgba(0, 223, 196, 0.1);
}

.transaction-row.drop .transaction-icon {
  color: var(--accent-danger);
  background: rgba(244, 67, 54, 0.1);
}

.transaction-row .player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.transaction-row .player-info {
  flex: 1;
}

.transaction-row .player-name {
  font-weight: 600;
  font-size: 0.9em;
  color: var(--text-primary);
}

.transaction-row .player-meta {
  font-size: 0.8em;
  color: var(--text-muted);
}

.transaction-bid {
  position: absolute;
  top: 0.75em;
  right: 0.75em;
  background: var(--bg-tertiary);
  padding: 0.25em 0.75em;
  border-radius: 20px;
  font-weight: 600;
  font-size: 1.1em;
  color: var(--accent-success);
  border: 2px solid rgba(0, 223, 196, 0.3);
}

/* Multiple transaction embeds */
.transaction-embed-container {
  display: flex;
  flex-direction: column;
  gap: 0.75em;
  margin-top: 0.5em;
}

.transaction-bid-inline {
  margin-left: auto;
  background: var(--bg-tertiary);
  padding: 0.2em 0.6em;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9em;
  color: var(--accent-success);
  border: 1px solid rgba(0, 223, 196, 0.3);
}

/* GIF and Image attachments */
.chat-gif-container,
.chat-image-container {
  margin-top: 0.5em;
  border-radius: 8px;
  overflow: hidden;
}

.chat-gif,
.chat-image {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.chat-gif {
  max-height: 200px;
  width: auto;
}

.chat-image {
  max-height: 300px;
  width: auto;
}

/* Reactions */
.chat-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em;
  margin-top: 0.25em;
}

.chat-reaction {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.25em 0.5em;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.85em;
  color: var(--text-secondary);
  min-height: 24px;
}

.chat-reaction.my-reaction {
  background: rgba(126, 196, 255, 0.2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.reaction-emoji {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.reaction-count {
  font-size: 0.9em;
  font-weight: 600;
}

.reaction-text {
  font-size: 0.75em;
  text-transform: capitalize;
  color: var(--text-muted);
}

.chat-reaction.more {
  color: var(--text-muted);
  font-style: italic;
}

.reaction-emoji-fallback {
  font-size: 0.8em;
  color: var(--text-muted);
}

/* System Messages */
.chat-message.system-message {
  background: linear-gradient(135deg, rgba(126, 196, 255, 0.05), rgba(0, 223, 196, 0.05));
  border-color: rgba(126, 196, 255, 0.2);
}

.chat-message.system-message .chat-msg-header {
  gap: 0.5em;
}

.chat-message.system-message .system-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.chat-message.system-message .chat-text {
  font-style: italic;
  color: var(--text-muted);
}


.trade-block-badge {
  margin-left: auto;
  background: linear-gradient(135deg, var(--accent-warning), var(--accent-primary));
  padding: 0.3em 0.8em;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85em;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.player-depth {
  font-size: 0.75em;
  color: var(--accent-warning);
  margin-top: 0.2em;
}
.loading-more {
  text-align: center;
  padding: 1em;
  color: var(--text-muted);
  font-size: 0.9em;
  font-style: italic;
}

.chat-message:hover .message-hover-actions {
    display: flex !important;
    opacity: 1 !important;
}

.message-hover-actions {
    flex-shrink: 0;
}

.message-hover-actions button:hover {
    background: var(--border-color) !important;
    border-color: var(--accent-primary) !important;
    color: var(--accent-primary) !important;
}