body {
  font-family: "Sarabun", Arial, sans-serif;
  background: #f5f7fb;
  margin: 0;
  color: #1a1a2e;
}

.header-compact {
  padding: 20px;
}

.header {
  background: linear-gradient(90deg, #2c5cc5, #4aa3ff);
  color: white;
  padding: 30px 20px;
  box-shadow: 0 4px 12px rgba(44, 92, 197, 0.15);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
}

.header h1 {
  margin: 0 0 10px 0;
  font-size: 28px;
}

.header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
}

.back-link a {
  color: white;
  text-decoration: none;
  font-size: 14px;
  opacity: 0.8;
  display: inline-block;
  margin-bottom: 15px;
}

.back-link a:hover {
  opacity: 1;
  text-decoration: underline;
}

.container {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  gap: 24px;
}

.container.narrow {
  display: block;
  max-width: 900px;
}

.left {
  flex: 3;
  min-width: 0; /* Prevent flex overflow */
}

.right {
  flex: 1;
  min-width: 280px;
}

.right > .button {
  margin-bottom: 20px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.topic-main-post {
  background-color: #dbeafe; /* Light blue */
  border: 1px solid #bfdbfe;
}

.profile-mini {
  margin-top: 20px;
}

.profile-mini p {
  margin: 0 0 12px;
  font-weight: 600;
}

.card h3 {
  margin-top: 0;
  font-size: 18px;
  color: #111827;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topic {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.2s;
}

.topic:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.topic-info {
  flex: 1;
  padding-right: 15px;
}

.topic-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  text-decoration: none;
  display: block;
  margin-bottom: 6px;
  line-height: 1.4;
}

.topic-title:hover {
  color: #2c5cc5;
}

.topic-excerpt {
  color: #64748b;
  font-size: 14px;
  line-height: 1.6;
  margin: 4px 0 8px;
}

.topic-meta {
  font-size: 13px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.topic-meta a {
  color: inherit;
  text-decoration: none;
}

.topic-meta a:hover {
  color: #2c5cc5;
}

.topic-stats {
  display: flex;
  align-items: center;
  gap: 15px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
}

.tag {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: white;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  text-decoration: none;
}

/* Tag Colors */
.policy {
  background: #4aa3ff;
}
.research {
  background: #f4a62a;
}
.youth {
  background: #3ccf91;
}
.health {
  background: #ff4a4a;
}
.rights {
  background: #8b5cf6;
}
.mental-health {
  background: #ec4899;
}
.general {
  background: #8b9bb4;
}

.button {
  background: #ff7a00;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  display: block;
  font-weight: bold;
  border: none;
  width: 100%;
  transition: background 0.3s;
  box-sizing: border-box;
}

.button:hover {
  background: #e66e00;
}
.btn-secondary {
  background: #f1f5f9;
  color: #475569;
}
.btn-secondary:hover {
  background: #e2e8f0;
}
.button-inline {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tabs a {
  text-decoration: none;
  color: #475569;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
}

.tabs a.active {
  background: #2c5cc5;
  color: #fff;
}

.search {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.search:focus {
  border-color: #4aa3ff;
  box-shadow: 0 0 0 3px rgba(74, 163, 255, 0.2);
}

.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
}
.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  box-sizing: border-box;
}

.form-group textarea {
  width: 100%;
  min-height: 220px;
  box-sizing: border-box;
}

.form-help {
  color: #64748b;
  font-size: 13px;
  margin: 8px 0 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.alert {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}
.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.empty-state {
  text-align: center;
  color: #6b7280;
  padding: 20px;
}

.text-center {
  text-align: center;
}

/* Article/Post Reading */
.post-header {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}
.post-title {
  font-size: 24px;
  margin: 0 0 10px 0;
}
.post-author-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #6b7280;
  font-size: 14px;
}

.post-author-meta a {
  color: inherit;
  text-decoration: none;
}

.post-body {
  line-height: 1.8;
  font-size: 16px;
  color: #374151;
}
.post-body img {
  max-width: 100%;
  border-radius: 8px;
}
.post-body iframe {
  max-width: 100%;
  border-radius: 8px;
}
.post-body a {
  color: #2563eb;
}
.post-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.action-btn {
  background: transparent;
  border: 1px solid #d1d5db;
  padding: 6px 12px;
  border-radius: 20px;
  color: #4b5563;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}
.action-btn:hover {
  background: #f3f4f6;
}
.action-btn.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.action-btn.danger {
  color: #dc2626;
}

.status-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
}

.comment-box {
  background: #fce7f3;
  border: 1px solid #fbcfe8;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.comment-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
}
.comment-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.comment-label {
  font-weight: 700;
  color: #1f2937;
}
.comment-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.post-body {
  margin-bottom: 16px;
}
.comment-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: #475569;
  border-top: 1px solid #e5e7eb;
  padding-top: 14px;
  margin-top: 14px;
}
.comment-author {
  font-weight: 700;
  color: #1d4ed8;
}
.comment-date {
  font-size: 13px;
  color: #6b7280;
}
.hidden {
  display: none !important;
}
.report-form-wrapper {
  margin-top: 14px;
}
.report-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.report-form input {
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  min-width: 220px;
  flex: 1;
}
.report-form.compact input {
  max-width: 160px;
}
.action-btn.secondary {
  background: #f1f5f9;
  color: #475569;
  border-color: #d1d5db;
}

.pagination {
  margin-top: 20px;
  text-align: center;
}

.online-count {
  font-size: 18px;
  font-weight: bold;
  color: #2c5cc5;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-list a {
  color: #1f2937;
  text-decoration: none;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 10px;
}

.side-list a:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.side-list span {
  display: block;
  color: #64748b;
  font-size: 12px;
  margin-top: 4px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 18px;
}

.profile-card h2 {
  margin: 0 0 4px;
}

.profile-card p {
  margin: 0 0 4px;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2c5cc5, #4aa3ff);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 700;
}

.muted {
  color: #64748b;
  font-size: 13px;
}

.ck-editor__editable_inline {
  min-height: 220px;
  font-family: "Sarabun", Arial, sans-serif;
  font-size: 16px;
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  .right {
    margin-top: 20px;
  }
  .search-box {
    flex-direction: column;
  }
  .button-inline {
    width: 100%;
  }
  .topic {
    flex-direction: column;
    gap: 10px;
  }
  .topic-stats {
    justify-content: flex-start;
  }
  .post-author-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .profile-card {
    align-items: flex-start;
  }
}
