<template>
  <div class="site">
    <!-- Desktop Sidebar -->
    <AppNavigation class="sidebar-desktop" />

    <!-- Mobile Header -->
    <div class="mobile-header">
      <NuxtLink to="/" class="brand">Ghost Guild</NuxtLink>
      <button class="btn" @click="isMobileMenuOpen = true">Menu</button>
    </div>

    <!-- Main Content -->
    <main class="main">
      <TopStrip :page-path="currentPageName" />
      <slot />
    </main>

    <!-- Mobile Drawer -->
    <USlideover v-model:open="isMobileMenuOpen" side="left">
      <template #body>
        <AppNavigation :is-mobile="true" @navigate="isMobileMenuOpen = false" />
      </template>
    </USlideover>

  </div>
</template>

<script setup>
const isMobileMenuOpen = ref(false)
const route = useRoute()

const currentPageName = computed(() => {
  const path = route.path
  if (path === '/') return ''
  // Convert /member/dashboard → member / dashboard
  return path.slice(1).replace(/\//g, ' / ')
})
</script>

<style scoped>
.site {
  min-height: 100vh;
}

.main {
  margin-left: 220px;
}

.sidebar-desktop {
  display: block;
}

.mobile-header {
  display: none;
}

.brand {
  font-family: 'Brygada 1918', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--candle);
  text-decoration: none;
}

@media (max-width: 768px) {
  .sidebar-desktop {
    display: none;
  }
  .mobile-header {
    display: flex;
    padding: 12px 20px;
    border-bottom: 1px dashed var(--border);
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .main {
    margin-left: 0;
  }
}
</style>
