<template>
  <div class="system-config-container">
    <el-card shadow="never" class="main-card">
      <template #header>
        <div class="page-header">
          <div class="header-left">
            <span class="title">系统设置中心</span>
          </div>
          <div class="header-right">
            <div class="custom-tabs">
              <div v-for="(item, index) in menuList" :key="index"
                :class="['tab-item', { active: activeTab === item.key }]" @click="activeTab = item.key">
                {{ item.label }}
              </div>
            </div>
          </div>
        </div>
      </template>

      <div class="content-body">
        <transition name="fade-transform" mode="out-in">
          <div :key="activeTab" class="content-wrapper">
            <!-- 网站设置 -->
            <WebsiteConfig v-if="activeTab === 'website'" />

            <!-- 平台配置 -->
            <PlatformConfig v-if="activeTab === 'platform'" />

            <!-- 文件存储配置 -->
            <OssConfig v-if="activeTab === 'storage'" />

            <!-- 短信配置 -->
            <!-- <SmsConfig v-if="activeTab === 'sms'" /> -->

            <!-- 协议配置 -->
            <ProtocolConfig v-if="activeTab === 'protocol'" />

            <!-- APP配置 -->
            <AppConfig v-if="activeTab === 'app'" />
          </div>
        </transition>
      </div>
    </el-card>
  </div>
</template>

<script setup name="SystemConfig" lang="ts">
import { ref, computed } from 'vue';
import WebsiteConfig from './website/index.vue';
import AppConfig from './app/index.vue';
import PlatformConfig from './platform/index.vue';
// import SmsConfig from '@/views/systemConfig/sms/index.vue';
import ProtocolConfig from '@/views/systemConfig/protocol/index.vue';
import OssConfig from '@/views/system/oss/config.vue';
import { Setting, Platform, Document } from '@element-plus/icons-vue';

const activeTab = ref('website');

const menuList = [
  { label: '网站设置', key: 'website' },
  { label: 'APP配置', key: 'app' },
  { label: '平台配置', key: 'platform' },
  { label: '存储配置', key: 'storage' },
  // { label: '短信配置', key: 'sms' },
  { label: '协议配置', key: 'protocol' }
];
</script>

<style scoped lang="scss">
.system-config-container {
  padding: 20px;
  background-color: #f5f7f9;
  min-height: calc(100vh - 84px);
}

.main-card {
  border: none;
  border-radius: 12px;
  background-color: #fff;
  min-height: calc(100vh - 124px);

  :deep(.el-card__header) {
    padding: 24px;
    border-bottom: 1px solid #f0f2f5;
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  .title {
    font-size: 18px;
    font-weight: 600;
    color: #1d2129;
    position: relative;
    padding-left: 12px;

    &::before {
      content: '';
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      width: 4px;
      height: 18px;
      background: #409eff;
      border-radius: 2px;
    }
  }
}

.custom-tabs {
  display: flex;
  background-color: #f4f5f8;
  padding: 4px;
  border-radius: 8px;
  gap: 4px;

  .tab-item {
    padding: 6px 16px;
    font-size: 14px;
    color: #4e5969;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;

    &:hover {
      color: #1d2129;
      background-color: #fff;
    }

    &.active {
      background-color: #fff;
      color: #409eff;
      font-weight: 600;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
  }
}

.content-body {
  padding: 24px;
}

.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;

  .empty-content {
    text-align: center;
    max-width: 320px;
  }

  .empty-icon {
    font-size: 64px;
    color: #e5e6eb;
    margin-bottom: 16px;
  }

  .empty-text {
    font-size: 18px;
    font-weight: 600;
    color: #1d2129;
    margin-bottom: 8px;
  }

  .empty-desc {
    font-size: 14px;
    color: #86909c;
    line-height: 1.6;
  }
}

/* Tab 切换动画 */
.fade-transform-enter-active,
.fade-transform-leave-active {
  transition: all 0.3s;
}

.fade-transform-enter-from {
  opacity: 0;
  transform: translateX(-15px);
}

.fade-transform-leave-to {
  opacity: 0;
  transform: translateX(15px);
}
</style>
