/* ── Panel Layout ─────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #05050a;
  --sidebar:  #0a0a14;
  --bg-card:  rgba(255,255,255,.035);
  --border:   rgba(255,255,255,.07);
  --border2:  rgba(255,255,255,.12);
  --purple:   #8b5cf6;
  --purple-d: #6d28d9;
  --blue:     #3b82f6;
  --cyan:     #06b6d4;
  --white:    #f8fafc;
  --muted:    #64748b;
  --muted2:   #94a3b8;
  --success:  #22c55e;
  --danger:   #ef4444;
  --warn:     #f59e0b;
  --sidebar-w: 240px;
}

body {
  background: var(--bg);
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,.35); border-radius: 3px; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.panel-wrap { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo {
  font-size: 1.3rem;
  font-weight: 900;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}
.sidebar-logo .logo-sub { font-size: 0.7rem; color: var(--muted); font-weight: 500; }

.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }

.nav-section-label {
  padding: 0.6rem 1rem 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  margin: 0.1rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted2);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--white); }
.nav-item.active { background: rgba(139,92,246,.15); color: var(--white); }
.nav-item.active .nav-icon { color: var(--purple); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}
.user-info-sidebar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.5rem;
  border-radius: 8px;
}
.user-avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.8rem;
  flex-shrink: 0;
}
.user-info-text .name { font-size: 0.875rem; font-weight: 700; }
.user-info-text .role { font-size: 0.7rem; color: var(--muted); }
.logout-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  transition: color .2s;
  font-size: 1rem;
}
.logout-btn:hover { color: var(--danger); }

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

.panel-topbar {
  height: 56px;
  background: rgba(5,5,10,.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 0.95rem; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }

.online-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted2);
  background: rgba(34,197,94,.08);
  border: 1px solid rgba(34,197,94,.15);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}
.online-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.5} }

.panel-content { padding: 1.5rem; flex: 1; }

/* ── Section visibility ────────────────────────────────────────────────────── */
.panel-section { display: none; }
.panel-section.active { display: block; }

/* ── Stat Cards ───────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: border-color .2s;
}
.stat-card:hover { border-color: rgba(139,92,246,.25); }
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.stat-icon.purple { background: rgba(139,92,246,.15); }
.stat-icon.blue   { background: rgba(59,130,246,.15); }
.stat-icon.green  { background: rgba(34,197,94,.12); }
.stat-icon.cyan   { background: rgba(6,182,212,.12); }
.stat-info .val { font-size: 1.6rem; font-weight: 800; line-height: 1; margin-bottom: 0.2rem; }
.stat-info .lbl { font-size: 0.75rem; color: var(--muted); font-weight: 500; }

/* ── Panel Cards ──────────────────────────────────────────────────────────── */
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.panel-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-card-header h3 { font-size: 0.9rem; font-weight: 700; }
.panel-card-body { padding: 1.25rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media(max-width:900px){ .two-col { grid-template-columns: 1fr; } }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th {
  text-align: left;
  padding: 0.6rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 0.75rem 0.85rem; border-bottom: 1px solid rgba(255,255,255,.04); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.025); }

/* ── Console ──────────────────────────────────────────────────────────────── */
.console-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(0,0,0,.3);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.console-toolbar select,
.console-toolbar input {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border2);
  color: var(--white);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  outline: none;
}
.console-output {
  background: #020205;
  min-height: 420px;
  max-height: 520px;
  overflow-y: auto;
  padding: 1rem;
  font-family: 'Menlo', 'Monaco', 'Fira Code', monospace;
  font-size: 0.8rem;
  line-height: 1.7;
}
.log-line { display: flex; gap: 0.75rem; }
.log-ts { color: #444; white-space: nowrap; }
.log-level { white-space: nowrap; font-weight: 700; }
.log-level.info   { color: #22d3ee; }
.log-level.warn   { color: #f59e0b; }
.log-level.error  { color: #ef4444; }
.log-level.system { color: #a78bfa; }
.log-msg { color: #94a3b8; word-break: break-word; }

/* ── Form Elements ────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--white);
  font-size: 0.875rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139,92,246,.12);
}
.form-input::placeholder { color: var(--muted); }
.form-select { appearance: none; cursor: pointer; }
.form-textarea { resize: vertical; min-height: 90px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--purple), var(--blue)); color: #fff; }
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--muted2); border: 1px solid var(--border2); }
.btn-ghost:hover { color: var(--white); background: rgba(255,255,255,.06); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.25); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-success { background: rgba(34,197,94,.12); color: var(--success); border: 1px solid rgba(34,197,94,.2); }
.btn-success:hover { background: rgba(34,197,94,.22); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Badge ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-admin  { background: rgba(139,92,246,.15); color: var(--purple); border: 1px solid rgba(139,92,246,.25); }
.badge-user   { background: rgba(59,130,246,.1);  color: var(--blue);   border: 1px solid rgba(59,130,246,.2); }
.badge-online { background: rgba(34,197,94,.1);   color: var(--success); border: 1px solid rgba(34,197,94,.2); }
.badge-offline{ background: rgba(255,255,255,.05);color: var(--muted);   border: 1px solid var(--border); }
.badge-banned { background: rgba(239,68,68,.1);   color: var(--danger);  border: 1px solid rgba(239,68,68,.2); }

/* ── Search ───────────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
}
.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--white);
  font-size: 0.875rem;
  width: 220px;
}
.search-bar input::placeholder { color: var(--muted); }

/* ── Announcement ─────────────────────────────────────────────────────────── */
.announcement-item {
  padding: 1rem;
  border-radius: 10px;
  background: rgba(139,92,246,.06);
  border: 1px solid rgba(139,92,246,.15);
  margin-bottom: 0.75rem;
}
.announcement-item:last-child { margin-bottom: 0; }
.announcement-item h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.35rem; }
.announcement-item p { color: var(--muted2); font-size: 0.83rem; }
.announcement-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; font-size: 0.72rem; color: var(--muted); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #0d0d1a;
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 1.75rem;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h3 { font-size: 1rem; font-weight: 800; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.modal-close:hover { color: var(--white); }

/* ── Alert ────────────────────────────────────────────────────────────────── */
.alert-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideUp .3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  display: none;
}
.alert-toast.show { display: flex; align-items: center; gap: 0.5rem; }
.alert-toast.success { background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.3); color: #86efac; }
.alert-toast.error   { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-toast.info    { background: rgba(59,130,246,.15); border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }
@keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

/* ── Loading Spinner ──────────────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(139,92,246,.2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 500;
  transition: opacity .3s;
}
.loading-screen.hidden { opacity: 0; pointer-events: none; }
.loading-logo {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── User profile card ────────────────────────────────────────────────────── */
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 1rem;
}
.profile-name { font-size: 1.3rem; font-weight: 800; }
.profile-role { font-size: 0.8rem; color: var(--muted2); margin-top: 0.25rem; }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.profile-stat { text-align: center; }
.profile-stat .v { font-size: 1.2rem; font-weight: 800; display: block; }
.profile-stat .l { font-size: 0.7rem; color: var(--muted); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media(max-width:768px){
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .panel-main { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
