/* ===================================================
   MOKSHA HUB – Workbench Design Tokens
   Load this BEFORE app.css in base.html
=================================================== */

/* ── Typography ──────────────────────────────── */
:root {
  --font-sans: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
}

/* ── Accent (Moksha Orange) ───────────────────── */
:root {
  --accent:         oklch(0.67 0.18 42);         /* ≈ #ff7b00 */
  --accent-hover:   oklch(0.60 0.18 42);         /* ≈ #e06a00 */
  --accent-muted:   oklch(0.67 0.18 42 / 0.12);
  --accent-text:    #ffffff;
}

/* ── Light mode ──────────────────────────────── */
:root {
  --bg:       #f0f2f5;
  --surface:  #ffffff;
  --surface-1:#f8f9fa;

  --text:     #111827;
  --text-2:   #374151;
  --border:   #e0e3e8;
  --muted:    #6b7280;

  /* Sidebar */
  --sidebar-bg:              #ffffff;
  --sidebar-border:          #e0e3e8;
  --sidebar-link:            #4b5563;
  --sidebar-link-hover-bg:   #f3f4f6;
  --sidebar-link-active-bg:  oklch(0.67 0.18 42 / 0.08);
  --sidebar-link-active:     oklch(0.60 0.18 42);

  /* Layout */
  --sidebar-w:  240px;
  --topbar-h:   56px;

  /* Scrollbars */
  --scrollbar-thumb: rgba(0,0,0,.18);
  --scrollbar-track: rgba(0,0,0,.05);
}

/* ── Dark mode ────────────────────────────────── */
html[data-theme="dark"] {
  --accent:         oklch(0.72 0.18 42);
  --accent-hover:   oklch(0.65 0.18 42);
  --accent-muted:   oklch(0.72 0.18 42 / 0.15);

  --bg:       #0b0f14;
  --surface:  #121823;
  --surface-1:#17202d;

  --text:     #e5e7eb;
  --text-2:   #9ca3af;
  --border:   #253041;
  --muted:    #9ca3af;

  --sidebar-bg:              #0e1520;
  --sidebar-border:          #1e2d40;
  --sidebar-link:            #94a3b8;
  --sidebar-link-hover-bg:   #1a2740;
  --sidebar-link-active-bg:  oklch(0.72 0.18 42 / 0.12);
  --sidebar-link-active:     oklch(0.72 0.18 42);

  --scrollbar-thumb: rgba(255,255,255,.15);
  --scrollbar-track: rgba(255,255,255,.05);
}

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

/* ── Sidebar ──────────────────────────────────── */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.25s ease;
}

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

/* Login page: sidebar hidden → full width */
.app-sidebar.d-none + .app-main {
  margin-left: 0;
}

/* ── Sidebar header (logo) ────────────────────── */
.sidebar-header {
  padding: 16px 16px 14px;
  background: var(--accent);
  border-bottom: 1px solid var(--accent-hover);
  flex-shrink: 0;
}

.sidebar-header .sb-logo {
  fill: oklch(0.93 0.09 42);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

/* ── Sidebar nav ──────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 6px 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 16px;
  color: var(--sidebar-link);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  line-height: 1.4;
  border-left: 2px solid transparent;
}

.sidebar-link i {
  font-size: 1.02rem;
}

.sidebar-link:hover {
  background: var(--sidebar-link-hover-bg);
  color: var(--text);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--sidebar-link-active-bg);
  color: var(--sidebar-link-active);
  border-left-color: var(--sidebar-link-active);
  font-weight: 600;
}

.sidebar-link i {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link.disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

/* ── Sidebar group / section ──────────────────── */
.sidebar-group {
  padding-top: 8px;
}

.sidebar-group + .sidebar-group {
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-label {
  display: block;
  padding: 8px 16px 4px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge-soon {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  background: var(--border);
  color: var(--muted);
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 4px;
  font-style: normal;
}

/* ── Sidebar footer ───────────────────────────── */
.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--sidebar-border);
  padding: 8px 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Icon-only buttons (notif, theme) */
.sidebar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--sidebar-link);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-size: 1rem;
  flex-shrink: 0;
  position: relative;
}

.sidebar-icon-btn:hover {
  background: var(--sidebar-link-hover-bg);
  color: var(--text);
}

/* Notification dot */
.notif-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  background: #ef4444;
  border-radius: 50%;
  border: 1.5px solid var(--sidebar-bg);
}

/* User menu button */
.sidebar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.sidebar-user-btn:hover {
  background: var(--sidebar-link-hover-bg);
}

.sidebar-user-btn .user-name-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.sidebar-user-btn .bi-person-circle {
  font-size: 1.1rem;
  color: var(--muted);
  flex-shrink: 0;
}

.sidebar-user-btn .bi-chevron-up {
  font-size: 0.65rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Mobile topbar ────────────────────────────── */
.app-topbar {
  display: none;
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  z-index: 999;
  padding: 0 12px;
  align-items: center;
  gap: 8px;
}

.topbar-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.35rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.12s;
  flex-shrink: 0;
}

.topbar-hamburger:hover {
  background: var(--sidebar-link-hover-bg);
}

.topbar-spacer {
  flex: 1;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
  display: block;
}

/* ── Responsive: mobile ────────────────────────── */
@media (max-width: 991px) {
  .app-sidebar {
    transform: translateX(-100%);
    z-index: 1010;
  }

  .app-sidebar.sidebar-open {
    transform: translateX(0);
  }

  /* Login page sidebar stays hidden */
  .app-sidebar.d-none {
    display: none !important;
  }

  .app-main {
    margin-left: 0;
  }

  .app-topbar {
    display: flex;
  }
}

/* ── Page content ─────────────────────────────── */
.app-content {
  flex: 1;
  padding: 0;
}

/* Toast container — keep above sidebar */
#toastContainer {
  z-index: 1100;
}

/* ── Theme toggle icon ────────────────────────── */
/* Light mode: show moon (click to go dark) */
.theme-icon-moon { display: inline-flex; }
.theme-icon-sun  { display: none; }

/* Dark mode: show sun (click to go light) */
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun  { display: inline-flex; }

/* ── Sidebar notification badge ──────────────── */
.sidebar-notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.5rem;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  line-height: 1;
  border: 1.5px solid var(--sidebar-bg);
}

.sidebar-notif-badge.d-none { display: none !important; }
