/* 创小助 全局设计系统 v3.0 — 品牌色、排版、组件、交互 */
:root {
  /* 品牌色 */
  --color-primary: #2B6CB0;
  --color-primary-light: #3182CE;
  --color-primary-dark: #1A4D80;
  --color-primary-gradient: linear-gradient(135deg, #2B6CB0, #3182CE);

  /* 语义色 */
  --color-success: #38A169;
  --color-warning: #DD6B20;
  --color-danger: #E53E3E;
  --color-info: #2B6CB0;

  /* 文字色 */
  --color-text-primary: #1A202C;
  --color-text-secondary: #718096;
  --color-text-muted: #A0AEC0;
  --color-text-inverse: #FFFFFF;

  /* 背景色 */
  --color-bg: #F7FAFC;
  --color-bg-card: #FFFFFF;
  --color-bg-hover: #EBF4FF;

  /* 边框 */
  --color-border: #E2E8F0;
  --color-border-light: #EDF2F7;

  /* 阴影 */
  --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
  --dropdown-shadow: 0 4px 16px rgba(0,0,0,0.12);
  --modal-shadow: 0 8px 32px rgba(0,0,0,0.15);

  /* 圆角 */
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-input: 8px;
  --radius-badge: 6px;
  --radius-avatar: 50%;
  --radius-modal: 12px;

  /* 间距 */
  --space-page-x: 20px;
  --space-page-y: 24px;
  --space-module: 32px;
  --space-card: 20px;
  --space-card-padding: 20px;
  --space-element: 12px;
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap-md: 12px;
  --gap-lg: 16px;
  --gap-xl: 24px;

  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;

  /* 层级 */
  --z-dropdown: 100;
  --z-sidebar: 20;
  --z-topbar: 30;
  --z-toast: 300;
  --z-modal: 1000;
  --z-loading: 1020;
}

/* ===== 全局基础 ===== */
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  margin: 0; min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--color-primary-light); }
*, *::before, *::after { box-sizing: border-box; }

