/* ===== 全局样式 ===== */
* {
  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;
  background: #0a0e27;
  color: #fff;
}

:root {
  --primary-color: #00d4ff;
  --secondary-color: #00ff88;
  --warning-color: #ffaa00;
  --danger-color: #ff4757;
  --purple-color: #a855f7;
  --bg-dark: #0a0e27;
  --bg-panel: rgba(10, 20, 50, 0.6);
  --bg-card: rgba(0, 150, 200, 0.08);
  --border-color: rgba(0, 212, 255, 0.3);
  --border-light: rgba(0, 212, 255, 0.15);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);
}

/* ===== 品牌元素 ===== */
/* 品牌水印 */
.brand-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 160px;
  font-weight: 900;
  letter-spacing: 20px;
  color: rgba(0, 212, 255, 0.03);
  pointer-events: none;
  z-index: 1;
  user-select: none;
  white-space: nowrap;
}

/* 品牌 Logo */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 20px;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 102, 255, 0.1));
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.brand-logo-icon {
  font-size: 22px;
  color: var(--primary-color);
  filter: drop-shadow(0 0 6px var(--primary-color));
  animation: rotate-brand 8s linear infinite;
}

@keyframes rotate-brand {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.brand-logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #fff, var(--primary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 面板品牌标签 */
.brand-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--primary-color);
  background: rgba(0, 212, 255, 0.12);
  border: 1px solid var(--border-light);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.brand-dot {
  color: var(--primary-color);
  font-size: 10px;
  margin-right: 2px;
}

/* 底部品牌栏 */
.footer-bar {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.footer-brand {
  color: var(--primary-color);
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
}

.footer-sep {
  color: var(--border-color);
}

/* ===== Dashboard 容器 ===== */
.dashboard {
  width: 100vw;
  height: 100vh;
  background: 
    radial-gradient(ellipse at top, rgba(0, 100, 150, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at bottom, rgba(0, 50, 100, 0.1) 0%, transparent 50%),
    linear-gradient(180deg, #0a0e27 0%, #0d1535 50%, #0a0e27 100%);
  display: flex;
  flex-direction: column;
  padding: 10px 15px 15px;
  position: relative;
  overflow: hidden;
}

/* 背景网格效果 */
.dashboard::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* ===== 顶部标题栏 ===== */
.top-header {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
}

.header-left, .header-right {
  flex: 1;
  display: flex;
  align-items: center;
}

.header-right {
  justify-content: flex-end;
}

.decoration-line {
  height: 2px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
  position: relative;
}

.decoration-line.left {
  background: linear-gradient(90deg, transparent, var(--primary-color));
}

.decoration-line.right {
  background: linear-gradient(90deg, var(--primary-color), transparent);
}

.decoration-line::before,
.decoration-line::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border: 2px solid var(--primary-color);
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.decoration-line.left::after {
  right: 0;
  border-left: none;
  border-bottom: none;
}

.decoration-line.right::before {
  left: 0;
  border-right: none;
  border-top: none;
}

.header-center {
  text-align: center;
  padding: 0 40px;
}

.main-title {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(180deg, #fff 0%, var(--primary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 4px;
  text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
  line-height: 1.2;
}

.title-icon {
  margin: 0 15px;
  font-size: 28px;
  -webkit-text-fill-color: initial;
  filter: drop-shadow(0 0 8px var(--primary-color));
}

.subtitle {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 6px;
  margin-top: 4px;
}

.datetime {
  font-size: 16px;
  color: var(--text-secondary);
  font-family: 'Consolas', monospace;
  margin-right: 20px;
  letter-spacing: 1px;
}

/* 语言切换按钮 */
.lang-switcher {
  display: flex;
  gap: 2px;
  margin-right: 15px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 3px;
  flex-shrink: 0;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}

.lang-btn:hover {
  color: var(--text-secondary);
}

.lang-btn.active {
  background: linear-gradient(135deg, var(--primary-color), #0066ff);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
}

/* ===== 核心指标卡片 ===== */
.metric-cards {
  display: flex;
  gap: 15px;
  margin: 10px 0;
  position: relative;
  z-index: 10;
}

.metric-card {
  flex: 1;
  background: linear-gradient(135deg, rgba(0, 80, 120, 0.2) 0%, rgba(0, 30, 60, 0.4) 100%);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-color);
  box-shadow: 0 0 15px var(--primary-color);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 212, 255, 0.2);
  border-color: var(--primary-color);
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-right: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.metric-info {
  flex: 1;
}

.metric-value {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  font-family: 'Consolas', 'DIN', monospace;
  line-height: 1;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.metric-unit {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 4px;
}

.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.metric-trend {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.metric-trend.up {
  color: var(--secondary-color);
  background: rgba(0, 255, 136, 0.1);
}

.metric-trend.down {
  color: var(--danger-color);
  background: rgba(255, 71, 87, 0.1);
}

.metric-trend.danger {
  color: var(--danger-color);
  background: rgba(255, 71, 87, 0.1);
  animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.alarm-card {
  animation: alarm-glow 2s infinite;
}

@keyframes alarm-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 71, 87, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 71, 87, 0.5); }
}

/* ===== 主体内容区 ===== */
.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 400px 1fr 400px;
  gap: 15px;
  min-height: 0;
  position: relative;
  z-index: 10;
}

.left-panel, .right-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 0;
}

/* 左侧面板各模块比例 */
.left-panel .panel-box:nth-child(1) { flex: 1.6; min-height: 200px; }  /* 车辆列表 */
.left-panel .panel-box:nth-child(2) { flex: 1;   min-height: 180px; }  /* 状态分布 */
.left-panel .panel-box:nth-child(3) { flex: 1.2; min-height: 220px; }  /* 油耗排名 */

/* 右侧面板各模块比例 */
.right-panel .panel-box:nth-child(1) { flex: 1;   min-height: 180px; }  /* 油耗趋势 */
.right-panel .panel-box:nth-child(2) { flex: 1.2; min-height: 200px; }  /* 告警信息 */
.right-panel .panel-box:nth-child(3) { flex: 1.6; min-height: 280px; }  /* 车辆详情 */

.center-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 0;
}

/* ===== 面板容器 ===== */
.panel-box {
  background: linear-gradient(135deg, rgba(0, 50, 80, 0.2) 0%, rgba(0, 20, 40, 0.4) 100%);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  backdrop-filter: blur(10px);
}

/* 四角装饰 */
.panel-box::before,
.panel-box::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--primary-color);
  z-index: 2;
}

