/* static/css/layout.css — App shell, sidebar, topbar, content area */

/* ─── App Shell ──────────────────────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--brand-primary);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
}

.sidebar__logo {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.sidebar__logo-mark {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  color: #ffffff;
  letter-spacing: -0.01em;
}

.sidebar__logo-sub {
  font-size: var(--text-2xs);
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.sidebar__nav {
  flex: 1;
  padding: var(--space-3) 0;
}

.sidebar__section-label {
  font-size: var(--text-2xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  padding: var(--space-4) var(--space-6) var(--space-2);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-6);
  color: rgba(255,255,255,0.75);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: background var(--transition-fast), color var(--transition-fast);
  border-radius: 0;
  text-decoration: none;
  line-height: 1.4;
}

.sidebar__link:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  text-decoration: none;
}

.sidebar__link--active {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  border-right: 3px solid var(--brand-accent);
}

.sidebar__link-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar__user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: #ffffff;
  flex-shrink: 0;
}

.sidebar__user-name {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: rgba(255,255,255,0.9);
  truncate: true;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  font-size: var(--text-2xs);
  color: rgba(255,255,255,0.45);
}

/* ─── Main Panel ─────────────────────────────────────────────────────────── */
.main-panel {
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
  gap: var(--space-4);
}

.topbar__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar__notification-btn {
  position: relative;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: background var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
}

.topbar__notification-btn:hover { background: var(--color-surface-2); }

.topbar__badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
  border: 2px solid var(--color-surface);
}

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: var(--space-8);
}

/* ─── Page Header ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* ─── Responsive: collapse sidebar below 768px ───────────────────────────── */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
  }
  .sidebar--open { transform: translateX(0); }

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

  .main-content { padding: var(--space-4); }
}
