<script setup>
import { ref } from 'vue'
import { useAuth } from './composables/useAuth.js'
import AppSidebar from './components/AppSidebar.vue'

const { isLoggedIn } = useAuth()
const sidebarCollapsed = ref(false)
</script>

<template>
  <div id="app" :class="{ 'sidebar-collapsed': sidebarCollapsed }">
    <AppSidebar v-if="isLoggedIn" :collapsed="sidebarCollapsed" @toggle="sidebarCollapsed = !sidebarCollapsed" />
    <main class="main-content" :class="{ 'no-sidebar': !isLoggedIn }">
      <router-view />
    </main>
  </div>
</template>

<style scoped>
#app { display: flex; min-height: 100vh; background: var(--bg); }
.main-content { flex: 1; margin-left: 260px; padding: 2rem; min-height: 100vh; transition: margin-left 0.3s; }
.main-content.no-sidebar { margin-left: 0; }
.sidebar-collapsed .main-content { margin-left: 70px; }
@media (max-width: 1024px) { .main-content { margin-left: 70px; } }
@media (max-width: 768px) { .main-content { margin-left: 0; } }
</style>
