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

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #718096;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --danger: #e53e3e;
  --success: #38a169;
  --vote-btn-bg: #eef2ff;
  --vote-btn-hover: #e0e7ff;
  --vote-btn-active: #c7d2fe;
  --vote-disabled: #cbd5e0;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #1a1d2e;
    --border: #2d3047;
    --text: #e2e8f0;
    --text-muted: #a0aec0;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --vote-btn-bg: #1e2140;
    --vote-btn-hover: #262a4a;
    --vote-btn-active: #313666;
    --vote-disabled: #4a5568;
    --shadow: 0 1px 4px rgba(0,0,0,.3);
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.3px;
}

.vote-budget {
  font-size: .85rem;
  font-weight: 600;
  background: var(--vote-btn-bg);
  color: var(--accent);
  padding: .3rem .8rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: background .2s, color .2s;
}

.vote-budget.exhausted {
  background: #fff5f5;
  color: var(--danger);
}

@media (prefers-color-scheme: dark) {
  .vote-budget.exhausted { background: #2d1515; }
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
main {
  max-width: 760px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Add-idea form ───────────────────────────────────────────────────────────── */
.add-idea-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.add-idea-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.required { color: var(--danger); }

.field input, .field textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .55rem .8rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
  resize: vertical;
}

.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border: none;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.form-error {
  margin-top: .5rem;
  font-size: .85rem;
  color: var(--danger);
  min-height: 1.2em;
}

/* ── Ideas list ───────────────────────────────────────────────────────────── */
.ideas-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .75rem;
}

.count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: .9rem;
}

.ideas-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.idea-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  box-shadow: var(--shadow);
  will-change: transform;
}

/* ── Vote button ─────────────────────────────────────────────────────────────── */
.btn-vote {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  background: var(--vote-btn-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .45rem .65rem;
  min-width: 2.6rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  font-family: inherit;
}

.btn-vote:hover:not(:disabled) {
  background: var(--vote-btn-hover);
  border-color: var(--accent);
}

.btn-vote:active:not(:disabled) {
  background: var(--vote-btn-active);
  transform: scale(.93);
}

.btn-vote:disabled {
  background: var(--bg);
  cursor: not-allowed;
  opacity: .5;
}

.vote-arrow {
  font-size: .75rem;
  color: var(--accent);
  line-height: 1;
}

.btn-vote:disabled .vote-arrow {
  color: var(--vote-disabled);
}

.vote-count {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

/* ── Idea content ────────────────────────────────────────────────────────────── */
.idea-content {
  flex: 1;
  min-width: 0;
}

.idea-title {
  font-weight: 600;
  word-break: break-word;
  margin-bottom: .2rem;
}

.idea-desc {
  font-size: .88rem;
  color: var(--text-muted);
  word-break: break-word;
  margin-bottom: .3rem;
}

.idea-meta {
  font-size: .78rem;
  color: var(--text-muted);
}

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: .95rem;
  padding: 2rem 0;
}

.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  header { flex-direction: column; align-items: flex-start; }
  main { margin: 1rem auto; }
}
