/* ============================================================
   TV — app shell: ambient backdrop, sidebar, toolbar
   ============================================================ */

/* Ambient desktop backdrop that shows through the vibrancy layers */
#ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 700px at 78% -12%, rgba(63, 92, 255, 0.16), transparent 62%),
    radial-gradient(1000px 620px at -8% 108%, rgba(255, 71, 128, 0.10), transparent 58%),
    radial-gradient(900px 540px at 45% 118%, rgba(40, 200, 190, 0.07), transparent 60%),
    #0d0d12;
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  height: 100dvh;
}

/* ============================================================
   Sidebar — translucent vibrancy panel
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 6px 10px 12px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(44px) saturate(180%);
  -webkit-backdrop-filter: blur(44px) saturate(180%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
  z-index: 40;
  overflow: hidden;
}

.sidebar-app {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 8px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  flex: none;
}
.sidebar-app .sidebar-app-logo {
  width: 22px; height: 22px; flex: none;
  color: var(--text-primary);
}

.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding-top: 2px; }
.sidebar-scroll::-webkit-scrollbar { width: 0; }

.sidebar-label {
  padding: 16px 10px 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.side-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 32px;
  padding: 0 9px;
  margin-bottom: 1px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(235, 235, 245, 0.78);
  white-space: nowrap;
  transition: background 110ms var(--ease-out), color 110ms;
}
.side-item:hover { background: var(--fill-hover); color: var(--text-primary); }
.side-item.is-active {
  background: var(--fill-selected);
  color: #fff;
  font-weight: 600;
}
.side-item .side-icon {
  width: 19px; height: 19px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.side-item .side-icon svg { width: 19px; height: 19px; }
.side-item .side-badge {
  margin-left: auto;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ff453a;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Apple TV+ wordmark icon */
.side-item .side-icon .wordmark {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.sidebar-account {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  margin-top: 8px;
  padding: 0 9px;
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.sidebar-account:hover { background: var(--fill-hover); color: var(--text-primary); }
.sidebar-account .avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  flex: none;
  background-size: cover;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.sidebar-account .account-name { overflow: hidden; text-overflow: ellipsis; }

/* Collapsed icon-rail mode */
.app.sidebar-collapsed .sidebar { width: var(--sidebar-rail); }
.app.sidebar-collapsed .side-item { justify-content: center; padding: 0; }
.app.sidebar-collapsed .side-item .side-text,
.app.sidebar-collapsed .side-item .side-badge { display: none; }
.app.sidebar-collapsed .sidebar-label { text-indent: -9999px; height: 12px; padding: 14px 0 4px; }
.app.sidebar-collapsed .sidebar-account { justify-content: center; padding: 0; }
.app.sidebar-collapsed .sidebar-account .account-name { display: none; }
.app.sidebar-collapsed .sidebar-app { justify-content: center; padding: 0; }

.sidebar-collapse-btn { margin: 2px auto 0; display: flex; }

/* ============================================================
   Main column: toolbar + scrolling view
   ============================================================ */
.main {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Toolbar floats over the scrolling content with vibrancy */
.toolbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--toolbar-height);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px 0 24px;
  background: linear-gradient(rgba(14, 14, 18, 0.62), rgba(14, 14, 18, 0.38));
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--ease-out), background 240ms;
}
.toolbar.is-visible { opacity: 1; pointer-events: auto; }
.toolbar.is-scrolled {
  background: rgba(18, 18, 22, 0.72);
  box-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.08);
}

.toolbar-context {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.toolbar.is-scrolled .toolbar-context { opacity: 1; transform: translateY(0); }
.toolbar-context .ctx-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-search {
  margin-left: auto;
  position: relative;
  width: min(300px, 34vw);
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.10);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--text-tertiary);
  transition: background 140ms, box-shadow 140ms, width 220ms var(--ease-out);
}
.toolbar-search:hover { background: rgba(255, 255, 255, 0.145); }
.toolbar-search:focus-within {
  background: rgba(20, 20, 24, 0.9);
  box-shadow: 0 0 0 3.5px rgba(10, 132, 255, 0.45);
  width: min(380px, 40vw);
}
.toolbar-search svg { width: 14px; height: 14px; flex: none; }
.toolbar-search input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-primary);
}
.toolbar-search input::placeholder { color: var(--text-tertiary); }

/* Sidebar toggle inside the toolbar (narrow widths) */
.toolbar-side-toggle { display: none; }

/* The scrollable content surface */
.view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-content);
  border-radius: var(--radius-panel);
  margin: 0;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  position: relative;
}
.view::-webkit-scrollbar { width: 11px; }

/* Content vertical rhythm inside a page */
.page-body { padding: 0 44px 64px; }
