/* ========================================
   common.css —— 全站公共样式
   支持两套主题（通过 html[data-theme] 切换，见 js/theme.js）：
   - dark（默认）：科技感指挥中心风格，深空蓝背景 + 青色霓虹高亮 + 玻璃拟态
   - light：蓝白政务风格，深蓝顶栏 + 白色卡片 + 浅灰背景，扁平化、无发光特效
   新增主题时只需在下方新增一个 [data-theme="xxx"] 覆盖块，页面结构/类名无需改动。
   ======================================== */

:root,
[data-theme="dark"] {
  --bg-deep: #060b16;
  --bg-page-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(53, 229, 255, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(59, 130, 246, 0.08), transparent),
    linear-gradient(rgba(64, 220, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(64, 220, 255, 0.045) 1px, transparent 1px);
  --bg-page-size: auto, auto, 42px 42px, 42px 42px;
  --bg-panel: rgba(13, 24, 44, 0.72);
  --bg-panel-solid: #0d1830;
  --bg-input: rgba(255, 255, 255, 0.03);
  --border-glow: rgba(64, 220, 255, 0.35);
  --border-glow-strong: rgba(64, 220, 255, 0.65);
  --border-soft: rgba(255, 255, 255, 0.08);
  --border-softer: rgba(255, 255, 255, 0.06);
  --divider-soft: rgba(255, 255, 255, 0.1);
  --bar-track: rgba(255, 255, 255, 0.06);
  --accent-cyan: #35e5ff;
  --accent-blue: #3b82f6;
  --accent-green: #3bffa0;
  --text-primary: #e8f4ff;
  --text-secondary: #8fa8c7;
  --text-dim: #5a7291;
  --danger: #ff3b5c;
  --warning-orange: #ff9a3b;
  --warning-yellow: #ffe13b;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-mono: 'Consolas', 'Courier New', monospace;

  /* 深色主题专属特效开关（浅色主题下会被整体关闭，见下方 light 覆盖块） */
  --panel-glow-top: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  --panel-blur: blur(10px);
  --panel-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset, 0 8px 32px rgba(0, 0, 0, 0.35);
  --title-gradient: linear-gradient(90deg, var(--text-primary), var(--accent-cyan));
  --topbar-bg: linear-gradient(180deg, rgba(13, 24, 44, 0.95), rgba(13, 24, 44, 0.75));
  --topbar-blur: blur(8px);
  --brand-dot-glow: 0 0 10px var(--accent-cyan), 0 0 20px var(--accent-cyan);
  --card-glow-shadow: 0 0 16px rgba(64, 220, 255, 0.25);
}

/* ---------- 蓝白政务主题 ----------
   参考典型政务大屏/后台风格：深蓝顶栏与标题，白色卡片，浅灰背景，
   取消发光、玻璃拟态、网格纹理等"科技感"视觉，改为常规阴影与描边。 */
[data-theme="light"] {
  --bg-deep: #eef2f7;
  --bg-page-image: none;
  --bg-page-size: auto;
  --bg-panel: #ffffff;
  --bg-panel-solid: #ffffff;
  --bg-input: #ffffff;
  --border-glow: #dde4ee;
  --border-glow-strong: #c3cee0;
  --border-soft: #e4e9f0;
  --border-softer: #ebeef3;
  --divider-soft: #e4e9f0;
  --bar-track: #e9edf3;
  --accent-cyan: #1a56c4;
  --accent-blue: #1a56c4;
  --accent-green: #1a9c6b;
  --text-primary: #1f2d3d;
  --text-secondary: #5c6b7f;
  --text-dim: #8a97a8;
  --danger: #e0344c;
  --warning-orange: #e08a2e;
  --warning-yellow: #c9a023;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-mono: 'Consolas', 'Courier New', monospace;

  --panel-glow-top: none;
  --panel-blur: none;
  --panel-shadow: 0 1px 3px rgba(16, 36, 72, 0.08);
  --title-gradient: none;
  --topbar-bg: linear-gradient(180deg, #1a4fb0, #163f8c);
  --topbar-blur: none;
  --brand-dot-glow: none;
  --card-glow-shadow: 0 2px 10px rgba(26, 86, 196, 0.18);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  overflow-x: hidden;
  transition: background-color 0.2s, color 0.2s;
}

/* 背景装饰：深色主题下为径向光晕 + 网格线，营造指挥大屏氛围；
   浅色主题下 --bg-page-image 为 none，自动变为纯色背景 */
body {
  background-image: var(--bg-page-image);
  background-size: var(--bg-page-size);
}

a { color: var(--accent-cyan); text-decoration: none; }

/* ---------- 顶部导航 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 28px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border-glow);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: var(--topbar-blur);
}

[data-theme="light"] .topbar {
  box-shadow: 0 2px 8px rgba(16, 36, 72, 0.15);
}

[data-theme="light"] .topbar .brand,
[data-theme="light"] .topbar nav a,
[data-theme="light"] .topbar .env-tag {
  color: #ffffff;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}

.topbar .brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: var(--brand-dot-glow);
  animation: pulse 2s infinite;
}

[data-theme="light"] .topbar .brand .dot {
  background: #5bd1a0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.topbar nav {
  display: flex;
  gap: 6px;
}

.topbar nav a {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: all 0.2s;
  border: 1px solid transparent;
  opacity: 0.82;
}

.topbar nav a:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.topbar nav a.active {
  opacity: 1;
  background: rgba(64, 220, 255, 0.12);
  border-color: var(--border-glow);
  box-shadow: 0 0 12px rgba(64, 220, 255, 0.2) inset;
}

[data-theme="light"] .topbar nav a:hover {
  background: rgba(255, 255, 255, 0.14);
}
[data-theme="light"] .topbar nav a.active {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: none;
}

.topbar .env-tag {
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  opacity: 0.85;
}

/* ---------- 主题切换按钮 ---------- */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  transition: background 0.2s;
  white-space: nowrap;
}
.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ---------- 页面主体容器 ---------- */
.page-container {
  max-width: 1680px;
  margin: 0 auto;
  padding: 24px 28px 60px;
}

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 22px;
  margin: 0 0 6px;
  letter-spacing: 1px;
  color: var(--text-primary);
  background: var(--title-gradient);
}
[data-theme="dark"] .page-header h1 {
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ---------- 玻璃拟态卡片 ---------- */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: var(--panel-blur);
  box-shadow: var(--panel-shadow);
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--panel-glow-top);
  opacity: 0.6;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.panel-title .bar {
  display: inline-block;
  width: 4px;
  height: 14px;
  background: var(--accent-cyan);
  box-shadow: var(--brand-dot-glow);
  margin-right: 8px;
  border-radius: 2px;
  vertical-align: middle;
}
[data-theme="light"] .panel-title .bar {
  box-shadow: none;
}

