/* ================================================================
   Community Page — Ideas & Bug Reports
   ================================================================ */

/* ── Variable aliases (catalog.css uses --bg/--bg2/--bg3/--text/--text2/--text3) */
:root {
  --bg-0: var(--bg);
  --bg-2: var(--bg2);
  --bg-3: var(--bg3);
  --bg-4: var(--surface);
  --bg-5: var(--surface);
  --text-1: var(--text);
  --text-2: var(--text2);
  --text-3: var(--text3);
  --border-hover: #404660;
  --radius-xs: 4px;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 14px;
  --transition: 0.18s ease;
  --green: #5ef7a8;
  --green-dim: rgba(94, 247, 168, .15);
  --red: #f75e5e;
  --red-dim: rgba(247, 94, 94, .15);
  --blue: #5ea8f7;
  --blue-dim: rgba(94, 168, 247, .15);
  --yellow: #f7c55e;
  --yellow-dim: rgba(247, 197, 94, .15);
  --font: 'Segoe UI', system-ui, sans-serif;
}

/* ── Layout ─────────────────────────────────────────────── */
.comm-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: flex;
  gap: 24px;
  min-height: 70vh;
}

.comm-main {
  flex: 1;
  min-width: 0;
}

.comm-sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
}

/* ── Tabs ─────────────────────────────────────────────── */
.comm-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.comm-tab {
  padding: 10px 24px;
  border: none;
  background: none;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.comm-tab:hover {
  color: var(--text-1);
}

.comm-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── Header bar ──────────────────────────────────────── */
.comm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.comm-sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comm-sort-wrap label {
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
}

.comm-select {
  background: var(--bg-2);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.comm-select:focus {
  border-color: var(--accent);
}

.btn-submit-post {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-s);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-submit-post:hover {
  background: #5b4de0;
}

/* ── Cards ───────────────────────────────────────────── */
.comm-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comm-card {
  display: flex;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 14px;
  transition: var(--transition);
}

.comm-card:hover {
  border-color: var(--border-hover);
}

.comm-card.pinned {
  border-color: var(--accent-dim);
  background: color-mix(in srgb, var(--accent) 4%, var(--bg-2));
}

/* ── Vote column ─────────────────────────────────────── */
.vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 40px;
  padding-top: 2px;
}

.vote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--transition);
}

.vote-btn:hover {
  background: var(--bg-3);
  color: var(--text-1);
}

.vote-btn.active-up {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, transparent);
}

.vote-btn.active-down {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}

.vote-score {
  font-size: 14px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
  line-height: 1.3;
}

.vote-score.pos { color: var(--green); }
.vote-score.neg { color: var(--red); }
.vote-score.zero { color: var(--text-3); }

/* ── Card content ────────────────────────────────────── */
.comm-card-body {
  flex: 1;
  min-width: 0;
}

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

.comm-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* Status badges */
.badge-new { background: var(--blue-dim); color: var(--blue); }
.badge-under_review { background: var(--yellow-dim); color: var(--yellow); }
.badge-planned { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.badge-in_progress { background: var(--yellow-dim); color: var(--yellow); }
.badge-done, .badge-fixed { background: var(--green-dim); color: var(--green); }
.badge-rejected, .badge-wont_fix { background: var(--red-dim); color: var(--red); }
.badge-confirmed { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }

/* Category badges */
.badge-cat {
  background: var(--bg-3);
  color: var(--text-2);
}

.comm-pin-icon {
  color: var(--accent);
}

.comm-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
  line-height: 1.4;
  cursor: pointer;
}

.comm-card-title:hover {
  color: var(--accent);
}

.comm-card-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 8px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.comm-card-text.expanded {
  -webkit-line-clamp: unset;
  display: block;
}

.comm-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-3);
}

.comm-card-meta .author-name {
  color: var(--text-2);
  font-weight: 500;
}

.comm-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.comm-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--transition);
}

.comm-action-btn:hover {
  background: var(--bg-3);
  color: var(--text-1);
}

.comm-action-btn.danger:hover {
  color: var(--red);
  background: var(--red-dim);
}

/* Admin status select */
.comm-admin-select {
  padding: 3px 8px;
  font-size: 11px;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  outline: none;
}

.comm-admin-select:focus {
  border-color: var(--accent);
}

/* ── Sidebar ─────────────────────────────────────────── */
.comm-sidebar-section {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 14px;
  margin-bottom: 12px;
}

.comm-sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.comm-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comm-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.comm-filter-btn:hover {
  background: var(--bg-3);
  color: var(--text-1);
}

.comm-filter-btn.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 500;
}

/* ── Submit Modal ────────────────────────────────────── */
.comm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.comm-modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  width: 100%;
  max-width: 540px;
  padding: 24px;
  animation: comm-fade-in 0.2s ease;
}

@keyframes comm-fade-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.comm-modal h3 {
  font-size: 18px;
  color: var(--text-1);
  margin: 0 0 16px;
}

.comm-modal-field {
  margin-bottom: 12px;
}

.comm-modal-field label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 4px;
  font-weight: 500;
}

.comm-modal-field input,
.comm-modal-field textarea,
.comm-modal-field select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  font-size: 14px;
  outline: none;
  font-family: var(--font);
  box-sizing: border-box;
}

.comm-modal-field textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.comm-modal-field input:focus,
.comm-modal-field textarea:focus,
.comm-modal-field select:focus {
  border-color: var(--accent);
}

.comm-modal-field .char-count {
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
  margin-top: 2px;
}

.comm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ── Report Modal ────────────────────────────────────── */
.comm-report-reasons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.comm-report-reason {
  padding: 8px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.comm-report-reason:hover {
  border-color: var(--accent);
  color: var(--text-1);
}

.comm-report-reason.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-3));
  color: var(--accent);
}

/* ── Loading / Empty ─────────────────────────────────── */
.comm-loading,
.comm-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 14px;
}

.comm-load-more {
  text-align: center;
  padding: 16px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .comm-layout {
    flex-direction: column;
    padding: 16px 12px 40px;
  }

  .comm-sidebar {
    width: 100%;
    position: static;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .comm-sidebar-section {
    min-width: 200px;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .comm-card {
    padding: 10px;
  }

  .vote-col {
    min-width: 34px;
  }

  .comm-tabs {
    overflow-x: auto;
  }

  .comm-tab {
    padding: 10px 16px;
    white-space: nowrap;
  }
}

/* ── Scrollbar (sidebar) ─────────────────────────────── */
.comm-sidebar::-webkit-scrollbar { height: 4px; }
.comm-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.comm-sidebar::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Modal size variants ─────────────────────────────── */
.comm-modal-sm {
  max-width: 380px;
}

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

.comm-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Delete / Danger button ──────────────────────────── */
.btn-danger {
  padding: 8px 18px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-s);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #d94040;
}

/* ── Admin reports button ────────────────────────────── */
.btn-reports {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--surface);
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
}

.btn-reports:hover {
  border-color: var(--accent);
  color: var(--text);
}

.reports-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Admin report row ────────────────────────────────── */
.comm-report-row {
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  margin-bottom: 8px;
}

.comm-report-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comm-report-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* ── btn-sm ──────────────────────────────────────────── */
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* ── btn-icon ────────────────────────────────────────── */
.btn-icon {
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
