/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --bg:              #0E0E10;
  --surface:         #1F1F23;
  --surface-hover:   #26262C;
  --surface-raised:  #2A2A31;
  --border:          #2C2C36;
  --text:            #EFEFF1;
  --text-dim:        #ADADB8;
  --text-muted:      #9090A2;

  --accent:          #9146FF;
  --accent-hover:    #772CE8;
  --accent-dim:      rgba(145, 70, 255, 0.15);
  --accent-text:     #A87FFF;

  --color-sensory:        #4FC3F7;
  --color-sensory-dim:    rgba(79, 195, 247, 0.15);
  --color-medical:        #F87171;
  --color-medical-dim:    rgba(248, 113, 113, 0.15);
  --color-psychological:  #C084FC;
  --color-psychological-dim: rgba(192, 132, 252, 0.15);
  --color-situational:    #FCD34D;
  --color-situational-dim: rgba(252, 211, 77, 0.15);

  --success:   #4ADE80;
  --warning:   #FACC15;
  --danger:    #F87171;

  --radius:    8px;
  --radius-sm: 4px;
  --radius-lg: 12px;

  --sidebar-width: 240px;
  --transition:    150ms ease;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

img { display: block; max-width: 100%; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

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

input::placeholder, textarea::placeholder { color: var(--text-muted); }

/* ── App shell ────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.2px;
}

.sidebar-brand-name span { color: var(--accent); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-raised);
  flex-shrink: 0;
  object-fit: cover;
}

.sidebar-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-username {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-role {
  font-size: 11px;
  color: var(--text-dim);
}

.sidebar-stats {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.sidebar-nav {
  padding: 8px 0;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  border-radius: 0;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-dim);
  color: var(--accent-text);
}

.nav-link svg { flex-shrink: 0; opacity: 0.7; }

.sidebar-footer {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.sidebar-logout:hover {
  background: var(--surface-hover);
  color: var(--danger);
}
.nav-link.active svg { opacity: 1; }

.nav-icon { width: 16px; height: 16px; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.page-body {
  padding: 24px 28px;
  flex: 1;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
}

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

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }

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

.btn-confirm {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.3);
}
.btn-confirm:hover { background: rgba(74, 222, 128, 0.25); }

.btn-dispute {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.btn-dispute:hover { background: rgba(248, 113, 113, 0.25); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
  border-radius: var(--radius);
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.badge-sensory       { background: var(--color-sensory-dim);       color: var(--color-sensory); }
.badge-medical       { background: var(--color-medical-dim);       color: var(--color-medical); }
.badge-psychological { background: var(--color-psychological-dim); color: var(--color-psychological); }
.badge-situational   { background: var(--color-situational-dim);   color: var(--color-situational); }

.badge-published { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.badge-voting    { background: rgba(250, 204, 21, 0.15);  color: var(--warning); }
.badge-pending   { background: var(--surface-raised);     color: var(--text-dim); border: 1px solid var(--border); }
.badge-rejected  { background: rgba(248, 113, 113, 0.15); color: var(--danger); }

.badge-count {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.3s ease;
}

.progress-fill.sensory       { background: var(--color-sensory); }
.progress-fill.medical       { background: var(--color-medical); }
.progress-fill.psychological { background: var(--color-psychological); }
.progress-fill.situational   { background: var(--color-situational); }

/* ── Filter tabs ──────────────────────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 4px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.filter-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

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

.filter-tab.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 12px;
  color: var(--text-dim);
  text-align: center;
}

.empty-state-icon { font-size: 40px; opacity: 0.4; }
.empty-state-title { font-weight: 600; color: var(--text); }
.empty-state-body { font-size: 13px; max-width: 300px; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-close {
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--text); background: var(--surface-hover); }

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Form elements ────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-hint { font-size: 11px; color: var(--text-muted); }

.char-count {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}
.char-count.near-limit { color: var(--warning); }
.char-count.at-limit   { color: var(--danger); }

/* Category button group */
.category-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.category-btn {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
}

.category-btn:hover { border-color: var(--text-muted); color: var(--text); }

.category-btn.active[data-category="sensory"]       { border-color: var(--color-sensory);       background: var(--color-sensory-dim);       color: var(--color-sensory); }
.category-btn.active[data-category="medical"]       { border-color: var(--color-medical);       background: var(--color-medical-dim);       color: var(--color-medical); }
.category-btn.active[data-category="psychological"] { border-color: var(--color-psychological); background: var(--color-psychological-dim); color: var(--color-psychological); }
.category-btn.active[data-category="situational"]   { border-color: var(--color-situational);   background: var(--color-situational-dim);   color: var(--color-situational); }

/* ── Callout ──────────────────────────────────────────────────────────────── */
.callout {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}

.callout strong { color: var(--text); }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex   { display: flex; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.text-dim   { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 12px; }
.font-bold  { font-weight: 700; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-hover); color: var(--text); }

.nav-close {
  display: none;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.nav-close:hover { background: var(--surface-hover); color: var(--text); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99;
}

@media (max-width: 860px) {
  :root { --sidebar-width: 200px; }
}

@media (max-width: 640px) {
  :root { --sidebar-width: 240px; }

  .nav-toggle { display: flex; }
  .nav-close  { display: flex; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    box-shadow: 6px 0 28px rgba(0,0,0,0.5);
  }

  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open .sidebar-backdrop { display: block; }

  .page-header { padding: 14px 16px; gap: 8px; }
  .page-body   { padding: 16px; }

  .search-bar input { width: 100%; }
  .search-bar { flex: 1; }
}

/* ── User cards (shared: users.html + dashboard.html) ─────────────────────── */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.user-card-header:hover { background: var(--surface-hover); }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.user-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-raised);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 14px; font-weight: 600; color: var(--text); }
.user-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.badge-developer { background: rgba(145,70,255,0.15); border: 1px solid rgba(196,181,253,0.4); color: #C4B5FD; }
.badge-pending   { background: rgba(250,204,21,0.12);  border: 1px solid rgba(250,204,21,0.4);  color: #FACC15; }
.badge-none      { background: var(--surface-raised);  border: 1px solid var(--border);          color: var(--text-muted); }

.user-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 150ms ease;
  font-size: 10px;
}
.chevron.open { transform: rotate(180deg); }

.user-games {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: none;
}
.user-games.open { display: block; }

.games-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.game-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.game-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  user-select: none;
}

