<script setup lang="ts">
import { useAuthStore } from '@/stores/auth'
import { computed } from 'vue'

const auth = useAuthStore()
const isMobile = computed(() => {
  return /Android|iPhone|iPad|iPod|webOS/i.test(navigator.userAgent) || window.innerWidth < 768
})
</script>

<template>
  <router-view />
</template>

<style>
/* ═══════════════════════════════════════════════════════════
   企迹 (qiji) — Editorial/Magazine Design System
   Aesthetic: 编辑/杂志风格 | 墨色+朱砂+印泥金 | 站酷小薇体+思源宋体
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ── Core palette ── */
  --ink: #1C3738;
  --ink-light: #2A4F50;
  --ink-dark: #0F1F20;
  --vermilion: #B8472E;
  --vermilion-light: #D46A4F;
  --vermilion-dark: #8B3522;
  --gold: #C4934A;
  --gold-light: #D4AD6E;
  --gold-dark: #A67736;
  --paper: #F5F0E8;
  --paper-dark: #EBE4D8;
  --surface: #FFFFFF;
  --sage: #4A6741;
  --amber: #C68B3C;
  --warm-gray: #7B7568;
  --warm-border: #E5DFD3;

  /* ── Semantic tokens ── */
  --c-primary: var(--ink);
  --c-primary-light: var(--ink-light);
  --c-primary-bg: #EEF2F2;
  --c-accent: var(--vermilion);
  --c-accent-light: var(--vermilion-light);
  --c-gold: var(--gold);
  --c-success: var(--sage);
  --c-warning: var(--amber);
  --c-danger: var(--vermilion);
  --c-info: #5B7FA5;
  --c-text: #1A1A1A;
  --c-text-secondary: var(--warm-gray);
  --c-text-muted: #AAA59C;
  --c-bg: var(--paper);
  --c-bg-card: var(--surface);
  --c-border: var(--warm-border);

  /* ── Effects ── */
  --shadow-sm: 0 1px 2px rgba(28,55,56,0.04);
  --shadow: 0 2px 6px rgba(28,55,56,0.06);
  --shadow-md: 0 6px 18px rgba(28,55,56,0.08);
  --shadow-lg: 0 12px 36px rgba(28,55,56,0.10);
  --radius: 2px;
  --radius-sm: 2px;
  --radius-xs: 2px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

html, body, #app {
  margin: 0; padding: 0; height: 100%;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  font-family: 'Noto Serif SC', STSong, Songti SC, '宋体', serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Editorial heading style ── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'ZCOOL XiaoWei', STSong, Songti SC, serif;
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════════════════
   Element Plus Global Overrides — Editorial Remap
   ═══════════════════════════════════════════════════════════ */

/* ── Card: sharp corners, subtle border, refined shadow ── */
.el-card {
  border-radius: 2px !important;
  border: 1px solid var(--c-border) !important;
  box-shadow: var(--shadow) !important;
  transition: box-shadow var(--transition);
  background: var(--surface) !important;
}
.el-card:hover { box-shadow: var(--shadow-md) !important; }
.el-card__header {
  border-bottom: 2px solid var(--gold) !important;
  padding: 16px 20px !important;
  font-family: 'ZCOOL XiaoWei', STSong, serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: 0.03em;
}
.el-card__body { padding: 20px !important; }

/* ── Button: sharp, decisive ── */
.el-button {
  border-radius: 2px !important;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all var(--transition);
  font-family: 'Noto Serif SC', STSong, Songti SC, serif;
}
.el-button--primary {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
  color: #fff !important;
}
.el-button--primary:hover {
  background: var(--ink-light) !important;
  border-color: var(--ink-light) !important;
}
.el-button--success {
  background: var(--sage) !important;
  border-color: var(--sage) !important;
}
.el-button--danger {
  background: var(--vermilion) !important;
  border-color: var(--vermilion) !important;
}
.el-button--warning {
  background: var(--amber) !important;
  border-color: var(--amber) !important;
}

