<script setup lang="ts">
/**
 * @file default.vue
 * @description Layout หลักสำหรับหน้าเว็บของผู้ใช้ (Authenticated Users)
 * Uses Quasar QLayout for responsive structure.
 */

// Initialize global theme management
useThemeMode()

const leftDrawerOpen = ref(false)
const toggleLeftDrawer = () => {
  leftDrawerOpen.value = !leftDrawerOpen.value
}
</script>

<template>
  <q-layout view="hHh LpR lFf" class="bg-slate-50 dark:!bg-[#020617] text-slate-900 dark:!text-slate-50 font-sans">
    <!-- Header -->
    <q-header
      bordered
      class="bg-white/80 dark:!bg-[#0f172a]/80 backdrop-blur-md text-slate-900 dark:!text-white border-b border-slate-200 dark:border-slate-800"
    >
      <AppHeader @toggleSidebar="toggleLeftDrawer" />
    </q-header>

    <!-- Sidebar (Drawer) -->
    <q-drawer
      v-model="leftDrawerOpen"
      show-if-above
      bordered
      :width="280"
      class="bg-white dark:!bg-[#0f172a] border-r border-slate-200 dark:border-slate-800"
    >
      <AppSidebar />
    </q-drawer>

    <!-- Main Content -->
    <q-page-container>
      <q-page class="relative">
        <slot />
      </q-page>
    </q-page-container>

    <!-- Mobile Bottom Nav -->
    <q-footer
      v-if="$q.screen.lt.md"
      bordered
      class="!bg-white dark:!bg-[#1e293b] text-primary border-t border-slate-200 dark:border-slate-700"
    >
       <MobileNav />
    </q-footer>
  </q-layout>
</template>

<style>
/* Ensure fonts are applied */
.font-inter {
  font-family: 'Inter', sans-serif;
}
</style>
