/* Chat Application Styles */

/* Thread replies animation */
.thread-replies {
  transition: opacity 0.2s ease-in-out;
}

.thread-replies.hidden {
  display: none;
}

/* Prevent action buttons from showing on media hover */
.group:hover .group-hover\:opacity-100 {
  opacity: 0;
}

/* Show action buttons only when hovering over message text area */
.group:hover .flex-1:hover ~ .group-hover\:opacity-100,
.group:hover .group-hover\:opacity-100:hover {
  opacity: 1;
}

/* Hide action buttons when message is being edited */
.editing .group-hover\:opacity-100 {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Smooth chevron rotation */
span[id^="thread-chevron-"] {
  display: inline-block;
  transition: transform 0.2s ease;
}

/* Message textarea styling */
#message_body {
  line-height: 1.5;
  overflow-y: hidden;
  transition: height 0.1s ease;
}

#message_body::-webkit-scrollbar {
  width: 4px;
}

#message_body::-webkit-scrollbar-track {
  background: #f1f5f9;
}

#message_body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

/* Dark mode message textarea scrollbar */
.dark #message_body::-webkit-scrollbar-track {
  background: #374151;
}

.dark #message_body::-webkit-scrollbar-thumb {
  background: #6b7280;
}

/* Mention styles */
.mention {
  color: #2563eb;
  background-color: #dbeafe;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mention:hover {
  background-color: #bfdbfe;
  color: #1d4ed8;
}

/* Dark mode mention styles */
.dark .mention {
  color: #60a5fa;
  background-color: #1e3a8a;
}

.dark .mention:hover {
  background-color: #1e40af;
  color: #93bbfc;
}

/* Channel item styles */
.channel-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.channel-item:hover {
  background-color: #f9fafb;
}

.dark .channel-item:hover {
  background-color: #374151;
}

/* Active channel item */
.channel-item.active {
  background-color: #FFF0F1;
  color: #FF6D75;
}

.dark .channel-item.active {
  background-color: rgba(255, 109, 117, 0.2);
  color: #FF6D75;
}

/* Messages container */
#messagesContainer {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

#messagesContainer::-webkit-scrollbar {
  width: 8px;
}

#messagesContainer::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

#messagesContainer::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

#messagesContainer::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Dark mode messages container scrollbar */
.dark #messagesContainer {
  scrollbar-color: #4b5563 #1f2937;
}

.dark #messagesContainer::-webkit-scrollbar-track {
  background: #1f2937;
}

.dark #messagesContainer::-webkit-scrollbar-thumb {
  background: #4b5563;
}

.dark #messagesContainer::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Emoji picker styles */
#emojiPicker {
  max-height: 300px;
  overflow-y: auto;
}

/* More menu styles */
#moreMenu {
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pinned messages container */
.pinned-messages-container {
  transition: all 0.3s ease;
}

/* Channel settings dropdown */
div[id^="channel-settings-"] {
  animation: fadeIn 0.15s ease-out;
}

/* File attachment hover effects */
.attachment-item:hover {
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dark .attachment-item:hover {
  border-color: #4b5563;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Image grid in messages */
.message-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
  max-width: 400px;
}

/* YouTube preview styles */
.youtube-preview {
  max-width: 400px;
  transition: all 0.2s ease;
}

.youtube-preview:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Link preview styles */
.link-preview {
  transition: all 0.2s ease;
}

.link-preview:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dark .link-preview:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Google Docs preview styles */
.google-docs-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
  max-width: 400px;
}

.google-docs-preview:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  transform: translateY(-1px);
}

.dark .google-docs-preview {
  background-color: #1f2937;
  border-color: #374151;
}

.dark .google-docs-preview:hover {
  background-color: #374151;
  border-color: #4b5563;
}

/* Message input area */
.message-input-container {
  border-top: 1px solid #e5e7eb;
  background-color: #ffffff;
}

.dark .message-input-container {
  border-top-color: #374151;
  background-color: #1f2937;
}

/* Reply indicator */
.reply-indicator {
  background-color: #f3f4f6;
  border-left: 3px solid #FF6D75;
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 0.25rem;
}

.dark .reply-indicator {
  background-color: #374151;
}

/* Thread panel styles */
#threadPanel {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Note modal styles */
.note-item {
  transition: all 0.2s ease;
}

.note-item:hover {
  background-color: #f9fafb;
  transform: translateX(4px);
}

.dark .note-item:hover {
  background-color: #374151;
}

/* Shared message styles */
.shared-message-container {
  background: linear-gradient(to right, #f9fafb, #f3f4f6);
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
}

.dark .shared-message-container {
  background: linear-gradient(to right, #1f2937, #111827);
  border-color: #374151;
}

.shared-message-header {
  background-color: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.5rem 1rem;
}

.dark .shared-message-header {
  background-color: #374151;
  border-bottom-color: #4b5563;
}

/* Reaction tooltip styles */
.reaction-tooltip {
  background-color: #111827;
  color: #f3f4f6;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 200px;
  max-height: 150px;
  overflow-y: auto;
}

.reaction-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #111827;
}

/* Member selection modal */
.member-checkbox:checked {
  background-color: #FF6D75;
  border-color: #FF6D75;
}

.member-checkbox:focus {
  ring-color: #FF6D75;
}

/* Channel form navigation */
.channel-form-step {
  transition: all 0.3s ease;
}

.channel-form-step.hidden {
  opacity: 0;
  transform: translateX(-20px);
}

/* Loading states */
.message-loading {
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* Favorite button animation */
.favorite-btn {
  transition: all 0.2s ease;
}

.favorite-btn:hover {
  transform: scale(1.1);
}

/* Unread message indicator */
.unread-indicator {
  background-color: #FF6D75;
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
  min-width: 1.25rem;
  text-align: center;
}

/* Message hover effects */
.message-wrapper {
  transition: background-color 0.15s ease;
}

.message-wrapper:hover {
  background-color: #f9fafb;
}

.dark .message-wrapper:hover {
  background-color: #1f2937;
}

/* Reply message styles */
.reply-message {
  border-left: 2px solid rgba(255, 109, 117, 0.3);
  padding-left: 1rem;
}

/* Edited message indicator */
.edited-indicator {
  color: #9ca3af;
  font-size: 0.75rem;
  font-style: italic;
}

/* Pinned message indicator */
.pinned-indicator {
  color: #f59e0b;
  font-size: 1rem;
}

/* File icon styles */
.file-icon {
  font-size: 2rem;
  line-height: 1;
}

/* Image loading placeholder */
.image-loading {
  background-color: #f3f4f6;
  animation: pulse 1.5s ease-in-out infinite;
}

.dark .image-loading {
  background-color: #374151;
}

/* Search results highlight */
.search-highlight {
  background-color: #fef3c7;
  color: #92400e;
  padding: 0 0.125rem;
  border-radius: 0.125rem;
}

.dark .search-highlight {
  background-color: #78350f;
  color: #fef3c7;
}

/* Empty state styles */
.empty-state {
  color: #9ca3af;
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state-icon {
  font-size: 3rem;
  opacity: 0.5;
  margin-bottom: 1rem;
}

/* Notification badge */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: #ef4444;
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.25rem;
  border-radius: 9999px;
  min-width: 1rem;
  text-align: center;
}