import React from 'react'
import ReactDOM from 'react-dom/client'
import { BrowserRouter } from 'react-router-dom'
import { ConfigProvider, theme } from 'antd'
import zhCN from 'antd/locale/zh_CN'
import './index.css'
import App from './App'

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <ConfigProvider
      locale={zhCN}
      theme={{
        algorithm: theme.defaultAlgorithm,
        token: {
          colorPrimary: '#1677ff',
          colorSuccess: '#52c41a',
          colorWarning: '#faad14',
          colorError: '#ff4d4f',
          colorBgLayout: '#f5f6f8',
          colorBgContainer: '#ffffff',
          colorBgElevated: '#ffffff',
          colorText: '#1f2937',
          colorTextSecondary: '#6b7280',
          colorBorder: '#e5e7eb',
          colorBorderSecondary: '#f0f0f0',
          borderRadius: 6,
          borderRadiusLG: 8,
          fontSize: 14,
          fontFamily:
            '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
        },
        components: {
          Tabs: {
            itemColor: '#6b7280',
            itemSelectedColor: '#1677ff',
            itemHoverColor: '#1677ff',
            inkBarColor: '#1677ff',
            titleFontSize: 13,
            cardPadding: '8px 16px',
          },
          Table: {
            headerBg: '#fafafa',
            headerColor: '#374151',
            headerSplitColor: '#f0f0f0',
            rowHoverBg: '#f8faff',
            borderColor: '#f5f5f5',
            cellPaddingBlock: 12,
            cellFontSize: 13,
          },
          Card: {
            headerBg: '#ffffff',
            paddingLG: 20,
          },
          Button: {
            borderRadius: 6,
            primaryShadow: '0 2px 6px rgba(22, 119, 255, 0.25)',
          },
          Input: {
            borderRadius: 6,
            paddingBlock: 6,
          },
          Select: {
            borderRadius: 6,
          },
          Segmented: {
            itemSelectedBg: '#1677ff',
            itemSelectedColor: '#ffffff',
            trackBg: '#e8e8e8',
          },
          Tag: {
            borderRadiusSM: 4,
            defaultBg: '#f5f5f5',
            defaultColor: '#4b5563',
          },
        },
      }}
    >
      <BrowserRouter>
        <App />
      </BrowserRouter>
    </ConfigProvider>
  </React.StrictMode>,
)
