/* Layout — app shell, sidebar, page structure (design spec sections 4-5) */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width-collapsed) 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.app-shell.sidebar-expanded {
  grid-template-columns: var(--sidebar-width-expanded) 1fr;
}

.main-content {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.page-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.page-title {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.page-body {
  flex: 1;
  padding: var(--space-5) var(--space-6);
  overflow-y: auto;
}

/* Sidebar */

.sidebar {
  position: fixed;
  left: 0; top: 0;
  height: 100vh;
  width: var(--sidebar-width-collapsed);
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: width 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.expanded { width: var(--sidebar-width-expanded); }

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 24px; height: 24px;
  flex-shrink: 0;
  color: var(--accent);
}

.sidebar-brand-name {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 180ms ease;
}
.sidebar.expanded .sidebar-brand-name { opacity: 1; }

.sidebar-nav {
  flex: 1;
  padding: var(--space-2) 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  margin: 0 var(--space-2);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 140ms, background 140ms;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-item:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.sidebar-item.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-2));
  top: 8px; bottom: 8px;
  width: 2px;
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  background: var(--accent);
}

.sidebar-item-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.sidebar-item-label {
  font-size: var(--text-base);
  font-weight: 500;
  opacity: 0;
  transition: opacity 180ms ease;
}
.sidebar.expanded .sidebar-item-label { opacity: 1; }

.sidebar-toggle {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 140ms;
}
.sidebar-toggle:hover { color: var(--text-secondary); }
