<template>
  <div class="sino-page">
    <div v-if="hasToolbar" class="sino-toolbar">
      <div class="sino-toolbar-left">
        <slot name="toolbar-left" />
      </div>
      <div class="sino-toolbar-right">
        <slot name="toolbar-right" />
      </div>
    </div>
    <div class="sino-card">
      <slot />
    </div>
    <div v-if="$slots.pagination" class="sino-pagination">
      <slot name="pagination" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { computed, useSlots } from 'vue'

const slots = useSlots()
const hasToolbar = computed(() => !!slots['toolbar-left'] || !!slots['toolbar-right'])
</script>

<style scoped>
.sino-page {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.sino-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.sino-toolbar-left,
.sino-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sino-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  flex: 1;
}
.sino-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 20px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
}
</style>
