/* 1. CSS 變數 & 全局設置 */
:root {
  --primary: #3b82f6;
  --accent: #0ea5e9;
  --glass: rgba(255, 255, 255, 0.85);
  --dark-glass: rgba(15, 23, 42, 0.85);
  --nav-h: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: 'Noto Sans TC', sans-serif; background: #0b0e12; overflow: hidden; }

/* 2. 佈局層級 (Navigation & Layout) */
#navbar-placeholder { position: relative; z-index: 30000 !important; }
#mapRoot { position: absolute; inset: var(--nav-h) 0 0 0; z-index: 1; }
#waterMap { width: 100%; height: 100%; }

/* 3. 頂部工具列 (Top Tools) */
.top-left-tools {
  position: absolute; top: 15px; left: 15px; z-index: 10;
  display: flex; flex-direction: column; gap: 10px;
}

.map-title-badge {
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px 20px;
  border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.4);
  font-weight: 900;
  font-size: 14px;
  color: #1e293b;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  display: inline-block;
  white-space: nowrap;
}

.btn-locate {
  background: var(--glass);
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 12px;
  font-size: 18px;
  color: var(--primary);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  backdrop-filter: blur(5px);
}

/* 4. 底部 UI (Bottom UI)*/
.bottom-ui {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 500px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 分類按鈕列 */
.category-bar { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }

.cat-btn {
  flex: 0 0 auto;
  background: var(--glass);
  border: none;
  padding: 10px 18px;
  border-radius: 50px;
  font-weight: bold;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  backdrop-filter: blur(5px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cat-btn.active { background: var(--primary); color: white; }

/* 操作 Dock */
.action-dock {
  background: var(--dark-glass);
  backdrop-filter: blur(15px);
  border-radius: 24px;
  padding: 12px 24px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.dock-item {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.dock-item span { font-size: 11px; font-weight: 700; }

.dock-item:active { transform: scale(0.9); transition: transform 0.1s; }

.dock-item.active { color: #4ade80; }

#btnNearestWater i { color: #0ea5e9; }

.dock-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.1); }

/* 5. 彈窗卡片 (Popup Card) */
.maplibregl-popup-content { border-radius: 18px; padding: 0; width: 260px; overflow: hidden; }

.p-img { width: 100%; height: 130px; object-fit: cover; }

.p-content { padding: 15px; }

.p-title { font-size: 18px; font-weight: 900; margin: 0; color: #1e293b; }

.p-badge { font-size: 11px; background: #e0f2fe; padding: 2px 8px; border-radius: 6px; color: #0369a1; }

.p-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4b5563;
  margin-top: 6px;
}

.p-info-row i {
  color: #3b82f6;
  width: 14px;
  text-align: center;
}

.p-nav { display: block; width: 100%; background: var(--primary); color: white !important; text-decoration: none; text-align: center; padding: 10px; border-radius: 10px; margin-top: 12px; font-weight: bold; }

.p-nav-btn {
  display: block;
  background: #3b82f6;
  color: white !important;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  text-decoration: none;
  margin-top: 12px;
  font-weight: bold;
  font-size: 14px;
  transition: opacity 0.2s;
}

.p-nav-btn:hover { opacity: 0.9; }

/* 6. 使用者位置標記 */
.user-marker {
  width: 20px;
  height: 20px;
  background: #4285F4;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(66, 133, 244, 0.2);
  position: relative;
}

.user-marker::after {
  content: "";
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  background: rgba(66, 133, 244, 0.4);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring { 
  0% { transform: scale(0.5); opacity: 0.8; } 
  100% { transform: scale(2); opacity: 0; } 
}