.game-chip-approved { background: rgba(74,222,128,0.12);  color: #4ADE80; border-color: rgba(74,222,128,0.25); }
.game-chip-pending  { background: rgba(250,204,21,0.10);  color: #FACC15; border-color: rgba(250,204,21,0.30); }

.game-chip-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  opacity: 0.55;
  transition: opacity var(--transition);
}
.game-chip-btn:hover    { opacity: 1; }
.game-chip-btn:disabled { opacity: 0.25; cursor: default; pointer-events: none; }

.game-chip-add {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.game-chip-add:hover { border-color: var(--accent-text); color: var(--accent-text); }

.game-search-area {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.game-search-area.hidden { display: none; }

.game-search-wrap {
  position: relative;
  max-width: 280px;
}

.add-game-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 10;
  max-height: 180px;
  overflow-y: auto;
}
.add-game-option {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.add-game-option:last-child { border-bottom: none; }
.add-game-option:hover { background: var(--surface-hover); }

/* ── IGDB verification section ───────────────────────────────────────────── */
.igdb-section {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.igdb-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.igdb-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.btn-igdb-check {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.btn-igdb-check:hover { color: var(--accent); border-color: var(--accent); }
.btn-igdb-check:disabled { opacity: 0.5; cursor: default; }
.igdb-results { display: flex; flex-direction: column; gap: 5px; }
.igdb-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.igdb-game-name { color: var(--text); flex: 1; }
.igdb-companies { color: var(--text-muted); font-size: 11px; }
.igdb-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}
.igdb-strong   { background: rgba(34,197,94,0.15);  color: #22c55e; }
.igdb-possible { background: rgba(234,179,8,0.15);   color: #eab308; }
.igdb-none     { background: rgba(239,68,68,0.12);   color: #ef4444; }
.igdb-unknown  { background: var(--surface-raised);  color: var(--text-muted); }
