/* 部门联系方式页面样式 - 复用流程图页面风格 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --red-primary: #C41E24;
  --gold: #D4A843;
  --bg-gradient-start: #F5E6D3;
  --bg-gradient-end: #E8D5B7;
  --card-bg: rgba(255,255,255,0.88);
  --text-primary: #1A1A1A;
  --text-secondary: #666;
  --border-color: rgba(196,30,36,0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, var(--bg-gradient-start), var(--bg-gradient-end));
  min-height: 100vh;
  color: var(--text-primary);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--bg-gradient-start), var(--bg-gradient-end));
  min-height: 100vh;
  position: relative;
}

/* 导航栏 */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #C41E24, #9B1820);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  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 {
  font-family: "Noto Serif SC", serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}

.nav-spacer { width: 32px; }

/* 搜索栏 */
.search-bar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: rgba(255,255,255,0.6);
  gap: 8px;
}

.search-icon { flex-shrink: 0; }

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
  color: var(--text-primary);
}

.search-input::placeholder { color: #999; }

.search-clear {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

/* 统计行 */
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
}

.summary {
  font-size: 13px;
  color: var(--text-secondary);
}

.summary-num {
  color: var(--red-primary);
  font-weight: 700;
  font-size: 15px;
}

.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);
}

/* 分类标签 */
.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 12px 10px;
}

.category-tabs .tab-btn {
  padding: 0.35rem 0.25rem;
  font-size: 0.72rem;
  border-radius: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.cat-section {
  margin-bottom: 12px;
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  backdrop-filter: blur(8px);
}

.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid rgba(212,168,67,0.15);
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: box-shadow 0.2s;
}
.cat-header:active { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }

.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;
  background: var(--red-primary);
  color: #fff;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 600;
}

.cat-title {
  font-family: "Noto Serif SC", serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.cat-arrow {
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.cat-body {
  overflow: hidden;
  transition: max-height 0.35s ease;
  max-height: 5000px;
}

.cat-body.collapsed {
  max-height: 0;
}

/* 事项卡片 */
.contact-item {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  cursor: pointer;
  transition: background 0.2s;
}

.contact-item:active { background: rgba(196,30,36,0.04); }

.contact-item:last-child { border-bottom: none; }

.contact-item.has-contact {
  border-left: 3px solid var(--gold);
}

.contact-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.contact-item-seq {
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.contact-item-name {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  line-height: 1.4;
}

.contact-item-badge {
  font-size: 10px;
  color: var(--gold);
  background: rgba(212,168,67,0.15);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.contact-item-depts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.dept-tag {
  font-size: 11px;
  color: var(--red-primary);
  background: rgba(196,30,36,0.08);
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.4;
}

.contact-preview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.contact-preview-row {
  display: flex;
  gap: 4px;
}

.contact-preview-label {
  color: var(--gold);
  font-weight: 600;
  flex-shrink: 0;
}

.empty-preview {
  color: #ccc;
  font-style: italic;
}

/* 弹窗 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.show {
  display: flex;
}

.modal-container {
  background: #fff;
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: linear-gradient(135deg, rgba(196,30,36,0.05), rgba(212,168,67,0.05));
}

.modal-title {
  font-family: "Noto Serif SC", serif;
  font-size: 17px;
  font-weight: 700;
  flex: 1;
  line-height: 1.4;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #999;
  flex-shrink: 0;
  margin-left: 12px;
}

.modal-close:hover { color: var(--red-primary); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-section { margin-bottom: 4px; }

.modal-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-left: 10px;
  border-left: 3px solid var(--red-primary);
}

.modal-section-title.county-title {
  border-left-color: var(--gold);
  color: #B8860B;
}

.modal-section-title.town-title {
  border-left-color: #4A90D9;
  color: #2C6FB5;
}

.modal-dept-item {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
  line-height: 1.5;
}

.modal-contact-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
  background: rgba(245,230,211,0.5);
  padding: 12px;
  border-radius: 8px;
}

.modal-contact-empty {
  font-size: 13px;
  color: #ccc;
  font-style: italic;
  padding: 12px;
  text-align: center;
}

.modal-divider {
  height: 1px;
  background: rgba(0,0,0,0.06);
  margin: 16px 0;
}

/* 返回顶部 */
.back-top {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--red-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(196,30,36,0.4);
  z-index: 50;
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* 跨页面链接 */
.cross-links {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(196, 30, 36, 0.15);
  flex-wrap: wrap;
}
.cross-link {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}
.link-duty {
  background: rgba(196, 30, 36, 0.08);
  color: #C41E24;
  border: 1px solid rgba(196, 30, 36, 0.2);
}
.link-duty:hover {
  background: #C41E24;
  color: #fff;
}
.link-flow {
  background: rgba(212, 168, 67, 0.08);
  color: #B8902F;
  border: 1px solid rgba(212, 168, 67, 0.25);
}
.link-flow:hover {
  background: #D4A843;
  color: #fff;
}
.link-scenario {
  background: rgba(30, 100, 200, 0.08);
  color: #1e64c8;
  border: 1px solid rgba(30, 100, 200, 0.2);
}
.link-scenario:hover {
  background: #1e64c8;
  color: #fff;
}
