/* ================================================================
   佰钧成网络安全分析系统v1.0 - 样式文件
   风格：深色政企SOC安全大屏 / 深蓝底色 / 青蓝色霓虹 / 发光边框
   适配：1920×1080 标准大屏
   ================================================================ */

/* ---------- 全局重置 ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #c8d6e5;
  background: #050d1f;
}

ul, li { list-style: none; }
button { cursor: pointer; border: none; outline: none; background: none; color: inherit; font-family: inherit; }

/* ---------- 风险配色常量（统一规范） ---------- */
/*
  高危: #f53f3f 红色
  中危: #ff7d00 橙色
  低危: #0fc6c2 青色
  正常: #36cfa7 绿色
*/

/* ================================================================
   整体容器
   ================================================================ */
.dashboard-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 1920px;
  min-height: 1080px;
  /* 深蓝底色 + 细微网格背景 */
  background:
    linear-gradient(180deg, #061530 0%, #050d1f 50%, #040a18 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 细微网格背景（叠加层） */
.dashboard-container::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 180, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 180, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ================================================================
   顶部通栏 Header
   ================================================================ */
.dashboard-header {
  position: relative;
  z-index: 10;
  height: 70px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  /* 顶部渐变装饰条 */
  background:
    linear-gradient(180deg, rgba(0, 150, 255, 0.15) 0%, rgba(0, 100, 200, 0.05) 60%, transparent 100%);
  border-bottom: 1px solid rgba(0, 180, 255, 0.2);
  box-shadow: 0 2px 20px rgba(0, 150, 255, 0.1);
}

/* 左侧 Logo + 标题 */
.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.logo-placeholder {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 198, 255, 0.5);
}

.logo-icon {
  font-size: 24px;
  color: #fff;
}

/* 替换 Logo 图片时使用 */
.header-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.header-title {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(90deg, #ffffff 0%, #00d4ff 50%, #0099ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  text-shadow: 0 0 30px rgba(0, 200, 255, 0.3);
}

/* 中间：时间筛选 */
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.time-filter {
  display: flex;
  background: rgba(0, 50, 100, 0.3);
  border: 1px solid rgba(0, 180, 255, 0.3);
  border-radius: 6px;
  padding: 3px;
}

.time-btn {
  padding: 6px 20px;
  font-size: 13px;
  color: #7fb3d5;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.time-btn:hover {
  color: #00d4ff;
}

.time-btn.active {
  background: linear-gradient(90deg, #0099ff 0%, #00c6ff 100%);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 198, 255, 0.5);
}

/* 右侧 KPI + 时钟 + 全屏 */
.header-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
}

.header-kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.kpi-label {
  font-size: 12px;
  color: #6b8cae;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  font-family: "Consolas", "Monaco", monospace;
}

.kpi-danger  { color: #f53f3f; text-shadow: 0 0 8px rgba(245, 63, 63, 0.5); }
.kpi-warning { color: #ff7d00; text-shadow: 0 0 8px rgba(255, 125, 0, 0.5); }
.kpi-success { color: #36cfa7; text-shadow: 0 0 8px rgba(54, 207, 167, 0.5); }
.kpi-primary { color: #00c6ff; text-shadow: 0 0 8px rgba(0, 198, 255, 0.5); }

.header-clock {
  font-size: 22px;
  font-weight: 600;
  font-family: "Consolas", "Monaco", monospace;
  color: #00d4ff;
  text-shadow: 0 0 10px rgba(0, 200, 255, 0.5);
  letter-spacing: 1px;
}

.fullscreen-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 100, 200, 0.2);
  border: 1px solid rgba(0, 180, 255, 0.3);
  border-radius: 6px;
  color: #00c6ff;
  font-size: 18px;
  transition: all 0.3s ease;
}

.fullscreen-btn:hover {
  background: rgba(0, 150, 255, 0.3);
  box-shadow: 0 0 12px rgba(0, 198, 255, 0.4);
}

/* ================================================================
   主体内容区（三栏）
   ================================================================ */
.dashboard-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: 24% 52% 24%;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.panel-left,
.panel-right {
  overflow-y: auto;
  padding-right: 2px;
}

/* 滚动条样式 */
.panel-left::-webkit-scrollbar,
.panel-right::-webkit-scrollbar {
  width: 4px;
}
.panel-left::-webkit-scrollbar-thumb,
.panel-right::-webkit-scrollbar-thumb {
  background: rgba(0, 180, 255, 0.2);
  border-radius: 2px;
}

/* ================================================================
   卡片通用样式
   ================================================================ */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(10, 30, 60, 0.8) 0%, rgba(5, 15, 35, 0.9) 100%);
  border: 1px solid rgba(0, 180, 255, 0.2);
  border-radius: 4px;
  box-shadow:
    inset 0 0 20px rgba(0, 100, 200, 0.08),
    0 0 15px rgba(0, 100, 200, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 卡片发光边角装饰 */
.card::before,
.card::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #00c6ff;
  pointer-events: none;
  z-index: 2;
}

.card::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
  box-shadow: -2px -2px 6px rgba(0, 198, 255, 0.5);
}

.card::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
  box-shadow: 2px 2px 6px rgba(0, 198, 255, 0.5);
}

