/* ============================================================================
 * 空天地一体化应急指挥中心 - 主题样式
 * ============================================================================
 * 设计风格：深色科技风（指挥中心）
 * 包含：灾种 Tab 栏、状态环、灾种主题色、动画、灾种舞台容器
 * ============================================================================ */

/* ==================== 灾种主题色变量 ==================== */
:root {
  /* 灾种主题色 */
  --disaster-urban-waterlogging: #00bcd4;   /* 青蓝 */
  --disaster-forest-fire:        #ff5722;   /* 橙红 */
  --disaster-freezing:           #03a9f4;   /* 冰蓝 */
  --disaster-rainstorm:          #673ab7;   /* 紫 */
  --disaster-typhoon:            #607d8b;   /* 灰 */
  --disaster-building-fire:      #f44336;   /* 红色 */

  /* 状态色 */
  --status-safe:   #1cbf6f;
  --status-warning: #e0b332;
  --status-danger:  #f44336;
  --status-extreme: #ff1744;
}

/* 当前激活灾种主题色（默认渍涝） */
#commandCenter {
  --theme-color: var(--disaster-urban-waterlogging);
  --theme-color-rgb: 0, 188, 212;
}

#commandCenter[data-active-disaster="urban_waterlogging"] {
  --theme-color: var(--disaster-urban-waterlogging);
  --theme-color-rgb: 0, 188, 212;
}
#commandCenter[data-active-disaster="forest_fire"] {
  --theme-color: var(--disaster-forest-fire);
  --theme-color-rgb: 255, 87, 34;
}
#commandCenter[data-active-disaster="freezing"] {
  --theme-color: var(--disaster-freezing);
  --theme-color-rgb: 3, 169, 244;
}
#commandCenter[data-active-disaster="rainstorm"] {
  --theme-color: var(--disaster-rainstorm);
  --theme-color-rgb: 103, 57, 183;
}
#commandCenter[data-active-disaster="typhoon"] {
  --theme-color: var(--disaster-typhoon);
  --theme-color-rgb: 96, 125, 139;
}
#commandCenter[data-active-disaster="building_fire"] {
  --theme-color: var(--disaster-building-fire);
  --theme-color-rgb: 244, 67, 54;
}

/* ==================== 顶部指挥栏 ==================== */
.command-topbar {
  background: linear-gradient(180deg, rgba(7, 17, 31, 0.95) 0%, rgba(13, 26, 45, 0.92) 100%);
  border-bottom: 2px solid rgba(var(--theme-color-rgb), 0.3);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(var(--theme-color-rgb), 0.15);
  transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

.command-topbar .brand-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(var(--theme-color-rgb), 0.5));
  transition: filter 0.5s ease;
}

