*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  background-image: url('../assets/bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Edge-to-edge layout with a uniform outer gap */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  padding: 1.5rem; /* Creates the breathing room around the edges */
  gap: 1.5rem;     /* Space between sidebar and main content */
}

/* Floating, Sticky Glass Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass-dark);
  border-radius: var(--radius-lg); /* Rounded card edges */
  padding: 1.5rem;

  position: sticky;
  top: 1.5rem; /* Matches the shell's top padding */
  height: calc(100vh - 3rem); /* Exact viewport height minus top and bottom padding */
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-glass-dark);
  margin-bottom: 1.5rem;
}

.brand-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: 1.2;
}

.nav-group {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: all 0.2s ease;
}

.nav-link:hover {
  background-color: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
}

.nav-link.active {
  background-color: var(--accent-glow);
  color: var(--accent-primary);
}

/* Main Content Area */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Hamburger button - Hidden on Desktop */
.mobile-toggle {
  display: none;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass-dark);
  border-radius: var(--radius-md);
  padding: 0.6rem;
  cursor: pointer;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 90;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
}

.close-sidebar {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Mobile Breakpoint */
@media (max-width: 900px) {
  .app-shell {
    padding: 1rem;
  }

  .main-wrapper {
    padding-top: 3.5rem; /* Clears the hamburger button */
  }

  .mobile-toggle, .close-sidebar {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    border-radius: 0; /* Removes rounding so it sits flush against the screen edge when opened */
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }
}
