/* ═══════════════════════════════════════════════════════════
   DISCORD MANAGER DASHBOARD v3.0 — CSS
   Aesthetic: Dark Industrial / Refined Utility
   Fonts: Syne (headings) + Manrope (body) + JetBrains Mono (code)
═══════════════════════════════════════════════════════════ */

:root {
  --bg:          #08090c;
  --bg2:         #0e1015;
  --card:        #111318;
  --card2:       #161922;
  --border:      #1e222e;
  --border2:     #252b3a;
  --primary:     #6c63ff;
  --primary-dim: rgba(108,99,255,.15);
  --accent:      #00e5a0;
  --accent-dim:  rgba(0,229,160,.12);
  --red:         #ff4d6d;
  --red-dim:     rgba(255,77,109,.12);
  --orange:      #ff9f43;
  --orange-dim:  rgba(255,159,67,.12);
  --gold:        #ffd166;
  --gold-dim:    rgba(255,209,102,.12);
  --text:        #dde3f0;
  --text-muted:  #6b7590;
  --text-dim:    #4a5270;
  --font:        'Manrope', sans-serif;
  --font-head:   'Syne', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
  --radius:      10px;
  --radius-lg:   16px;
  --sidebar-w:   240px;
  --transition:  .18s cubic-bezier(.4,0,.2,1);
}

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

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

/* ── Layout ────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.logo-badge {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.logo-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
  color: var(--text);
}

.logo-ver {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--text-dim);
  padding: 14px 8px 6px;
  font-family: var(--font-head);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background: var(--card);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active .nav-icon { stroke: var(--primary); }

.nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  transition: stroke var(--transition);
}

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  font-family: var(--font-mono);
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

.user-chip img {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  flex-shrink: 0;
}

.user-chip-info { min-width: 0; }

.user-chip-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip-role {
  font-size: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
}

.btn-logout {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-logout:hover {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--red);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

/* ── Main ──────────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 60px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  flex: 1;
  letter-spacing: .01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-guild {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-refresh {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.btn-refresh:hover { color: var(--text); background: var(--card2); }

.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.card-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body { padding: 20px; }

/* ── Stats grid ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-card.blue::before  { background: var(--primary); }
.stat-card.green::before { background: var(--accent); }
.stat-card.red::before   { background: var(--red); }
.stat-card.warn::before  { background: var(--orange); }
.stat-card.gold::before  { background: var(--gold); }

.stat-card.blue  { border-color: rgba(108,99,255,.25); }
.stat-card.green { border-color: rgba(0,229,160,.25); }
.stat-card.red   { border-color: rgba(255,77,109,.25); }
.stat-card.warn  { border-color: rgba(255,159,67,.25); }
.stat-card.gold  { border-color: rgba(255,209,102,.25); }

.stat-icon-wrap {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

.stat-card.blue  .stat-icon-wrap { background: var(--primary-dim); color: var(--primary); }
.stat-card.green .stat-icon-wrap { background: var(--accent-dim);  color: var(--accent); }
.stat-card.red   .stat-icon-wrap { background: var(--red-dim);     color: var(--red); }
.stat-card.warn  .stat-icon-wrap { background: var(--orange-dim);  color: var(--orange); }
.stat-card.gold  .stat-icon-wrap { background: var(--gold-dim);    color: var(--gold); }

.stat-value {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Grid layouts ──────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text-dim);
  font-family: var(--font-head);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

.td-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: var(--font);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { flex-shrink: 0; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #5b52e0; box-shadow: 0 4px 16px rgba(108,99,255,.4); }

.btn-success { background: var(--accent); color: #08090c; }
.btn-success:hover { background: #00cc8e; }

.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,77,109,.3); }
.btn-danger:hover { background: var(--red); color: #fff; }

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

.btn-warn { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(255,159,67,.3); }
.btn-warn:hover { background: var(--orange); color: #fff; }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: 6px; }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Form ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: .04em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  transition: border-color var(--transition);
  outline: none;
}

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

.form-select { cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }

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

/* ── Toggle ────────────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-wrap:last-child { border-bottom: none; }

.toggle-info .toggle-label { font-size: 13px; font-weight: 600; }
.toggle-info .toggle-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.toggle {
  position: relative;
  width: 42px; height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border2);
  border-radius: 22px;
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Badge / Tag ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.badge-blue   { background: var(--primary-dim); color: var(--primary); }
.badge-green  { background: var(--accent-dim);  color: var(--accent); }
.badge-red    { background: var(--red-dim);     color: var(--red); }
.badge-orange { background: var(--orange-dim);  color: var(--orange); }
.badge-gray   { background: rgba(255,255,255,.06); color: var(--text-muted); }
.badge-gold   { background: var(--gold-dim);    color: var(--gold); }

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

.empty-icon { color: var(--text-dim); opacity: .5; }
.empty-text { font-size: 14px; font-weight: 500; }
.empty-sub  { font-size: 12px; color: var(--text-dim); }

/* ── Member row ────────────────────────────────────────────── */
.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.member-row:hover { background: rgba(255,255,255,.02); }
.member-row:last-child { border-bottom: none; }

