/* ============ 护民官 v4 功能扩展模块 ============ */
/* 全部基于现有 Design Tokens，保持视觉一致性 */

/* ===== 通用工具卡增强 ===== */
.tool-card.v4 {
  position: relative;
  background: linear-gradient(135deg, var(--bg3), var(--bg2));
  border: 1px solid var(--rule);
  overflow: hidden;
}
.tool-card.v4::after {
  content: 'NEW';
  position: absolute;
  top: 6px; right: 6px;
  font-size: 9px; font-weight: 800;
  padding: 2px 6px;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  letter-spacing: 0.5px;
}
.tool-card.v4:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(253,203,110,0.15);
}

/* ===== 功能区标题 ===== */
.feature-section-title {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--accent);
  margin: 28px 0 14px;
  padding-left: 12px;
  border-left: 4px solid var(--brand);
  display: flex;
  align-items: center;
  gap: 8px;
}
.feature-section-title .badge-v4 {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
}

/* ===== 计算器样式 ===== */
.calc-box { padding: 4px 0; }
.calc-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.calc-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--ink);
  font-size: var(--fs-lg);
  outline: none;
  transition: border 0.2s;
}
.calc-input:focus { border-color: var(--accent); }
.calc-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: var(--fs-md);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s;
}
.calc-btn:hover { transform: translateY(-1px); }
.calc-btn:active { transform: translateY(0); }
.calc-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.calc-metric {
  background: var(--bg2);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.calc-metric-label { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 4px; }
.calc-metric-value { font-size: var(--fs-lg); font-weight: 800; color: var(--accent); }
.calc-metric-value.cost { color: var(--bad); }
.calc-bar-area { margin-bottom: 16px; }
.calc-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.calc-bar-name { font-size: var(--fs-sm); color: var(--ink-soft); width: 70px; flex-shrink: 0; }
.calc-bar-track { flex: 1; height: 22px; background: var(--bg2); border-radius: 6px; overflow: hidden; }
.calc-bar-fill { height: 100%; border-radius: 6px; transition: width 0.6s ease; }
.calc-bar-value { font-size: var(--fs-sm); color: var(--muted); width: 80px; text-align: right; flex-shrink: 0; }
.calc-verdict {
  padding: 16px;
  border-radius: 10px;
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.6;
}
.calc-verdict.good { background: rgba(46,213,115,0.1); border: 1px solid rgba(46,213,115,0.3); color: var(--good); }
.calc-verdict.warn { background: rgba(255,165,2,0.1); border: 1px solid rgba(255,165,2,0.3); color: var(--warn); }
.calc-verdict.bad { background: rgba(255,71,87,0.1); border: 1px solid rgba(255,71,87,0.3); color: var(--bad); }
.calc-alt {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg2);
  border-radius: 8px;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  line-height: 1.6;
}
.calc-alt strong { color: var(--accent); }

