/**
 * JXKit 行业垂直风控预设系统样式表 (industry.css)
 * 纯客户端 5 大黄金场景预设控制器、法规动态警示条、S级红线徽章
 * 全面优化选态高对比度，适配明暗双主题，拒绝 Emoji，呈现严谨企业级质感
 */

/* 1. 行业风控预设外层卡片 */
.industry-preset-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0.85rem 1.15rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.industry-preset-card:hover {
  border-color: rgba(243, 128, 32, 0.3);
}

/* 2. 预设选择器头部与胶囊选项 */
.industry-preset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-color);
}

.industry-preset-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.industry-preset-title svg {
  color: var(--accent-cf, #f38020);
  flex-shrink: 0;
}

.industry-pills {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* 默认未选中状态：干净利落的圆角胶囊 */
.industry-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.85rem;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 9999px;
  color: var(--text-secondary, #4b5563);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  font-family: inherit;
}

.industry-pill:hover {
  background: var(--bg-secondary, #f1f5f9);
  color: var(--text-primary, #111827);
  border-color: rgba(243, 128, 32, 0.45);
}

/* 选中的高对比度样式：实底 Cloudflare 橙 + 纯白文字 + 柔和阴影，任何主题下均醒目清晰 */
.industry-pill.active {
  background: #f38020 !important;
  border-color: #f38020 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(243, 128, 32, 0.38), 0 0 0 1px #ea580c !important;
}

.industry-pill.active::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.95);
  flex-shrink: 0;
}

/* 规则分类筛选 Tab 高对比度选态强化 (解决浅色/深色主题下选态不明显的问题) */
.cat-tab.active {
  background: #0f172a !important;
  border-color: #0f172a !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25) !important;
}

[data-theme="dark"] .cat-tab.active,
body:not([data-theme="light"]) .cat-tab.active {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: #0b0f19 !important;
  box-shadow: 0 2px 10px rgba(255, 255, 255, 0.22) !important;
}

.cat-tab.active .cat-badge {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
}

[data-theme="dark"] .cat-tab.active .cat-badge,
body:not([data-theme="light"]) .cat-tab.active .cat-badge {
  background: rgba(0, 0, 0, 0.14) !important;
  color: #0b0f19 !important;
}

/* 3. 行业法规动态提示条 */
.industry-notice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
  padding: 0.5rem 0.75rem;
  background: rgba(243, 128, 32, 0.05);
  border-left: 3px solid #f38020;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.notice-main {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 240px;
}

.notice-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  background: rgba(243, 128, 32, 0.16);
  color: #d95a00;
  border: 1px solid rgba(243, 128, 32, 0.35);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1.25;
}

[data-theme="dark"] .notice-tag,
body.theme-dark .notice-tag {
  color: #f38020;
}

.notice-text {
  line-height: 1.5;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.load-sample-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(243, 128, 32, 0.1);
  border: 1px solid rgba(243, 128, 32, 0.32);
  border-radius: 6px;
  color: #d95a00;
  padding: 0.28rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

[data-theme="dark"] .load-sample-link,
body.theme-dark .load-sample-link {
  color: #f38020;
}

.load-sample-link:hover {
  background: #f38020;
  border-color: #f38020;
  color: #ffffff !important;
}

/* 4. S级行业专属红线徽章与高亮增强 */
.v-industry-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(243, 128, 32, 0.12);
  color: #d95a00;
  border: 1px solid rgba(243, 128, 32, 0.28);
  margin-left: 0.4rem;
  vertical-align: middle;
}

[data-theme="dark"] .v-industry-badge,
body.theme-dark .v-industry-badge {
  color: #f38020;
}

.pop-cat-badge.badge-industry-active {
  background: rgba(243, 128, 32, 0.16);
  color: #d95a00;
  border: 1px solid rgba(243, 128, 32, 0.35);
  font-weight: 600;
}

[data-theme="dark"] .pop-cat-badge.badge-industry-active,
body.theme-dark .pop-cat-badge.badge-industry-active {
  color: #f38020;
}

.violation-mark.focus-industry {
  border-bottom: 2px dashed #f97316;
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.35);
}

/* 5. 交互式浮动平替气泡 (Popover) 深度美化与自适应排版 (Fixed 视口定位，永不撑大文本框) */
.replace-popover {
  position: fixed !important;
  z-index: 9999 !important;
  width: 330px !important;
  max-width: calc(100vw - 24px) !important;
  background: var(--bg-card) !important;
  backdrop-filter: blur(24px) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 14px !important;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(243, 128, 32, 0.18) !important;
  padding: 0.95rem 1rem !important;
}

.popover-header {
  margin-bottom: 0.65rem !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding-bottom: 0.55rem !important;
}

.popover-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.popover-cat-badge {
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  padding: 0.18rem 0.55rem !important;
  border-radius: 4px !important;
  background: rgba(239, 68, 68, 0.12) !important;
  color: #ef4444 !important;
  white-space: nowrap !important;
}

.popover-target-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.86rem;
  flex-wrap: wrap;
}

.popover-target-label {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.popover-target-val {
  color: #d95a00;
  font-weight: 700;
  word-break: break-all;
}

[data-theme="dark"] .popover-target-val {
  color: #f38020;
}

.popover-reason {
  background: rgba(243, 128, 32, 0.05) !important;
  border-left: 3px solid #f38020 !important;
  border-radius: 4px !important;
  padding: 0.45rem 0.65rem !important;
  color: var(--text-secondary) !important;
  font-size: 0.78rem !important;
  line-height: 1.5 !important;
  margin-bottom: 0.65rem !important;
}

.popover-input-group label {
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  color: var(--text-secondary) !important;
  margin-bottom: 0.3rem !important;
}

.popover-input {
  padding: 0.45rem 0.7rem !important;
  border-radius: 8px !important;
  border: 1px solid var(--border-color) !important;
  background: var(--bg-secondary) !important;
  font-size: 0.86rem !important;
}

.popover-input:focus {
  border-color: #f38020 !important;
  box-shadow: 0 0 0 2px rgba(243, 128, 32, 0.2) !important;
}

.popover-sugg-title {
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  color: var(--text-secondary) !important;
  margin-bottom: 0.35rem !important;
}

.pop-chip-btn {
  background: rgba(243, 128, 32, 0.08) !important;
  color: #c2410c !important;
  border: 1px solid rgba(243, 128, 32, 0.28) !important;
  padding: 0.25rem 0.6rem !important;
  border-radius: 6px !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
}

[data-theme="dark"] .pop-chip-btn {
  color: #f38020 !important;
  background: rgba(243, 128, 32, 0.12) !important;
}

.pop-chip-btn:hover {
  background: #f38020 !important;
  border-color: #f38020 !important;
  color: #ffffff !important;
}

.popover-footer {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 0.45rem !important;
  padding-top: 0.65rem !important;
  margin-top: 0.5rem !important;
  border-top: 1px solid var(--border-color) !important;
}

/* 移动端自适应微调 */
@media (max-width: 768px) {
  .industry-preset-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .industry-pills {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .industry-pill {
    flex-shrink: 0;
  }
  .industry-notice-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .load-sample-link {
    align-self: flex-start;
  }
}
