/* Forum styles — dark theme matching chat.html */
:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel2: #1a2332;
  --border: #1f2a3b;
  --accent: #60a5fa;
  --accent2: #7c3aed;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --admin-badge: #fbbf24;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.forum-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ── */
.forum-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.forum-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.forum-logo span { color: var(--accent); }

.forum-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  color: var(--muted);
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all .15s;
}
.nav-link:hover { color: var(--text); background: var(--panel2); text-decoration: none; }

/* ── Main content ── */
.forum-content {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: 0.4; }

/* ── Page title ── */
.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--text);
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-secondary {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  font-size: 12px;
  padding: 4px 10px;
}
.btn-danger:hover { background: var(--danger); color: var(--bg); }

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

/* ── Category card ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.category-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.category-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(96,165,250,.15);
}
.category-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}
.category-icon { font-size: 22px; }
.category-desc { font-size: 13px; color: var(--muted); }
.category-stats {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

/* ── Thread list ── */
.thread-list { display: flex; flex-direction: column; gap: 8px; }

.thread-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  transition: all .15s;
}
.thread-item:hover {
  border-color: var(--accent);
  background: var(--panel2);
}
.thread-item.pinned {
  border-color: var(--warning);
}

.thread-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  color: white;
}

.thread-body { flex: 1; min-width: 0; }

.thread-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.thread-title:hover { color: var(--accent); }

.badge-pinned {
  font-size: 10px;
  background: var(--warning);
  color: #0f172a;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.thread-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.thread-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  min-width: 50px;
  text-align: center;
}
.thread-stats strong { color: var(--text); font-size: 16px; }

/* ── Thread view ── */
.thread-header {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.thread-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}
.thread-header-meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ── Posts ── */
.post-list { display: flex; flex-direction: column; gap: 12px; }

.post-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  gap: 14px;
}
.post-card.op { border-color: rgba(96,165,250,.3); }

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
  color: white;
}

.post-body { flex: 1; min-width: 0; }

.post-author-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.post-author {
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: var(--accent);
}
.post-author:hover { text-decoration: underline; }

.badge-admin {
  font-size: 10px;
  background: var(--admin-badge);
  color: #0f172a;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.badge-op {
  font-size: 10px;
  background: var(--accent);
  color: #0f172a;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.post-time { font-size: 12px; color: var(--muted); }

.post-content {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* URL links inside post content */
.post-content a { color: var(--accent); }

.post-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Reply form ── */
.reply-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
}
.reply-box h3 { margin-bottom: 12px; font-size: 16px; }

/* ── Marketplace CTA ── */
.marketplace-cta {
  background: linear-gradient(135deg, rgba(96,165,250,.1), rgba(124,58,237,.1));
  border: 1px solid rgba(96,165,250,.3);
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.marketplace-cta p { font-size: 13px; color: var(--muted); margin: 0; }

/* ── Forms ── */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: #0b1220;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 110px; }

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.modal h2 {
  font-size: 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: #0b1220;
  border-radius: 8px;
  padding: 4px;
}
.modal-tab {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.modal-tab.active {
  background: var(--panel2);
  color: var(--text);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal { position: relative; }

/* ── Alert/toast ── */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-error { background: rgba(248,113,113,.15); border: 1px solid rgba(248,113,113,.4); color: var(--danger); }
.alert-success { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); color: var(--success); }
.alert.hidden { display: none; }

/* ── Toast snackbar ── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 300;
  transition: transform .25s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ── Search bar ── */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.search-bar input { flex: 1; }
.search-bar button { flex-shrink: 0; }

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

/* ── User info bar (top of content) ── */
.user-bar {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.user-bar.hidden { display: none; }
.user-bar-left { display: flex; align-items: center; gap: 8px; }
.user-bar-right { display: flex; align-items: center; gap: 8px; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }

/* ── New thread form ── */
.new-thread-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.new-thread-form h2 { margin-bottom: 20px; font-size: 20px; }

/* ── Profile ── */
.profile-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  flex-shrink: 0;
  color: white;
}
.profile-info h2 { font-size: 22px; margin-bottom: 6px; }
.profile-stats { display: flex; gap: 20px; margin-top: 10px; }
.profile-stat { text-align: center; }
.profile-stat strong { display: block; font-size: 20px; color: var(--accent); }
.profile-stat span { font-size: 12px; color: var(--muted); }

/* ── Loading spinner ── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .forum-header { padding: 0 12px; }
  .forum-content { padding: 16px 10px; }
  .category-grid { grid-template-columns: 1fr; }
  .thread-item { flex-wrap: wrap; }
  .post-card { flex-direction: column; }
  .profile-card { flex-direction: column; align-items: center; text-align: center; }
  .profile-stats { justify-content: center; }
  .marketplace-cta { flex-direction: column; }
}
