/* Ryze ecom — app shell: navbar + dark espresso sidebar + content inset */

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

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ---------- Navbar (48px, top, full width) ---------- */
.navbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--navbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
  z-index: 30;
  flex-shrink: 0;
}
.navbar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: var(--text-body-lg);
}
.navbar .logo-sun {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

/* Breadcrumbs with thin diagonal slash */
.crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-body);
  min-width: 0;
}
.crumb {
  color: var(--muted-foreground);
  padding: 4px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.crumb.current { color: var(--foreground); font-weight: 500; }
.crumb-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.15s;
}
.crumb-switcher:hover { background: var(--accent); }
.crumb-switcher svg { width: 13px; height: 13px; color: var(--muted-foreground); }
.crumb-slash { color: var(--border); flex-shrink: 0; }

.navbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Agent pill button */
.agent-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: inherit;
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--foreground);
  cursor: pointer;
  transition: background-color 0.15s;
}
.agent-btn:hover { background: var(--muted); }
.agent-btn .sparkle { color: var(--brand); width: 15px; height: 15px; }

/* ---------- Sidebar (dark espresso, hover-expand rail) ---------- */
.sidebar {
  position: relative;
  width: var(--sidebar-w-icon);
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-foreground);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 20;
}
.sidebar:hover, .sidebar.expanded, html.sb-open .sidebar {
  width: var(--sidebar-w);
  box-shadow: var(--shadow-panel);
}
html.sb-open .sidebar, html.sb-open .sidebar * { transition: none; }
html.sb-open .sidebar:hover, html.sb-open .sidebar:hover * { transition: none; }

/* Textured gradient background layers */
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 60% at 20% 0%, rgba(120, 75, 35, 0.35), transparent 60%),
    radial-gradient(ellipse 100% 50% at 90% 100%, rgba(90, 55, 25, 0.3), transparent 55%);
  pointer-events: none;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-brand-dark);
  pointer-events: none;
}
.sidebar > * { position: relative; z-index: 1; }

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: none;
}
.sidebar-scroll::-webkit-scrollbar { display: none; }

/* Group label — visible only expanded */
.nav-group-label {
  font-size: var(--text-tiny);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  padding: 12px 10px 4px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
}
.sidebar:hover .nav-group-label,
.sidebar.expanded .nav-group-label,
html.sb-open .sidebar .nav-group-label { opacity: 1; }

/* Divider shown in icon mode instead of label */
.nav-group-divider {
  height: 1px;
  width: 20px;
  margin: 10px auto 6px;
  background: var(--sidebar-border);
  transition: opacity 0.15s;
}
.sidebar:hover .nav-group-divider,
.sidebar.expanded .nav-group-divider,
html.sb-open .sidebar .nav-group-divider { opacity: 0; height: 0; margin: 0; }

/* Nav item */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-small);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.5;
  opacity: 0.6;
  transition: transform 0.15s, opacity 0.15s;
  flex-shrink: 0;
}
.nav-item:hover svg { transform: translateX(2px); opacity: 1; }

.nav-item.active {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 20px;
  border-radius: 0 999px 999px 0;
  background: var(--sidebar-primary);
}

.nav-item .label {
  opacity: 0;
  transition: opacity 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar:hover .nav-item .label,
.sidebar.expanded .nav-item .label,
html.sb-open .sidebar .nav-item .label { opacity: 1; }

/* Drill-in chevron + count badge on the right */
.nav-item .trail {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.sidebar:hover .nav-item .trail,
.sidebar.expanded .nav-item .trail,
html.sb-open .sidebar .nav-item .trail { opacity: 1; }
.nav-item .trail svg { width: 14px; height: 14px; opacity: 0.5; }
.nav-count {
  font-size: var(--text-tiny);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
}
.nav-count.hot { background: var(--brand); color: #fff; }

/* Sub-items (drill-in section, expanded inline) */
.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.sidebar:hover .nav-sub.open,
html.sb-open .sidebar .nav-sub.open { max-height: 400px; }
html.drills-set .sidebar:hover .nav-sub.open,
html.drills-set.sb-open .sidebar .nav-sub.open { max-height: 0; }
html.d-growth .sidebar:hover #sub-growth, html.sb-open.d-growth #sub-growth,
html.d-store .sidebar:hover #sub-store, html.sb-open.d-store #sub-store,
html.d-support .sidebar:hover #sub-support, html.sb-open.d-support #sub-support { max-height: 400px !important; }
html.drills-set .nav-item.open .chev { transform: none; }
html.d-growth [data-drill="growth"] .chev,
html.d-store [data-drill="store"] .chev,
html.d-support [data-drill="support"] .chev { transform: rotate(90deg) !important; }
/* collapsed rail: parent of active sub-item shows active state */
[data-drill].child-active { background: var(--sidebar-accent); }
[data-drill].child-active svg { opacity: 1; }
.sidebar:hover [data-drill].child-active,
html.sb-open .sidebar [data-drill].child-active { background: transparent; }
.sidebar:hover [data-drill].child-active:hover,
html.sb-open .sidebar [data-drill].child-active:hover { background: rgba(255, 255, 255, 0.06); }
.nav-sub .nav-item {
  height: 30px;
  padding-left: 36px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.6);
}
.nav-sub .nav-item:hover { color: #fff; }
.nav-sub .nav-item.active { color: #fff; }
.nav-item .chev { transition: transform 0.2s; }
.nav-item.open .chev { transform: rotate(90deg); }

/* Sidebar footer — account */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-footer .nav-item { height: 36px; }
.sidebar-footer .avatar { width: 22px; height: 22px; margin-left: -3px; }
.sidebar-footer .sub {
  font-size: var(--text-tiny);
  color: rgba(255, 255, 255, 0.4);
  display: block;
  line-height: 1.2;
}

/* ---------- Content inset ---------- */
.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: transparent;
}
.page {
  max-width: 1408px;
  margin: 0 auto;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.page-header h1 { font-size: var(--text-h3); font-weight: 700; }
.page-header .sub { font-size: var(--text-body); color: var(--muted-foreground); margin-top: 2px; }
.page-header .actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Grid helpers */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 4px; }

@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
}