/* ===== 排版 ===== */
.h1, h1-like { font-size: 28px; font-weight: 700; line-height: 1.3; margin: 0 0 12px; }
.h2, h2-like { font-size: 20px; font-weight: 600; line-height: 1.4; margin: 32px 0 16px; }
.h3, h3-like { font-size: 16px; font-weight: 600; line-height: 1.4; margin: 24px 0 12px; }
.h4, h4-like { font-size: 14px; font-weight: 600; line-height: 1.4; margin: 16px 0 8px; }
.text-body { font-size: 14px; line-height: 1.6; }
.text-small { font-size: 12px; line-height: 1.5; color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-primary-color { color: var(--color-primary); }

/* ===== 通用卡片 ===== */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--space-card-padding);
  border: 1px solid var(--color-border);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card-hover:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-1px);
}
.card-flat { box-shadow: none; border-color: var(--color-border-light); }
.card-compact { padding: 12px 16px; }
.card-clickable { cursor: pointer; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; font-weight: 500; border-radius: var(--radius-btn);
  text-decoration: none; cursor: pointer; transition: all 0.15s;
  border: none; line-height: 1.4; white-space: nowrap;
  font-family: inherit; user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active { transform: scale(0.97); }
.btn-sm  { padding: 6px 14px; font-size: 13px; height: 34px; }
.btn-md  { padding: 8px 20px; font-size: 14px; height: 40px; }
.btn-lg  { padding: 12px 28px; font-size: 16px; height: 48px; }

.btn-primary {
  background: var(--color-primary-gradient); color: white;
  box-shadow: 0 1px 3px rgba(43,108,176,0.2);
}
.btn-primary:hover { background: linear-gradient(135deg, #1A4D80, #2B6CB0); color: white; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(43,108,176,0.3); }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text-secondary); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-bg-hover); }
.btn-ghost { background: transparent; color: var(--color-text-secondary); }
.btn-ghost:hover { background: var(--color-bg-hover); color: var(--color-primary); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover { background: #b91c1c; color: white; transform: translateY(-1px); }
.btn-soft { background: var(--color-bg-hover); color: var(--color-primary); border: 1px solid transparent; }
.btn-success { background: var(--color-success); color: white; }

/* ===== 表单 ===== */
.input {
  display: block; width: 100%;
  padding: 10px 14px; font-size: 14px; height: 40px;
  border: 1px solid var(--color-border); border-radius: var(--radius-input);
  background: white; color: var(--color-text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(43,108,176,0.1); }
.input.error { border-color: var(--color-danger); }
.input::placeholder { color: var(--color-text-muted); }
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--color-text-primary); }
.form-error { font-size: 12px; color: var(--color-danger); margin-top: 4px; }
.form-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.form-select { appearance: none; padding-right: 32px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center; }
textarea.input { height: auto; min-height: 80px; resize: vertical; }

/* ===== 徽章 ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; font-size: 12px; font-weight: 500;
  border-radius: 999px; white-space: nowrap;
}
.badge-blue { background: var(--color-bg-hover); color: var(--color-primary); }
.badge-green { background: #f0fdf4; color: #166534; }
.badge-red { background: #fef2f2; color: #991b1b; }
.badge-yellow { background: #fffbeb; color: #92400e; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-prepare { display:inline-block;font-size:10px;font-weight:500;padding:1px 6px;border-radius:4px;background:#fef3c7;color:#92400e;vertical-align:middle;margin-left:2px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 12px 16px;
  font-weight: 600; font-size: 13px;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px; font-size: 14px;
  border-bottom: 1px solid var(--color-border-light);
}
.table tr:hover td { background: var(--color-bg-hover); }
.table-sm td, .table-sm th { padding: 8px 12px; font-size: 13px; }

/* ===== 提示/Alert ===== */
.alert { padding: 12px 16px; border-radius: var(--radius-btn); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--color-bg-hover); color: var(--color-primary-dark); border: 1px solid #bfdbfe; }

/* ===== 下拉菜单 ===== */
.user-dropdown, [data-dropdown] .dropdown-menu {
  display: none; position: absolute; top: 100%; right: 0;
  background: white; border: 1px solid var(--color-border);
  border-radius: var(--radius-card); box-shadow: var(--dropdown-shadow);
  min-width: 160px; padding: 6px 0; z-index: var(--z-dropdown); margin-top: 6px;
}
.user-dropdown.show, [data-dropdown].show .dropdown-menu { display: block; }
.user-dropdown a, .dropdown-menu a {
  display: block; padding: 8px 16px; font-size: 14px;
  color: var(--color-text-primary); text-decoration: none;
}
.user-dropdown a:hover, .dropdown-menu a:hover { background: var(--color-bg-hover); color: var(--color-primary); }
.user-dropdown .divider, .dropdown-menu .divider { height: 1px; background: var(--color-border); margin: 4px 0; }

/* ===== 用户头像 ===== */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-primary-gradient);
  color: white; display: flex; align-items: center;
  justify-content: center; font-size: 14px; font-weight: 600;
  cursor: pointer; user-select: none; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 20px; }
.avatar-xl { width: 64px; height: 64px; font-size: 28px; }

/* ===== 折叠面板 (Accordion) ===== */
.accordion { border: 1px solid var(--color-border); border-radius: var(--radius-card); overflow: hidden; margin-bottom: 12px; }
.accordion-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--color-bg);
  font-weight: 600; font-size: 14px; color: var(--color-text-primary);
  cursor: pointer; user-select: none; transition: background 0.15s;
}
.accordion-header:hover { background: var(--color-bg-hover); }
.accordion-header .arrow { transition: transform 0.3s; font-size: 12px; color: var(--color-text-muted); }
.accordion-header.open .arrow { transform: rotate(180deg); }
.accordion-body { padding: 16px 20px; display: none; }
.accordion-body.open { display: block; }

/* ===== 标签页 (Tabs) ===== */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--color-border); margin-bottom: 16px; }
.tab {
  padding: 8px 0; font-size: 14px; color: var(--color-text-secondary);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all 0.15s; white-space: nowrap;
}
.tab:hover { color: var(--color-primary); }
.tab.active { color: var(--color-primary); font-weight: 500; border-bottom-color: var(--color-primary); }