.panel-box::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}

.panel-box::after {
  top: -1px;
  right: -1px;
  border-left: none;
  border-bottom: none;
}

.panel-box .corner-bl,
.panel-box .corner-br {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--primary-color);
  z-index: 2;
}

.panel-box .corner-bl {
  bottom: -1px;
  left: -1px;
  border-right: none;
  border-top: none;
}

.panel-box .corner-br {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-icon {
  font-size: 18px;
}

.panel-tabs {
  display: flex;
  gap: 2px;
}

.panel-tabs .tab {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.panel-tabs .tab:hover {
  color: var(--text-secondary);
}

.panel-tabs .tab.active {
  color: var(--primary-color);
  background: rgba(0, 212, 255, 0.15);
}

.panel-subinfo {
  font-size: 12px;
  color: var(--text-muted);
}

.panel-body {
  flex: 1;
  padding: 12px;
  min-height: 0;
  overflow: hidden;
}

.chart-container {
  width: 100%;
  height: 100%;
  min-height: 200px;
}

.chart-container.tall {
  min-height: 280px;
}

/* ===== 地图面板 ===== */
.map-panel {
  flex: 1.5;
}

.map-chart {
  min-height: 350px;
}

.map-controls {
  display: flex;
  gap: 15px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-item .dot.running { background: var(--secondary-color); box-shadow: 0 0 6px var(--secondary-color); }
.legend-item .dot.idle { background: var(--warning-color); box-shadow: 0 0 6px var(--warning-color); }
.legend-item .dot.stopped { background: #667788; box-shadow: 0 0 6px #667788; }
.legend-item .dot.fault { background: var(--danger-color); box-shadow: 0 0 6px var(--danger-color); }

/* ===== 车辆列表 ===== */
.vehicle-list {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
}

.vehicle-list::-webkit-scrollbar {
  width: 4px;
}

.vehicle-list::-webkit-scrollbar-track {
  background: rgba(0, 212, 255, 0.05);
  border-radius: 2px;
}

.vehicle-list::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.3);
  border-radius: 2px;
}

.vehicle-item {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
}

.vehicle-item:hover {
  background: rgba(0, 212, 255, 0.1);
}

.vehicle-item.active {
  background: rgba(0, 212, 255, 0.15);
  border-left: 2px solid var(--primary-color);
  padding-left: 6px;
}

.vehicle-item .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  justify-self: center;
}

.vehicle-item .status-dot.running {
  background: var(--secondary-color);
  box-shadow: 0 0 6px var(--secondary-color);
  animation: pulse-dot 2s infinite;
}

.vehicle-item .status-dot.idle {
  background: var(--warning-color);
  box-shadow: 0 0 6px var(--warning-color);
}

.vehicle-item .status-dot.stopped {
  background: #667788;
}

.vehicle-item .status-dot.fault {
  background: var(--danger-color);
  box-shadow: 0 0 6px var(--danger-color);
  animation: pulse-dot 1s infinite;
}

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

.vehicle-item .plate {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vehicle-item .type {
  font-size: 11px;
  color: var(--text-muted);
}

.vehicle-item .fuel {
  font-size: 12px;
  color: var(--primary-color);
  font-family: 'Consolas', monospace;
  font-weight: 600;
}

/* ===== 告警列表 ===== */
.alarm-stats-header {
  display: flex;
  gap: 10px;
}

.alarm-stat {
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Consolas', monospace;
}

.alarm-stat.danger {
  color: var(--danger-color);
  background: rgba(255, 71, 87, 0.15);
}

.alarm-stat.warning {
  color: var(--warning-color);
  background: rgba(255, 170, 0, 0.15);
}

.alarm-stat.info {
  color: var(--primary-color);
  background: rgba(0, 212, 255, 0.15);
}

.alarm-list {
  height: 100%;
  overflow-y: auto;
  padding-right: 5px;
}

.alarm-list::-webkit-scrollbar {
  width: 4px;
}

.alarm-list::-webkit-scrollbar-track {
  background: rgba(0, 212, 255, 0.05);
  border-radius: 2px;
}

.alarm-list::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.3);
  border-radius: 2px;
}