.panel-title-left {
  display: flex;
  align-items: center;
}

/* ---------- 栅格布局辅助类 ---------- */
.grid {
  display: grid;
  gap: 18px;
}
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.grid-sidebar { grid-template-columns: 1.6fr 1fr; }
.grid-chat-layout { grid-template-columns: 260px 1fr; }

@media (max-width: 1100px) {
  .grid-2, .grid-3, .grid-4, .grid-sidebar, .grid-chat-layout { grid-template-columns: 1fr; }
}

/* ---------- 统计数字卡片 ---------- */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(64, 220, 255, 0.05);
  border: 1px solid rgba(64, 220, 255, 0.18);
}
[data-theme="light"] .stat-card {
  background: #f3f7fd;
  border: 1px solid #dbe6f6;
}
.stat-card .num {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  text-shadow: 0 0 12px rgba(64,220,255,0.4);
}
[data-theme="light"] .stat-card .num {
  text-shadow: none;
}
.stat-card .label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 可点击统计卡片（点击弹出明细详情），hover态给出可点击反馈 */
.stat-card-clickable {
  cursor: pointer;
  transition: all 0.2s;
}
.stat-card-clickable:hover {
  background: rgba(64, 220, 255, 0.12);
  border-color: var(--border-glow-strong);
  transform: translateY(-2px);
}
[data-theme="light"] .stat-card-clickable:hover {
  background: #e6f0fb;
}

