/**
 * LivreAudio Phase D — Layout desktop + responsive
 * Requiert design-tokens.css
 */

body {
  padding: 0 !important;
  min-height: 100vh;
  background: var(--bg);
}

.app-frame {
  display: flex;
  min-height: 100vh;
  max-width: 100%;
}

/* ── Sidebar desktop ── */
.sidebar {
  display: none;
  flex-direction: column;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: var(--space-lg) var(--space-md);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .brand-logo span {
  font-size: 1.25rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1;
}

.sidebar-nav .app-nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: 0.15s;
}

.sidebar-nav .app-nav-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.sidebar-nav .app-nav-btn.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav .app-nav-btn:hover:not(.active) {
  background: var(--secondary-btn);
  color: var(--text);
}

.sidebar-footer {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* ── Main content ── */
.app-main {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

.shell {
  max-width: var(--content-max) !important;
  margin: 0 auto;
  padding: var(--space-lg) var(--shell-padding-x, 16px);
  padding-bottom: calc(var(--nav-bottom-height) + var(--space-lg));
}

main {
  max-width: 100% !important;
}

#brandHeader {
  display: none;
}

body.on-home .home-top-brand {
  display: none;
}

/* ── Bottom nav (mobile/tablet) ── */
.bottom-nav {
  max-width: 100% !important;
}

/* ── BookCard constitution ── */
.book-card-v2 {
  flex: 0 0 var(--book-card-width);
  min-height: var(--book-card-min-height);
}

.book-card-v2 .book-cover {
  width: var(--cover-width);
  height: var(--cover-height);
}

.lib-card .book-cover {
  width: var(--cover-width);
  height: var(--cover-height);
}

button.primary {
  min-height: var(--btn-height);
  border-radius: var(--radius-btn);
}

.book-card-v2 .play-btn,
.lib-card .play-btn {
  min-height: 42px;
  border-radius: var(--radius-btn);
}

.demo-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent);
  margin-left: 0.35rem;
  vertical-align: middle;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.demo-section-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: var(--space-lg) 0 var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.page-header-bar {
  margin-bottom: var(--space-lg);
}

.page-header-bar h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

/* ── Desktop ≥1280 ── */
@media (min-width: 1280px) {
  .sidebar {
    display: flex;
  }

  .bottom-nav {
    display: none !important;
  }

  .shell {
    padding-bottom: var(--space-xl);
  }

  body.on-home .home-top-brand {
    display: block;
    text-align: center;
    margin-bottom: var(--space-md);
  }

  #viewCreate .page-title,
  #viewLibrary .section-head,
  #viewSettings .faq {
    max-width: 720px;
  }

  .player-all {
    max-width: 900px;
  }
}

/* ── Tablet 768–1279 ── */
@media (min-width: 768px) and (max-width: 1279px) {
  .shell {
    max-width: 720px !important;
  }

  .library-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Mobile <768 ── */
@media (max-width: 767px) {
  .shell {
    padding: var(--space-md) var(--space-md) calc(var(--nav-bottom-height) + var(--space-md));
  }

  body.on-home .home-top-brand {
    display: block;
  }

  .books-scroll .book-card-v2 {
    flex: 0 0 min(280px, 85vw);
  }
}

/* Listen empty state */
.empty-state {
  text-align: center;
  padding: 3rem var(--space-md);
  max-width: 480px;
  margin: 2rem auto;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.empty-state .primary {
  max-width: 280px;
  margin: 0 auto;
}
