<template>
    <div class="admin-layout">
        <!-- 头部 -->
        <div class="admin-header">
            <div class="header-left">
                <h1 v-if="title" class="header-title">{{ title }}</h1>
                <p v-if="info" class="header-subtitle">{{ info }}</p>
            </div>
            <div class="header-right">
                <slot name="action"></slot>
            </div>
        </div>
        <!-- 内容区 -->
        <div class="admin-content">
            <slot></slot>
        </div>
    </div>
</template>

<script setup lang="ts">
defineProps({
    title: {
        type: String,
        default: ''
    },
    info: {
        type: String,
        default: ''
    }
})
</script>

<style lang="scss" scoped>
.admin-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #ebeef5;
    margin-bottom: 16px;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: #303133;
    margin: 0;
}

.header-subtitle {
    font-size: 13px;
    color: #909399;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
}
</style>