/* ── Tag: editorial label style ── */
.el-tag {
  border-radius: 2px !important;
  font-weight: 500;
  font-family: 'Noto Serif SC', STSong, serif;
  letter-spacing: 0.02em;
}

/* ── Tabs ── */
.el-tabs__item {
  font-weight: 500;
  font-family: 'ZCOOL XiaoWei', STSong, serif;
}
.el-tabs__active-bar { background: var(--gold) !important; }
.el-tabs__item.is-active { color: var(--ink) !important; }

/* ── Table ── */
.el-table th.el-table__cell {
  background: var(--c-primary-bg);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  font-family: 'ZCOOL XiaoWei', STSong, serif;
  letter-spacing: 0.03em;
}
.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
  background: var(--c-primary-bg);
}

/* ── Pagination ── */
.el-pagination { margin-top: 16px; }

/* ── Dialog ── */
.el-dialog {
  border-radius: 2px !important;
}
.el-dialog__header {
  padding: 20px 24px 0 !important;
  font-weight: 600;
  font-family: 'ZCOOL XiaoWei', STSong, serif;
}
.el-dialog__body { padding: 20px 24px !important; }

/* ── Menu ── */
.el-menu { border-right: none !important; }

/* ── Progress ── */
.el-progress-bar__outer { border-radius: 0 !important; }
.el-progress-bar__inner { border-radius: 0 !important; background: var(--ink) !important; }

/* ── Form ── */
.el-form { max-width: 100%; }
.el-select, .el-date-editor { max-width: 100%; }
.el-table { max-width: 100%; }
.el-table__body-wrapper { overflow-x: auto; }
.el-radio-button__inner {
  min-height: 36px;
  line-height: 36px;
  border-radius: 2px !important;
}
.el-radio-button__orig-radio:checked + .el-radio-button__inner {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
}

/* ── Input & Select borders ── */
.el-input__wrapper {
  border-radius: 2px !important;
  box-shadow: 0 0 0 1px var(--c-border) inset !important;
}
.el-input__wrapper:hover { box-shadow: 0 0 0 1px var(--ink) inset !important; }
.el-input__wrapper.is-focus { box-shadow: 0 0 0 2px var(--ink) inset !important; }
.el-select .el-input__wrapper { border-radius: 2px !important; }

/* ── Date picker ── */
.el-date-editor.el-input { border-radius: 2px !important; }

/* ── Textarea ── */
.el-textarea__inner {
  border-radius: 2px !important;
  font-family: 'Noto Serif SC', STSong, serif;
}

/* ── Radio ── */
.el-radio__input.is-checked .el-radio__inner {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
}
.el-radio__input.is-checked + .el-radio__label { color: var(--ink) !important; }

/* ── Checkbox ── */
.el-checkbox__input.is-checked .el-checkbox__inner {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
}

/* ── Switch ── */
.el-switch.is-checked .el-switch__core {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
}

/* ── Loading spinner ── */
.el-loading-spinner .circular circle { stroke: var(--gold) !important; }

/* ── Message box ── */
.el-message-box { border-radius: 2px !important; }

/* ── Notification ── */
.el-notification { border-radius: 2px !important; }

/* ── Divider ── */
.el-divider__text {
  font-family: 'ZCOOL XiaoWei', STSong, serif;
  color: var(--warm-gray);
}

/* ── Image Preview Overlay ── */
.image-preview-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.image-preview-full {
  max-width: 95vw; max-height: 95vh;
  object-fit: contain; cursor: default;
}
.image-preview-close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.15); color: #fff;
  border: none; width: 40px; height: 40px; font-size: 20px;
  cursor: pointer; border-radius: 50%; transition: background 0.2s;
}
.image-preview-close:hover { background: rgba(255,255,255,0.35); }
</style>