/* ===== 模态框 ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: var(--z-modal); justify-content: center; align-items: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white; border-radius: var(--radius-modal);
  box-shadow: var(--modal-shadow); width: 320px; max-width: 90vw;
  max-height: 80vh; overflow-y: auto;
}
.modal-header {
  padding: 16px; font-size: 16px; font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}
.modal-body { padding: 16px; font-size: 14px; line-height: 1.6; }
.modal-footer {
  padding: 12px 16px; display: flex; justify-content: flex-end; gap: 12px;
  border-top: 1px solid var(--color-border-light);
}

/* ===== 分步器 ===== */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 24px; }
.step-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
  border: 2px solid var(--color-border); background: white; color: var(--color-text-muted);
}
.step-dot.done { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.step-dot.current { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-bg-hover); }
.step-line { flex: 1; height: 2px; background: var(--color-border); min-width: 24px; }
.step-line.done { background: var(--color-primary); }
.step-label { font-size: 11px; color: var(--color-text-muted); margin-top: 4px; text-align: center; }
.step-label.current { color: var(--color-primary); font-weight: 600; }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state-title { font-size: 16px; font-weight: 500; color: var(--color-text-secondary); margin-bottom: 8px; }
.empty-state-desc { font-size: 14px; color: var(--color-text-muted); margin-bottom: 16px; }

/* ===== 骨架屏 ===== */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: 6px; height: 16px; margin-bottom: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== 选择卡片 ===== */
.choice-card {
  background: white; border: 2px solid var(--color-border);
  border-radius: var(--radius-card); padding: 16px;
  cursor: pointer; transition: all 0.2s;
}
.choice-card:hover { border-color: #93c5fd; }
.choice-card.selected { border-color: var(--color-primary); background: var(--color-bg-hover); }

/* ===== 评分进度条 ===== */
.score-bar { height: 8px; border-radius: 4px; background: var(--color-border); overflow: hidden; }
.score-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.score-fill.green { background: #10b981; }
.score-fill.blue { background: var(--color-primary); }
.score-fill.orange { background: var(--color-warning); }
.score-fill.red { background: var(--color-danger); }

/* ===== 侧边栏 ===== */
.sidebar {
  position: fixed; top: 60px; left: 0; bottom: 0;
  width: 220px; background: white;
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden; z-index: var(--z-sidebar);
  scrollbar-width: thin; scrollbar-color: #CBD5E0 transparent;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 4px; }
.sidebar-inner { padding: 8px 0; }
.sidebar-section {
  padding: 12px 16px 6px;
  font-size: 12px; font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: 0.05em;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 14px; font-weight: 400;
  color: var(--color-text-secondary);
  text-decoration: none; transition: all 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-item:hover { background: var(--color-bg-hover); color: var(--color-primary); }
.sidebar-item.active { background: var(--color-bg-hover); color: var(--color-primary); font-weight: 500; border-left-color: var(--color-primary); }
.sidebar-sub { padding-left: 44px; font-size: 13px; }
.sidebar-footer {
  border-top: 1px solid var(--color-border);
  padding: 12px 16px; font-size: 12px; color: var(--color-text-secondary);
}

/* ===== 面包屑 ===== */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; margin-bottom: 12px; flex-wrap: wrap;
}
.breadcrumb a { color: var(--color-text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb-sep { color: var(--color-text-muted); font-size: 14px; user-select: none; }
.breadcrumb-current { color: var(--color-text-primary); font-weight: 500; }

/* ===== Toast ===== */
.toast-container {
  position: fixed; top: 72px; right: 20px; z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: var(--radius-card);
  background: white; box-shadow: var(--card-shadow);
  border: 1px solid var(--color-border);
  font-size: 14px; font-weight: 500; min-width: 240px; max-width: 400px;
  pointer-events: auto; animation: toastIn 0.25s ease-out;
}
.toast.toast-out { animation: toastOut 0.25s ease-in forwards; }
.toast-success { border-left: 4px solid var(--color-success); }
.toast-error { border-left: 4px solid var(--color-danger); }
.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-info { border-left: 4px solid var(--color-primary); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg { flex: 1; color: var(--color-text-primary); }
.toast-close { background: none; border: none; cursor: pointer; font-size: 16px; color: var(--color-text-muted); padding: 0 2px; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ===== 移动响应式 ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-with-sidebar { margin-left: 0; padding-bottom: 72px; }
}

/* ===== 文字对比度优化 ===== */
/* 覆盖 Tailwind 灰色文字，提高可读性 */
body .text-gray-200 { color: #6b7280; }
body .text-gray-300 { color: #4b5563; }
body .text-gray-400 { color: #374151; }
body .text-gray-500 { color: #1f2937; }
body .text-gray-600 { color: #111827; }
