/* 场景化案例页样式 */
:root {
  --red-primary: #C41E24;
  --gold: #D4A843;
  --bg-warm: #F5E6D3;
  --bg-warm-end: #E8D5B7;
  --text-dark: #1A1A1A;
  --text-muted: #666;
  --card-bg: rgba(255,255,255,0.88);
  --border-light: #E8D5C4;
}

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

html { overflow-x: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, var(--bg-warm) 0%, var(--bg-warm-end) 100%);
  min-height: 100vh;
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* 导航栏 */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #C41E24 0%, #A01820 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(196,30,36,0.3);
}
.nav-back {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 4px;
}
.nav-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  font-family: "Noto Serif SC", serif;
  letter-spacing: 2px;
}
.nav-spacer { width: 32px; }

/* 搜索栏 */
.search-bar {
  display: flex;
  align-items: center;
  margin: 12px 16px;
  padding: 8px 12px;
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border-light);
  backdrop-filter: blur(8px);
}
.search-icon { flex-shrink: 0; margin-right: 8px; }
.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-dark);
}
.search-input::placeholder { color: #aaa; }
.search-clear {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

/* 统计概览 + 全部按钮 */
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px;
}
.summary { font-size: 13px; color: var(--text-muted); }
.summary-num { color: var(--red-primary); font-weight: 700; }

/* 分类标签 */
.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 16px 12px;
}
.tab-btn {
  padding: 0.35rem 0.25rem;
  border: 1px solid rgba(196, 30, 36, 0.2);
  border-radius: 16px;
  background: rgba(255,255,255,0.6);
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
}
.tab-btn:active { transform: scale(0.95); }
.tab-btn.active {
  background: var(--red-primary);
  color: white;
  border-color: var(--red-primary);
}
.tab-btn-all {
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(196, 30, 36, 0.2);
  border-radius: 14px;
  background: rgba(255,255,255,0.6);
}
.tab-btn-all.active {
  background: var(--red-primary);
  color: #fff;
  border-color: var(--red-primary);
}

/* 内容区域 */
.content { padding: 0 16px 80px; }

/* 分类区域 */
.cat-section {
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
}
.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}
.cat-header:active { background: rgba(196,30,36,0.05); }
.cat-title-wrap { display: flex; align-items: center; gap: 8px; }
.cat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--red-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.cat-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  font-family: "Noto Serif SC", serif;
}
.cat-arrow { transition: transform 0.3s; flex-shrink: 0; }

.cat-body { transition: max-height 0.3s ease; overflow: hidden; }
.cat-body.collapsed { max-height: 0 !important; }

/* 事项卡片 */
.scenario-item {
  padding: 12px 14px;
  border-top: 1px solid rgba(232,213,196,0.5);
  transition: background 0.15s;
  cursor: pointer;
}
.scenario-item:active { background: rgba(196,30,36,0.04); }
.scenario-item.has-case { border-left: 3px solid var(--gold); }

.scenario-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.scenario-item-seq {
  font-size: 11px;
  color: var(--red-primary);
  font-weight: 700;
  white-space: nowrap;
}
.scenario-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  flex: 1;
}
.scenario-item-case-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #D4A843, #C49533);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

.scenario-item-depts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.scenario-dept-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #FFF5F5;
  color: var(--red-primary);
  border: 1px solid rgba(196,30,36,0.15);
}

/* 案例标签 */
.case-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.case-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, #FFFBF0, #FFF5E0);
  border: 1px solid rgba(212,168,67,0.3);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
}
.case-chip:hover {
  background: linear-gradient(135deg, #FFF8E0, #FFEDC0);
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(212,168,67,0.15);
}
.case-chip:active {
  transform: translateY(0);
}
.case-chip-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.case-chip-title {
  color: var(--text-dark);
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-item-action {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* 跨页面链接 */
.cross-links {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(196, 30, 36, 0.15);
}

.cross-link {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s;
}

.cross-link:active {
  transform: scale(0.95);
}

.link-duty { background: #C41E24; color: #fff !important; }
.link-duty:hover { background: #a01820; }

.link-flow { background: #D4A843; color: #fff !important; }
.link-flow:hover { background: #b89232; }

.link-contact { background: #2563eb; color: #fff !important; }
.link-contact:hover { background: #1d4ed8; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* 返回顶部 */
.back-top {
  position: fixed;
  bottom: 24px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--red-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(196,30,36,0.3);
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s;
  z-index: 50;
}
.back-top.show { opacity: 1; transform: scale(1); }

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }

.modal-container {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s;
  overflow: hidden;
}
.modal-overlay.show .modal-container { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #f0e8df;
  flex-shrink: 0;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  font-family: "Noto Serif SC", serif;
  color: var(--text-dark);
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  padding: 4px;
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  -webkit-overflow-scrolling: touch;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 18px;
  border-top: 1px solid #f0e8df;
  flex-shrink: 0;
}
.modal-zoom-out, .modal-zoom-in {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
  color: #555;
  font-size: 12px;
  cursor: pointer;
}
.modal-zoom-out:active, .modal-zoom-in:active { background: #f0f0f0; }
.modal-zoom-value { font-size: 13px; color: #666; min-width: 40px; text-align: center; }

/* 案例详情 */
.scenario-detail {
  transform-origin: top center;
  transition: transform 0.15s;
}
.scenario-detail-header {
  text-align: center;
  margin-bottom: 18px;
}
.scenario-detail-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  font-family: "Noto Serif SC", serif;
  margin-bottom: 10px;
  line-height: 1.5;
}
.scenario-detail-depts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.scenario-detail-dept-tag {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  background: #FFF5F5;
  color: var(--red-primary);
  border: 1px solid rgba(196,30,36,0.12);
}
.scenario-case-section {
  background: linear-gradient(135deg, #FFFBF0, #FFF8F5);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid rgba(212,168,67,0.18);
}
.scenario-case-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  margin-bottom: 12px;
  font-family: "Noto Serif SC", serif;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(212,168,67,0.3);
}
/* 富文本案例内容渲染 */
.scenario-case-content {
  font-size: 14px;
  line-height: 1.9;
  color: #333;
  padding: 14px 16px;
  background: rgba(255,255,255,0.7);
  border-radius: 10px;
  border-left: 3px solid var(--gold);
}
.scenario-case-content p {
  margin: 0 0 10px;
}
.scenario-case-content p:last-child {
  margin-bottom: 0;
}
.scenario-case-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 8px 0;
  display: block;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.scenario-case-content ul,
.scenario-case-content ol {
  padding-left: 24px;
  margin: 8px 0;
}
.scenario-case-content li {
  margin-bottom: 6px;
}
.scenario-case-content b,
.scenario-case-content strong {
  font-weight: 700;
}
.scenario-case-content i,
.scenario-case-content em {
  font-style: italic;
}
.scenario-case-content u {
  text-decoration: underline;
}
.scenario-case-empty {
  text-align: center;
  padding: 28px 16px;
  color: #bbb;
  font-size: 13px;
  background: rgba(255,255,255,0.5);
  border-radius: 8px;
  margin-bottom: 0;
  border: 1px dashed #e0d5c0;
}
