/* ============================================================
   DevIdeas — Shared Design System
   Aesthetic: Dark industrial-editorial with amber accents
   Fonts: DM Mono (mono headlines) + Instrument Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Instrument+Sans:wght@400;500;600;700&display=swap');

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
  --bg:          #0d0d0f;
  --surface:     #141416;
  --surface-2:   #1c1c20;
  --border:      #2a2a30;
  --border-soft: #222228;

  --amber:       #f5a623;
  --amber-dim:   #c47d0e;
  --amber-glow:  rgba(245, 166, 35, 0.12);

  --text:        #e8e8ec;
  --text-muted:  #7a7a8a;
  --text-faint:  #3d3d48;

  --green:       #2dd98f;
  --red:         #f05a5a;
  --blue:        #5a9cf0;
  --purple:      #a78bfa;

  --radius:      6px;
  --radius-lg:   12px;
  --shadow:      0 4px 24px rgba(0,0,0,0.5);
  --font-mono:   'DM Mono', monospace;
  --font-body:   'Instrument Sans', sans-serif;

  --sidebar-w:   240px;
  --header-h:    60px;
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Typography ─────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-mono); font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.8rem); }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }
p  { color: var(--text-muted); font-size: 0.95rem; }
small { font-size: 0.8rem; color: var(--text-muted); }

.mono { font-family: var(--font-mono); }
.amber { color: var(--amber); }
.green { color: var(--green); }
.red   { color: var(--red); }
.muted { color: var(--text-muted); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--amber);
  color: #0d0d0f;
}
.btn-primary:hover { background: #f7b84e; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(245,166,35,0.3); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }

.btn-danger {
  background: rgba(240, 90, 90, 0.1);
  color: var(--red);
  border: 1px solid rgba(240, 90, 90, 0.3);
}
.btn-danger:hover { background: rgba(240, 90, 90, 0.2); }

.btn-success {
  background: rgba(45, 217, 143, 0.1);
  color: var(--green);
  border: 1px solid rgba(45, 217, 143, 0.3);
}
.btn-success:hover { background: rgba(45, 217, 143, 0.2); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.btn-icon { padding: 8px; border-radius: var(--radius); }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card:hover { border-color: var(--border-soft); }
.card-sm { padding: 16px; border-radius: var(--radius); }

/* ─── Form Elements ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-input, .form-textarea, .form-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.9rem;
  transition: border-color 0.15s;
  width: 100%;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-select option { background: var(--surface-2); }
.form-error { font-size: 0.8rem; color: var(--red); }
.form-hint  { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Badges / Tags ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
}
.badge-amber   { background: var(--amber-glow); color: var(--amber); border: 1px solid rgba(245,166,35,0.2); }
.badge-green   { background: rgba(45,217,143,0.1); color: var(--green); border: 1px solid rgba(45,217,143,0.2); }
.badge-red     { background: rgba(240,90,90,0.1); color: var(--red); border: 1px solid rgba(240,90,90,0.2); }
.badge-blue    { background: rgba(90,156,240,0.1); color: var(--blue); border: 1px solid rgba(90,156,240,0.2); }
.badge-purple  { background: rgba(167,139,250,0.1); color: var(--purple); border: 1px solid rgba(167,139,250,0.2); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

.tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.1s;
}
.tag:hover, .tag.active { background: var(--amber-glow); color: var(--amber); border-color: rgba(245,166,35,0.3); }
.tags-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ─── App Layout (Sidebar + Main) ────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 100;
  padding: 0;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--amber);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: #0d0d0f;
  flex-shrink: 0;
}
.logo-text { font-family: var(--font-mono); font-size: 0.95rem; color: var(--text); }
.logo-text span { color: var(--amber); }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section { padding: 12px 16px 4px; }
.nav-section-label {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-radius: 0;
  transition: all 0.12s;
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  color: var(--amber);
  background: var(--amber-glow);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--amber);
  border-radius: 0 2px 2px 0;
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--amber);
  color: #0d0d0f;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  font-family: var(--font-mono);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  transition: background 0.12s;
}
.user-mini:hover { background: var(--surface-2); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--amber-glow);
  border: 1px solid rgba(245,166,35,0.3);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--amber);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; truncate: ellipsis; overflow: hidden; white-space: nowrap; }
.user-role { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-mono); }

/* ─── Main content ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.top-bar {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  background: rgba(13,13,15,0.85);
  backdrop-filter: blur(12px);
  z-index: 50;
}
.page-title { font-family: var(--font-mono); font-size: 1rem; color: var(--text); }
.top-bar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.page-body { flex: 1; padding: 28px; max-width: 1200px; width: 100%; }

/* ─── Idea Cards ─────────────────────────────────────────── */
.ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.idea-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.idea-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.idea-card:hover {
  border-color: rgba(245,166,35,0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.idea-card:hover::before { opacity: 1; }

.idea-card.selected-card { border-color: rgba(45,217,143,0.4); }
.idea-card.selected-card::before { background: linear-gradient(90deg, transparent, var(--green), transparent); opacity: 1; }

.idea-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.idea-title { font-family: var(--font-mono); font-size: 1rem; color: var(--text); line-height: 1.3; }
.idea-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.idea-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  margin-top: auto;
}
.upvote-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  transition: all 0.15s;
}
.upvote-btn:hover { border-color: var(--amber); color: var(--amber); }
.upvote-btn.voted { background: var(--amber-glow); border-color: rgba(245,166,35,0.4); color: var(--amber); }
.upvote-btn .arrow { font-size: 1rem; line-height: 1; }