.command-topbar h1 {
  background: linear-gradient(90deg, #ecf5ff 0%, rgba(var(--theme-color-rgb), 0.85) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: background 0.5s ease;
}

.live-pulse {
  background: rgba(28, 191, 111, 0.15) !important;
  color: var(--status-safe) !important;
  border: 1px solid rgba(28, 191, 111, 0.3);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(28, 191, 111, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(28, 191, 111, 0); }
}

/* ==================== 顶部状态环 ==================== */
.status-pills {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(18, 35, 60, 0.6);
  border: 1px solid rgba(101, 152, 223, 0.18);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.status-pill:hover {
  background: rgba(31, 67, 111, 0.7);
  border-color: rgba(var(--theme-color-rgb), 0.4);
  transform: translateY(-1px);
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-safe);
  box-shadow: 0 0 8px currentColor;
}

.status-pill.level-warning .dot { background: var(--status-warning); color: var(--status-warning); }
.status-pill.level-danger  .dot { background: var(--status-danger);  color: var(--status-danger);  animation: blink 1s infinite; }
.status-pill.level-extreme .dot { background: var(--status-extreme); color: var(--status-extreme); animation: blink 0.6s infinite; }

.status-pill .name {
  color: var(--text, #ecf5ff);
  font-weight: 600;
}

.status-pill .level {
  color: var(--muted, #90a8ca);
  font-size: 10px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* ==================== 灾种 Tab 栏 ==================== */
.disaster-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 24px;
  background: linear-gradient(180deg, rgba(10, 22, 40, 0.95) 0%, rgba(7, 17, 31, 0.95) 100%);
  border-bottom: 1px solid rgba(101, 152, 223, 0.14);
  overflow-x: auto;
  scrollbar-width: thin;
}

.disaster-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 20px;
  min-width: 110px;
  border-radius: 12px;
  background: rgba(18, 35, 60, 0.5);
  border: 1px solid rgba(101, 152, 223, 0.18);
  color: var(--muted, #90a8ca);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.disaster-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(var(--theme-color-rgb), 0.8);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.disaster-tab:hover {
  background: rgba(31, 67, 111, 0.7);
  color: #dff4ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.disaster-tab.active {
  background: linear-gradient(180deg, rgba(var(--theme-color-rgb), 0.25) 0%, rgba(var(--theme-color-rgb), 0.05) 100%);
  border-color: rgba(var(--theme-color-rgb), 0.6);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(var(--theme-color-rgb), 0.25);
}

.disaster-tab.active::before {
  transform: scaleX(1);
}

.disaster-tab .tab-icon {
  font-size: 22px;
  line-height: 1;
}

.disaster-tab .tab-name {
  font-weight: 700;
  font-size: 13px;
}

.disaster-tab .tab-loc {
  font-size: 10px;
  opacity: 0.7;
}

/* ==================== 灾种舞台容器 ==================== */
.disaster-stage-wrap {
  position: relative;
  width: 100%;
  min-height: 520px;
}

.disaster-stage {
  display: none;
  animation: fade-in 0.35s ease;
}

.disaster-stage.active {
  display: block;
}

/* 真实地图宿主 */
.disaster-map-host {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.disaster-map-host.hidden {
  display: none !important;
}

.disaster-map-host .stage-toolbar-stack {
  min-height: 36px;
}

.disaster-map-host .disaster-stage {
  animation: none;
}

.disaster-map {
  width: 100%;
  height: 520px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(var(--theme-color-rgb), 0.28);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), 0 12px 32px rgba(0, 0, 0, 0.28);
  background: #0b1524;
  z-index: 1;
}

.disaster-map-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 500;
  pointer-events: none;
  font-size: 11px;
  color: rgba(220, 235, 255, 0.75);
  background: rgba(6, 14, 26, 0.72);
  border: 1px solid rgba(120, 170, 230, 0.25);
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.disaster-map-status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 600;
  pointer-events: none;
  font-size: 13px;
  color: #e8f3ff;
  background: rgba(8, 18, 34, 0.88);
  border: 1px solid rgba(120, 180, 255, 0.35);
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.disaster-map-status.error {
  border-color: rgba(255, 120, 100, 0.55);
  color: #ffd0c8;
}

.disaster-map-host {
  position: relative;
}

/* Leaflet 标注气泡 */
.disaster-map-marker {
  background: transparent !important;
  border: none !important;
}

.dm-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-6px);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
}

.dm-emoji {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: radial-gradient(circle at 35% 30%, var(--f), var(--c));
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 12px rgba(0, 200, 255, 0.45);
}

.dm-label {
  margin-top: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  white-space: nowrap;
  color: #f3f8ff;
  background: rgba(8, 18, 32, 0.88);
  border: 1px solid rgba(127, 219, 255, 0.45);
}

.leaflet-container {
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #0b1524;
}

.leaflet-control-layers,
.leaflet-bar a {
  background: rgba(12, 24, 42, 0.92) !important;
  color: #d7e7ff !important;
  border-color: rgba(110, 160, 220, 0.35) !important;
}

.leaflet-control-layers-expanded {
  color: #d7e7ff !important;
}

.leaflet-popup-content-wrapper {
  background: rgba(10, 22, 40, 0.95);
  color: #e8f2ff;
  border-radius: 10px;
  border: 1px solid rgba(120, 170, 230, 0.35);
}

.leaflet-popup-tip {
  background: rgba(10, 22, 40, 0.95);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==================== 灾种画布 ==================== */
.stage-canvas {
  position: relative;
  width: 100%;
  height: 480px;
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(ellipse at center,
                              rgba(var(--theme-color-rgb), 0.08) 0%,
                              rgba(7, 17, 31, 0.95) 70%);
  border: 1px solid rgba(var(--theme-color-rgb), 0.2);
  box-shadow: inset 0 0 60px rgba(var(--theme-color-rgb), 0.04);
  transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

.stage-canvas canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ==================== 灾种工具栏 ==================== */
.stage-toolbar {
  display: flex;
  gap: 10px;
  padding: 8px 0 12px;
  flex-wrap: wrap;
}

/* ==================== 预警列表 ==================== */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.alert-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(18, 35, 60, 0.6);
  border-left: 3px solid var(--status-warning);
  font-size: 12px;
  color: #dff4ff;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: slide-in 0.3s ease;
}

.alert-item.level-warning { border-left-color: var(--status-warning); }
.alert-item.level-danger  { border-left-color: var(--status-danger); background: rgba(244, 67, 54, 0.08); }
.alert-item.level-extreme {
  border-left-color: var(--status-extreme);
  background: rgba(255, 23, 68, 0.12);
  animation: pulse-bg 1.4s ease-in-out infinite;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-bg {
  0%, 100% { background: rgba(255, 23, 68, 0.12); }
  50%      { background: rgba(255, 23, 68, 0.22); }
}

.alert-item .alert-title {
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alert-item .alert-time {
  font-size: 10px;
  color: var(--muted, #90a8ca);
}

.alert-item .alert-body {
  font-size: 11px;
  color: rgba(223, 244, 255, 0.85);
  line-height: 1.5;
}

.alert-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted, #90a8ca);
  font-size: 12px;
}

/* ==================== 指挥建议卡片 ==================== */
.command-advice-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.advice-section {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(18, 35, 60, 0.55);
  border: 1px solid rgba(var(--theme-color-rgb), 0.25);
}

.advice-section .advice-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(var(--theme-color-rgb), 1);
  margin-bottom: 6px;
}

.advice-section .advice-list {
  margin: 0;
  padding-left: 18px;
  font-size: 11px;
  color: rgba(223, 244, 255, 0.85);
  line-height: 1.7;
}

.advice-section .advice-list li {
  margin-bottom: 2px;
}

.advice-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted, #90a8ca);
  font-size: 12px;
}

/* ==================== 建筑火灾楼层切换显隐 ==================== */
#commandCenter[data-active-disaster="building_fire"] #floorSwitcher {
  display: inline-flex;
}

#commandCenter:not([data-active-disaster="building_fire"]) #floorSwitcher {
  display: none;
}