/* ---------- 徽标/标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid currentColor;
}
.badge.badge-red    { color: var(--danger); background: rgba(255,59,92,0.1); }
.badge.badge-orange { color: var(--warning-orange); background: rgba(255,154,59,0.1); }
.badge.badge-yellow { color: var(--warning-yellow); background: rgba(255,225,59,0.1); }
.badge.badge-blue    { color: var(--accent-blue); background: rgba(59,130,246,0.12); }
.badge.badge-green   { color: var(--accent-green); background: rgba(59,255,160,0.1); }
.badge.badge-gray    { color: var(--text-dim); background: rgba(90,114,145,0.1); }

.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-glow);
  background: rgba(64, 220, 255, 0.08);
  color: var(--accent-cyan);
  transition: all 0.2s;
}
.btn:hover {
  background: rgba(64, 220, 255, 0.18);
  box-shadow: var(--card-glow-shadow);
}
.btn.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #04141f;
  border-color: transparent;
}
.btn.btn-primary:hover {
  box-shadow: var(--card-glow-shadow);
}
.btn.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: rgba(143, 168, 199, 0.3);
}
.btn.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}
.btn.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 关键确认动作按钮（如"确认下发"）：需要在列表中最醒目，区别于普通主按钮 */
.btn.btn-confirm {
  background: linear-gradient(135deg, #1fcf7a, var(--accent-green));
  color: #04241a;
  border-color: transparent;
  box-shadow: 0 0 14px rgba(59, 255, 160, 0.35);
}
.btn.btn-confirm:hover {
  box-shadow: 0 0 20px rgba(59, 255, 160, 0.55);
  transform: translateY(-1px);
}

[data-theme="light"] .btn {
  background: #eef4fc;
}
[data-theme="light"] .btn:hover {
  background: #e1ecfa;
}
[data-theme="light"] .btn.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #ffffff;
}
[data-theme="light"] .btn.btn-confirm {
  background: linear-gradient(135deg, #1fa863, #2ecc81);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(26,156,107,0.3);
}
[data-theme="light"] .btn.btn-confirm:hover {
  box-shadow: 0 0 16px rgba(26,156,107,0.45);
}
[data-theme="light"] .btn.btn-ghost {
  border-color: #d6dee9;
}
[data-theme="light"] .btn.btn-ghost:hover {
  background: #f3f6fa;
}

/* ---------- 提示条 / 风控提示（重要：AI建议 vs 人工决策的视觉区分） ---------- */
.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
}
.notice.notice-warning {
  background: rgba(255, 154, 59, 0.1);
  border: 1px solid rgba(255, 154, 59, 0.4);
  color: #ffd9ad;
}
.notice.notice-info {
  background: rgba(64, 220, 255, 0.08);
  border: 1px solid rgba(64, 220, 255, 0.3);
  color: #bfeeff;
}
.notice-icon { font-size: 16px; line-height: 1.6; }

[data-theme="light"] .notice.notice-warning {
  background: #fdf3e8;
  border-color: #f0d5ad;
  color: #8a5a1e;
}
[data-theme="light"] .notice.notice-info {
  background: #eaf2fd;
  border-color: #c7dcf5;
  color: #1f4e8c;
}

/* ---------- 列表/条目通用 ---------- */
.list-item {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-softer);
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
[data-theme="light"] .list-item {
  background: #f7f9fc;
}
.list-item:hover {
  border-color: var(--border-glow);
}
.list-item .list-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.list-item .list-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.list-item .list-item-detail {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.list-item .list-item-footer {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.source-tag {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.03);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-softer);
}
[data-theme="light"] .source-tag {
  background: #f1f4f8;
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(64,220,255,0.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(64,220,255,0.45); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c3d2e8; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #a9bdda; }

/* 底部版本信息 */
.footer-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 40px;
  letter-spacing: 0.5px;
}

/* ---------- 筛选条组件（防控巡查页等列表筛选场景） ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-group-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-right: 2px;
}
.filter-chip {
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
[data-theme="light"] .filter-chip {
  background: #f3f6fa;
}
.filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-glow);
}
.filter-chip.filter-chip-active {
  color: var(--accent-cyan);
  background: rgba(64, 220, 255, 0.14);
  border-color: var(--border-glow-strong);
  box-shadow: 0 0 10px rgba(64,220,255,0.2);
}
[data-theme="light"] .filter-chip.filter-chip-active {
  color: #ffffff;
  background: var(--accent-cyan);
  box-shadow: none;
}

/* ---------- 全局弹窗（要素信息小卡片 / 居中模态框），各页面通用 ---------- */
.map-popup {
  position: absolute;
  z-index: 20;
  min-width: 240px;
  background: rgba(13, 24, 44, 0.95);
  border: 1px solid var(--border-glow-strong);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 20px rgba(64,220,255,0.15);
  display: none;
}
[data-theme="light"] .map-popup {
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(16,36,72,0.18);
}
.map-popup.visible { display: block; }
.map-popup h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-primary);
}
.map-popup .popup-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0;
}
.map-popup .popup-row span:last-child {
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.map-popup .popup-close {
  position: absolute;
  top: 10px; right: 10px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 14px;
}

/* 全局居中模态框（隐患点档案宽表、统计卡片详情等）：独立于任何容器，固定定位居中于
   整个视口，带遮罩层，与 .map-popup（随点击位置定位的小卡片）视觉上区分。
   任何页面给弹窗加上 .global-modal 类即可复用这套居中定位样式。 */
.global-modal.map-popup {
  position: fixed !important;
  z-index: 200;
  min-width: 380px;
}
.profile-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
  display: none;
}
.profile-modal-mask.visible { display: block; }
