/* MudCast Community Board Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --mud: #3D2B1F;
  --mud-light: #5C4033;
  --earth: #8B6914;
  --water: #1B4332;
  --water-light: #2D6A4F;
  --cream: #F5F0E8;
  --sand: #E8DCC8;
  --gold: #D4A843;
  --warm-white: #FEFCF7;
  --border: #DDD5C4;
  --text-muted: #8B7A6A;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--warm-white);
  color: var(--mud);
  min-height: 100vh;
}

/* ==================== NAV ==================== */
.comm-nav {
  background: var(--mud);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--mud-light);
}

.comm-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.comm-nav-brand {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--cream);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.comm-nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.comm-nav-user {
  font-size: 0.875rem;
  color: var(--sand);
  opacity: 0.8;
}

.comm-nav-back {
  font-size: 0.875rem;
  color: var(--sand);
  text-decoration: none;
  transition: color 0.2s;
}
.comm-nav-back:hover { color: var(--cream); }

/* ==================== AUTH GATE ==================== */
.comm-auth-gate {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.comm-auth-inner {
  text-align: center;
  max-width: 380px;
}

.comm-auth-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.comm-auth-inner h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.comm-auth-inner p {
  color: var(--mud-light);
  margin-bottom: 24px;
}

/* ==================== HERO ==================== */
.comm-hero {
  background: var(--mud);
  color: var(--cream);
  padding: 40px 24px 32px;
}

.comm-hero-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.comm-hero-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 8px;
}

.comm-hero-slogan {
  font-size: 1rem;
  font-style: italic;
  color: var(--sand);
  margin-bottom: 6px;
}

.comm-hero-sub {
  font-size: 0.95rem;
  color: rgba(245, 240, 232, 0.65);
}

/* ==================== LAYOUT ==================== */
.comm-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 768px) {
  .comm-layout {
    grid-template-columns: 1fr;
    padding: 16px 16px 80px;
  }
}

/* ==================== SIDEBAR ==================== */
.comm-sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (max-width: 768px) {
  .comm-sidebar {
    position: static;
    order: -1;
  }
}

.comm-sidebar-section {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.comm-sidebar-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--earth);
  margin-bottom: 12px;
}

.comm-board-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comm-board-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.comm-board-btn:hover { background: var(--sand); }
.comm-board-btn.active { background: var(--mud); }
.comm-board-btn.active .comm-board-label,
.comm-board-btn.active .comm-board-icon { color: var(--cream); }
.comm-board-btn.active .comm-board-desc { color: var(--sand); }

.comm-board-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.comm-board-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--mud);
  line-height: 1.3;
}

.comm-board-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.comm-board-home .comm-board-label {
  color: var(--earth);
}

.comm-home-tag {
  display: inline-block;
  background: var(--gold);
  color: var(--mud);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* My type card */
.comm-my-type-card {
  border-radius: 8px;
  padding: 4px 0;
}

.comm-my-type-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comm-my-type-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.comm-my-type-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--mud);
}

.comm-my-type-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==================== FEED ==================== */
.comm-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.comm-feed-header {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  padding: 20px 20px 0;
  margin-bottom: 0;
}

.comm-feed-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.comm-feed-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mud);
}

/* Category filter */
.comm-category-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.comm-cat-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: white;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mud-light);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.comm-cat-btn:hover { border-color: var(--earth); color: var(--earth); }
.comm-cat-btn.active {
  background: var(--earth);
  border-color: var(--earth);
  color: white;
}

/* Sort */
.comm-sort-row {
  display: flex;
  gap: 4px;
  padding: 10px 0;
}

.comm-sort-btn {
  padding: 4px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.comm-sort-btn:hover { color: var(--mud); }
.comm-sort-btn.active { background: var(--mud); color: var(--cream); }

/* Posts list */
.comm-posts-list {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: white;
  overflow: hidden;
}

.comm-loading, .comm-error {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.comm-error { color: #c0392b; }

.comm-empty {
  padding: 60px 40px;
  text-align: center;
}

.comm-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.comm-empty-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--mud);
  margin-bottom: 6px;
}

.comm-empty-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==================== POST CARD ==================== */
.comm-post-card {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.comm-post-card:last-child { border-bottom: none; }
.comm-post-card:hover { background: #fdf9f4; }

.comm-post-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.comm-author-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.comm-author-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--mud);
}

.comm-author-badge {
  font-size: 1rem;
  line-height: 1;
  cursor: default;
}

.comm-author-badge-sm { font-size: 0.875rem; }

.comm-post-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.comm-post-cat {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--sand);
  color: var(--earth);
  padding: 2px 8px;
  border-radius: 10px;
}

