/* ============================================================
   layout.css: app shell — topbar, sidebar, canvas, detail panel
   ============================================================ */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 56px;
  padding: 0 var(--space-5);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
  z-index: var(--z-dropdown);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.brand-icon { display: flex; align-items: center; }

.brand-name {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand-accent { color: var(--airflow-bright); }

.brand-version {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  justify-content: center;
}

.nav-pill {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--ease-fast);
  white-space: nowrap;
}
.nav-pill:hover {
  background: var(--bg-3);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-pill.active {
  background: var(--airflow-subtle);
  color: var(--airflow-bright);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ── App body ───────────────────────────────────────────────── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border-default);
  overflow-y: auto;
  padding: var(--space-4) 0;
}

.sidebar-section {
  padding: 0 var(--space-3);
  margin-bottom: var(--space-5);
}

.sidebar-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-link {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: all var(--ease-fast);
  border-left: 2px solid transparent;
}
.sidebar-link:hover {
  background: var(--bg-3);
  color: var(--text-primary);
  text-decoration: none;
}
.sidebar-link.active {
  background: var(--airflow-subtle);
  color: var(--airflow-bright);
  border-left-color: var(--airflow);
  font-weight: 500;
}

/* ── Canvas ─────────────────────────────────────────────────── */
.canvas {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-1);
  min-width: 0;
}

.module-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-8) var(--space-16);
}

/* Modules that need the full width opt out */
.module-container.full-width { max-width: none; }

/* ── Detail panel ───────────────────────────────────────────── */
.detail-panel {
  width: 380px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-left: 1px solid var(--border-default);
  overflow-y: auto;
  padding: var(--space-6);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: 220px; }
  .detail-panel { width: 320px; }
  .topbar-nav { display: none; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    z-index: var(--z-overlay);
    transform: translateX(-100%);
    transition: transform var(--ease-in-out);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .detail-panel {
    position: fixed;
    right: 0;
    top: 56px;
    bottom: 0;
    z-index: var(--z-overlay);
  }
  .module-container { padding: var(--space-5) var(--space-4) var(--space-12); }
}
