/* ═══════════════════════════════════════════
   Discord Manager — Stylesheet
   ═══════════════════════════════════════════ */

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

:root {
  --bg-deep: #0a0b0f;
  --bg-main: #0f1117;
  --bg-card: #161821;
  --bg-card-hover: #1c1e2a;
  --bg-input: #1a1c28;
  --border: #252838;
  --border-focus: #5865f2;
  --text: #e4e5ea;
  --text-dim: #8b8fa3;
  --text-muted: #5c5f72;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --green: #57f287;
  --green-dim: #2d7d46;
  --red: #ed4245;
  --red-dim: #7d2224;
  --yellow: #fee75c;
  --yellow-dim: #7d6d2e;
  --orange: #e67e22;
  --cyan: #00d4aa;
  --sidebar-w: 260px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-main);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
}

.guild-icon {
  width: 40px; height: 40px; border-radius: 12px;
  object-fit: cover;
}

.guild-icon-placeholder {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.brand-name {
  font-weight: 700; font-size: 14px;
  display: block; color: var(--text);
}

.brand-sub {
  font-size: 12px; color: var(--text-muted);
}

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-label {
  display: block; padding: 8px 12px 4px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0;
  border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 14px; font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}

.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item.active svg { stroke: #fff; }
.nav-item svg { flex-shrink: 0; stroke: var(--text-dim); transition: stroke var(--transition); }
.nav-item:hover svg { stroke: var(--text); }

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

.user-info {
  display: flex; align-items: center; gap: 10px;
}

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
}

.user-name { font-size: 13px; font-weight: 600; }

.logout-btn {
  display: block; margin-top: 10px; padding: 6px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-dim);
  font-size: 12px; cursor: pointer; text-align: center;
  text-decoration: none; transition: all var(--transition);
}
.logout-btn:hover { background: var(--red-dim); color: var(--red); border-color: var(--red-dim); }

/* ═══ MAIN CONTENT ═══ */
.main { margin-left: var(--sidebar-w); padding: 28px 32px; min-height: 100vh; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px; font-weight: 800;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-dim) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.page-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

/* ═══ CARDS ═══ */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: all var(--transition);
}
.card:hover { border-color: #353850; }

.card-title {
  font-size: 16px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* ═══ STAT CARDS ═══ */
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  position: relative; overflow: hidden;
}

.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.blue::before { background: var(--accent); }
.stat-card.green::before { background: var(--green); }
.stat-card.red::before { background: var(--red); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.cyan::before { background: var(--cyan); }

.stat-value {
  font-size: 32px; font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}
.stat-card.blue .stat-value { color: var(--accent); }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.red .stat-value { color: var(--red); }
.stat-card.yellow .stat-value { color: var(--yellow); }
.stat-card.cyan .stat-value { color: var(--cyan); }

.stat-label { font-size: 13px; color: var(--text-dim); margin-top: 6px; font-weight: 500; }

/* ═══ TABLE ═══ */
.table-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 12px 16px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); background: var(--bg-input);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 16px; font-size: 14px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(88, 101, 242, 0.04); }

/* ═══ BADGES ═══ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge.warn { background: rgba(254,231,92,0.12); color: var(--yellow); }
.badge.mute { background: rgba(230,126,34,0.12); color: var(--orange); }
.badge.kick { background: rgba(237,66,69,0.12); color: var(--red); }
.badge.ban { background: rgba(237,66,69,0.18); color: var(--red); }
.badge.unban, .badge.unmute { background: rgba(87,242,135,0.12); color: var(--green); }
.badge.open { background: rgba(87,242,135,0.12); color: var(--green); }
.badge.claimed { background: rgba(88,101,242,0.12); color: var(--accent); }
.badge.closed { background: rgba(91,95,114,0.2); color: var(--text-muted); }
.badge.active { background: rgba(87,242,135,0.12); color: var(--green); }
.badge.ended { background: rgba(91,95,114,0.2); color: var(--text-muted); }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; transition: all var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-danger { background: var(--red-dim); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-secondary { background: var(--bg-input); color: var(--text-dim); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 6px; }

/* ═══ FORMS ═══ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-dim); margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 14px;
  transition: all var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,101,242,0.15);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-card); color: var(--text); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px;
  width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

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

.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; padding: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

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

/* ═══ SEARCH ═══ */
.search-box {
  position: relative; margin-bottom: 20px;
}
.search-box input {
  width: 100%; padding: 10px 14px 10px 40px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 14px;
}
.search-box input:focus { outline: none; border-color: var(--accent); }
.search-box svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  stroke: var(--text-muted);
}

