/* ============================================
   FlowStash — Sub-Nav Component
   Left-side vertical navigation for composite tabs.
   Used by: Studio, Inbox, Profile (Earn) and
            Library, Requests, Profile (Buy).
   ============================================ */

.tab-shell {
  display: grid;
  grid-template-columns: 192px 1fr;
  gap: 0;
  min-height: 480px;
  align-items: start;
}

.tab-shell__sidebar {
  grid-column: 1;
  border-right: 1px solid var(--border-subtle);
}

.tab-shell__body {
  grid-column: 2;
}

/* ── Sub-Nav sidebar ── */
.sub-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) 0;
  position: sticky;
  top: calc(var(--space-8) + 60px); /* approx nav height */
  min-height: 100%;
}

/* ── Individual nav item ── */
.sub-nav__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  width: 100%;
  position: relative;
  transition:
    color var(--duration-fast) var(--ease-default),
    background var(--duration-fast) var(--ease-default);
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-nav__item:hover {
  color: var(--text-secondary);
  background: var(--border-subtle);
}

/* Active state: left accent bar + highlight */
.sub-nav__item--active {
  color: var(--text-primary);
  background: var(--border-default);
}

.sub-nav__item--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--accent);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

/* ── Icon inside nav item ── */
.sub-nav__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.7;
}

.sub-nav__item--active .sub-nav__icon {
  opacity: 1;
  color: var(--accent);
}

/* ── Label text ── */
.sub-nav__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Section content area ── */
.tab-section {
  padding: 0 0 var(--space-8) 0;
  min-height: 400px;
}

.tab-shell__body .tab-section {
  padding-left: var(--space-8);
}

/* ── Mobile: horizontal scroll bar (sub-nav collapses) ── */
@media (max-width: 680px) {
  .tab-shell {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .tab-shell__sidebar {
    border-right: none;
  }

  .sub-nav {
    flex-direction: row;
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    padding: 0 0 var(--space-1);
    position: static;
    gap: var(--space-1);
    /* Hide scrollbar visually */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .sub-nav::-webkit-scrollbar {
    display: none;
  }

  .sub-nav__item {
    flex-shrink: 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: var(--space-2) var(--space-4);
    border-bottom: 2px solid transparent;
  }

  .sub-nav__item::before {
    /* Replace the left bar with a bottom bar on mobile */
    top: auto;
    bottom: -2px;
    left: 10%;
    right: 10%;
    width: auto;
    height: 2px;
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  }

  .tab-section,
  .tab-shell__body .tab-section {
    padding: var(--space-6) 0 var(--space-8);
  }
}