/* ==================== 通用：滚动条美化 ==================== */
.alert-list::-webkit-scrollbar,
.disaster-tabs::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.alert-list::-webkit-scrollbar-thumb,
.disaster-tabs::-webkit-scrollbar-thumb {
  background: rgba(var(--theme-color-rgb), 0.4);
  border-radius: 3px;
}

/* ==================== 底部机器狗实时视野 ==================== */
.robot-vision-dock {
  margin-top: 12px;
  margin-bottom: 8px;
  padding-bottom: 14px;
}

.robot-vision-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.robot-vision-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.robot-vision-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(var(--theme-color-rgb), 0.35);
  background: rgba(var(--theme-color-rgb), 0.12);
  color: #cfe9ff;
}

.robot-vision-status.is-online {
  border-color: rgba(46, 210, 138, 0.55);
  background: rgba(46, 210, 138, 0.15);
  color: #7dffc0;
}

.robot-vision-status.is-offline {
  border-color: rgba(255, 117, 117, 0.45);
  background: rgba(255, 117, 117, 0.12);
  color: #ffb0b0;
}

.robot-vision-host {
  font-size: 12px;
  color: var(--muted, #90a8ca);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.robot-vision-cams {
  display: inline-flex;
  gap: 6px;
}

.robot-cam-btn,
.robot-vision-reconnect {
  background: rgba(18, 35, 60, 0.9);
  color: #dce9ff;
  border: 1px solid rgba(122, 168, 220, 0.35);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
  cursor: pointer;
}

.robot-cam-btn.active {
  background: linear-gradient(90deg, rgba(var(--theme-color-rgb), 0.85), rgba(57, 192, 255, 0.75));
  border-color: transparent;
  color: #fff;
}

.robot-vision-reconnect:hover,
.robot-cam-btn:hover {
  filter: brightness(1.08);
}

.robot-vision-frame-wrap {
  position: relative;
  margin-top: 10px;
  width: 100%;
  min-height: 280px;
  max-height: 420px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(122, 168, 220, 0.28);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(var(--theme-color-rgb), 0.12), transparent 55%),
    linear-gradient(180deg, #0a1628, #07101c);
}

.robot-vision-frame {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 420px;
  min-height: 280px;
  object-fit: contain;
  background: #050b14;
}

.robot-vision-frame.is-hidden {
  opacity: 0;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.robot-vision-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: #9eb6d4;
  font-size: 14px;
  letter-spacing: 0.3px;
  pointer-events: none;
}

.robot-vision-placeholder.is-hidden {
  display: none;
}

@media (max-width: 900px) {
  .robot-vision-frame-wrap,
  .robot-vision-frame {
    min-height: 200px;
    max-height: 300px;
  }
}

/* ==================== 响应式 ==================== */
@media (max-width: 1280px) {
  .status-pills { display: none; }
}
