/* GoonWall v5 - Chat Styles */

#chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

/* Custom scrollbar for chat */
#chat-messages::-webkit-scrollbar {
  width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
  background: var(--background-color);
}

#chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.chat-message {
  word-wrap: break-word;
  padding: 6px 8px;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.02);
  border-left: 2px solid transparent;
  position: relative;
}

.chat-message:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.message-header-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0; /* Allow text to truncate */
}

.message-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.message-timestamp {
  font-size: 11px;
  color: #999;
  font-weight: normal;
  white-space: nowrap;
}

.chat-message .username {
  color: var(--accent-color);
  font-weight: bold;
  font-size: 13px;
}

.chat-message .text {
  font-size: 14px;
  line-height: 1.4;
}

/* Role-based message styling */
.moderator-message {
  border-left-color: #00ffff;
}

.moderator-message .username {
  color: #00ffff; /* Cyan for mods */
}

.premium-message {
  border-left-color: #ffd700;
}

.premium-message .username {
  color: #ffd700; /* Gold for premium */
}

/* Role badges */
.role-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 2px;
  margin-left: 4px;
  font-weight: bold;
  text-transform: uppercase;
}

.moderator-badge {
  background-color: #00ffff;
  color: #000;
}

.premium-badge {
  background-color: #ffd700;
  color: #000;
}

/* Delete button */
.delete-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 2px;
  opacity: 0;
  transition: all 0.2s ease;
}

.chat-message:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background-color: #ff4444;
  color: white;
}

/* GIF/Image messages */
.gif-message {
  background-color: rgba(255, 255, 255, 0.05);
}

.gif-container {
  margin-top: 6px;
  border-radius: 4px;
  overflow: hidden;
}

.gif-container img, .gif-container video {
  max-width: 100%;
  max-height: 200px;
  display: block;
  border-radius: 4px;
}

.chat-gif {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.chat-gif:hover {
  opacity: 0.8;
}

#chat-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

#chat-input {
  flex-grow: 1;
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  color: var(--primary-text);
  padding: 12px;
  font-family: var(--font-main);
  border-radius: 4px;
  font-size: 14px;
}

#chat-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(224, 17, 95, 0.2);
}

#chat-input::placeholder {
  color: #666;
}

#chat-form button {
  background-color: var(--accent-color);
  border: none;
  color: white;
  padding: 12px 20px;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: bold;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

#chat-form button:hover {
  background-color: #c00d52;
}

#chat-form button:active {
  transform: translateY(1px);
}

/* Mobile chat tab layout */
@media screen and (max-width: 768px) {
  #chat-tab.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 10px;
    gap: 10px;
  }
  
  #chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 0; /* Remove any margin that could cause spacing issues */
  }
  
  #chat-form {
    flex-shrink: 0;
    margin-top: 0; /* Remove margin since we use gap on parent */
    background-color: var(--surface-color);
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    border-radius: 4px;
  }
  
  .message-timestamp {
    font-size: 10px;
  }
  
  .message-header-right {
    gap: 6px;
  }
}

/* Smaller mobile devices */
@media screen and (max-width: 480px) {
  #chat-tab.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 8px;
    gap: 8px;
  }
  
  #chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 0;
    padding: 5px;
    gap: 5px;
  }
  
  #chat-form {
    flex-shrink: 0;
    margin-top: 0;
    background-color: var(--surface-color);
    padding: 6px 0;
    border-top: 1px solid var(--border-color);
    border-radius: 4px;
  }
}