/* ===== 倒计时守护样式 ===== */
.deadline-list { display: flex; flex-direction: column; gap: 10px; }
.deadline-item {
  background: var(--bg2);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  padding: 14px;
  border-left: 4px solid var(--good);
  transition: border-color 0.3s;
}
.deadline-item.urgent { border-left-color: var(--warn); }
.deadline-item.critical { border-left-color: var(--bad); animation: pulse-border 2s infinite; }
@keyframes pulse-border {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,71,87,0.2); }
  50% { box-shadow: 0 0 0 6px rgba(255,71,87,0); }
}
.deadline-item-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.deadline-item-title { font-size: var(--fs-md); font-weight: 700; color: var(--ink); }
.deadline-item-days { font-size: var(--fs-lg); font-weight: 800; }
.deadline-item-days.urgent { color: var(--warn); }
.deadline-item-days.critical { color: var(--bad); }
.deadline-item-desc { font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
.deadline-item-date { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; }
.deadline-del {
  font-size: var(--fs-xs);
  color: var(--muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}
.deadline-del:hover { color: var(--bad); background: rgba(255,71,87,0.1); }

/* ===== 法律体检样式 ===== */
.checkup-progress {
  height: 6px;
  background: var(--bg2);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}
.checkup-progress-bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.4s; }
.checkup-q { font-size: var(--fs-lg); font-weight: 700; color: var(--ink); margin-bottom: 16px; line-height: 1.5; }
.checkup-q-hint { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 16px; }
.checkup-options { display: flex; flex-direction: column; gap: 10px; }
.checkup-opt {
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  color: var(--ink);
  font-size: var(--fs-md);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.checkup-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.checkup-opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.checkup-report { display: none; }
.checkup-score-ring {
  width: 120px; height: 120px;
  margin: 0 auto 20px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.checkup-score-num { font-size: 36px; font-weight: 800; color: var(--accent); }
.checkup-score-label { font-size: var(--fs-xs); color: var(--muted); text-align: center; }
.checkup-risk-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.checkup-risk {
  padding: 12px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.checkup-risk.high { background: rgba(255,71,87,0.08); border-left: 3px solid var(--bad); }
.checkup-risk.mid { background: rgba(255,165,2,0.08); border-left: 3px solid var(--warn); }
.checkup-risk.low { background: rgba(46,213,115,0.08); border-left: 3px solid var(--good); }
.checkup-risk-title { font-weight: 700; margin-bottom: 4px; }

/* ===== 时间线记录器样式 ===== */
.timeline-entry {
  background: var(--bg2);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
  border-left: 3px solid var(--accent);
}
.timeline-entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.timeline-entry-date { font-size: var(--fs-sm); color: var(--accent); font-weight: 600; }
.timeline-entry-type { font-size: var(--fs-xs); padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.timeline-entry-content { font-size: var(--fs-sm); color: var(--ink-soft); line-height: 1.6; }
.timeline-entry-actions { margin-top: 8px; display: flex; gap: 8px; }
.timeline-entry-actions button {
  font-size: var(--fs-xs);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.timeline-entry-actions button:hover { color: var(--ink); border-color: var(--accent); }
.timeline-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.timeline-form input, .timeline-form textarea, .timeline-form select {
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--rule-soft);
  border-radius: 8px;
  color: var(--ink);
  font-size: var(--fs-sm);
  outline: none;
  font-family: inherit;
}
.timeline-form input:focus, .timeline-form textarea:focus, .timeline-form select:focus { border-color: var(--accent); }

/* ===== 部门导航器样式 ===== */
.dept-result {
  background: var(--bg2);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}
.dept-result-name { font-size: var(--fs-xl); font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.dept-result-desc { font-size: var(--fs-md); color: var(--ink-soft); line-height: 1.6; margin-bottom: 12px; }
.dept-result-info { display: flex; flex-direction: column; gap: 8px; }
.dept-result-info-item { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--ink-soft); }
.dept-result-info-item .ic { font-size: var(--fs-lg); }
.dept-conditions { margin-top: 12px; padding: 12px; background: var(--bg3); border-radius: 8px; font-size: var(--fs-sm); color: var(--muted); line-height: 1.6; }
.dept-conditions strong { color: var(--ink); }

/* ===== 合同扫描仪样式 ===== */
.contract-input {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  background: var(--bg2);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  color: var(--ink);
  font-size: var(--fs-sm);
  outline: none;
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
}
.contract-input:focus { border-color: var(--accent); }
.contract-results { margin-top: 16px; }
.contract-risk-item {
  background: var(--bg2);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  border-left: 4px solid var(--good);
}
.contract-risk-item.high { border-left-color: var(--bad); }
.contract-risk-item.mid { border-left-color: var(--warn); }
.contract-risk-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.contract-risk-level { font-size: var(--fs-xs); padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.contract-risk-level.high { background: rgba(255,71,87,0.15); color: var(--bad); }
.contract-risk-level.mid { background: rgba(255,165,2,0.15); color: var(--warn); }
.contract-risk-level.low { background: rgba(46,213,115,0.15); color: var(--good); }
.contract-risk-text { font-size: var(--fs-sm); color: var(--ink); line-height: 1.6; margin-bottom: 8px; }
.contract-risk-explain { font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; padding: 8px; background: var(--bg3); border-radius: 6px; }
.contract-risk-suggest { font-size: var(--fs-xs); color: var(--good); margin-top: 6px; font-weight: 600; }
.contract-mode-toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.contract-mode-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.contract-mode-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ===== 反诈模拟器样式 ===== */
.fraud-scene { display: none; }
.fraud-scene.active { display: block; }
.fraud-chat {
  background: var(--bg2);
  border-radius: 12px;
  padding: 16px;
  min-height: 200px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow-y: auto;
}
.fraud-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  margin-bottom: 8px;
}
.fraud-msg.them { background: var(--bg3); color: var(--ink); border-bottom-left-radius: 4px; }
.fraud-msg.you { background: var(--accent-soft); color: var(--accent); border-bottom-right-radius: 4px; margin-left: auto; text-align: right; }
.fraud-choices { display: flex; flex-direction: column; gap: 8px; }
.fraud-choice {
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  color: var(--ink);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.fraud-choice:hover { border-color: var(--accent); }
.fraud-choice.correct { border-color: var(--good); background: rgba(46,213,115,0.1); }
.fraud-choice.wrong { border-color: var(--bad); background: rgba(255,71,87,0.1); }
.fraud-feedback {
  padding: 12px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  line-height: 1.6;
  margin-top: 10px;
  display: none;
}
.fraud-feedback.show { display: block; }
.fraud-feedback.good { background: rgba(46,213,115,0.1); color: var(--good); }
.fraud-feedback.bad { background: rgba(255,71,87,0.1); color: var(--bad); }

/* ===== 通用功能按钮 ===== */
.feature-btn {
  padding: 10px 20px;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.feature-btn:hover { border-color: var(--accent); color: var(--accent); }
.feature-btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  border: none;
}
.feature-btn.danger {
  color: var(--bad);
  border-color: rgba(255,71,87,0.3);
}

/* ===== 空状态 ===== */
.feature-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.feature-empty .ic { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }

/* ===== 响应式微调 ===== */
@media (max-width: 480px) {
  .calc-metrics { grid-template-columns: 1fr 1fr; }
  .calc-input-group { flex-direction: column; }
}

/* ===== 动态弹窗关闭按钮修复 ===== */
/* 之前 .modal-close 类未定义CSS,导致按钮无法点击 */

/* ===== 宣传口号轮播图 ===== */
.slogan-carousel {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.carousel-track {
  display: flex;
  width: 500%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.carousel-slide {
  width: 20%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.carousel-slide::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.12), transparent 60%);
  pointer-events: none;
}
.slide-content {
  text-align: center;
  z-index: 1;
  padding: 20px;
  animation: slideFadeIn 0.8s ease;
}
.slide-icon {
  font-size: 40px;
  margin-bottom: 10px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}
.slide-title {
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  letter-spacing: 2px;
}
.slide-sub {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  margin: 0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}
.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}
.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
}
.carousel-dot.active {
  background: #fff;
  width: 24px;
  border-radius: 4px;
}
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  opacity: 0;
}
.slogan-carousel:hover .carousel-arrow {
  opacity: 1;
}
.carousel-arrow:hover {
  background: rgba(0, 0, 0, 0.6);
}
.carousel-arrow.prev { left: 10px; }
.carousel-arrow.next { right: 10px; }
@keyframes slideFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 480px) {
  .slogan-carousel { height: 170px; }
  .slide-title { font-size: 18px; letter-spacing: 1px; }
  .slide-icon { font-size: 32px; }
  .slide-sub { font-size: 12px; }
  .carousel-arrow { opacity: 0.7; }
}

/* 不使用 position:absolute, 避免覆盖各模块自带的 .modal-close 样式 */
.modal-close {
  background: none !important;
  border: none !important;
  color: var(--muted, #8a857a) !important;
  font-size: 24px !important;
  cursor: pointer !important;
  padding: 4px 8px !important;
  line-height: 1 !important;
  border-radius: 6px !important;
  flex-shrink: 0 !important;
  z-index: 10 !important;
  position: relative !important;
  pointer-events: auto !important;
}
.modal-close:hover {
  color: var(--ink, #e8e8e8) !important;
  background: rgba(255,255,255,0.06) !important;
}
.modal-close:active {
  transform: scale(0.92);
}

/* 确保动态弹窗的 modal-box 有相对定位 */
#hmgDynModal .modal-box {
  position: relative !important;
}

/* 确保弹窗头部使用 flex 布局, 让关闭按钮在右侧 */
#hmgDynModal .modal-box > div:first-child,
#hmgDynModal .modal-box > [class*="-head"],
#hmgDynModal .modal-box > [class*="-header"] {
  display: flex !important;
  align-items: center !important;
}
