/* ========== Page layout ========== */
body.page-template-page-planner { --planner-sidebar: clamp(380px, 32vw, 560px); }
body.page-template-page-planner .container,
body.page-template-page-planner #wrapper,
body.page-template-page-planner .inner-wrapper,
body.page-template-page-planner .site-main{
  max-width:100% !important; width:100% !important; margin:0 !important; padding:0 !important;
}

/* 兩欄：地圖 / 右欄（桌機用 Grid，手機直排） */
body.page-template-page-planner #planner-app{
  display:flex; min-height:100vh; height:auto !important; position:static !important;
}
@media (min-width:1200px){
  body.page-template-page-planner #planner-app{
    display:grid !important;
    grid-template-columns: minmax(0,1fr) var(--planner-sidebar) !important;
    gap:12px;
  }
}

/* 左：地圖 */
body.page-template-page-planner #map{
  flex:1 1 auto; min-height:100vh; min-width:0 !important;
}

/* 右：側欄 */
body.page-template-page-planner #planner-sidebar,
body.page-template-page-planner #sidebar{
  position:relative; flex:0 0 var(--planner-sidebar); width:var(--planner-sidebar);
  max-width:var(--planner-sidebar); min-width:0 !important;
  overflow:visible; min-height:70vh; padding:10px; border-left:2px solid #ccc; background:#fafafa;
}
/* 基準：右欄寬用 clamp，自然跟著螢幕變化 */
body.page-template-page-planner{
  --planner-sidebar: clamp(420px, 32vw, 560px);
}

/* ≥1200px 才切兩欄 Grid */
@media (min-width:1200px){
  body.page-template-page-planner #planner-app{
    display:grid;
    grid-template-columns:minmax(0,1fr) var(--planner-sidebar);
    gap:12px;
  }
}
/* 手機直排 */
@media (max-width:980px){
  body.page-template-page-planner #planner-app{ flex-direction:column; }
  body.page-template-page-planner #map{ min-height:55vh; }
  body.page-template-page-planner #planner-sidebar,
  body.page-template-page-planner #sidebar{ width:auto; max-width:none; flex:0 0 auto; min-height:auto; border-left:none; border-top:2px solid #ccc; }
}

/* 防橫向捲軸（欄位不要被內容撐破） */
html body.page-template-page-planner{ overflow-x:hidden !important; }
body.page-template-page-planner #planner-app,
body.page-template-page-planner #planner-app > *{ box-sizing:border-box !important; max-width:100% !important; }
body.page-template-page-planner #planner-sidebar,
body.page-template-page-planner #sidebar{ overflow-wrap:anywhere; word-break:break-word; }

/* 工具列置頂（保留） */
#planner-toolbar.planner-toolbar{
  position:sticky; top:0; z-index:3; display:flex; gap:8px; padding:8px 10px; background:#fafafa; border-bottom:1px solid #e5e7eb;
}

/* ========== Timeline（保留你要的樣式） ========== */
body.page-template-page-planner #planner-timeline,
body.page-template-page-planner .planner-timeline,
body.page-template-page-planner .timeline{ writing-mode:horizontal-tb !important; text-orientation:mixed !important; }
body.page-template-page-planner #planner-timeline{ position:static !important; bottom:auto !important; top:auto !important; box-shadow:none !important; }
body.page-template-page-planner #planner-timeline .tl-label,
body.page-template-page-planner .planner-timeline .tl-label,
body.page-template-page-planner .timeline .tl-label,
body.page-template-page-planner #planner-timeline [class*="label"],
body.page-template-page-planner .planner-timeline [class*="label"],
body.page-template-page-planner .timeline [class*="label"]{
  writing-mode:horizontal-tb !important; text-orientation:mixed !important;
  transform:none !important; rotate:0deg !important; white-space:nowrap !important; word-break:keep-all !important;
  overflow:hidden !important; text-overflow:ellipsis !important; line-height:1.2 !important; display:inline-block !important; vertical-align:middle !important;
}
body.page-template-page-planner .tl-bar{ position:relative; }
body.page-template-page-planner .tl-bar.is-tiny .tl-label{ display:none !important; }
body.page-template-page-planner .tl-bar.is-tiny::after{ content:attr(data-name); position:absolute; bottom:100%; left:0; transform:translateY(-2px); font-size:12px; white-space:nowrap; pointer-events:none; }

/* ========== Leaflet 層級（控制器常駐） ========== */
body.page-template-page-planner #map.leaflet-container{ position:relative; overflow:hidden !important; z-index:0 !important; width:100% !important; }
body.page-template-page-planner #map .leaflet-pane{ z-index:200 !important; }
body.page-template-page-planner #map .leaflet-tile-pane{ z-index:200 !important; }
body.page-template-page-planner #map .leaflet-overlay-pane{ z-index:400 !important; }
body.page-template-page-planner #map .leaflet-shadow-pane{ z-index:500 !important; }
body.page-template-page-planner #map .leaflet-marker-pane{ z-index:600 !important; }
body.page-template-page-planner #map .leaflet-tooltip-pane{ z-index:650 !important; }
body.page-template-page-planner #map .leaflet-popup-pane{ z-index:700 !important; }
body.page-template-page-planner #map .leaflet-control-container,
body.page-template-page-planner #map .leaflet-top,
body.page-template-page-planner #map .leaflet-bottom,
body.page-template-page-planner #map .leaflet-control{ position:relative; z-index:1000 !important; pointer-events:auto; }
body.page-template-page-planner #map .leaflet-control-layers,
body.page-template-page-planner #map .multi-day-legend{ z-index:1001 !important; }

/* ========== Footer：回主題預設，僅確保在地圖之上 ========== */
body.page-template-page-planner #footer,
body.page-template-page-planner .footer-widgets,
body.page-template-page-planner .footer-bottom,
body.page-template-page-planner .site-footer{
  position:relative; z-index:900 !important;   /* 高於地圖即可；保持主題背景/裝飾 */
}
/* 不再改 footer 的 ::before / ::after，也不要隱藏 footer 之後的節點 */
#accordion-container details > summary{
  font-size:16px; font-weight:700;
  margin:10px 0 6px; padding:6px 10px;
  background:#f7f9fc; border:1px solid #e5eaf2; border-radius:8px;
}
#accordion-container details + details{ margin-top:12px; }

/* 名稱標籤外觀 */
.leaflet-tooltip.spot-label{
  background: rgba(255,255,255,0.9);
  border: none;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: #111;
  white-space: nowrap;
  pointer-events: none;        /* 不擋點擊 */
  transform: translateY(-2px); /* 微調垂直對齊 */
}

/* 文字描邊：深淺背景都清楚（不支援瀏覽器會自動忽略）*/
.leaflet-tooltip.spot-label {
  -webkit-text-stroke: 3px rgba(255,255,255,0.9);
  paint-order: stroke fill;
}
.leaflet-tooltip.spot-label span,
.leaflet-tooltip.spot-label { text-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.leaflet-tooltip-pane.hide-spot-labels .spot-label {
  display: none !important;
}
