<template>
  <div class="dashboard-root">
    <!-- 第一行：头像+欢迎语 -->
    <UserGreeting />

    <Statistic />

    <!-- 全部应用 -->
    <AllApplications @addFavorites="handleAddFavorites" />
  </div>
</template>

<script setup>
import AllApplications from '@/components/AllApplications.vue';
import UserGreeting from '@/views/components/Hello.vue';
import Statistic from '@/views/components/Statistic.vue';
</script>

<style scoped>
.dashboard-root {
  min-height: 100vh;
  /* background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%); */
  padding: 32px;
}

/* 业务功能区标题栏 */
.business-area-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.business-area-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.edit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f3f4f6;
  border: none;
  border-radius: 6px;
  color: #6b7280;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.edit-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

/* 业务功能区样式 */
.business-modules {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.business-module {
  display: flex;
  align-items: center;
  padding: 16px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.05);
  transition: all 0.2s;
  cursor: pointer;
}

.business-module:hover {
  box-shadow: 0 4px 16px 0 rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.business-module-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 12px;
  background: #3b82f6; /* 默认图标背景色 */
}

.business-module-icon i {
  font-size: 20px;
  color: #fff;
}

.business-module-title {
  font-size: 16px;
  font-weight: 500;
  color: #303133;
  margin: 0;
}

/* 弹窗样式 */
.dialog-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.setting-dialog {
  width: 500px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.dialog-header {
  padding: 16px 24px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 18px;
}

.close-btn:hover {
  color: #333;
}

.dialog-content {
  padding: 24px;
  max-height: 400px;
  overflow-y: auto;
}

.module-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.module-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
}

.module-item:last-child {
  border-bottom: none;
}

.module-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.module-index {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.module-name {
  font-size: 16px;
  color: #333;
}

.module-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.move-btn {
  color: #9ca3af;
  background: #f9fafb;
}

.move-btn:hover {
  background: #f3f4f6;
  color: #6b7280;
}

.move-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.delete-btn {
  color: #ef4444;
  background: #fee2e2;
}

.delete-btn:hover {
  background: #fecaca;
}

.empty-tip {
  text-align: center;
  padding: 40px 0;
  color: #9ca3af;
  font-size: 14px;
  background: #f9fafb;
  border-radius: 8px;
}

.dialog-footer {
  padding: 16px 24px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.cancel-btn, .confirm-btn {
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.cancel-btn {
  background: #f3f4f6;
  border: none;
  color: #6b7280;
}

.cancel-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.confirm-btn {
  background: #3b82f6;
  border: none;
  color: #fff;
}

.confirm-btn:hover {
  background: #2563eb;
}
</style>