.idea-meta { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--text-muted); font-size: 0.75rem; font-family: var(--font-mono); }
.meta-item { display: flex; align-items: center; gap: 4px; }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: all 0.1s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

/* ─── Toast Notifications ────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
  font-size: 0.875rem;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { transform: translateX(100%); opacity: 0; } }
.toast.removing { animation: fadeOut 0.25s ease forwards; }

/* ─── Search & Filters ───────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.search-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 14px 9px 36px;
  font-size: 0.875rem;
  width: 100%;
  transition: border-color 0.15s;
}
.search-input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }
.sort-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 0.875rem;
  cursor: pointer;
}
.sort-select:focus { outline: none; border-color: var(--amber); }

/* ─── Stats Row ──────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-value { font-family: var(--font-mono); font-size: 1.6rem; color: var(--text); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-mono); }
.stat-change { font-size: 0.75rem; color: var(--green); font-family: var(--font-mono); }

/* ─── Comments ───────────────────────────────────────────── */
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.comment-body { flex: 1; }
.comment-author { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.comment-time { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); margin-left: 8px; }
.comment-text { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }
.comment-input-row { display: flex; gap: 10px; }
.comment-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.875rem;
  resize: none;
}
.comment-input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; opacity: 0.3; }

/* ─── Loader ─────────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
  flex-direction: column;
  gap: 16px;
}
.loading-overlay p { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.85rem; }

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); gap: 0; }
.tab-btn {
  padding: 10px 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-family: var(--font-mono);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ─── Auth Pages (no sidebar) ────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  padding: 20px;
}
.auth-bg-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border-soft) 1px, transparent 1px),
                    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.3;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-title { font-family: var(--font-mono); font-size: 1.4rem; margin-bottom: 6px; }
.auth-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 28px; }

/* ─── Notification Dot ───────────────────────────────────── */
.notif-dot {
  width: 8px; height: 8px;
  background: var(--amber);
  border-radius: 50%;
  position: absolute;
  top: 8px; right: 12px;
}

/* ─── Progress Bar ───────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ─── Divider ────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
}
.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.divider-text::before, .divider-text::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); --sidebar-w: 240px; }
  .main-content { margin-left: 0; }
  .ideas-grid { grid-template-columns: 1fr; }
  .mobile-menu-btn { display: flex !important; }
  .top-bar { padding: 0 16px; }
  .page-body { padding: 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
.mobile-menu-btn { display: none; }

/* ─── Utilities ──────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }