/**
 * Little Social - Thread / Conversation View Component
 * Renders conversation trees with ancestor connector lines,
 * highlighted focus posts, inline reply boxes, and descendant replies.
 */

.thread-container {
  display: flex;
  flex-direction: column;
}

/* Ancestor & Descendant Status Items */
.thread-item {
  position: relative;
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--surface-card);
  transition: background-color var(--transition-fast);
}

.thread-item:hover {
  background-color: var(--surface-card-hover);
}

/* Vertical Thread Connector Lines */
.thread-line {
  position: absolute;
  top: 64px;
  bottom: 0;
  left: calc(var(--space-4) + 21px); /* Centers line under the 44px avatar */
  width: 2px;
  background-color: var(--border-color);
  z-index: 1;
}

/* Focused / Main Status in Thread */
.thread-focused-status {
  padding: var(--space-4);
  background-color: var(--surface-card);
  border-block: 2px solid var(--accent-subtle);
  position: relative;
  z-index: 2;
}

.thread-focused-status .status-avatar {
  width: 52px;
  height: 52px;
}

.thread-focused-status .status-content {
  font-size: var(--text-lg);
  line-height: 1.6;
  margin-block: var(--space-3);
}

.thread-focused-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-3);
  border-block: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-block: var(--space-2);
}

.thread-stats-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.thread-stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.thread-stat-number {
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

/* Inline Reply Composer in Thread */
.thread-inline-reply {
  padding: var(--space-3) var(--space-4);
  background-color: var(--surface-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.thread-inline-reply-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
}

.thread-reply-input-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Descendants Indentation */
.thread-descendant-group {
  display: flex;
  flex-direction: column;
}

.thread-descendant-group .thread-item {
  border-bottom: 1px solid var(--border-subtle);
}

.thread-descendant-nested {
  margin-left: var(--space-6);
  border-left: 2px solid var(--border-subtle);
}

/* Focused status author row and actions */
.thread-focused-author {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-2);
}

.thread-focused-author .badge {
  margin-left: auto;
}

.thread-focused-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

/* Reply depth beyond the first level, capped so deep threads stay readable */
.thread-descendant-nested {
  margin-left: calc(var(--space-6) * min(var(--depth, 1), 4));
}

@container column (max-width: 380px) {
  .thread-descendant-nested {
    margin-left: calc(var(--space-3) * min(var(--depth, 1), 4));
  }
}

.thread-focused-author .status-display-name {
  font-size: var(--text-md);
}

.thread-stats-row {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.thread-focused-actions .thread-stats-row {
  padding-bottom: 0;
  border-bottom: none;
}

.thread-stat-label {
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.thread-focused-action-bar {
  max-width: 100%;
  justify-content: space-around;
  padding-top: var(--space-3);
}

/* Looks like an input, opens the composer dialog */
.thread-reply-prompt {
  flex: 1;
  justify-content: flex-start;
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  font-weight: var(--font-regular);
  color: var(--text-muted);
  background-color: var(--surface-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  text-align: left;
}

.thread-reply-prompt:hover {
  border-color: var(--border-focus);
  color: var(--text-secondary);
}
