/* ==========================================================================
   羚牛氢能 - 车辆网络
   Design Philosophy: Apple Restrained Minimalist (极致克制 · 纯净无痕)
   ========================================================================== */

/* --------------------------------------------------------------------------
   RESTRICTED DUAL-THEME COLOR SYSTEM (纯黑 / 纯白)
   -------------------------------------------------------------------------- */

/* 1. 纯黑/深色模式 (Minimal Dark Charcoal) */
.theme-dark {
  --bg-app: #0A0B0E;
  --bg-radial: radial-gradient(circle at 50% 20%, #12141C 0%, #0A0B0E 100%);
  --glass-bg: rgba(20, 22, 28, 0.68);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover-border: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  --accent-primary: #007143; /* 羚牛品牌绿 */
  --accent-quantity: #34D399; /* 品牌绿的深色主题高对比版本 */
  --accent-cyan: #38BDF8;    /* 柔和冰蓝 */
  --accent-mint: #10B981;
  --accent-blue: #3B82F6;
  --text-main: #F1F5F9;
  --text-muted: #94A3B8;
  --text-sub: #64748B;
  --pill-bg: rgba(255, 255, 255, 0.06);
  --segmented-bg: rgba(255, 255, 255, 0.05);
  --map-style: amap://styles/darkblue;
}

/* 2. 纯白/浅色模式 (Apple Studio Pure White) */
.theme-white {
  --bg-app: #F5F5F7;
  --bg-radial: radial-gradient(circle at 50% 20%, #FFFFFF 0%, #F5F5F7 100%);
  --glass-bg: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-hover-border: rgba(0, 0, 0, 0.18);
  --glass-shadow: 0 12px 32px rgba(0, 0, 0, 0.05);
  --accent-primary: #007143;
  --accent-quantity: #007143;
  --accent-cyan: #0284C7;
  --accent-mint: #059669;
  --accent-blue: #2563EB;
  --text-main: #1D1D1F;
  --text-muted: #6E6E73;
  --text-sub: #86868B;
  --pill-bg: rgba(0, 0, 0, 0.04);
  --segmented-bg: rgba(0, 0, 0, 0.04);
  --map-style: amap://styles/light;
}

/* Elegant Subscript Typographic Tuning for H₂ */
sub, .h2-sub {
  font-size: 0.7em;
  line-height: 0;
  vertical-align: -0.22em;
  font-family: 'JetBrains Mono', -apple-system, sans-serif;
  font-weight: 700;
  margin-left: 0.5px;
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   GLOBAL RESET & RESTRAINED GLASS WRAPPER
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-app);
  background-image: var(--bg-radial);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

.liquid-cockpit-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 12px 16px;
  gap: 12px;
}

/* Restrained Apple Glass Panel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  transition: border-color 0.25s ease, background 0.25s ease;
}

.glass-panel:hover {
  border-color: var(--glass-hover-border);
}

/* --------------------------------------------------------------------------
   1. NAVIGATION HEADER (PROMINENT LOGO)
   -------------------------------------------------------------------------- */
.liquid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 18px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-block {
  display: flex;
  align-items: center;
}

/* Enlarged Lingniu Logo */
.brand-logo-svg {
  height: 34px;
  width: auto;
  display: block;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.theme-dark .brand-block {
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
}

.brand-logo-svg:hover {
  transform: scale(1.03);
}

.brand-divider {
  width: 1px;
  height: 22px;
  background: var(--glass-border);
}

.cockpit-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cockpit-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.de-tag {
  font-size: 9px;
  padding: 1px 6px;
  background: var(--pill-bg);
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Header KPI Capsules */
.header-kpi-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kpi-glass-capsule {
  display: flex;
  flex-direction: column;
  padding: 4px 14px;
  background: var(--pill-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
}

.capsule-lbl {
  font-size: 9px;
  color: var(--text-muted);
}

.capsule-val {
  font-family: 'JetBrains Mono', -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.15;
}

.capsule-val small {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
}

.trend-pill {
  font-size: 9px;
  font-style: normal;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-left: 2px;
}

/* Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.glass-segmented-control, .theme-switcher-bw {
  display: flex;
  background: var(--segmented-bg);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
}

.segment-btn, .bw-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.segment-btn.active, .bw-btn.active {
  background: var(--glass-bg);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.bw-svg {
  stroke: currentColor;
}

.time-widget {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   2. MAIN BODY (CENTER MAP CANVAS + RIGHT SIDEBAR)
   -------------------------------------------------------------------------- */
.cockpit-main-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

/* SPATIAL MAP CONTAINER */
.map-spatial-container {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-top-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  pointer-events: none;
}

.map-top-bar * { pointer-events: auto; }

.status-glass-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-main);
}

.pulse-ring {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.map-legend-glass {
  display: flex;
  gap: 10px;
  padding: 4px 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  font-size: 10px;
  color: var(--text-muted);
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.dot-primary { background: var(--accent-cyan); }
.dot-mid { background: var(--accent-blue); }
.dot-low { background: var(--text-sub); }

.amap-canvas-box {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
}

#amapContainer {
  width: 100%;
  height: 100%;
}

.map-action-controls {
  position: absolute;
  bottom: 24px;
  right: 14px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.glass-btn {
  padding: 4px 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.glass-btn:hover {
  border-color: var(--text-muted);
}

.map-bottom-info {
  height: 24px;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 10px;
  color: var(--text-muted);
  border-top: 1px solid var(--glass-border);
}

/* RIGHT SIDEBAR */
.sidebar-operations {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.sidebar-card {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  overflow: hidden;
}

.flex-fill-auto { flex: 1; min-height: 0; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--glass-border);
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.panel-tag {
  font-size: 9px;
  padding: 1px 5px;
  background: var(--pill-bg);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Card 1: Clean Status Cells */
.status-glass-grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.glass-cell {
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
}

.cell-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.cell-num small {
  font-size: 9px;
  color: var(--text-muted);
}

.cell-label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}

.status-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.dot-mint { background: var(--accent-mint); }
.dot-blue { background: var(--accent-blue); }
.dot-sub { background: var(--text-sub); }

.liquid-progress-bar {
  display: flex;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.seg { height: 100%; }
.seg-running { background: var(--accent-mint); }
.seg-stopped { background: var(--accent-blue); }
.seg-offline { background: var(--text-sub); }

/* Card 2: TOP Ranking List */
.glass-tab-control {
  display: flex;
  gap: 2px;
  background: var(--segmented-bg);
  padding: 1px;
  border-radius: 6px;
}

.gtab {
  padding: 2px 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  font-size: 9px;
  color: var(--text-muted);
  cursor: pointer;
}

.gtab.active {
  background: var(--glass-bg);
  color: var(--text-main);
  font-weight: 600;
}

.liquid-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  flex: 1;
}

.rank-glass-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--glass-border);
  transition: all 0.15s ease;
  cursor: pointer;
}

.rank-glass-row:hover {
  background: var(--pill-bg);
  border-color: var(--glass-hover-border);
}

.r-badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 9.5px;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

/* Scoped Theme Ranking Badge Colors for High Contrast in Both Modes */
/* 1. Dark Mode Ranking Badges */
.theme-dark .r-badge.r-top1 { background: #38BDF8; color: #0A0B0E; font-weight: 800; }
.theme-dark .r-badge.r-top2 { background: rgba(56, 189, 248, 0.2); color: #38BDF8; border: 1px solid rgba(56, 189, 248, 0.3); }
.theme-dark .r-badge.r-top3 { background: rgba(255, 255, 255, 0.1); color: #CBD5E1; }
.theme-dark .r-badge { background: rgba(255, 255, 255, 0.06); color: #64748B; }

/* 2. Light Mode Ranking Badges (Clear High-Contrast Blue/Green/Dark Gray) */
.theme-white .r-badge.r-top1 { background: #007143; color: #FFFFFF; font-weight: 800; }
.theme-white .r-badge.r-top2 { background: #0284C7; color: #FFFFFF; font-weight: 700; }
.theme-white .r-badge.r-top3 { background: rgba(0, 0, 0, 0.08); color: #1D1D1F; font-weight: 700; }
.theme-white .r-badge { background: rgba(0, 0, 0, 0.04); color: #86868B; }

.r-name {
  font-weight: 500;
  color: var(--text-main);
  flex: 1;
}

.r-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-main);
}

/* Custom Scrollbars */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }

/* AMAP MAP PROVINCE BUOYS */
.amap-logo, .amap-copyright {
  opacity: 0.2 !important;
  filter: invert(0.9) hue-rotate(180deg) !important;
}

.province-info-badge-wrap {
  position: relative;
  z-index: 10;
}

.map-info-window {
  min-width: 190px;
  max-width: 300px;
  padding: 11px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-bg);
  color: var(--text-main);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(18px);
  font: 12px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.map-info-window strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.province-info-badge-wrap:hover {
  z-index: 999 !important;
}

.province-info-card {
  display: inline-flex;
  flex-direction: column;
  padding: 3px 8px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s ease;
}

.province-info-card.is-vehicle-point {
  border-radius: 10px;
  border-color: rgba(2, 132, 199, 0.34);
  box-shadow: 0 5px 16px rgba(2, 132, 199, 0.18);
}

.province-info-card.is-vehicle-point.is-online .p-dot { background: #00a86b; }
.province-info-card.is-vehicle-point.is-offline .p-dot { background: #8e8e93; }

.province-info-badge-wrap:hover .province-info-card {
  transform: scale(1.15);
  border-color: var(--accent-cyan) !important;
}

.p-head {
  display: flex;
  align-items: center;
  gap: 4px;
}

.p-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.p-name {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-main);
}

.p-total {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-quantity);
  margin-left: 2px;
}

.p-sub {
  font-size: 8px;
  color: var(--text-sub);
  margin-top: 1px;
}

/* --------------------------------------------------------------------------
   MOBILE / NARROW VIEWPORT
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .liquid-cockpit-wrapper {
    width: 100%;
    height: auto;
    min-height: 100dvh;
    padding: 8px;
    gap: 8px;
  }

  .liquid-header {
    height: auto;
    min-height: 0;
    padding: 10px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-left {
    width: 100%;
    min-width: 0;
    gap: 10px;
  }

  .brand-block {
    flex: 0 1 150px;
    min-width: 118px;
  }

  .brand-logo-svg {
    width: 100%;
    max-width: 150px;
    height: auto;
  }

  .brand-divider {
    flex: 0 0 1px;
  }

  .cockpit-title-wrap {
    min-width: 0;
    flex: 1;
    justify-content: flex-end;
  }

  .cockpit-title {
    flex: 0 0 auto;
    font-size: 15px;
    white-space: nowrap;
    word-break: keep-all;
  }

  .de-tag {
    display: none;
  }

  .header-kpi-group {
    order: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }

  .kpi-glass-capsule {
    min-width: 0;
    padding: 5px 7px;
  }

  .capsule-lbl {
    overflow: hidden;
    font-size: 8px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .capsule-val {
    font-size: 12px;
    white-space: nowrap;
  }

  .header-controls {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  .segment-btn,
  .bw-btn {
    padding: 4px 8px;
    font-size: 10px;
  }

  .time-widget {
    display: none;
  }

  .cockpit-main-grid {
    grid-template-columns: minmax(0, 1fr);
    flex: none;
    min-height: 0;
    gap: 8px;
  }

  .map-spatial-container {
    height: 520px;
    min-height: 520px;
  }

  .map-top-bar {
    top: 8px;
    left: 8px;
    right: 8px;
  }

  .status-glass-pill {
    min-width: 0;
    max-width: 100%;
    padding: 4px 8px;
  }

  #mapStatusText {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .map-legend-glass {
    display: none;
  }

  .map-action-controls {
    right: 8px;
    bottom: 30px;
    gap: 4px;
  }

  .glass-btn {
    padding: 5px 7px;
    font-size: 9px;
  }

  .map-bottom-info {
    justify-content: flex-start;
    overflow: hidden;
  }

  .map-bottom-info span:not(:last-child) {
    display: none;
  }

  .sidebar-operations {
    min-height: auto;
  }

  .sidebar-card {
    overflow: visible;
  }

  .liquid-ranking-list {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 390px) {
  .brand-block {
    flex-basis: 138px;
  }

  .brand-logo-svg {
    max-width: 138px;
  }

  .theme-switcher-bw .bw-btn span {
    display: none;
  }
}
