/* ============================================
   Jade — Layout System (App Shell + Grid)
   ============================================ */

/* ── App Shell: 3-Column Grid ── */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--aside-width);
  grid-template-areas: "sidebar main aside";
  height: 100vh;
  min-height: 100vh;
  background: var(--bg-void);
  overflow: hidden;
}

.app-shell--no-aside {
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-areas: "sidebar main";
}

/* ── Sidebar ── */

.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-4) 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--duration-normal) var(--ease-out);
  z-index: 20;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  margin-bottom: var(--space-4);
  color: var(--green-bright);
}

.sidebar__logo svg {
  width: 32px;
  height: 32px;
}

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

.sidebar__nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  margin: 0 auto;
}

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

.sidebar__nav-item--active {
  background: var(--bg-card);
  color: var(--green-bright);
}

.sidebar__nav-item--active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--green-bright);
  border-radius: var(--radius-pill);
}

.sidebar__nav-item svg {
  width: 22px;
  height: 22px;
}

.sidebar__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) var(--space-2);
  gap: var(--space-3);
  position: relative; /* anchor for auth dropdown */
}

/* ── Main Content ── */

.main-content {
  grid-area: main;
  max-width: var(--main-max-width);
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Right Aside ── */

.aside {
  grid-area: aside;
  padding: var(--space-6) var(--space-4);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  overflow-x: hidden;
}

.aside__section {
  margin-bottom: var(--space-8);
}

.aside__section-title {
  font-size: var(--text-body-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Responsive: Tablet (2-column) ── */

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-areas: "sidebar main";
  }

  .aside {
    display: none;
  }

  .main-content {
    max-width: 100%;
    padding: var(--space-6) var(--space-6);
  }
}

/* ── Responsive: Mobile (single column + bottom bar) ── */

@media (max-width: 640px) {
  body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  .mobile-header {
    flex-shrink: 0;
  }

  .app-shell {
    flex: 1;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: "main";
    padding-bottom: var(--bottom-bar-height);
    overflow: hidden;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    max-width: 100%;
    padding: var(--space-4) var(--space-3);
  }

  /* ── Mobile Bottom Tab Bar ── */

  .bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-bar-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    z-index: 30;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

@media (min-width: 641px) {
  .bottom-bar {
    display: none;
  }
}

.bottom-bar__nav {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--space-4);
}

.bottom-bar__nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-circle);
  color: var(--text-muted);
  transition: color var(--duration-fast) var(--ease-out);
}

.bottom-bar__nav-item:hover,
.bottom-bar__nav-item--active {
  color: var(--green-bright);
}

.bottom-bar__create {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-circle);
  background: var(--green-bright);
  color: var(--text-on-green);
  box-shadow: var(--shadow-glow-green);
  margin-top: -12px;
  transition: all var(--duration-fast) var(--ease-out);
}

.bottom-bar__create:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow-green-strong);
}

.bottom-bar__create svg {
  width: 22px;
  height: 22px;
}