/* Alright Pumo — Premium Design System & UI Components */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

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

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.2s ease;
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Typography */
h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--ink);
}

a { color: var(--brand); text-decoration: none; transition: 0.15s; }
a:hover { color: var(--brand-d); text-decoration: underline; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* App Shell */
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  backdrop-filter: blur(12px);
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-d));
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
  box-shadow: 0 4px 12px var(--brand-ring);
}

.brand-text b {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
  display: block;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--ink), var(--ink-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Navigation */
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-secondary);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  opacity: 0.75;
  transition: 0.15s;
}

.nav-item:hover {
  background: var(--panel2);
  color: var(--ink);
  transform: translateX(2px);
}

.nav-item.on {
  background: var(--brand-t);
  color: var(--brand);
  font-weight: 600;
}

.nav-item.on svg {
  opacity: 1;
  stroke: var(--brand);
}

.nav-item .badge {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  box-shadow: 0 2px 6px var(--brand-ring);
}

.sidebar-spacer { flex: 1; }

/* User Card in Sidebar */
.user-widget {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  display: grid;
  gap: 10px;
}

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

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-l));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
  box-shadow: 0 2px 8px var(--brand-ring);
}

.user-meta { min-width: 0; line-height: 1.25; }
.user-meta b {
  font-size: 13px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.user-meta span { font-size: 11px; color: var(--muted); }

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.role-badge.admin { background: var(--brand-t); color: var(--brand); }
.role-badge.manager { background: var(--info-t); color: var(--info); }
.role-badge.trainer { background: var(--ok-t); color: var(--ok); }

/* Quick Theme Selector Dropdown */
.theme-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

/* Main Area */
.main-content {
  padding: 28px 36px 60px;
  max-width: 1600px;
  width: 100%;
  min-width: 0;
}

/* Page Top Bar */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
}

.page-header p {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 4px;
}

/* Buttons */
.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  border-color: var(--brand);
  background: var(--panel2);
  transform: translateY(-1px);
}

.btn.pri {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px var(--brand-ring);
}

.btn.pri:hover {
  background: var(--brand-d);
  border-color: var(--brand-d);
  transform: translateY(-1px);
}

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

.btn.danger {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 30%, transparent);
}
.btn.danger:hover {
  background: var(--bad-t);
  border-color: var(--bad);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.btn.ghost:hover {
  background: var(--panel2);
  border-color: var(--line);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* Cards & Containers */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover { border-color: color-mix(in srgb, var(--line) 70%, var(--brand)); }
.card.pad { padding: 20px 24px; }

/* Grid Layouts */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); margin-bottom: 20px; }
.kpi {
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand);
  opacity: 0;
  transition: opacity 0.2s;
}
.kpi:hover::before { opacity: 1; }
.kpi small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi b {
  display: block;
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-head);
  margin-top: 4px;
  color: var(--ink);
  line-height: 1.1;
}
.kpi span { font-size: 12px; color: var(--muted); margin-top: 2px; display: block; }

.two { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.three { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--panel2);
  color: var(--ink-secondary);
  border: 1px solid var(--line);
}
.chip.ok { background: var(--ok-t); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-t); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-t); color: var(--bad); border-color: transparent; }
.chip.info { background: var(--info-t); color: var(--info); border-color: transparent; }
.chip.ember, .chip.brand { background: var(--brand-t); color: var(--brand); border-color: transparent; }

/* Tables */
.tablewrap { overflow: auto; border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; text-align: left; }
th {
  position: sticky;
  top: 0;
  background: var(--panel2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 2;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-subtle);
  vertical-align: middle;
  color: var(--ink);
}
tbody tr { transition: background-color 0.1s; }
tbody tr:hover { background: color-mix(in srgb, var(--brand-t) 35%, transparent); }
tr.click { cursor: pointer; }

/* Progress bars */
.bar {
  height: 8px;
  background: var(--panel3);
  border-radius: 99px;
  overflow: hidden;
  min-width: 75px;
}
.bar i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.bar.ok i { background: var(--ok); }

/* Inputs & Form Controls */
input, select, textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  width: 100%;
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--panel2);
  color: var(--muted);
  cursor: not-allowed;
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters input { max-width: 280px; }
.filters select { width: auto; max-width: 220px; }

/* Empty state */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 12px;
}
.empty svg { width: 44px; height: 44px; opacity: 0.5; stroke: var(--muted); }

/* Quick Search Palette (Cmd+K / Ctrl+K) */
.spotlight-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  place-items: start center;
  padding-top: 14vh;
}
.spotlight-modal.on { display: grid; }
.spotlight-box {
  width: min(620px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.spotlight-input-wrap {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.spotlight-input-wrap svg { width: 20px; height: 20px; stroke: var(--muted); }
.spotlight-input {
  border: none;
  box-shadow: none;
  padding: 0;
  font-size: 16px;
  background: transparent;
}
.spotlight-input:focus { box-shadow: none; }
.spotlight-results {
  max-height: 380px;
  overflow: auto;
  padding: 8px;
  display: grid;
  gap: 3px;
}
.spotlight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: 0.1s;
}
.spotlight-item:hover, .spotlight-item.active {
  background: var(--brand-t);
  color: var(--brand);
}

/* Drawer */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 50;
}
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: min(840px, 100%);
  background: var(--bg);
  z-index: 60;
  transform: translateX(102%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.drawer.on { transform: none; }
.dh {
  padding: 20px 24px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 4px; margin-top: 14px; overflow: auto; }
.tabs button {
  border: 0;
  background: none;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs button.on {
  color: var(--brand);
  border-color: var(--brand);
}
.db { padding: 22px 26px 80px; overflow: auto; flex: 1; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 99px;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 120;
  pointer-events: none;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive adjustments */
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    bottom: 0; top: auto;
    height: auto; width: 100%;
    flex-direction: row;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    border-right: 0;
  }
  .brand-header, .user-widget, .sidebar-spacer { display: none; }
  .nav-group { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 3px; font-size: 11px; padding: 6px 8px; }
  .main-content { padding: 18px 18px 90px; }
  .two, .three { grid-template-columns: 1fr; }
}