.member-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--card2);
  border: 2px solid var(--border2);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  overflow: hidden;
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }

.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 13px; font-weight: 600; }
.member-id   { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }

/* ── Search ────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
}
.search-wrap svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.search-wrap input {
  padding-left: 34px;
}

/* ── Progress bar ──────────────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .5s ease;
}

/* ── Rank card ─────────────────────────────────────────────── */
.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.rank-item:last-child { border-bottom: none; }

.rank-pos {
  width: 28px;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  flex-shrink: 0;
}

.rank-1 { color: var(--gold); }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

.rank-info { flex: 1; min-width: 0; }
.rank-name  { font-size: 13px; font-weight: 600; }
.rank-level { font-size: 11px; color: var(--text-muted); }

.rank-xp {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* ── Activity feed ─────────────────────────────────────────── */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.dot-warn    { background: var(--orange); }
.dot-ticket  { background: var(--primary); }
.dot-ban     { background: var(--red); }
.dot-join    { background: var(--accent); }
.dot-leave   { background: var(--text-dim); }
.dot-mod     { background: var(--gold); }

.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; color: var(--text); }
.activity-time { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); margin-top: 2px; }

/* ── Panel ticket card ─────────────────────────────────────── */
.panel-card {
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-emoji {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--primary-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.panel-title { font-size: 14px; font-weight: 700; }
.panel-desc  { font-size: 12px; color: var(--text-muted); }
.panel-footer { display: flex; gap: 6px; }

/* ── Log row ───────────────────────────────────────────────── */
.log-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.log-row:last-child { border-bottom: none; }

.log-time {
  font-family: var(--font-mono);
  color: var(--text-dim);
  flex-shrink: 0;
  width: 100px;
}
.log-type {
  flex-shrink: 0;
  width: 90px;
}
.log-msg { color: var(--text); flex: 1; }

/* ── Giveaway card ─────────────────────────────────────────── */
.giveaway-card {
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 16px;
  border-top: 3px solid var(--gold);
}

.giveaway-prize { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.giveaway-meta  { font-size: 12px; color: var(--text-muted); }
.giveaway-timer { font-family: var(--font-mono); font-size: 13px; color: var(--gold); margin-top: 6px; }

/* ── Toast ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  animation: slideUp .2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}

.toast.success { background: #0d2e20; border: 1px solid rgba(0,229,160,.3); color: var(--accent); }
.toast.error   { background: #2e0d16; border: 1px solid rgba(255,77,109,.3); color: var(--red); }
.toast.info    { background: var(--card); border: 1px solid var(--border2); color: var(--text); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
  backdrop-filter: blur(4px);
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  transform: scale(.96);
  transition: transform var(--transition);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.open .modal { transform: scale(1); }

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

.modal-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--red-dim); color: var(--red); border-color: var(--red); }

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

/* ── Loading ───────────────────────────────────────────────── */
.loading-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Index page (login) ────────────────────────────────────── */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.login-bg::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(108,99,255,.08) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(0,229,160,.06) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
