html, body {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow:hidden;
}

#title-panel {
  background-color: #222;
  color: #fff;
  padding: 10px 20px;
  font-size: 1.4rem;
}


#main-content {
  flex: 1;
  display: flex;
}

#map {
  flex: 3;
  height: 100%;
}

#fire-control-panel {
  position: absolute;
  bottom: 40px;                 
  left: 50%;                     
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 12px 18px;
  display: flex;
  gap: 20px;
  align-items: center;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 999;
}
#fire-control-panel select {
  font-size: 1rem;
  padding: 6px 10px;
}

#fire-control-panel input[type="range"] {
  width: 260px;
  height: 6px;
}

#slider-date-label {
  font-weight: bold;
  font-size: 1rem;
}

/* —— smoke mode —— */
/* ——  Legend —— */
.leaflet-control.legend {
  background: white;
  padding: 8px;
  font-size: 14px;
  line-height: 1.2;
  color: #333;
  border-radius: 5px;
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
}
.legend table {
  border-collapse: collapse;
  width: 100%;
}
.legend td, .legend th {
  padding: 4px;
  text-align: left;
  vertical-align: middle;
}
.legend .color-box {
  width: 18px;
  height: 18px;
  display: inline-block;
  margin-right: 6px;
  border: 1px solid #999;
}

/*info box*/
.info-box {
  position: absolute;
  z-index: 10000 !important;
  width: 500px;           
  height: 190px;           
  background-color: var(--aqi_color);
  border-radius: 10px;
  padding: 1em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: background .3s, height .3s;
  overflow: visible;
  color: #000;             
  font-family: Arial, sans-serif;
}

.info-box .info-placeholder {
  font-size: 1.2em;
}

.info-box .info-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4em;
}

.info-box .info-left .name-box {
  background: #fff;
  padding: 0.4em 0.6em;
  border-radius: 6px;
  font-size: 1.6em;
  font-weight: bold;
  color: #000;
}

.info-box .info-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2em;
}
.info-box .aqi-value {
  font-size: 3em;
  font-weight: bold;
}
.info-box .aqi-label {
  font-size: 1.6em;
}
.info-box .aqi-subtext {
  font-size: 1em;
}
.info-box.expanded {
  max-height: 200px;  
}

/* recommendation */
.info-box .rec-box {
  background: #fff;
  padding: 0.4em 0.6em;
  border-radius: 6px;
  font-size: 1.1em;
  line-height: 1.4;
  margin-top: 0.6em;
  width: calc(100% - 2em);
  color: #000;
}

/* control-btn */
.info-box .info-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5em;
  margin-top: 0.6em;
}
.info-box .btn-action {
  background: rgba(0,0,0,0.15);
  border: none;
  border-radius: 4px;
  padding: 0.4em 0.8em;
  font-size: 0.95em;
  cursor: pointer;
  color: #000;
}

/* fire box */
.info-box .fire-section {
  display: none;
  margin-top: 0.6em;
}
.info-box.expanded .fire-section {
  display: block;
}
.info-box .fire-box {
  background: #fff;
  padding: 0.6em;
  border-radius: 6px;
  font-size: 1em;
  color: #000;
}
.info-box .fire-box a {
  text-decoration: none;
  color: #000;
}

/*----wind mode----*/
.wind-arrow {
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-bottom-color: rgba(0,0,0,0.7);
  transform-origin: 50% 50%;
}

#main-content {
  flex: 1;              
  display: flex;       
}

#map {
  flex: 1;               
  height: 100%;         
}
/* —— Mode dropdown —— */
#mode-dropdown-container {
  position: absolute;
  top: 10px;
  right: 20px;
  z-index: 2000;
}

#main-mode-btn {
  padding: 6px 14px;
  font-size: 14px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.dropdown-menu {
  display: flex;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  width: 160px;
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  flex-direction: column;
  align-items: stretch;
  z-index: 1001;
}

.dropdown-item {
  display:block;
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid #eee;
  text-align: left;
  background-color: white;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background-color: #f1f1f1;
}
.submenu-container {
  position: relative;
}
/* 默认隐藏子菜单 */
.dropdown-submenu {
  display: none;
  position: absolute;
  top: 0;
  right: 100%;
  background: white;
  border: 1px solid #ccc;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  min-width: 140px;
  z-index: 1000;
}

/* hover 父容器时展开 */
.submenu-container:hover > .dropdown-submenu {
  display: block;
}
/* 保持二级项样式和一级一致 */
.dropdown-submenu .dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
}

#main-container {
  display: flex;
  height: 100vh; 
  width: 100%;
}

#map {
  flex: 1; 
  height: 100%;
}

#sidebar-content {
  width: 420px;
  height: 100%;  
  overflow-y: auto;
  background-color: rgba(255,255,255,0.96);
  box-shadow: -2px 0 10px rgba(0,0,0,0.2);
  padding: 16px;
  display: none;
}

