
/* ShadLab OS — Phase 12.0.3 Unified Sidebar Engine */

.shadlab-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--sl-color-bg);
  color: var(--sl-color-text);
  font-family: var(--sl-font-family);
  direction: rtl;
}

.shadlab-shell.is-collapsed {
  grid-template-columns: 84px minmax(0, 1fr);
}

.sl-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--sl-color-surface);
  border-inline-start: 1px solid var(--sl-color-border);
  box-shadow: var(--sl-shadow-sm);
  padding: var(--sl-space-4);
  z-index: 1000;
}

.sl-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sl-space-3);
  padding: var(--sl-space-3);
  border-radius: var(--sl-radius-lg);
  background: var(--sl-color-surface-soft);
  margin-bottom: var(--sl-space-4);
}

.sl-sidebar-brand-title {
  font-size: var(--sl-font-size-lg);
  font-weight: var(--sl-font-weight-bold);
  white-space: nowrap;
}

.sl-sidebar-toggle,
.sl-sidebar-mobile-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--sl-radius-md);
  border: 1px solid var(--sl-color-border);
  background: var(--sl-color-surface);
  color: var(--sl-color-text);
  cursor: pointer;
}

.sl-sidebar-section-title {
  color: var(--sl-color-muted);
  font-size: var(--sl-font-size-xs);
  font-weight: var(--sl-font-weight-bold);
  margin: var(--sl-space-5) var(--sl-space-3) var(--sl-space-2);
}

.sl-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-1);
}

.sl-sidebar-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sl-space-3);
  padding: 10px 12px;
  border-radius: var(--sl-radius-md);
  color: var(--sl-color-text);
  text-decoration: none;
  min-height: 42px;
}

.sl-sidebar-item:hover {
  background: var(--sl-color-primary-soft);
  color: var(--sl-color-primary);
  text-decoration: none;
}

.sl-sidebar-item.is-active {
  background: var(--sl-color-primary);
  color: #fff;
  box-shadow: var(--sl-shadow-sm);
}

.sl-sidebar-icon {
  width: 22px;
  min-width: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sl-sidebar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sl-sidebar-badge {
  margin-inline-start: auto;
  min-width: 22px;
  height: 22px;
  border-radius: var(--sl-radius-pill);
  background: var(--sl-severity-danger);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--sl-font-size-xs);
  padding: 0 7px;
}

.shadlab-shell.is-collapsed .sl-sidebar {
  padding: var(--sl-space-3);
}

.shadlab-shell.is-collapsed .sl-sidebar-label,
.shadlab-shell.is-collapsed .sl-sidebar-section-title,
.shadlab-shell.is-collapsed .sl-sidebar-brand-title,
.shadlab-shell.is-collapsed .sl-sidebar-badge {
  display: none;
}

.shadlab-shell-main {
  min-width: 0;
  padding: var(--sl-space-6);
}

.sl-sidebar-backdrop {
  display: none;
}

@media (max-width: 782px) {
  .shadlab-shell {
    display: block;
  }

  .sl-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: auto;
    inset-inline-end: 0;
    width: min(86vw, 320px);
    transform: translateX(110%);
    transition: transform .18s ease;
    height: 100vh;
  }

  .shadlab-shell.sidebar-open .sl-sidebar {
    transform: translateX(0);
  }

  .sl-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.55);
    z-index: 999;
    display: none;
  }

  .shadlab-shell.sidebar-open .sl-sidebar-backdrop {
    display: block;
  }

  .shadlab-shell-main {
    padding: var(--sl-space-4);
  }

  .sl-sidebar-mobile-toggle {
    position: fixed;
    inset-inline-end: var(--sl-space-4);
    bottom: var(--sl-space-4);
    z-index: 998;
    box-shadow: var(--sl-shadow-md);
  }
}