.card-header {
  position: relative;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: linear-gradient(90deg, rgba(0, 150, 255, 0.15) 0%, rgba(0, 100, 200, 0.05) 70%, transparent 100%);
  border-bottom: 1px solid rgba(0, 180, 255, 0.15);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: #e0f0ff;
  letter-spacing: 1px;
  position: relative;
  padding-left: 10px;
}

.card-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 14px;
  background: linear-gradient(180deg, #00c6ff 0%, #0072ff 100%);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0, 198, 255, 0.6);
}

.card-badge {
  padding: 2px 8px;
  font-size: 12px;
  background: rgba(245, 63, 63, 0.15);
  color: #f53f3f;
  border: 1px solid rgba(245, 63, 63, 0.3);
  border-radius: 10px;
  font-family: "Consolas", monospace;
}

.card-body {
  flex: 1;
  padding: 12px;
  min-height: 0;
  position: relative;
}

.card-body-no-padding {
  padding: 0;
}

/* ================================================================
   KPI 数字网格
   ================================================================ */
.kpi-grid {
  display: grid;
  gap: 10px;
}

.kpi-grid-2 { grid-template-columns: 1fr 1fr; }
.kpi-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.kpi-item {
  text-align: center;
  padding: 10px 6px;
  background: rgba(0, 80, 160, 0.1);
  border: 1px solid rgba(0, 150, 255, 0.15);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.kpi-item:hover {
  background: rgba(0, 100, 200, 0.15);
  border-color: rgba(0, 198, 255, 0.3);
}

.kpi-num {
  font-size: 24px;
  font-weight: 700;
  font-family: "Consolas", "Monaco", monospace;
  line-height: 1.2;
  color: #e0f0ff;
}

.kpi-desc {
  margin-top: 4px;
  font-size: 12px;
  color: #6b8cae;
}

/* ================================================================
   图表容器
   ================================================================ */
.chart-container {
  width: 100%;
  height: 100%;
  min-height: 180px;
}

.chart-map      { min-height: 260px; }
.chart-topology { min-height: 260px; }
.chart-gauge    { min-height: 160px; }

/* ================================================================
   中间主区域布局
   ================================================================ */
.panel-center {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.center-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.center-bottom {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.card-map,
.card-topology,
.card-alerts,
.card-trend {
  height: 100%;
}

/* ================================================================
   排行榜列表
   ================================================================ */
.rank-list {
  padding: 8px 0;
}

.rank-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(0, 150, 255, 0.08);
}

.rank-list li:last-child { border-bottom: none; }

.rank-list li:hover {
  background: rgba(0, 150, 255, 0.1);
  padding-left: 18px;
}

.rank-num {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: "Consolas", monospace;
  border-radius: 4px;
  flex-shrink: 0;
}

.rank-num.top1 { background: linear-gradient(135deg, #ff4757 0%, #f53f3f 100%); color: #fff; box-shadow: 0 0 8px rgba(245, 63, 63, 0.5); }
.rank-num.top2 { background: linear-gradient(135deg, #ff9f43 0%, #ff7d00 100%); color: #fff; box-shadow: 0 0 8px rgba(255, 125, 0, 0.5); }
.rank-num.top3 { background: linear-gradient(135deg, #ffd93d 0%, #f9ca24 100%); color: #333; box-shadow: 0 0 8px rgba(255, 217, 61, 0.5); }
.rank-num.normal { background: rgba(0, 150, 255, 0.2); color: #7fb3d5; }

.rank-name {
  flex: 1;
  font-size: 13px;
  color: #c8d6e5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-level {
  flex-shrink: 0;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 3px;
}

.rank-level.high   { background: rgba(245, 63, 63, 0.15); color: #f53f3f; border: 1px solid rgba(245, 63, 63, 0.3); }
.rank-level.medium { background: rgba(255, 125, 0, 0.15); color: #ff7d00; border: 1px solid rgba(255, 125, 0, 0.3); }
.rank-level.low    { background: rgba(15, 198, 194, 0.15); color: #0fc6c2; border: 1px solid rgba(15, 198, 194, 0.3); }

.rank-count {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  font-family: "Consolas", monospace;
  color: #ff7d00;
  min-width: 40px;
  text-align: right;
}

/* IP 排行榜专用 */
.rank-list-ip .rank-name {
  font-family: "Consolas", monospace;
  font-size: 12px;
  color: #00d4ff;
}

/* ================================================================
   滚动列表（告警 / 日志）
   ================================================================ */
.scroll-list {
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* 告警列表 */
.alert-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 150, 255, 0.08);
  transition: all 0.2s ease;
}

.alert-list li:hover {
  background: rgba(0, 150, 255, 0.1);
}

.alert-time {
  flex-shrink: 0;
  font-size: 11px;
  font-family: "Consolas", monospace;
  color: #6b8cae;
  width: 70px;
}

.alert-level-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.alert-level-dot.high   { background: #f53f3f; box-shadow: 0 0 6px #f53f3f; }
.alert-level-dot.medium { background: #ff7d00; box-shadow: 0 0 6px #ff7d00; }
.alert-level-dot.low    { background: #0fc6c2; box-shadow: 0 0 6px #0fc6c2; }

.alert-type {
  flex-shrink: 0;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(0, 150, 255, 0.15);
  color: #00c6ff;
  width: 70px;
  text-align: center;
}

.alert-desc {
  flex: 1;
  font-size: 12px;
  color: #c8d6e5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-ip {
  flex-shrink: 0;
  font-size: 11px;
  font-family: "Consolas", monospace;
  color: #ff7d00;
  width: 100px;
  text-align: right;
}

/* ================================================================
   策略合规详情
   ================================================================ */
.policy-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
  padding: 0 4px;
}

.policy-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: rgba(0, 80, 160, 0.08);
  border-radius: 3px;
  font-size: 12px;
}

.policy-label { color: #6b8cae; }
.policy-value {
  font-weight: 600;
  font-family: "Consolas", monospace;
  font-size: 14px;
}

/* ================================================================
   底部日志分析专区
   ================================================================ */
.dashboard-footer {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  height: 220px;
  padding: 0 12px 12px;
}

.card-footer {
  height: 100%;
}

.footer-body {
  display: grid;
  grid-template-columns: 25% 50% 25%;
  gap: 12px;
  height: 100%;
  padding: 8px 12px 12px;
}

.footer-col {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* 日志筛选 Tab */
.log-filter-tabs {
  display: flex;
  gap: 4px;
}

.log-tab {
  padding: 3px 10px;
  font-size: 12px;
  color: #6b8cae;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.log-tab:hover { color: #00c6ff; }

.log-tab.active {
  background: rgba(0, 150, 255, 0.2);
  color: #00d4ff;
  border: 1px solid rgba(0, 180, 255, 0.3);
}

/* 日志列表 */
.log-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 150, 255, 0.06);
  transition: all 0.2s ease;
  font-size: 12px;
}

.log-list li:hover {
  background: rgba(0, 150, 255, 0.08);
}

.log-time {
  flex-shrink: 0;
  font-family: "Consolas", monospace;
  color: #6b8cae;
  width: 75px;
}

.log-level {
  flex-shrink: 0;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 3px;
  width: 42px;
  text-align: center;
}

.log-level.emergency { background: rgba(245, 63, 63, 0.2); color: #f53f3f; border: 1px solid rgba(245, 63, 63, 0.3); }
.log-level.warning   { background: rgba(255, 125, 0, 0.2); color: #ff7d00; border: 1px solid rgba(255, 125, 0, 0.3); }
.log-level.notice    { background: rgba(0, 198, 255, 0.15); color: #00c6ff; border: 1px solid rgba(0, 198, 255, 0.3); }
.log-level.info      { background: rgba(54, 207, 167, 0.15); color: #36cfa7; border: 1px solid rgba(54, 207, 167, 0.3); }

.log-source {
  flex-shrink: 0;
  width: 70px;
  color: #7fb3d5;
  font-size: 11px;
}

.log-content {
  flex: 1;
  color: #a8c0d8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Consolas", monospace;
  font-size: 11px;
}

/* ================================================================
   全局弹窗（统一深色样式）
   ================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 10, 30, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

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

.modal-box {
  position: relative;
  width: 600px;
  max-width: 90vw;
  max-height: 80vh;
  background: linear-gradient(180deg, #0a1e3c 0%, #050d1f 100%);
  border: 1px solid rgba(0, 198, 255, 0.4);
  border-radius: 6px;
  box-shadow:
    0 0 40px rgba(0, 150, 255, 0.3),
    inset 0 0 30px rgba(0, 100, 200, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(-20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* 弹窗发光边角 */
.modal-box::before,
.modal-box::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid #00c6ff;
  pointer-events: none;
  z-index: 2;
}

.modal-box::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
  box-shadow: -3px -3px 10px rgba(0, 198, 255, 0.6);
}

.modal-box::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
  box-shadow: 3px 3px 10px rgba(0, 198, 255, 0.6);
}

.modal-header {
  flex-shrink: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(90deg, rgba(0, 150, 255, 0.2) 0%, rgba(0, 100, 200, 0.05) 70%, transparent 100%);
  border-bottom: 1px solid rgba(0, 180, 255, 0.2);
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: #e0f0ff;
  letter-spacing: 1px;
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7fb3d5;
  font-size: 14px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(245, 63, 63, 0.2);
  color: #f53f3f;
}

.modal-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  color: #c8d6e5;
  line-height: 1.7;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 180, 255, 0.3);
  border-radius: 3px;
}

/* 弹窗内详情表格样式 */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.detail-table th,
.detail-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 150, 255, 0.1);
  font-size: 13px;
}

.detail-table th {
  width: 120px;
  color: #6b8cae;
  font-weight: normal;
  background: rgba(0, 80, 160, 0.1);
}

.detail-table td {
  color: #e0f0ff;
  font-family: "Consolas", monospace;
}

.detail-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #00d4ff;
  margin: 16px 0 8px;
  padding-left: 8px;
  border-left: 3px solid #00c6ff;
}

.detail-text {
  font-size: 13px;
  color: #a8c0d8;
  line-height: 1.8;
  padding: 8px 12px;
  background: rgba(0, 80, 160, 0.08);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 弹窗内列表 */
.detail-list {
  padding: 8px 0;
}

.detail-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(0, 150, 255, 0.08);
  font-size: 13px;
}

.detail-list li:last-child { border-bottom: none; }

/* ================================================================
   数字滚动动画（数字变化过渡）
   ================================================================ */
.kpi-num,
.kpi-value {
  transition: color 0.3s ease;
}

/* ================================================================
   响应式兜底（仅保证 1920 以下不崩，不做移动端）
   ================================================================ */
@media (max-width: 1600px) {
  .dashboard-container {
    min-width: 1600px;
    min-height: 900px;
  }
  .header-title { font-size: 22px; }
  .kpi-num { font-size: 20px; }
}