#sidebar-content img {
  width: 100%;
  margin-bottom: 12px;
  border-radius: 6px;
}
#welcome-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5); /* 半透明黑背景 */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

#welcome-box {
  background: white;
  padding: 24px 30px;
  border-radius: 10px;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  font-family: sans-serif;
}

#welcome-box h2 {
  margin-top: 0;
  font-size: 24px;
}

#welcome-box p {
  font-size: 16px;
  margin-bottom: 12px;
}

/* 让模式按钮出现在标题栏下方 */
:root { --header-h: 56px; } /* 这行与你 index.html 里的高度保持一致 */

.mode-toolbar{
  position: fixed;
  top: calc(var(--header-h) + 8px); /* 标题栏高度 + 间距 */
  left: 12px;
  z-index: 900;                      /* 低于标题栏(1000)，高于地图 */
  display: flex;
  gap: 8px;
  padding: 6px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

/* 可选：按钮小优化 */
.mode-toolbar .mode-btn{
  padding: 6px 10px;
  border-radius: 8px;
}
.mode-toolbar .mode-btn.active{
  box-shadow: inset 0 0 0 2px #4f46e5;
}

/* 小屏适配：左右留白，居中一点 */
@media (max-width: 640px){
  .mode-toolbar{
    top: calc(var(--header-h) + 6px);
    left: 8px; right: 8px;
    justify-content: center;
  }
}


.wind-toolbar{
  background: rgba(255,255,255,.9);
  padding: 6px; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.wind-btn{
  border: 1px solid #ddd; background:#fff; margin-right:6px;
  width:28px; height:28px; border-radius:6px; cursor:pointer;
}
.wind-btn:hover{ background:#f3f3f3; }


/* ====== FIRMS 热点 Popup 样式 ====== */
.hotspot-popup {
  font: 13px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.hotspot-popup h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
}

.hotspot-popup .sub {
  color: #667;
  margin-bottom: 8px;
}

.hotspot-popup .kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 4px 10px;
  margin: 6px 0;
}

.hotspot-popup .k {
  color: #556;
  text-align: right;
}

.hotspot-popup .v {
  color: #111;
}

.hotspot-popup .muted {
  color: #6b7280;
}

.hotspot-popup .badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid transparent;
}

.badge-high {
  background: #e8f5e9;
  border-color: #2e7d32;
  color: #2e7d32;
}

.badge-nom {
  background: #fff3e0;
  border-color: #ff8f00;
  color: #ff8f00;
}

.badge-low {
  background: #fdecea;
  border-color: #c62828;
  color: #c62828;
}

.badge-unk {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
}

.hotspot-popup .foot {
  margin-top: 8px;
  color: #6b7280;
}

/* ====== Fire Perimeter Popup 样式 ====== */
.perim-popup {
  font: 13px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.perim-popup h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
}

.perim-popup .kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 4px 10px;
  margin: 6px 0;
}

.perim-popup .k {
  color: #556;
  text-align: right;
}

.perim-popup .v {
  color: #111;
}

