/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-card-hover: #222632;
  --bg-input: #13151d;
  --border: #2a2e3a;
  --text: #e4e4e7;
  --text-muted: #8b8d98;
  --accent: #3B82F6;
  --accent-hover: #2563eb;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --purple: #a855f7;
  --radius: 8px;
  --radius-lg: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

code, .mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Header === */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo:hover { text-decoration: none; color: var(--accent); }
.nav { display: flex; align-items: center; gap: 0.75rem; }
.nav-link { color: var(--text-muted); font-size: 0.875rem; }
.nav-link:hover { color: var(--text); text-decoration: none; }
.user-badge {
  font-size: 0.8rem;
  background: var(--bg);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  color: var(--text-muted);
}

/* === Main === */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-card-hover); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-card); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }

/* === Cards === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--accent); }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* === Badges === */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-feature { background: #3b82f620; color: var(--accent); }
.badge-bug { background: #ef444420; color: var(--red); }
.badge-improvement { background: #a855f720; color: var(--purple); }
.badge-idea { background: #f59e0b20; color: var(--orange); }
.badge-proposed { background: #8b8d9820; color: var(--text-muted); }
.badge-accepted { background: #3b82f620; color: var(--accent); }
.badge-in_progress { background: #f59e0b20; color: var(--orange); }
.badge-done { background: #22c55e20; color: var(--green); }
.badge-rejected { background: #ef444420; color: var(--red); }

/* === Priority === */
.priority-1 { color: var(--text-muted); }
.priority-2 { color: var(--accent); }
.priority-3 { color: var(--orange); }
.priority-4 { color: var(--red); }

/* === Forms === */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 500;
}
input, textarea, select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }

/* === Modal === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* === Kanban === */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  overflow-x: auto;
}
@media (max-width: 900px) {
  .kanban { grid-template-columns: 1fr; }
}
.kanban-col {
  min-width: 0;
}
.kanban-col-header {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kanban-col-count {
  background: var(--bg);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
}
.kanban-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.kanban-item:hover { border-color: var(--accent); }
.kanban-item-title { font-size: 0.875rem; font-weight: 500; margin-bottom: 0.4rem; }
.kanban-item-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* === Vote button === */
.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.vote-btn:hover { border-color: var(--accent); color: var(--accent); }
.vote-btn.voted { border-color: var(--accent); color: var(--accent); background: #3b82f610; }

/* === Item detail === */
.item-header { margin-bottom: 1.5rem; }
.item-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.item-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; font-size: 0.85rem; color: var(--text-muted); }
.item-description { margin: 1.5rem 0; line-height: 1.7; }
.item-description p { margin-bottom: 0.75rem; }

/* === Comments === */
.comments { margin-top: 2rem; }
.comment {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment-header {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}
.comment-author { font-weight: 600; color: var(--text); }
.comment-date { color: var(--text-muted); }
.comment-body { font-size: 0.875rem; }

/* === Admin === */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
}
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.admin-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--bg-card-hover); }
.admin-table input[type="checkbox"] { cursor: pointer; }

/* === Floating action bar === */
.action-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 150;
}
.action-bar-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* === Prompt preview === */
.prompt-preview {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 60vh;
  overflow-y: auto;
  color: var(--text-muted);
}

/* === Tabs === */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* === Page header === */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.page-title { font-size: 1.3rem; font-weight: 700; }
.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

/* === Filter bar === */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-bar select { width: auto; max-width: 160px; }

/* === Empty state === */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state-text { font-size: 0.95rem; }

/* === Section headers === */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* === Responsive === */
@media (max-width: 640px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .admin-table { font-size: 0.75rem; }
  .admin-table th, .admin-table td { padding: 0.4rem 0.5rem; }
  .action-bar { left: 1rem; right: 1rem; transform: none; }
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === Admin app filter tabs === */
.app-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.app-tab {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.app-tab:hover { border-color: var(--accent); color: var(--text); }
.app-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
