/* ShukaHub Admin — Supabase-inspired strict minimal dark UI
   Variables, fonts, layout, components.
   ───────────────────────────────────────────────────────── */

:root {
  --bg:        #0d0e11;
  --bg-2:      #0a0b0e;
  --panel:    #14161b;
  --panel-2:  #1a1d23;
  --line:     rgba(255, 255, 255, 0.07);
  --line-2:   rgba(255, 255, 255, 0.12);
  --text:     #e6e6e6;
  --text-dim: #b0b3b8;
  --muted:    #8b8f96;
  --muted-2:  #6b6f76;

  --brand:        #E07A00;
  --brand-soft:   rgba(224, 122, 0, 0.14);
  --brand-edge:   rgba(224, 122, 0, 0.42);
  --green:        #3ecf8e;
  --green-soft:   rgba(62, 207, 142, 0.14);
  --yellow:       #f5b342;
  --yellow-soft:  rgba(245, 179, 66, 0.14);
  --red:          #ff5a5a;
  --red-soft:     rgba(255, 90, 90, 0.14);
  --blue:         #6aa9ff;
  --blue-soft:    rgba(106, 169, 255, 0.14);

  --radius:     6px;
  --radius-lg:  10px;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }
code, kbd, .mono { font-family: var(--font-mono); }
a { color: inherit; text-decoration: none; }

/* ═══ AUTH GATE ════════════════════════════════════════════════ */
.adm-shell[hidden] { display: none !important; }

.adm-gate {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 999;
  padding: 24px;
}

.adm-gate-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 24px 64px -20px rgba(0, 0, 0, 0.8);
}

.adm-gate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.adm-gate-brand-logo {
  width: 40px; height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.adm-gate-brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.adm-gate-brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.adm-gate-input {
  display: block;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s var(--ease);
  margin-bottom: 10px;
}

.adm-gate-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.adm-gate-btn {
  display: block;
  width: 100%;
  background: var(--brand);
  color: #1a1100;
  border: none;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  transition: filter 0.15s var(--ease);
}

.adm-gate-btn:hover { filter: brightness(1.08); }

.adm-gate-error {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--red);
  min-height: 16px;
}

/* ═══ APP SHELL ════════════════════════════════════════════════ */
.adm-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
}

/* ── Sidebar ── */
.adm-sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.adm-sidebar-logo {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.adm-sidebar-brandtxt { line-height: 1.2; min-width: 0; }
.adm-sidebar-name { font-weight: 600; font-size: 14px; }
.adm-sidebar-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

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

.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 2px 0;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  user-select: none;
}

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

.adm-nav-item.active {
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-edge);
  padding: 7px 11px;
}

.adm-nav-icon {
  font-family: var(--font-mono);
  font-size: 12px;
  width: 16px;
  opacity: 0.85;
  text-align: center;
}

.adm-nav-badge {
  margin-left: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  min-width: 22px;
  text-align: center;
}

.adm-nav-badge:empty { display: none; }
.adm-nav-badge-warn { background: var(--yellow-soft); border-color: rgba(245, 179, 66, 0.32); color: var(--yellow); }
.adm-nav-badge-danger { background: var(--red-soft); border-color: rgba(255, 90, 90, 0.32); color: var(--red); }

.adm-sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.adm-sidebar-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.adm-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(62, 207, 142, 0.7);
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

.adm-lock-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 12px;
  transition: all 0.15s var(--ease);
}

.adm-lock-btn:hover { color: var(--text); border-color: var(--text-dim); }

/* ═══ MAIN ═════════════════════════════════════════════════════ */
.adm-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.adm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
}

