/* 
 * Songbrocade Clean & Functional Design System 
 * 风格：极简/高对比/SaaS风格
 * 交互：PC优先，移动端自适应
 */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
  /* 仅保留黑白两种基色，贴近书本天然配色 */
  --bg-page: #FFFFFF;        /* 页面背景/卡片/输入统一白色 */
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;

  --text-primary: #000000;   /* 所有文字统一纯黑 */
  --text-secondary: #000000;
  --text-tertiary: #000000;

  /* 边框与阴影使用黑色的透明度变化来体现层次 */
  --border-light: rgba(0,0,0,0.06);
  --border-medium: rgba(0,0,0,0.18);
  --border-focus: rgba(0,0,0,0.35);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.12);
  
  --mobile-nav-height: 60px;
}

/* 深色模式下也保持黑白配色，避免反色干扰阅读 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-input: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #000000;
    --text-tertiary: #000000;
  }
}

/* 🛠 基础重置 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }

body {
  background-color: var(--bg-page);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* ✒️ 排版系统 */
h1, h2, h3, h4 {
  font-family: 'Noto Serif SC', serif; /* 保留宋体作为品牌特征 */
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

h1 { font-size: 2rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
}
a:hover { text-decoration: underline; color: var(--cinnabar-dark); }

/* 📦 布局容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Hero 区域 - 去除复杂背景，改为简洁 */
.hero-section {
  text-align: center;
  padding: 4rem 1rem;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-light);
}

/* 🃏 卡片组件 - 扁平化 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

/* 🔘 按钮系统 - 功能性 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  font-size: 0.95rem;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-medium);
}
.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover {
  background: var(--bg-page);
  border-color: var(--border-focus);
  text-decoration: underline;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 📝 表单系统 - 统一黑字 */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--bg-input); /* 深炭灰背景 */
  color: #000000;              /* 始终使用黑色文字 */
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cinnabar);
  box-shadow: 0 0 0 2px rgba(230, 75, 59, 0.1);
}