.search-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-top: 4px;
  max-height: 200px; overflow-y: auto;
  display: none;
}
.search-results.active { display: block; }

.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-item img { width: 28px; height: 28px; border-radius: 50%; }

/* ═══ CATEGORY CARDS ═══ */
.category-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  position: relative; transition: all var(--transition);
}
.category-card:hover { border-color: #353850; }

.category-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.category-name {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}

.category-actions { display: flex; gap: 6px; }

.category-meta { font-size: 13px; color: var(--text-dim); }
.category-meta span { display: block; margin-bottom: 4px; }

.toggle {
  position: relative; width: 40px; height: 22px;
  background: var(--bg-input); border-radius: 11px;
  border: 1px solid var(--border); cursor: pointer;
  transition: all var(--transition);
}
.toggle.active { background: var(--accent); border-color: var(--accent); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); transition: transform var(--transition);
}
.toggle.active::after { transform: translateX(18px); }

/* ═══ QUESTIONS LIST ═══ */
.question-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg-input);
  border-radius: var(--radius-sm); margin-bottom: 6px;
  font-size: 13px;
}
.question-item .remove-q {
  margin-left: auto; background: none; border: none;
  color: var(--red); cursor: pointer; font-size: 16px;
}

/* ═══ TOAST ═══ */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  animation: toastIn 0.3s ease-out;
  box-shadow: var(--shadow);
}
.toast.success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(87,242,135,0.3); }
.toast.error { background: var(--red-dim); color: var(--red); border: 1px solid rgba(237,66,69,0.3); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ═══ LOGIN ═══ */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #131525 0%, var(--bg-deep) 70%);
}

.login-card {
  text-align: center; padding: 48px 40px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; max-width: 400px; width: 100%;
  box-shadow: var(--shadow);
}

.login-title { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.login-sub { color: var(--text-dim); font-size: 15px; margin-bottom: 32px; }

.login-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px; border-radius: var(--radius);
  background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 700; font-family: inherit;
  border: none; cursor: pointer; text-decoration: none;
  transition: all var(--transition);
}
.login-btn:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 8px 25px rgba(88,101,242,0.35); }

.login-error {
  margin-top: 16px; padding: 10px; border-radius: var(--radius-sm);
  background: var(--red-dim); color: var(--red); font-size: 13px;
}

/* ═══ ERROR PAGE ═══ */
.error-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; text-align: center;
}
.error-code { font-size: 100px; font-weight: 800; color: var(--accent); font-family: 'JetBrains Mono', monospace; line-height: 1; }
.error-msg { font-size: 18px; color: var(--text-dim); margin: 16px 0 32px; }

/* ═══ EMPTY STATE ═══ */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 15px; }

/* ═══ TABS ═══ */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; background: var(--bg-input); border-radius: var(--radius-sm); padding: 4px; width: fit-content; }
.tab {
  padding: 8px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--text-dim); background: transparent;
  border: none; font-family: inherit;
  transition: all var(--transition);
}
.tab.active { background: var(--accent); color: #fff; }
.tab:hover:not(.active) { color: var(--text); }

/* ═══ RESPONSIVE ═══ */
.mobile-toggle {
  display: none; position: fixed; top: 16px; left: 16px; z-index: 200;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
  color: var(--text); cursor: pointer;
}

@media (max-width: 768px) {
  .mobile-toggle { display: block; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 60px 16px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
}
