/* Routerr Health — Sidebar & App Shell Layout
   Collapsible sidebar: shows icons only by default, expands on hover as floating overlay. */

/* ── App Shell Grid ── */
.app-shell {
  display: grid;
  grid-template-columns: 56px 1fr;  /* collapsed sidebar width */
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 500;
  width: 56px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  transition: width 0.2s ease, box-shadow 0.2s ease;
}

.sidebar:hover {
  width: 220px;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  overflow-y: auto;
}

/* ── Brand ── */
.sidebar-brand {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: padding 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-brand .brand-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: cover;
  object-position: -4px center;  /* Crop to R icon in collapsed state */
  transition:
    width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    object-position 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar:hover .sidebar-brand {
  padding: 12px 16px;
  justify-content: flex-start;
}

.sidebar:hover .sidebar-brand .brand-logo {
  width: 160px;
  object-position: center;  /* Pan to reveal full ROUTERR HEALTH lockup */
}

.sidebar-brand h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: none;
}

.sidebar:hover .sidebar-brand h2 {
  display: block;
}

.sidebar-brand h2 span {
  color: var(--accent);
}

.sidebar-brand .brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: none;
}

.sidebar:hover .sidebar-brand .brand-sub {
  display: block;
}

/* ── Nav Links ── */
.sidebar-nav {
  flex: 1;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar:hover .sidebar-nav {
  padding: 12px 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0px;
  padding: 10px 0;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0;  /* Hide text labels when collapsed */
  font-weight: 500;
  text-decoration: none;
  transition: all .15s var(--ease);
  white-space: nowrap;
  overflow: hidden;
  justify-content: center;
}

.sidebar:hover .sidebar-nav a {
  font-size: 0.85rem;  /* Show text labels when expanded */
  gap: 10px;
  padding: 9px 11px;
  justify-content: flex-start;
}

.sidebar-nav a:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.sidebar-nav a.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.sidebar-nav a .nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-nav .nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

/* ── Sidebar Footer (User badge) ── */
.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  overflow: hidden;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 4px;
  border-radius: var(--radius);
  transition: background .15s var(--ease);
}

.sidebar:hover .sidebar-user {
  justify-content: flex-start;
  gap: 10px;
  padding: 8px;
}

.sidebar-user:hover {
  background: var(--surface);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  width: 0;
  opacity: 0;
  overflow: hidden;
  transition: opacity 0.15s ease 0.05s;
}

.sidebar:hover .sidebar-user-info {
  width: auto;
  opacity: 1;
}

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.sidebar-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.15s ease 0.05s, color 0.15s var(--ease);
}

.sidebar:hover .sidebar-logout {
  width: auto;
  padding: 4px;
  opacity: 1;
}

.sidebar-logout:hover {
  color: var(--red);
}

/* ── Page Content Area ── */
.page-content {
  grid-column: 2;  /* Explicitly place in second column since fixed sidebar leaves column 1 empty */
  overflow-y: auto;
  background: var(--bg);
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.page-header h1 {
  font-size: 1.25rem;
}

.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Page Body ── */
.page-body {
  padding: 20px 24px;
}