/* 🏷 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge-cinnabar { background: rgba(230, 75, 59, 0.1); color: var(--cinnabar); border-color: rgba(230, 75, 59, 0.2); }
.badge-indigo { background: rgba(0, 0, 0, 0.04); color: var(--text-primary); border-color: rgba(0,0,0,0.08); }
.badge-gold { background: rgba(0, 0, 0, 0.04); color: var(--text-primary); border-color: rgba(0,0,0,0.08); }

/* 🔄 步骤向导 - 简洁版 */
.wizard-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  position: relative;
  padding: 0 1rem;
}
.wizard-steps::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 2rem;
  right: 2rem;
  height: 2px;
  background: var(--border-light);
  z-index: 0;
}
.step-item {
  position: relative;
  z-index: 1;
  text-align: center;
  background: var(--bg-page); /* 遮挡连线 */
  padding: 0 0.5rem;
}
.step-circle {
  width: 30px;
  height: 30px;
  background: var(--bg-card);
  border: 2px solid var(--border-medium);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.step-item.active .step-circle {
  background: var(--bg-card);
  border-color: var(--border-focus);
  color: var(--text-primary);
}
.step-item.completed .step-circle {
  background: var(--bg-card);
  border-color: var(--border-medium);
  color: var(--text-primary);
}
.step-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.step-item.active .step-label { color: var(--text-primary); font-weight: 600; }

/* 📂 类别选择器 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.category-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.category-card-item:hover {
  border-color: var(--cinnabar);
  box-shadow: var(--shadow-md);
}
.category-card-item.selected {
  border-color: var(--cinnabar);
  background: rgba(230, 75, 59, 0.03);
}
.category-icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }

/* 📱 导航栏 - PC 优先 */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 0;
}
.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
}
.nav-links {
  display: flex;
  gap: 2rem;
}
.nav-item {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-item:hover, .nav-item.active {
  text-decoration: underline;
}

/* 📱 移动端 App 化适配 */
@media (max-width: 768px) {
  /* 1. 全局布局：沉浸式，去除网页感 */
  .container {
    padding: 1rem 1rem 6rem 1rem; /* 底部留出导航栏空间 */
    max-width: 100%;
  }

  /* 2. 顶部导航：App Header 风格 */
  .navbar {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
  }
  .nav-links { display: none; }
  .brand span { font-size: 1.2rem; }
  .navbar .btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 99px; /* 胶囊按钮 */
  }

  /* 3. 底部导航：原生 Tab Bar 风格 */
  .mobile-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--mobile-nav-height);
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.02);
  }
  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 10px;
    text-decoration: none !important;
    padding: 4px 0;
  }
  .tab-item.active { 
    color: #000; 
    font-weight: 600;
  }
  .tab-icon { 
    font-size: 1.4rem; 
    margin-bottom: 2px; 
    display: block;
  }

  /* 4. 步骤条：紧凑型 */
  .wizard-steps {
    margin: 0 -1rem 1.5rem -1rem;
    padding: 1rem;
    background: #FAFAFA; /* 浅灰背景区分 */
    border-bottom: 1px solid rgba(0,0,0,0.05);
    justify-content: space-evenly;
  }
  .wizard-steps::before {
    top: 24px;
    left: 3rem;
    right: 3rem;
    background: #E0E0E0;
  }
  .step-circle {
    width: 24px;
    height: 24px;
    font-size: 12px;
    background: #FFF;
    margin-bottom: 4px;
  }
  .step-label { font-size: 11px; }
  .step-item { background: transparent; } /* 透出背景色 */

  /* 5. 卡片：通栏或微边距，更像原生 View */
  .card {
    border: none;
    box-shadow: none;
    padding: 0;
    background: transparent;
    margin-bottom: 2rem;
  }
  /* 特殊处理向导内容卡片 */
  .wizard-content.card {
    border: none;
    box-shadow: none;
  }

  /* 6. 表单：大触控区域 */
  .form-group { margin-bottom: 1.5rem; }
  label { font-size: 14px; color: #333; margin-bottom: 8px; }
  input, select, textarea {
    padding: 12px;
    font-size: 16px; /* 防止 iOS 缩放 */
    background: #F5F5F5; /* 浅灰输入框背景 */
    border: 1px solid transparent;
    border-radius: 8px;
  }
  input:focus, select:focus, textarea:focus {
    background: #FFF;
    border-color: #000;
    box-shadow: none;
  }

  /* 7. 按钮：底部固定大按钮或全宽按钮 */
  .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border-radius: 12px;
    background: #000;
    color: #FFF;
    border: none;
    margin-top: 1rem;
  }
  .btn-secondary {
    width: 100%;
    padding: 14px;
    border: 1px solid #DDD;
    background: #FFF;
    margin-top: 0.5rem;
  }
  
  /* 8. 类别选择：网格化 */
  .category-grid {
    grid-template-columns: 1fr 1fr; /* 两列 */
    gap: 12px;
  }
  .category-card-item {
    padding: 1rem;
    border: 1px solid #EEE;
    background: #FFF;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  }
  .category-icon { font-size: 2rem; margin-bottom: 0.5rem; }
  .category-card-item h4 { font-size: 14px; margin-bottom: 4px; }
  .category-card-item p { font-size: 11px; color: #666; line-height: 1.3; margin: 0; }
  .category-card-item.selected {
    border-color: #000;
    background: #F9F9F9;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }

  /* 9. 布局调整 */
  .form-row { flex-direction: column; gap: 1rem; }
  .grid { display: block; } /* 堆叠布局 */
  .grid > div { margin-bottom: 2rem; }
  
  /* 10. 标题与文本 */
  h1 { font-size: 24px; margin-bottom: 1rem; }
  h2 { font-size: 20px; }
  p { font-size: 14px; color: #555; }
  
  /* 隐藏不需要的 PC 元素 */
  .desktop-only { display: none !important; }
}

@media (min-width: 769px) {
  .mobile-tab-bar { display: none; }
}

/* 🧱 工具类 */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.mb-4 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.grid { display: grid; gap: 1.5rem; }
.hidden { display: none !important; }

/* 🖼 文件上传区 */
.upload-zone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  background: var(--bg-page);
  cursor: pointer;
}
.upload-zone:hover {
  border-color: var(--border-focus);
}

/* 📊 统计网格 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

/* 💡 加载动画 */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-light);
  border-top-color: var(--text-primary); /* Use black for spinner */
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 🍞 Toast Notifications */
.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid var(--border-light);
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-info { border-left: 4px solid #3b82f6; }

.toast-icon { font-size: 1.2rem; }

/* ⏳ Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.loading-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.loading-content {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  text-align: center;
  border: 1px solid var(--border-light);
}

.loading-text {
  margin-top: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* 📱 Mobile Tab Bar (Global) */
.mobile-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--mobile-nav-height);
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.02);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 10px;
  text-decoration: none !important;
  padding: 4px 0;
  transition: color 0.2s;
}

.tab-item.active { 
  color: var(--text-primary); 
  font-weight: 600;
}

.tab-icon { 
  font-size: 1.4rem; 
  margin-bottom: 2px; 
  display: block;
}

@media (min-width: 769px) {
  .mobile-tab-bar { display: none; }
}

/* ✨ Refined Typography & Colors */
:root {
  --text-secondary: #4B5563; /* Darker gray for better contrast */
}

/* 🖱️ Interactions */
.card {
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--text-primary);
}

button, a.btn {
  transition: all 0.2s ease;
}
button:active, a.btn:active {
  transform: scale(0.98);
}