.alarm-item {
  padding: 10px;
  margin-bottom: 8px;
  background: rgba(0, 50, 80, 0.3);
  border-radius: 6px;
  border-left: 3px solid;
  cursor: pointer;
  transition: all 0.2s;
}

.alarm-item:hover {
  background: rgba(0, 80, 120, 0.3);
  transform: translateX(2px);
}

.alarm-item.danger {
  border-left-color: var(--danger-color);
}

.alarm-item.warning {
  border-left-color: var(--warning-color);
}

.alarm-item.info {
  border-left-color: var(--primary-color);
}

.alarm-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.alarm-title .plate {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.alarm-title .type {
  font-size: 12px;
  font-weight: 600;
}

.alarm-item.danger .alarm-title .type { color: var(--danger-color); }
.alarm-item.warning .alarm-title .type { color: var(--warning-color); }
.alarm-item.info .alarm-title .type { color: var(--primary-color); }

.alarm-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.alarm-time {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alarm-status {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
}

.alarm-status.active {
  background: rgba(255, 71, 87, 0.2);
  color: var(--danger-color);
}

.alarm-status.resolved {
  background: rgba(0, 255, 136, 0.2);
  color: var(--secondary-color);
}

/* ===== 车辆详情 ===== */
.vehicle-detail {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-plate {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
}

.detail-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.detail-status.running {
  background: rgba(0, 255, 136, 0.15);
  color: var(--secondary-color);
}

.detail-status.idle {
  background: rgba(255, 170, 0, 0.15);
  color: var(--warning-color);
}

.detail-status.stopped {
  background: rgba(102, 119, 136, 0.15);
  color: #667788;
}

.detail-status.fault {
  background: rgba(255, 71, 87, 0.15);
  color: var(--danger-color);
}

.detail-model {
  font-size: 14px;
  color: var(--text-secondary);
}

.detail-driver {
  font-size: 12px;
  color: var(--text-muted);
}

.detail-device {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'Consolas', monospace;
}

.device-icon {
  color: var(--primary-color);
  font-size: 11px;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detail-metric {
  background: rgba(0, 80, 120, 0.2);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.detail-metric::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
}

.dm-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
  font-family: 'Consolas', 'DIN', monospace;
  line-height: 1;
}

.dm-unit {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dm-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(0, 50, 80, 0.2);
  border-radius: 4px;
}

.info-label {
  font-size: 12px;
  color: var(--text-muted);
}

.info-value {
  font-size: 12px;
  color: #fff;
  font-weight: 600;
  font-family: 'Consolas', monospace;
}

.detail-location {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  background: rgba(0, 50, 80, 0.2);
  border-radius: 6px;
  border: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.loc-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ===== 响应式适配 ===== */
@media (max-width: 1600px) {
  .main-content {
    grid-template-columns: 350px 1fr 350px;
  }
  
  .main-title {
    font-size: 26px;
  }
  
  .metric-value {
    font-size: 26px;
  }
}

@media (max-width: 1400px) {
  .main-content {
    grid-template-columns: 320px 1fr 320px;
  }
  
  .main-title {
    font-size: 22px;
  }
  
  .metric-value {
    font-size: 22px;
  }
  
  .metric-card {
    padding: 10px 15px;
  }
  
  .metric-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}
