/* ========== APP SHELL ========== */
.app-shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

/* ========== TOP NAVBAR ========== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-height);
  width: 100%;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.navbar__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--navbar-height);
}

.navbar__brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.navbar__logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.navbar__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.navbar__brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.navbar__brand-tagline {
  font-size: 0.58rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

.navbar__tabs {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 2px;
  flex-shrink: 0;
}

.navbar__tab {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  height: 100%;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  transition: color var(--transition);
  position: relative;
  white-space: nowrap;
}

.navbar__tab i,
.navbar__tab .icon {
  width: 18px;
  height: 18px;
  font-size: 18px;
}

.navbar__tab .nav-icon {
  width: 28px;
  height: 28px;
}

.navbar__tab .nav-icon svg {
  width: 100%;
  height: 100%;
}

.navbar__tab:hover {
  color: var(--primary);
}

.navbar__tab--active {
  color: var(--primary);
  font-weight: 600;
}

.navbar__tab--active:hover {
  background: transparent;
}

.navbar__tab--active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

.navbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3f4f6;
  border: none;
  border-radius: var(--radius-full);
  padding: 0 14px 0 16px;
  flex: 1;
  max-width: 520px;
  min-width: 180px;
  height: 42px;
  transition: background var(--transition), box-shadow var(--transition);
}

.navbar__search:focus-within {
  background: #fff;
  box-shadow: 0 0 0 2px var(--primary-light);
}

.navbar__search svg,
.navbar__search .icon {
  width: 16px;
  height: 16px;
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.navbar__search input {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-primary);
  min-width: 0;
}

.navbar__search input::placeholder {
  color: var(--text-muted);
}

.navbar__search-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 7px;
  flex-shrink: 0;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.navbar__icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.navbar__icon-btn:hover {
  background: #f3f4f6;
  color: var(--primary);
}

.navbar__icon-btn .icon {
  width: 20px;
  height: 20px;
  font-size: 20px;
}

.navbar__icon-btn .nav-icon {
  width: 28px;
  height: 28px;
}

.navbar__icon-btn .nav-icon svg {
  width: 100%;
  height: 100%;
}

.navbar__avatar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}

.navbar__avatar-wrap:hover {
  background: var(--page-bg);
}

.navbar__avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.navbar__status-dot {
  position: absolute;
  bottom: 6px;
  left: 28px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--card-bg);
}

.navbar__profile-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.navbar__profile-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.navbar__profile-level {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.profile-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 50;
  overflow: hidden;
  padding: 6px;
}

.profile-menu.is-open {
  display: block;
}

.profile-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.profile-menu button:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.profile-menu button svg, .profile-menu button .icon {
  width: 16px;
  height: 16px;
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.menu-toggle:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.menu-toggle svg, .menu-toggle .icon {
  width: 22px;
  height: 22px;
}

/* ========== PAGE BODY GRID ========== */
.page-body {
  width: 100%;
  margin: 0;
  padding: 14px 0;
  display: grid;
  grid-template-columns: var(--sidebar-left) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* ========== BOTTOM NAV (mobile) ========== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  z-index: 120;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  transition: color var(--transition);
  position: relative;
}

.bottom-nav__item .icon {
  width: 22px;
  height: 22px;
}

.bottom-nav__item .nav-icon {
  width: 24px;
  height: 24px;
}

.bottom-nav__item .nav-icon svg {
  width: 100%;
  height: 100%;
}

.bottom-nav__item--active,
.bottom-nav__item:hover {
  color: var(--primary);
}

.bottom-nav__badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-left,
.sidebar-right {
  position: sticky;
  top: calc(var(--navbar-height) + 20px);
  max-height: calc(100vh - var(--navbar-height) - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-left::-webkit-scrollbar,
.sidebar-right::-webkit-scrollbar {
  width: 4px;
}

.sidebar-left::-webkit-scrollbar-thumb,
.sidebar-right::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.main-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: var(--feed-max);
  margin: 0;
  width: 100%;
}

.view-grid .main-feed {
  max-width: var(--feed-max);
  margin: 0;
}

.view-grid .play-main {
  max-width: var(--feed-max);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 150;
  opacity: 0;
  transition: opacity var(--transition);
}

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