/* ==========================================================================
   EnigMafia Minimalist Modern Design System (Linear / Vercel Style)
   ========================================================================== */

:root {
  --bg-app: #09090b;
  --bg-surface: #121215;
  --bg-panel: #18181b;
  --bg-panel-hover: #202024;
  
  --border-subtle: #27272a;
  --border-active: #3f3f46;

  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #8b5cf6;

  /* Alignments */
  --town-bg: rgba(34, 197, 94, 0.12);
  --town-text: #4ade80;
  --town-border: rgba(34, 197, 94, 0.3);

  --mafia-bg: rgba(239, 68, 68, 0.12);
  --mafia-text: #f87171;
  --mafia-border: rgba(239, 68, 68, 0.3);

  --coven-bg: rgba(168, 85, 247, 0.12);
  --coven-text: #c084fc;
  --coven-border: rgba(168, 85, 247, 0.3);

  --vamp-bg: rgba(245, 158, 11, 0.12);
  --vamp-text: #fbbf24;
  --vamp-border: rgba(245, 158, 11, 0.3);

  --font-heading: 'Outfit', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* Wrapper */
.app-wrapper {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-badge {
  width: 36px;
  height: 36px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.1rem;
}

.nav-title-group h1 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.nav-subtitle {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mode-toggle-group {
  display: flex;
  background: var(--bg-panel);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: var(--border-subtle);
  color: var(--text-main);
}

/* Buttons */
.btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

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

.btn-secondary { background: var(--bg-panel); color: var(--text-main); border: 1px solid var(--border-subtle); }
.btn-secondary:hover { background: var(--bg-panel-hover); border-color: var(--border-active); }

.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border-subtle); }
.btn-outline:hover { color: var(--text-main); border-color: var(--border-active); }

.btn-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.75rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }

/* Views */
.view-container { display: none; }
.view-container.active { display: block; }

/* Public Layout */
.public-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .public-grid { grid-template-columns: 1fr; }
}

/* Panels */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1.15rem;
}

.highlight-panel {
  background: rgba(59, 130, 246, 0.04);
  border-color: rgba(59, 130, 246, 0.3);
}

.panel-header {
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-header h3 i { color: var(--primary); }

.panel-meta {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.panel-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.claim-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
}

.claim-notes {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

/* Badges */
.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-town { background: var(--town-bg); color: var(--town-text); border: 1px solid var(--town-border); }
.badge-mafia { background: var(--mafia-bg); color: var(--mafia-text); border: 1px solid var(--mafia-border); }
.badge-coven { background: var(--coven-bg); color: var(--coven-text); border: 1px solid var(--coven-border); }
.badge-vampire { background: var(--vamp-bg); color: var(--vamp-text); border: 1px solid var(--vamp-border); }
.badge-neutral { background: rgba(113, 113, 122, 0.15); color: #a1a1aa; border: 1px solid var(--border-subtle); }

/* Timeline */
.timeline-list { display: flex; flex-direction: column; gap: 0.65rem; }

.timeline-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-panel);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.timeline-tag {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.timeline-info { flex: 1; font-size: 0.875rem; }
.timeline-target { color: var(--accent); font-weight: 600; }
.timeline-result { color: var(--text-muted); font-size: 0.8rem; }

/* Chat Box */
.chat-panel { display: flex; flex-direction: column; height: 680px; }

.chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.agent-avatar {
  width: 38px;
  height: 38px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.agent-status { font-size: 0.775rem; color: var(--text-muted); }
.text-success { color: #22c55e; }

.identity-gate-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  margin: auto 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.gate-icon {
  width: 52px;
  height: 52px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.identity-gate-card h4 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.identity-gate-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  max-width: 320px;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 320px;
}

.gate-form input {
  text-align: center;
}

.quick-chips {
  display: flex;
  gap: 0.4rem;
  padding: 0.6rem 0;
  overflow-x: auto;
}

.chip-btn {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.775rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.chip-btn:hover { color: var(--text-main); border-color: var(--border-active); }

.chat-box {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.message { max-width: 88%; font-size: 0.875rem; display: flex; flex-direction: column; }
.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; }

.msg-bubble {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  line-height: 1.5;
}

.msg-bot .msg-bubble {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 2px;
}

.msg-user .msg-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.msg-time { font-size: 0.7rem; color: var(--text-dim); margin-top: 0.2rem; align-self: flex-end; }

.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chat-input-bar input {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  color: var(--text-main);
  font-size: 0.875rem;
}

.chat-input-bar input:focus { outline: none; border-color: var(--primary); }

/* Admin Dashboard */
.admin-top-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 800px) {
  .admin-top-bar { grid-template-columns: 1fr 1fr; }
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
}

.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.stat-card h3 { font-family: var(--font-heading); font-size: 1.35rem; font-weight: 700; }
.text-accent { color: var(--accent); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-top: 0.3rem;
}

.pill-active { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }

/* Admin Navigation Tabs */
.admin-nav-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.admin-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid transparent;
}

.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.badge-count {
  background: var(--border-subtle);
  color: var(--text-main);
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
}

.admin-tab-pane { display: none; }
.admin-tab-pane.active { display: block; }

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 800px) {
  .grid-2col { grid-template-columns: 1fr; }
}

/* Form Styling */
.form-group { margin-bottom: 0.9rem; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.form-row { display: flex; gap: 0.75rem; }
.col-4 { flex: 4; }
.col-6 { flex: 6; }
.col-8 { flex: 8; }

input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.875rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.input-copy-group { display: flex; gap: 0.5rem; }

/* Inbox Feed */
.inbox-feed { display: flex; flex-direction: column; gap: 0.75rem; max-height: 550px; overflow-y: auto; }

.inbox-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.inbox-card.flagged { border-color: #ef4444; background: rgba(239, 68, 68, 0.06); }
.inbox-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-dim); margin-bottom: 0.35rem; }
.inbox-question { font-weight: 600; color: #38bdf8; margin-bottom: 0.2rem; }
.inbox-answer { font-size: 0.85rem; color: var(--text-muted); }

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--primary);
  color: var(--text-main);
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }
