/* ==========================================================================
   Forum Styles (Clean, Mobile Responsive, Dark/Light Mode)
   ========================================================================== */

.forum-container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding-inline: 1rem;
}

@media (min-width: 768px) {
  .forum-container {
    padding-inline: 1.5rem;
  }
}

@media (min-width: 1200px) {
  .forum-container {
    padding-inline: 2rem;
  }
}

/* Category & Topic Headers */
.forum-header-card {
  border-radius: 18px;
  padding: 1.5rem;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.forum-header-flex {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

@media (min-width: 768px) {
  .forum-header-card {
    padding: 2rem;
  }
  .forum-header-flex {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.forum-header-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1 1 auto;
}

.forum-header-text {
  min-width: 0;
  flex: 1 1 auto;
}

.forum-header-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.25rem;
  word-break: normal;
  overflow-wrap: break-word;
}

.forum-header-text p {
  color: var(--muted, #64748b);
  font-size: 0.92rem;
  margin-bottom: 0;
  word-break: normal;
  overflow-wrap: break-word;
}

.forum-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Category cards on home page */
.forum-cat-card {
  border-radius: 16px;
  padding: 1.25rem;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
  position: relative;
}

.forum-cat-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.forum-cat-icon {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(99, 102, 241, 0.1));
  color: var(--primary, #3b82f6);
  border: 1px solid rgba(59, 130, 246, 0.2);
  flex-shrink: 0;
}

.forum-cat-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text, #1e293b);
  word-break: normal;
  overflow-wrap: break-word;
}

.forum-cat-desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted, #64748b);
  margin-bottom: 0.75rem;
  word-break: normal;
  overflow-wrap: break-word;
}

.forum-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted, #64748b);
  white-space: nowrap;
}

.forum-latest-bar {
  background: rgba(148, 163, 184, 0.08);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.forum-latest-title {
  font-weight: 600;
  color: var(--text, #1e293b);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.forum-latest-title:hover {
  color: var(--primary, #3b82f6);
  text-decoration: underline;
}

.forum-latest-meta {
  color: var(--muted, #64748b);
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 0.78rem;
}

/* Topic row in category list */
.forum-topic-row {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  transition: background-color 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .forum-topic-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.forum-topic-content {
  flex: 1 1 auto;
  min-width: 0;
}

.forum-topic-side {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

@media (min-width: 768px) {
  .forum-topic-side {
    justify-content: flex-end;
  }
}

.forum-topic-row:hover {
  background-color: rgba(148, 163, 184, 0.05);
}

.forum-topic-row:last-child {
  border-bottom: none;
}

.forum-topic-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #1e293b);
  text-decoration: none;
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: break-word;
}

.forum-topic-title:hover {
  color: var(--primary, #3b82f6);
}

/* Post card inside thread */
.forum-post-card {
  border-radius: 16px;
  padding: 1.25rem;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

@media (min-width: 768px) {
  .forum-post-card {
    padding: 1.75rem;
  }
}

.forum-post-body {
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--text, #1e293b);
  word-break: normal;
  overflow-wrap: break-word;
}

.forum-post-body pre,
.forum-post-body code {
  max-width: 100%;
  overflow-x: auto;
  background: rgba(148, 163, 184, 0.12);
  border-radius: 6px;
}

.forum-post-body pre {
  padding: 1rem;
}

.forum-sidebar-card {
  border-radius: 16px;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  padding: 1.25rem;
}

.forum-recent-item {
  padding-block: 0.65rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.forum-recent-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.forum-recent-title {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text, #1e293b);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.forum-recent-title:hover {
  color: var(--primary, #3b82f6);
}

/* Dark mode tweaks */
[data-bs-theme="dark"] .forum-header-card,
[data-bs-theme="dark"] .forum-cat-card,
[data-bs-theme="dark"] .forum-post-card,
[data-bs-theme="dark"] .forum-sidebar-card {
  background: var(--card, #152237);
  border-color: var(--border, #2d3e56);
}

[data-bs-theme="dark"] .forum-cat-icon {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.35);
  color: #8ab8ff;
}

[data-bs-theme="dark"] .forum-latest-bar {
  background: #101c2e;
}

[data-bs-theme="dark"] .forum-latest-title {
  color: var(--text, #edf3fc);
}

[data-bs-theme="dark"] .forum-meta-badge {
  background: #101c2e;
  color: var(--muted, #afbed2);
}

[data-bs-theme="dark"] .forum-topic-row {
  border-color: var(--border, #2d3e56);
}

[data-bs-theme="dark"] .forum-topic-row:hover {
  background-color: rgba(45, 62, 86, 0.3);
}

[data-bs-theme="dark"] .forum-recent-item {
  border-color: var(--border, #2d3e56);
}