.comm-post-title {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--mud);
  margin-bottom: 6px;
  line-height: 1.4;
}

.comm-post-preview {
  font-size: 0.875rem;
  color: var(--mud-light);
  line-height: 1.6;
  margin-bottom: 12px;
}

.comm-post-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==================== REACT BUTTON ==================== */
.comm-react-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.comm-react-btn:hover {
  border-color: var(--earth);
  color: var(--earth);
}

.comm-react-btn.reacted {
  background: var(--earth);
  border-color: var(--earth);
  color: white;
}

.comm-comment-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.comm-comment-open-btn:hover {
  border-color: var(--water-light);
  color: var(--water-light);
}

/* ==================== LOAD MORE ==================== */
.comm-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 20px 0 0;
}

/* ==================== BUTTONS ==================== */
.btn-comm-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--mud);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-comm-primary:hover { background: var(--mud-light); }

.btn-comm-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--cream);
  color: var(--mud);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-comm-secondary:hover { background: var(--sand); }

.btn-comm-new {
  padding: 8px 16px;
  font-size: 0.8rem;
}

.btn-comm-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
}

/* ==================== MODAL ==================== */
.comm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 43, 31, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.comm-modal {
  background: var(--warm-white);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.comm-modal-large {
  max-width: 680px;
}

.comm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.comm-modal-header h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--mud);
}

.comm-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--sand);
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mud-light);
  transition: background 0.15s;
  line-height: 1;
}

.comm-modal-close:hover { background: var(--border); }

.comm-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.comm-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ==================== FORM ==================== */
.comm-form-group {
  margin-bottom: 18px;
}

.comm-form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--mud);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.comm-form-input,
.comm-form-select,
.comm-form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--mud);
  background: white;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.comm-form-input:focus,
.comm-form-select:focus,
.comm-form-textarea:focus {
  outline: none;
  border-color: var(--earth);
}

.comm-form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.comm-comment-textarea {
  min-height: 80px;
}

.comm-char-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.comm-form-error {
  font-size: 0.85rem;
  color: #c0392b;
  margin-top: 8px;
  min-height: 20px;
}

/* Category chips */
.comm-cat-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.comm-cat-chip {
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: white;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mud-light);
  cursor: pointer;
  transition: all 0.15s;
}

.comm-cat-chip:hover { border-color: var(--earth); }
.comm-cat-chip.active {
  background: var(--mud);
  border-color: var(--mud);
  color: var(--cream);
}

/* ==================== POST DETAIL ==================== */
.comm-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 0.875rem;
}

.comm-detail-post-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mud);
  margin-bottom: 12px;
  line-height: 1.4;
}

.comm-detail-body {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--mud-light);
  white-space: pre-wrap;
  margin-bottom: 16px;
}

.comm-detail-actions {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ==================== COMMENTS ==================== */
.comm-comments-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid var(--sand);
}

.comm-comments-heading {
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--earth);
  margin-bottom: 16px;
}

.comm-comments-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 20px;
  max-height: 320px;
  overflow-y: auto;
}

.comm-empty-comments {
  padding: 20px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

.comm-comment {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.comm-comment:last-child { border-bottom: none; }

.comm-comment-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.comm-comment-body {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--mud-light);
  margin-bottom: 8px;
}

/* Add comment */
.comm-add-comment {
  padding-top: 16px;
}

.comm-comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
  .comm-hero { padding: 24px 16px 20px; }
  .comm-feed-title-row { flex-wrap: wrap; gap: 10px; }
  .comm-modal { max-height: 95vh; }
  .comm-modal-overlay { padding: 10px; align-items: flex-end; }
  .comm-modal { border-radius: 16px 16px 0 0; max-height: 90vh; }
}
