/**
 * Reddit-inspired Forum UI for Pond
 * Styles existing Drupal forum elements with modern Reddit aesthetics
 */

:root {
  --pond-upvote: #FF4500;
  --pond-downvote: #7193FF;
  --pond-text-primary: #1A1A1B;
  --pond-text-secondary: #787C7E;
  --pond-text-muted: #878A8C;
  --pond-bg-primary: #FFFFFF;
  --pond-bg-secondary: #F6F7F8;
  --pond-border: #E0E0E0;
  --pond-border-hover: #898989;
  --pond-link: #0079D3;
  --pond-success: #46D160;
}

/* ============================================
   Forum Post Card Layout
   ============================================ */

.node--type-forum {
  background: var(--pond-bg-primary);
  border: 1px solid var(--pond-border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: block;
  transition: border-color 0.15s ease;
}

.node--type-forum:hover {
  border-color: var(--pond-border-hover);
}

/* Main content area */
.node--type-forum > .node__content,
.node--type-forum > .content {
  padding: 0;
}

/* ============================================
   Vote Widget - Reddit Style
   ============================================ */

.forum-vote-widget {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  min-width: 40px;
  padding: 8px 4px;
}

.forum-vote-widget .vote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 4px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--pond-text-muted);
  transition: color 0.1s ease, background 0.1s ease;
}

.forum-vote-widget .vote-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.forum-vote-widget .vote-btn.vote-up:hover,
.forum-vote-widget .vote-btn.vote-up.active {
  color: var(--pond-upvote);
  background: rgba(255, 69, 0, 0.1);
}

.forum-vote-widget .vote-btn.vote-down:hover,
.forum-vote-widget .vote-btn.vote-down.active {
  color: var(--pond-downvote);
  background: rgba(113, 147, 255, 0.1);
}

.forum-vote-widget .vote-btn svg {
  width: 20px;
  height: 20px;
}

.forum-vote-widget .vote-score {
  font-size: 13px;
  font-weight: 700;
  color: var(--pond-text-primary);
  min-width: 20px;
  text-align: center;
  padding: 2px 0;
  line-height: 1;
}

/* Score colors based on state */
.forum-vote-widget[data-user-vote="up"] .vote-score {
  color: var(--pond-upvote);
}

.forum-vote-widget[data-user-vote="down"] .vote-score {
  color: var(--pond-downvote);
}

/* ============================================
   Post Header / Meta (Author, Date, Forum)
   ============================================ */

.node--type-forum .node__meta,
.node--type-forum .submitted,
.node--type-forum .field--name-uid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--pond-text-muted);
  margin-bottom: 8px;
  flex-direction: row;
}

/* Author link styling */
.node--type-forum .node__meta a,
.node--type-forum .submitted a,
.node--type-forum .username {
  color: var(--pond-text-secondary);
  text-decoration: none;
  font-weight: 500;
}

.node--type-forum .node__meta a:hover,
.node--type-forum .submitted a:hover,
.node--type-forum .username:hover {
  text-decoration: underline;
}

/* User picture / avatar - single instance */
.node--type-forum .user-picture img,
.node--type-forum img.user-picture {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
}

/* Hide duplicate avatars if any appear */
.node--type-forum .user-picture ~ .user-picture,
.node--type-forum .field--name-user-picture ~ .field--name-user-picture {
  display: none;
}

/* ============================================
   Post Title
   ============================================ */

.node--type-forum h2,
.node--type-forum .node__title,
.node--type-forum .field--name-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--pond-text-primary);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.node--type-forum h2 a,
.node--type-forum .node__title a {
  color: inherit;
  text-decoration: none;
}

.node--type-forum h2 a:hover,
.node--type-forum .node__title a:hover {
  text-decoration: underline;
}

.node--type-forum h2 a:visited,
.node--type-forum .node__title a:visited {
  color: #5a5a5b;
}

/* ============================================
   Post Body Content
   ============================================ */

.node--type-forum .field--name-body,
.node--type-forum .node__content .field--type-text-with-summary {
  font-size: 14px;
  line-height: 1.6;
  color: var(--pond-text-primary);
  margin-bottom: 12px;
}

/* ============================================
   Recommend Widget
   ============================================ */

.forum-recommend-widget {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 20px;
  background: var(--pond-bg-secondary);
  font-size: 12px;
  margin-right: 8px;
}

.forum-recommend-widget .recommend-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--pond-border);
  background: var(--pond-bg-primary);
  border-radius: 16px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--pond-text-secondary);
  transition: all 0.15s ease;
}

.forum-recommend-widget .recommend-btn:hover {
  border-color: var(--pond-link);
  color: var(--pond-link);
}

.forum-recommend-widget .recommend-btn.active {
  background: var(--pond-link);
  border-color: var(--pond-link);
  color: white;
}

.forum-recommend-widget .recommend-count {
  color: var(--pond-text-muted);
  font-size: 11px;
}

.forum-recommend-widget .promoted-badge {
  background: var(--pond-success);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

/* ============================================
   Report Widget
   ============================================ */

.forum-report-widget {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

.forum-report-widget .report-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--pond-text-muted);
  transition: background 0.15s ease;
}

.forum-report-widget .report-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--pond-text-secondary);
}

.forum-report-widget .report-submitted {
  font-size: 12px;
  color: var(--pond-text-muted);
  font-style: italic;
}

/* Report Modal */
.forum-report-widget .report-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.forum-report-widget .report-modal-content {
  background: white;
  padding: 24px;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
}

.forum-report-widget .report-modal-content h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
}