.adm-topbar-left { min-width: 0; }
.adm-topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.adm-crumb {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.adm-crumb #adminSectionTitle { color: var(--text); font-weight: 500; }
.adm-crumb-sep { opacity: 0.4; padding: 0 4px; }

.adm-topbar-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.adm-input {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  width: 240px;
  max-width: 100%;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.adm-input:focus {
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.adm-search { width: 280px; }

.adm-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
  cursor: pointer;
}

.adm-textarea { width: 100%; resize: vertical; min-height: 90px; }

.adm-icon-btn {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 14px;
  transition: all 0.15s var(--ease);
}

.adm-icon-btn:hover { border-color: var(--line-2); color: var(--text); }

/* ═══ SECTIONS ═════════════════════════════════════════════════ */
.adm-section {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
}

.adm-section[hidden] { display: none; }

.adm-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.adm-toolbar .adm-input { width: 320px; }

/* ═══ KPI CARDS ════════════════════════════════════════════════ */
.adm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.adm-kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.adm-kpi:hover { border-color: var(--line-2); transform: translateY(-1px); }

.adm-kpi-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.adm-kpi-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.adm-kpi-sub {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 4px;
}

.adm-kpi-warn { border-color: rgba(245, 179, 66, 0.25); }
.adm-kpi-warn .adm-kpi-num { color: var(--yellow); }

/* ═══ CARDS ════════════════════════════════════════════════════ */
.adm-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.adm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.adm-card-title { font-weight: 500; font-size: 13.5px; }

.adm-link-btn {
  background: transparent;
  color: var(--brand);
  border: none;
  font-size: 12px;
  font-weight: 500;
}

.adm-link-btn:hover { text-decoration: underline; }

.adm-help {
  padding: 10px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.adm-help code { background: var(--bg-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

.adm-form {
  padding: 6px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adm-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-top: 6px;
}

.adm-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.adm-btn-primary {
  background: var(--brand);
  color: #1a1100;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: filter 0.15s var(--ease);
}

.adm-btn-primary:hover { filter: brightness(1.08); }

.adm-btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 12.5px;
  transition: all 0.15s var(--ease);
}

.adm-btn-ghost:hover { border-color: var(--text-dim); color: var(--text); }

.adm-btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(255, 90, 90, 0.28);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 12.5px;
  transition: all 0.15s var(--ease);
}
.adm-btn-danger:hover { background: rgba(255, 90, 90, 0.22); }

/* ═══ TABLES ═══════════════════════════════════════════════════ */
.adm-table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: auto;
}

.adm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.adm-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.adm-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.adm-table tbody tr { transition: background 0.15s var(--ease); }
.adm-table tbody tr:hover { background: var(--panel-2); cursor: pointer; }
.adm-table tbody tr:last-child td { border-bottom: none; }

.adm-table .cell-id,
.adm-table .cell-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

.adm-table .cell-name { font-weight: 500; color: var(--text); }
.adm-table .cell-muted { color: var(--muted); }

.adm-table .cell-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.adm-table .cell-actions { text-align: right; white-space: nowrap; }
.adm-table .cell-actions .adm-btn-ghost,
.adm-table .cell-actions .adm-btn-danger { padding: 4px 9px; font-size: 11.5px; margin-left: 4px; }

.adm-table .row-reported { background: rgba(255, 90, 90, 0.04); }
.adm-table .row-banned   { opacity: 0.65; }

.adm-empty {
  text-align: center;
  color: var(--muted);
  padding: 22px 12px;
  font-style: italic;
}

/* ═══ STATUS PILLS ═════════════════════════════════════════════ */
.adm-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  text-transform: lowercase;
}

.adm-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; }

.adm-pill-green  { color: var(--green);  background: var(--green-soft);  border-color: rgba(62, 207, 142, 0.28); }
.adm-pill-green::before  { background: var(--green); box-shadow: 0 0 4px rgba(62,207,142,0.7); }

.adm-pill-yellow { color: var(--yellow); background: var(--yellow-soft); border-color: rgba(245, 179, 66, 0.28); }
.adm-pill-yellow::before { background: var(--yellow); }

.adm-pill-red    { color: var(--red);    background: var(--red-soft);    border-color: rgba(255, 90, 90, 0.28); }
.adm-pill-red::before    { background: var(--red); }

.adm-pill-blue   { color: var(--blue);   background: var(--blue-soft);   border-color: rgba(106, 169, 255, 0.28); }
.adm-pill-blue::before   { background: var(--blue); }

.adm-pill-gray   { color: var(--muted);  background: var(--panel-2);     border-color: var(--line); }
.adm-pill-gray::before   { background: var(--muted); }

/* ═══ AVATAR ═══════════════════════════════════════════════════ */
.adm-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  object-fit: cover;
  vertical-align: middle;
  margin-right: 8px;
}

.adm-user-cell { display: flex; align-items: center; }

/* ═══ DRAWER ═══════════════════════════════════════════════════ */
.adm-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(480px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 40px -20px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform 0.28s var(--ease);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.adm-drawer.open { transform: translateX(0); }

.adm-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.adm-drawer-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.adm-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.adm-drawer-section { margin-bottom: 22px; }

.adm-drawer-section-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.adm-drawer-field {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  gap: 12px;
}

.adm-drawer-field:last-child { border-bottom: none; }

.adm-drawer-field-key {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 110px;
}

.adm-drawer-field-val {
  font-size: 12.5px;
  color: var(--text);
  text-align: right;
  word-break: break-all;
  flex: 1;
}

.adm-drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* ═══ TOAST ════════════════════════════════════════════════════ */
.adm-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.adm-toast {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 12px 28px -10px rgba(0,0,0,0.7);
  min-width: 200px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.adm-toast.show { opacity: 1; transform: translateY(0); }
.adm-toast-success { border-color: rgba(62, 207, 142, 0.35); }
.adm-toast-error   { border-color: rgba(255, 90, 90, 0.35); }

/* ═══ RESPONSIVE ═══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .adm-shell { grid-template-columns: 64px 1fr; }
  .adm-sidebar-brandtxt,
  .adm-nav-item span:not(.adm-nav-icon):not(.adm-nav-badge),
  .adm-sidebar-meta span,
  .adm-lock-btn { display: none; }
  .adm-nav-item { justify-content: center; padding: 10px; }
  .adm-nav-item.active { padding: 9px; }
  .adm-search { width: 180px; }
}

@media (max-width: 600px) {
  .adm-section { padding: 14px; }
  .adm-topbar { padding: 12px 14px; }
  .adm-drawer { width: 100vw; }
}

/* ═══ SCROLLBAR ════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }
