
/* ==========================================================================
   APP PAGE LAYOUT  (app.html) - Three-column dual-panel layout
   ========================================================================== */

body.app-body {
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #100D09;
}

/* Disable video background on tool pages */
body.app-body #video-bg-container {
  display: none;
}

/* -- App: Top Bar --------------------------------------------------------- */
.app-topbar {
  height: var(--topbar-height);
  background: var(--background);
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}

.app-topbar .navbar__nav {
  top: var(--topbar-height);
}

/* -- App: Shell - three-column CSS Grid ----------------------------------- */
.app-shell {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr 300px;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 0.25s ease;
}

/* Collapsed panel states */
.app-shell.hide-left  { grid-template-columns: 0 1fr 300px; }
.app-shell.hide-right { grid-template-columns: var(--sidebar-width) 1fr 0; }
.app-shell.hide-left.hide-right { grid-template-columns: 0 1fr 0; }

/* -- Panel visibility when collapsed ---------------------------------------- */
.sidebar,
.right-panel {
  transition: opacity 0.2s ease;
}
.app-shell.hide-left  > .sidebar      { opacity: 0; pointer-events: none; overflow: hidden; }
.app-shell.hide-right > .right-panel  { opacity: 0; pointer-events: none; overflow: hidden; }

/* -- Panel toggle tabs (floating on center column edges) ------------------ */
.panel-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 52px;
  padding: 0;
  background: var(--clr-surface-raised);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.panel-toggle:hover {
  background: var(--clr-surface-raised);
  color: var(--clr-saffron);
}
.panel-toggle--left  { left: 0;  border-left: none;  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.panel-toggle--right { right: 0; border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* -- Left Sidebar (Fretboard Settings) ------------------------------------ */
.sidebar {
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-border) transparent;
}

.sidebar__section-label {
  padding: 20px 16px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--clr-text-muted);
  white-space: nowrap;
}

.sidebar__nav {
  list-style: none;
  padding: 4px 8px;
}

.sidebar__nav li + li {
  margin-top: 2px;
}

.sidebar__nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--clr-text-secondary);
  transition: background var(--transition), color var(--transition);
  text-align: left;
  white-space: nowrap;
}

.sidebar__nav-btn:hover {
  background: var(--clr-surface-raised);
  color: var(--clr-text);
}

.sidebar__nav-btn.active {
  background: var(--clr-saffron-glow);
  color: var(--clr-saffron);
  font-weight: 600;
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label { flex: 1; }

.nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: var(--fw-bold);
  padding: 2px 7px;
  border-radius: 100px;
  background: var(--clr-saffron);
  color: var(--clr-note-text);
  letter-spacing: 0.04em;
}

.sidebar__footer {
  margin-top: auto;
  padding: 8px;
  border-top: 1px solid var(--clr-border);
  flex-shrink: 0;
}

/* -- Right Panel (Tool Settings) ----------------------------------------- */
.right-panel {
  background: var(--clr-surface);
  border-left: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-border) transparent;
}

/* Workspace tabs: vertical card stack inside the right panel */
.right-panel #workspace-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: auto;
  padding: 4px 0;
  background: transparent;
  border-bottom: none;
  overflow: visible;
}

.right-panel .workspace-tab {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--clr-border);
}

.right-panel .workspace-tab--active {
  border-color: rgba(230, 148, 32, 0.44);
}

.right-panel .workspace-tab-add {
  margin-left: 0;
}

/* -- Right panel section visibility (driven by data-page attribute) ------ */
/* Sections are hidden by default; the one matching data-page is shown.     */
.rp-section {
  display: none;
}

.right-panel[data-page="home"] .rp-section[data-for-page="home"] { display: block; }
.right-panel[data-page="quiz"]  .rp-section[data-for-page="quiz"]  { display: block; }

/* -- Centre: Flutter Container ------------------------------------------- */
.flutter-container {
  position: relative; /* anchor for quiz-gate overlay */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0f0901;
  min-height: 0;
}

.app-shell--dashboard .flutter-container {
  pointer-events: none;
}

/* Flex spacers that push parts 2 & 3 to vertical centre */
.center-spacer {
  flex: 1;
  min-height: 0;
}

.flutter-area {
  flex: none;
  height: clamp(220px, 52vh, 520px);
  position: relative;
  overflow: hidden;
}

.flutter-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  display: block;
}