.forum-report-widget .report-option {
  display: block;
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 4px;
  cursor: pointer;
}

.forum-report-widget .report-option:hover {
  background: var(--pond-bg-secondary);
}

.forum-report-widget .report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.forum-report-widget .report-cancel,
.forum-report-widget .report-submit {
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.forum-report-widget .report-cancel {
  background: var(--pond-bg-secondary);
  color: var(--pond-text-secondary);
}

.forum-report-widget .report-submit {
  background: var(--pond-link);
  color: white;
}

.forum-report-widget .report-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   Post Actions Row (Comments, Share, etc.)
   ============================================ */

.node--type-forum .links,
.node--type-forum .node__links {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid #CCCCCC;
  margin-top: 16px;
}

.node--type-forum .links li,
.node--type-forum .node__links li {
  list-style: none;
  margin: 0;
}

.node--type-forum .links a,
.node--type-forum .node__links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pond-text-muted);
  text-decoration: none;
  transition: background 0.15s ease;
}

.node--type-forum .links a:hover,
.node--type-forum .node__links a:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ============================================
   Comments Section
   ============================================ */

.comment {
  display: block;
  background: var(--pond-bg-primary);
  border: 1px solid var(--pond-border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.comment > .forum-vote-widget {
  order: -1;
  flex-shrink: 0;
}

.comment .comment__content {
  flex: 1;
  min-width: 0;
}

/* Comment threading indent */
.indented {
  margin-left: 24px;
  padding-left: 16px;
  border-left: 2px solid #EDEFF1;
}

/* ============================================
   Forum List / Topic List
   ============================================ */

.view-forum-topics .views-row,
.forum-topic-list .forum-topic {
  background: var(--pond-bg-primary);
  border: 1px solid var(--pond-border);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: border-color 0.15s ease;
}

.view-forum-topics .views-row:hover,
.forum-topic-list .forum-topic:hover {
  border-color: var(--pond-border-hover);
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 768px) {
  .node--type-forum {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-bottom: 8px;
  }

  .node--type-forum > .forum-vote-widget {
    border-radius: 0;
    padding: 6px 2px;
    min-width: 36px;
  }

  .forum-vote-widget .vote-btn {
    width: 24px;
    height: 24px;
  }

  .forum-vote-widget .vote-btn svg {
    width: 16px;
    height: 16px;
  }

  .forum-vote-widget .vote-score {
    font-size: 12px;
  }

  .forum-recommend-widget {
    flex-wrap: wrap;
    padding: 4px 8px;
  }

  .indented {
    margin-left: 12px;
    padding-left: 12px;
  }

  .comment {
  display: block;
    padding: 10px 12px;
  }
}


/* ============================================
   Inline Vote Widget in Action Row
   ============================================ */

.node__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #CCCCCC;
  margin-top: 16px;
}

.node__actions .links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.vote-inline {
  display: inline-flex;
  align-items: center;
}

.vote-inline .forum-vote-widget {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 0;
  min-width: auto;
}

.vote-inline .forum-vote-widget .vote-btn {
  width: 24px;
  height: 24px;
  padding: 2px;
}

.vote-inline .forum-vote-widget .vote-score {
  font-size: 12px;
  min-width: 16px;
  padding: 0 4px;
}

/* Force node meta to be inline */
.node--type-forum .node__meta * {
  display: inline !important;
}
.node--type-forum .node__meta {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
}
.node--type-forum .node__meta img {
  display: inline-block !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  vertical-align: middle !important;
}

/* Force vote widget in actions row to be horizontal */
.node__actions .vote-inline .forum-vote-widget,
.node__actions .forum-vote-widget {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 0 !important;
  min-width: auto !important;
}

.node__actions .vote-inline .forum-vote-widget .vote-btn,
.node__actions .forum-vote-widget .vote-btn {
  width: 20px !important;
  height: 20px !important;
  padding: 2px !important;
}

.node__actions .vote-inline .forum-vote-widget .vote-score,
.node__actions .forum-vote-widget .vote-score {
  font-size: 12px !important;
  padding: 0 2px !important;
}

/* Action row styling */
.node__actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  padding-top: 10px;
  border-top: 1px solid #ddd;
  margin-top: 12px;
  font-size: 12px;
  color: #787C7E;
}

.node__actions .action-link {
  color: #787C7E;
  text-decoration: none;
  font-weight: 600;
}

.node__actions .action-link:hover {
  text-decoration: underline;
}

.node__actions .action-separator {
  color: #ccc;
}

.node__actions .vote-inline {
  display: inline-flex !important;
  align-items: center !important;
}

.node__actions .vote-inline .forum-vote-widget {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 2px !important;
  padding: 0 !important;
}

.node__actions .vote-inline .forum-vote-widget .vote-btn {
  width: 18px !important;
  height: 18px !important;
  padding: 0 !important;
}

.node__actions .vote-inline .forum-vote-widget .vote-score {
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 0 4px !important;
}

/* Comment meta styling */
.comment__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.comment__meta-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--pond-text-muted);
}

.comment__meta-text .author-name {
  font-weight: 500;
  color: var(--pond-text-secondary);
}

.comment__date {
  color: var(--pond-text-muted);
}

/* Comment actions row */
.comment__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--pond-border);
  margin-top: 12px;
}

.comment__actions .vote-inline {
  display: inline-flex;
}

.comment__actions .action-separator {
  color: var(--pond-text-muted);
}

/* Comment author row styling */
.comment__author-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.comment__author-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--pond-text-muted);
}

.comment__author-info .author-name {
  font-weight: 500;
  color: var(--pond-text-secondary);
}
