/* ==========================================================================
   layout.css — kerangka aplikasi, topbar, area konten, antrean
   ========================================================================== */

.app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-app);
}

.app__shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: calc(100vh - var(--player-height));
  height: calc(100dvh - var(--player-height));
  min-height: 0;
}

/* --------------------------------------------------------------------------
   Area utama
   -------------------------------------------------------------------------- */

.main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-app);
}

.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-height);
  padding: 0 26px;
  background: var(--topbar-bg);
  border-bottom: 1px solid transparent;
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}

.topbar.is-scrolled {
  border-bottom-color: var(--border);
}

.topbar__menu {
  display: none;
}

.topbar__history {
  display: flex;
  align-items: center;
  gap: 1px;
}

.topbar__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.005em;
}

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

.queue-toggle {
  position: relative;
}

.queue-toggle__dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease);
}

.queue-toggle.has-unread .queue-toggle__dot {
  opacity: 1;
  transform: scale(1);
}

.queue-toggle[aria-pressed="true"] {
  background: var(--bg-hover-strong);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   View / scroll area
   -------------------------------------------------------------------------- */

.view {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: calc(var(--topbar-height) + 20px) 30px 64px;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.view:focus {
  outline: none;
}

.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  animation: fade-in 220ms var(--ease-out);
}

.page--wide {
  max-width: none;
}

.page-enter {
  animation: rise-in 300ms var(--ease-out);
}

.section {
  margin-top: 40px;
}

.section:first-child {
  margin-top: 0;
}

.section--tight {
  margin-top: 26px;
}

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section__title {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--text);
}

.section__sub {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-3);
}

.section__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

/* --------------------------------------------------------------------------
   Antrean
   -------------------------------------------------------------------------- */

.queue-panel {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  bottom: var(--player-height);
  width: 376px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--modal-bg);
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.3);
  transform: translateX(calc(100% + 30px));
  visibility: hidden;
  transition: transform 320ms var(--ease-out), visibility 320ms;
  will-change: transform;
}

.queue-panel.is-open {
  transform: translateX(0);
  visibility: visible;
}

.queue-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 22px 16px;
  border-bottom: 1px solid var(--divider);
}

.queue-panel__head h2 {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.queue-panel__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 20px;
}

.queue-panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 22px 16px;
  border-top: 1px solid var(--divider);
  font-size: 12px;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Scaffolding yang dipakai lintas halaman
   -------------------------------------------------------------------------- */

.stack {
  display: grid;
  gap: 18px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row--between {
  justify-content: space-between;
}

.grow {
  flex: 1;
  min-width: 0;
}

.divider {
  height: 1px;
  border: 0;
  background: var(--divider);
  margin: 0;
}
