/* ============================================================
   京东AI视频分析业务管理平台 - 公共样式
   依据《京东IBMS界面规范》：
   - 整体色系：红、白、灰
   - 页面主底色：#F4F6FA（灰）
   - 顶部一级导航底色：#E1251B（京东红）
   - 左侧二级导航底色：#FFFFFF（白）
   - 左侧三级导航底色：#F9F9F9（灰）
   - 嵌套页面画布：1570px × 1012px，自适应
   - 字体：京东朗正（lib/fonts/JDLangZhengTi.ttf），全部页面统一
   ============================================================ */

@font-face {
  font-family: "JDLangZhengTi";
  src: url("../lib/fonts/JDLangZhengTi.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --jd-red: #E1251B;
  --jd-red-dark: #C81623;
  --jd-red-light: #FDECEB;
  --jd-bg: #F4F6FA;
  --jd-sidebar: #FFFFFF;
  --jd-sidebar-sub: #F9F9F9;
  --jd-text: #333333;
  --jd-text-sub: #666666;
  --jd-text-weak: #98A0B0;
  --jd-border: #E8EAF0;
  --jd-green: #37C273;
  --jd-orange: #F5A623;
  --jd-blue: #3D7EFF;
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: "JDLangZhengTi", "京东朗正", "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif;
  font-size: 14px;
  color: var(--jd-text);
  background: var(--jd-bg);
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #C9CEDB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #A9B0C2; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 页面水印（所有系统页面显示当前登录用户名，京东朗正字体） ---------- */
.jd-watermark-layer {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}
.jd-watermark-layer span {
  position: absolute;
  transform: rotate(-24deg);
  color: rgba(0, 0, 0, 0.05);
  font-size: 16px;
  font-weight: bold;
  white-space: nowrap;
  user-select: none;
}

/* ---------- 通用工具类 ---------- */
.text-red { color: var(--jd-red); }
.text-sub { color: var(--jd-text-sub); }
.text-weak { color: var(--jd-text-weak); }
.text-center { text-align: center; }
.text-bold { font-weight: bold; }
.flex-row { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ---------- 页面容器与标题 ---------- */
.page { padding: 14px 16px 20px; min-height: 100%; }
.page-title-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.page-title {
  font-size: 17px; font-weight: bold; position: relative; padding-left: 12px;
}
.page-title::before {
  content: ""; position: absolute; left: 0; top: 3px; bottom: 3px;
  width: 4px; border-radius: 2px; background: var(--jd-red);
}
.page-subtitle { font-size: 12px; color: var(--jd-text-weak); margin-left: 10px; font-weight: normal; }

/* ---------- 卡片 ---------- */
.jd-card {
  background: #FFFFFF; border-radius: 6px;
  box-shadow: 0 1px 4px rgba(31, 45, 76, 0.06);
  padding: 16px;
}
.jd-card + .jd-card { margin-top: 14px; }
.jd-card-title {
  font-size: 14px; font-weight: bold; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.jd-card-title .tt { display: flex; align-items: center; flex: 1; }
.jd-card-title .tt::before {
  content: ""; display: inline-block; width: 4px; height: 13px;
  border-radius: 2px; background: var(--jd-red); margin-right: 8px;
}

/* ---------- 检索条件栏 + 按钮工具栏 + 表格 + 分页（标准列表页） ---------- */
.filter-bar {
  background: #fff; border-radius: 6px; padding: 14px 16px 2px;
  box-shadow: 0 1px 4px rgba(31, 45, 76, 0.06);
  margin-bottom: 12px;
}
.filter-bar .el-form-item { margin-bottom: 12px; margin-right: 18px; }
/* 宽度统一作用在外层控件上，内层 input 跟随包裹层，避免边框超出/遮盖后续控件 */
.filter-bar .el-input { width: 180px; }
.filter-bar .el-input .el-input__inner { width: 100%; }
.filter-bar .el-select { width: 160px; }
.filter-bar .el-select .el-input { width: 100%; }
.filter-bar .el-select .el-input__inner { width: 100%; padding-right: 30px; }
.filter-bar .el-cascader .el-input, .filter-bar .el-cascader .el-input__inner { width: 100%; }
.filter-bar .el-range-editor.el-input__inner { width: 100%; }
.filter-bar .el-date-editor--daterange, .filter-bar .el-date-editor--datetimerange { width: 340px; }
/* 日期范围选择器："至"分隔符两侧留足空间，避免文字被遮挡 */
.filter-bar .el-date-editor .el-range-separator { min-width: 36px !important; padding: 0 6px !important; }
.filter-bar .el-date-editor .el-range-input { flex: 1; min-width: 0; }

.toolbar {
  background: #fff; border-radius: 6px; padding: 10px 16px;
  box-shadow: 0 1px 4px rgba(31, 45, 76, 0.06);
  margin-bottom: 12px; display: flex; align-items: center;
}
.toolbar .toolbar-tip { margin-left: auto; font-size: 12px; color: var(--jd-text-weak); }

.table-card {
  background: #fff; border-radius: 6px; padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(31, 45, 76, 0.06);
}
.pager-row { display: flex; justify-content: flex-end; padding: 14px 4px 2px; }

/* 左树右表布局 */
.tree-table-layout { display: flex; gap: 12px; align-items: stretch; }
.tree-panel {
  width: 260px; flex-shrink: 0; background: #fff; border-radius: 6px;
  box-shadow: 0 1px 4px rgba(31, 45, 76, 0.06); padding: 12px;
  display: flex; flex-direction: column;
}
.tree-panel .tree-search { margin-bottom: 10px; }
.tree-panel .tree-body { flex: 1; overflow: auto; }
.tree-panel-head { font-weight: bold; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.tree-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- 抓拍图占位（演示：无真实图片，用样式块模拟AI抓拍） ---------- */
.snap {
  width: 84px; height: 56px; border-radius: 4px; cursor: pointer;
  position: relative; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.snap i { font-size: 20px; color: rgba(255,255,255,0.85); z-index: 2; }
.snap .snap-flag {
  position: absolute; left: 0; bottom: 0; right: 0;
  background: rgba(0,0,0,0.45); color: #fff; font-size: 10px;
  text-align: center; padding: 1px 0; z-index: 2;
}
.snap::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px) 0 0/100% 8px,
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px) 0 0/8px 100%;
}
.snap.lv-high { background: linear-gradient(135deg, #7A2C26, #3E5580); }
.snap.lv-mid { background: linear-gradient(135deg, #7A5B26, #3E5580); }
.snap.lv-low { background: linear-gradient(135deg, #2C5A7A, #3E5580); }
/* 所有抓拍图统一方形 */
.snap.face { border-radius: 4px; }
.snap.person { background: linear-gradient(135deg, #5A3E7A, #3E5580); }
.snap.car { background: linear-gradient(135deg, #265A7A, #3E5580); }

/* 大图预览弹窗中的抓拍 */
.snap-lg { width: 100%; height: 240px; border-radius: 6px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2C5A7A, #3E5580); }
.snap-lg.lv-high { background: linear-gradient(135deg, #7A2C26, #3E5580); }
.snap-lg.lv-mid { background: linear-gradient(135deg, #7A5B26, #3E5580); }
.snap-lg.lv-low { background: linear-gradient(135deg, #2C5A7A, #3E5580); }
.snap-lg.person { background: linear-gradient(135deg, #5A3E7A, #3E5580); }
.snap-lg.car { background: linear-gradient(135deg, #265A7A, #3E5580); }
.snap-lg i { font-size: 56px; color: rgba(255,255,255,0.6); }
.snap-lg::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px) 0 0/100% 14px,
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px) 0 0/14px 100%;
}
.snap-lg .scanline {
  position: absolute; left: 0; right: 0; height: 60px; z-index: 1;
  background: linear-gradient(180deg, rgba(80,110,170,0) 0%, rgba(80,110,170,0.35) 50%, rgba(80,110,170,0) 100%);
  animation: snapscan 4s linear infinite;
}
@keyframes snapscan { 0% { top: -60px; } 100% { top: 100%; } }

/* ---------- 统计卡片 ---------- */
.stat-card {
  background: #fff; border-radius: 6px;
  box-shadow: 0 1px 4px rgba(31, 45, 76, 0.06);
  padding: 16px 18px; display: flex; align-items: center; justify-content: space-between;
}
.stat-card .stat-label { color: var(--jd-text-sub); font-size: 13px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 26px; font-weight: bold; line-height: 1; }
.stat-card .stat-value .unit { font-size: 13px; font-weight: normal; color: var(--jd-text-sub); margin-left: 4px; }
.stat-card .stat-foot { font-size: 12px; color: var(--jd-text-weak); margin-top: 8px; }
.stat-icon {
  width: 46px; height: 46px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
}
.stat-icon.red { background: linear-gradient(135deg, #F05A50, #E1251B); }
.stat-icon.orange { background: linear-gradient(135deg, #FFC371, #F5A623); }
.stat-icon.blue { background: linear-gradient(135deg, #6FA8FF, #3D7EFF); }
.stat-icon.green { background: linear-gradient(135deg, #6FD9A4, #37C273); }
.stat-icon.purple { background: linear-gradient(135deg, #B58AFF, #8A5CF6); }
.stat-icon.cyan { background: linear-gradient(135deg, #67DBE9, #22B8CF); }

/* ---------- 视频占位（演示用模拟画面） ---------- */
.video-placeholder {
  background: #16203A; border-radius: 4px; color: #7A8DB0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.video-placeholder.is-active { outline: 1px solid var(--jd-red); outline-offset: -1px; }
.video-placeholder .cam-name, .video-placeholder .cam-time {
  position: absolute; top: 6px; color: #C8D3EC; font-size: 12px;
  background: rgba(0,0,0,0.4); padding: 1px 7px; border-radius: 3px; z-index: 2;
}
.video-placeholder .cam-name { left: 6px; }
.video-placeholder .cam-time { right: 6px; }
.video-placeholder .cam-tools {
  position: absolute; right: 6px; bottom: 6px; z-index: 3;
  display: none; gap: 4px;
}
.video-placeholder:hover .cam-tools { display: flex; }
.video-placeholder .cam-tools span {
  width: 24px; height: 24px; background: rgba(0,0,0,0.5); border-radius: 4px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: #C8D3EC;
}
.video-placeholder .cam-tools span:hover { color: #fff; background: var(--jd-red); }
.video-placeholder .video-icon { font-size: 34px; color: #3E5580; }
.video-placeholder .video-empty { font-size: 12px; margin-top: 6px; }
.video-placeholder .scanline {
  position: absolute; left: 0; right: 0; height: 70px;
  background: linear-gradient(180deg, rgba(62,85,128,0) 0%, rgba(80,110,170,0.3) 50%, rgba(62,85,128,0) 100%);
  animation: scanmove 6s linear infinite; z-index: 1;
}
@keyframes scanmove { 0% { top: -70px; } 100% { top: 100%; } }

/* ---------- 平面图 / 地图容器 ---------- */
.plan-canvas {
  position: relative; width: 100%; height: 100%;
  background: #EDF0F5; border-radius: 6px; overflow: hidden;
}
.plan-svg { width: 100%; height: 100%; display: block; }
.map-marker {
  position: absolute; transform: translate(-50%, -100%); cursor: pointer; z-index: 3;
  text-align: center; user-select: none;
}
.map-marker .mk-dot {
  width: 14px; height: 14px; border-radius: 50%; margin: 0 auto;
  background: var(--jd-blue); border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(61,126,255,0.35);
}
.map-marker.online .mk-dot { background: var(--jd-green); box-shadow: 0 0 0 2px rgba(55,194,115,0.35); }
.map-marker.offline .mk-dot { background: #BFC4D1; box-shadow: none; }
.map-marker.alarm .mk-dot { background: var(--jd-red); box-shadow: 0 0 0 2px rgba(225,37,27,0.4); animation: mkblink 1s infinite; }
@keyframes mkblink { 50% { box-shadow: 0 0 0 6px rgba(225,37,27,0.15); } }
.map-marker .mk-label {
  font-size: 11px; color: #4A5B7C; background: rgba(255,255,255,0.9);
  padding: 0 5px; border-radius: 3px; margin-top: 2px; white-space: nowrap;
}
.map-marker:hover .mk-label { color: var(--jd-red); }
.map-marker.selected .mk-dot { background: var(--jd-red); }

/* 轨迹线标注 */
.track-pt {
  position: absolute; transform: translate(-50%, -50%); z-index: 4;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--jd-red); color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
}
.track-pt.start { background: var(--jd-green); }
.track-pt.end { background: var(--jd-red); }

/* ---------- 时间线（轨迹时序） ---------- */
.jd-timeline { padding-left: 4px; }
.jd-timeline .tl-item { display: flex; gap: 10px; padding: 6px 0; cursor: pointer; border-radius: 6px; }
.jd-timeline .tl-item:hover { background: #F7F8FB; }
.jd-timeline .tl-time { width: 130px; flex-shrink: 0; color: var(--jd-text-sub); font-size: 12px; }
.jd-timeline .tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--jd-red); margin-top: 5px; flex-shrink: 0; }
.jd-timeline .tl-body { flex: 1; font-size: 13px; }

/* ---------- 403 无权限提示 ---------- */
.perm-denied {
  position: fixed; inset: 0; z-index: 3000; background: var(--jd-bg);
  display: flex; align-items: center; justify-content: center;
}
.perm-denied .pd-box { text-align: center; }
.perm-denied .pd-icon { font-size: 64px; color: #D3D8E4; }
.perm-denied h2 { font-size: 20px; margin: 14px 0 8px; color: #333; }
.perm-denied p { color: var(--jd-text-sub); font-size: 13px; margin-bottom: 20px; }

/* ---------- 状态徽标 ---------- */
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px;
}
.status-dot.green { background: var(--jd-green); }
.status-dot.red { background: var(--jd-red); }
.status-dot.orange { background: var(--jd-orange); }
.status-dot.gray { background: #BFC4D1; }

/* ---------- Element UI 主题定制（京东红） ---------- */
.el-button--primary { background-color: var(--jd-red) !important; border-color: var(--jd-red) !important; }
.el-button--primary:hover, .el-button--primary:focus {
  background-color: var(--jd-red-dark) !important; border-color: var(--jd-red-dark) !important;
}
.el-button--text { color: var(--jd-red) !important; }
.el-button--text:hover, .el-button--text:focus { color: var(--jd-red-dark) !important; }

.el-menu { border-right: none !important; }

.el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: var(--jd-red) !important; color: #fff;
}
.el-pagination.is-background .el-pager li:not(.disabled):hover { color: var(--jd-red); }

.el-table th { background-color: #F9F9F9 !important; color: #555; font-weight: bold; }
.el-table thead { color: #555 !important; }
.el-table { font-size: 13px; }

.el-tabs__item.is-active { color: var(--jd-red) !important; }
.el-tabs__active-bar { background-color: var(--jd-red) !important; }
.el-tabs__item:hover { color: var(--jd-red); }

.el-checkbox__input.is-checked .el-checkbox__inner,
.el-radio__input.is-checked .el-radio__inner,
.el-tree-node__content .is-checked > .el-checkbox__inner {
  background-color: var(--jd-red) !important; border-color: var(--jd-red) !important;
}
.el-checkbox__input.is-indeterminate .el-checkbox__inner {
  background-color: var(--jd-red) !important; border-color: var(--jd-red) !important;
}
.el-checkbox__input.is-checked + .el-checkbox__label,
.el-radio__input.is-checked + .el-radio__label { color: var(--jd-red) !important; }
.el-switch.is-checked .el-switch__core { background-color: var(--jd-red) !important; border-color: var(--jd-red) !important; }

.el-tag--danger { background-color: var(--jd-red-light); border-color: #F5B5B1; color: var(--jd-red); }
.el-badge__content.is-fixed { background-color: var(--jd-red); }

.el-input__inner:focus, .el-textarea__inner:focus { border-color: var(--jd-red) !important; }
.el-select .el-input.is-focus .el-input__inner { border-color: var(--jd-red) !important; }
.el-select-dropdown__item.selected { color: var(--jd-red) !important; }
.el-date-table td.current:not(.disabled) span { background-color: var(--jd-red) !important; }
.el-tree-node.is-current > .el-tree-node__content { color: var(--jd-red) !important; background: #FDECEB !important; }

/* 表格内小按钮列间距 */
.el-table .cell { word-break: break-all; }
.op-btns .el-button { margin-left: 0 !important; margin-right: 8px; }
.op-btns .el-button:last-child { margin-right: 0 !important; }

/* 弹窗圆角 */
.el-dialog { border-radius: 8px; }
.el-dialog__header { border-bottom: 1px solid #EEF0F5; padding: 14px 20px; }
.el-dialog__title { font-weight: bold; font-size: 15px; }
