/* ========================================
   西夏文学习平台 · 基础样式
   Notion × flomo 风格 — 黑白灰 + 勃艮第红
   ======================================== */

:root {
  --color-bg: #FFFFFF;
  --color-bg-secondary: #F7F8FA;
  --color-bg-hover: #EFEFF0;
  --color-bg-active: #E8E8E9;
  --color-text: #1A1A1A;
  --color-text-secondary: #4D4D4D;
  --color-text-light: #8A8A8A;
  --color-border: #E8E8E8;
  --color-border-light: #F0F0F0;

  --color-primary: #800020;
  --color-primary-hover: #6B001A;
  --color-primary-light: #FDF2F4;
  --color-primary-border: #F5D6DB;

  --color-success: #2E7D32;
  --color-success-light: #E8F5E9;
  --color-warning: #D4A017;
  --color-warning-light: #FFF8E1;
  --color-danger: #C42B1C;
  --color-danger-light: #FFEBEE;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-pop: 0 8px 30px rgba(0,0,0,0.12);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
               Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono",
               "Consolas", monospace;

  --sidebar-width: 260px;
  --header-height: 0px;
  --transition: 0.2s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  overflow-x: hidden;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 0.5rem; }
.text-secondary { color: var(--color-text-secondary); }
.text-light { color: var(--color-text-light); }
.text-primary { color: var(--color-primary); }

/* 滚动条美化 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D0D0D0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #B0B0B0; }

/* 输入框通用 */
.input {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(128, 0, 32, 0.12);
}
.input::placeholder { color: var(--color-text-light); }
.input-lg { padding: 10px 16px; font-size: 1rem; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-outline:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-text-light);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--color-text-light);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.btn-close:hover { color: var(--color-text); background: var(--color-bg-hover); }

/* Toast */

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  max-width: 640px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  animation: modalIn 0.2s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border-light);
}
.modal-body { padding: 20px; overflow-y: auto; max-height: calc(80vh - 60px); }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; color: var(--color-text); }
.empty-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: center; }

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 0;
}
.page-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  transition: all var(--transition);
}
.page-btn:hover { background: var(--color-bg-hover); }
.page-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.page-btn:disabled { opacity: 0.4; cursor: default; }

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 32px;
  font-size: 0.85rem;
  color: var(--color-text-light);
  user-select: none;
}
.page-jump {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
}
.page-jump-input {
  width: 48px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  outline: none;
  transition: border-color var(--transition);
}
.page-jump-input:focus {
  border-color: var(--color-primary);
}
/* 移除 number input 的上下箭头 */
.page-jump-input::-webkit-inner-spin-button,
.page-jump-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.page-jump-input[type=number] {
  -moz-appearance: textfield;
}

/* 进度条 */
.progress-bar {
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* 启动加载画面 */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
.splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
.splash-content {
  text-align: center;
  max-width: 360px;
}
.splash-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: splashPulse 2s ease-in-out infinite;
}
.splash-glyph {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 16px;
  animation: splashPulse 2s ease-in-out infinite;
}
@keyframes splashPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.splash-content h2 {
  margin-bottom: 8px;
  color: var(--color-primary);
}
.splash-status {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}
.splash-progress-bar {
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}
.splash-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.import-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: var(--color-bg);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}
.import-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}
.import-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.2s ease;
}
