/* discussions.css - Discussion Threads Styling */
/* Version 1.0.0 */

.discussion-section {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.discussion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.discussion-title {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.discussion-count {
  font-size: 0.9rem;
  opacity: 0.7;
  font-weight: 400;
}

.discussion-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.discussion-sort label {
  font-size: 0.85rem;
  opacity: 0.8;
}

.discussion-sort select {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.discussion-sort select:hover {
  border-color: var(--primary);
}

/* Comment Composer */
.comment-composer {
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.comment-composer textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  transition: all 0.2s ease;
}

.comment-composer textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.comment-composer textarea::placeholder {
  color: var(--muted);
}

.comment-composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  gap: 1rem;
}

.comment-char-count {
  font-size: 0.75rem;
  opacity: 0.6;
}

.comment-auth-hint {
  font-size: 0.85rem;
  opacity: 0.7;
  padding: 0.75rem;
  text-align: center;
  background: rgba(139, 92, 246, 0.05);
  border-radius: 8px;
}

.comment-auth-hint a {
  color: var(--primary);
  text-decoration: underline;
}

/* Comments List */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.comment-empty {
  text-align: center;
  padding: 3rem 1rem;
  opacity: 0.6;
}

.comment-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.comment-empty-text {
  font-size: 0.95rem;
}

/* Individual Comment */
.comment {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.comment:hover {
  border-color: rgba(139, 92, 246, 0.3);
}

.comment.pinned {
  border-color: rgba(255, 215, 0, 0.4);
  background: rgba(255, 215, 0, 0.05);
}

.comment-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.8), rgba(59, 130, 246, 0.8));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.comment-meta {
  flex: 1;
  min-width: 0;
}

.comment-author {
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 0.5rem;
}

.comment-badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  background: rgba(139, 92, 246, 0.2);
  color: var(--primary);
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 4px;
  margin-right: 0.5rem;
  text-transform: uppercase;
}

.comment-time {
  font-size: 0.75rem;
  opacity: 0.6;
}

.comment-content {
  margin-bottom: 0.75rem;
  line-height: 1.6;
  font-size: 0.9rem;
  word-wrap: break-word;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.comment-action {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.comment-action:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--text);
}

.comment-action.upvoted {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: var(--primary);
}

.comment-action-icon {
  font-size: 1rem;
}

/* Replies */
.comment-replies {
  margin-top: 1rem;
  margin-left: 2.5rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(139, 92, 246, 0.2);
}

.comment-reply {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.reply-composer {
  margin-top: 0.75rem;
  animation: slideDown 0.2s ease;
}

.reply-composer textarea {
  width: 100%;
  min-height: 80px;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.reply-composer textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.reply-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pin indicator */
.comment-pin-icon {
  display: inline-block;
  margin-right: 0.5rem;
  color: rgba(255, 215, 0, 0.8);
  font-size: 0.9rem;
}

/* Mobile Collapsed View */
.discussion-section.collapsed .discussion-content {
  display: none;
}

.discussion-toggle {
  width: 100%;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  color: var(--text);
}

.discussion-toggle:hover {
  background: rgba(139, 92, 246, 0.05);
  border-color: rgba(139, 92, 246, 0.3);
}

.discussion-toggle-icon {
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.discussion-section:not(.collapsed) .discussion-toggle-icon {
  transform: rotate(180deg);
}

/* Responsive */
@media (max-width: 768px) {
  .discussion-section {
    padding: 1.5rem 0;
  }

  .discussion-toggle {
    display: flex !important; /* Show toggle on mobile */
  }

  .discussion-section.collapsed .discussion-header {
    display: none;
  }

  .discussion-title {
    font-size: 1.25rem;
  }

  .comment-replies {
    margin-left: 1rem;
  }

  .comment-reply {
    padding: 0.75rem;
  }

  .comment-avatar {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .discussion-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .comment-composer {
    padding: 1rem;
  }

  .comment-replies {
    margin-left: 0.5rem;
    padding-left: 0.5rem;
  }
}

/* Loading state */
.comments-loading {
  text-align: center;
  padding: 2rem;
  opacity: 0.6;
}

.comments-loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error state */
.comments-error {
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  text-align: center;
  color: #ef4444;
  font-size: 0.9rem;
}

/* Load More button */
.comment-load-more {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.comment-load-more button {
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.comment-load-more button:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}