.perim-popup .note {
  margin-top: 8px;
  color: #6b7280;
}
/* ====== CAL Fire Popup style ====== */
.calfire-popup { font: 13px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Arial; }
.calfire-popup h4 { margin: 0 0 6px 0; font-size: 14px; }
.calfire-popup .kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; margin: 6px 0; }
.calfire-popup .k { color: #556; text-align: right; }
.calfire-popup .v { color: #111; }
.calfire-popup .note { margin-top: 8px; color: #6b7280; }

/* ===== Legend for fire mode ===== */
.legend.fire-legend{
  background: rgba(255,255,255,.96);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  padding: 10px 12px;
  font: 13px/1.35 system-ui,-apple-system,Segoe UI,Roboto,Arial;
  color: #111;
  max-width: 260px;
}
.legend.fire-legend .legend-title{
  font-weight: 600;
  margin-bottom: 6px;
}
.legend.fire-legend .legend-row{
  display: flex; align-items: center; gap: 8px;
  margin: 6px 0;
}
.legend.fire-legend .legend-row em{
  color:#6b7280; font-style: normal;
}
.legend.fire-legend .swatch{
  display:inline-block; 
  flex: 0 0 auto; 
  box-sizing: content-box;
}

/* line（outer） */
.legend.fire-legend .swatch.line{
  height: 0; 
  border-top: 3px solid #999; 
  width: 24px; 
  border-radius: 0;
}

/* point */
.legend.fire-legend .swatch.dot{
  width: 12px; 
  aspect-ratio: 1/1; 
  border-radius: 50%;
  border: 1.5px solid transparent;
}

/* Color mapping (matches the color of your layer) */
.legend.fire-legend .orange{ border-color:#ff6d00; }
.legend.fire-legend .green { border-color:#2e7d32; }
.legend.fire-legend .red   { background:#e53935; border-color:#b71c1c; }
.legend.fire-legend .brown { background:#8d6e63; border-color:#6d4c41; }

/* description text */
.legend.fire-legend .legend-row em{ color:#6b7280; font-style: normal; }
/* --- stack controls in the corners so they never overlap --- */
#map .leaflet-control-container .leaflet-bottom.leaflet-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;               /* 间距：右下角控件之间 */
  padding-right: 12px;
  padding-bottom: 12px;
}

#map .leaflet-control-container .leaflet-bottom.leaflet-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;               /* 间距：左下角控件之间 */
  padding-left: 12px;
  padding-bottom: 12px;
}

/* 提高层级，确保可见 */
.panel.legend.fire-legend { z-index: 1200; }
.panel.legend.firms-prog-legend { z-index: 1190; }

/* （可选）如果 attribution 太靠近左下角，压到最下面 */
#map .leaflet-control-attribution { order: 99; z-index: 900; }


.mode-toolbar{
  position:absolute; top:10px; left:10px; z-index:1000;
  background:#fff; padding:6px 8px; border-radius:6px;
  box-shadow:0 1px 4px rgba(0,0,0,.2);
  font:14px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  pointer-events:auto;
}
.mode-toolbar .mode-btn{
  margin:0 6px 0 0; padding:4px 10px; cursor:pointer;
  border:1px solid #ccc; border-radius:4px; background:#f7f7f7;
  }
.mode-toolbar .mode-btn.active{
  background:#2b7; border-color:#2b7; color:#fff;
  }
  /* 通用小面板 */
.panel {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(2px);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  font-size: 13px;
  color: #222;
}
.panel .panel-title { font-weight: 700; margin-bottom: 8px; }

.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; line-height: 1.2; }
.kv .k { color:#666; }
.kv .v { color:#111; }
.note, .sub { color:#666; font-size:12px; margin-top:6px; }
.muted { color:#777; font-size:12px; }

/* 徽章 */
.badge { display:inline-block; padding:2px 6px; border-radius:999px; font-size:12px; line-height:1; border:1px solid rgba(0,0,0,0.08); }
.badge-high{ background:#e8f5e9; color:#1b5e20;}
.badge-mid{  background:#fff8e1; color:#e65100;}
.badge-low{  background:#ffebee; color:#b71c1c;}
.badge-unk{  background:#eceff1; color:#37474f;}

/* 侧边 Top5 列表 */
.fire-list { width: 280px; max-height: 58vh; overflow:auto; }
.fire-list .list { display: grid; gap: 8px; }
.fire-item { border:1px solid rgba(0,0,0,0.08); border-radius:12px; padding:8px 10px; cursor:pointer; background:#fff; }
.fire-item:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.12); }
.fire-item .title { font-weight:600; margin-bottom:6px; }
.fire-item .meta  { display:flex; gap:6px; }
.chip { background:#f2f2f2; border-radius:999px; padding:2px 8px; font-size:12px; }

/* 筛选器 */
.fire-filters { width: 220px; }
.fire-filters .row { display:flex; align-items:center; justify-content:space-between; margin:6px 0; gap:10px; }
.fire-filters select { width: 120px; padding:4px 6px; border-radius:8px; border:1px solid #ddd; }

/* Legend 改造 */
.legend .legend-row { display:flex; align-items:center; gap:8px; margin:6px 0; }
.legend .swatch { display:inline-block; }
.legend .swatch.line { width:30px; height:0; border-top:3px solid var(--c,#2e7d32); border-radius: 2px; }
.legend .swatch.dot.red { width:10px; height:10px; border-radius:50%; background:#e53935; border:1px solid #fff; box-shadow: 0 0 0 1px #b71c1c; }
.legend .swatch.icon { width:18px; text-align:center; }

.legend .gradient { display:flex; align-items:center; gap:8px; margin:8px 0 4px; }
.legend .gradient .bar {
  width: 140px; height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, #e53935 0%, #ff6d00 50%, #2e7d32 100%);
  border:1px solid rgba(0,0,0,0.08);
}

/* CAL FIRE emoji 图标更清晰 */
.calfire-icon { pointer-events: auto; }
.calfire-pin { font-size:18px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35)); }
.leaflet-pane.calfirePane,
.leaflet-pane.calfirePane .leaflet-marker-icon,
.calfire-icon,
.calfire-pin {
  pointer-events: auto !important;
}
.firms-prog-legend .swatch{
  display:inline-block;width:14px;height:14px;margin-right:8px;border-radius:4px;
}

/*NDVI Panel*/
.ndvi-panel img { border-radius: 8px; box-shadow: 0 1px 2px rgb(0 0 0 / 6%); }



