<template>
    <div class="tools-view">
        <div class="tools-card">
            <div class="page-header">
                <div>
                    <h1 class="tools-title">工具中心</h1>
                    <p class="tools-description">当前工具页面统一从这里进入，后续新增工具可继续在此扩展。</p>
                </div>
            </div>

            <div class="tool-grid">
                <button class="tool-item" type="button" @click="handleNavigate('/tools/waveform')">
                    <div class="tool-name">波形查看</div>
                    <div class="tool-text">选择同名 cfg/dat 文件并查看波形、RMS 和摘要信息。</div>
                </button>

                <button class="tool-item" type="button" @click="handleNavigate('/tools/mmsMapping')">
                    <div class="tool-name">MMS 映射</div>
                    <div class="tool-text">进入 MMS 映射页面，后续可继续补充映射配置和预览能力。</div>
                </button>

                <button class="tool-item" type="button" @click="handleNavigate('/tools/mmsMapping/deviceTypes')">
                    <div class="tool-name">设备类型校验</div>
                    <div class="tool-text">维护设备类型，并从列表进入 ICD 一致性校验和 PQDIF 预留校验。</div>
                </button>

                <button class="tool-item" type="button" @click="handleNavigate('/tools/addData')">
                    <div class="tool-name">addData</div>
                    <div class="tool-text">进入 addData 页面壳子，后续在此扩展补录数据能力和业务交互。</div>
                </button>

                <button class="tool-item" type="button" @click="handleNavigate('/tools/addLedger')">
                    <div class="tool-name">数据台账</div>
                    <div class="tool-text">维护工程、项目、设备和监测点的四级台账配置关系。</div>
                </button>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'

defineOptions({
    name: 'ToolsView'
})

const router = useRouter()

const handleNavigate = async (path: string) => {
    if (!path) return
    await router.push(path)
}
</script>

<style scoped lang="scss">
.tools-view {
    min-height: 100%;
    padding: 24px;
    background: #f5f7fa;
}

.tools-card {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 32px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.tools-title {
    margin: 0 0 12px;
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
}

.tools-description {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.tool-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    border: 1px solid #dbe3f0;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    cursor: pointer;
    text-align: left;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.tool-item:hover {
    border-color: #94a3b8;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.tool-name {
    font-size: 18px;
    font-weight: 600;
    color: #172033;
}

.tool-text {
    font-size: 13px;
    line-height: 1.7;
    color: #64748b;
}

@media (max-width: 992px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .tools-view {
        padding: 16px;
    }

    .tools-card {
        padding: 20px;
    }
}
</style>
