/* --- 基本樣式重設 --- */
html,
body {
    height: 100%;
    /* 讓 html 和 body 佔滿整個視窗高度 */
    margin: 0;
    /* 移除預設的外邊距 */
    padding: 0;
    /* 移除預設的內邊距 */
}

/* --- 地圖容器樣式 --- */
#map {
    height: 100vh;
    /* 地圖高度佔滿整個視窗可見高度 */
    width: 100%;
    /* 地圖寬度佔滿整個容器 */
    margin: 0;
    padding: 0;
}

.taiwan-Info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 20px;
    padding: 10px 18px;
    font-weight: bold;
    font-size: 1.2em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
}

.taiwan-Info ul {
    list-style-type: none;
    /* 移除黑點 */
    padding: 0;
    /* 移除內縮 */
    margin: 0;
    /* ✨ 這行是關鍵！移除預設的上下外邊距 */
}

.city-Info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 20px;
    padding: 6px 12px;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
}

.city-Info ul {
    list-style-type: none;
    /* 移除黑點 */
    padding: 0;
    /* 移除內縮 */
    margin: 0;
    /* ✨ 這行是關鍵！移除預設的上下外邊距 */
}

.district-Info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 20px;
    padding: 6px 12px;
    font-weight: bold;
    font-size: 1.1em;
    border: 2px solid #fff;
}

.district-Info ul {
    list-style-type: none;
    /* 移除黑點 */
    padding: 0;
    /* 移除內縮 */
    margin: 0;
    /* ✨ 這行是關鍵！移除預設的上下外邊距 */
}


/* --- 自訂圖示樣式 (只顯示圖標（無店名）) --- */
.custom-icon {
    display: flex;
    /* 使用 flexbox 排版 */
    align-items: center;
    /* 垂直置中 */
    justify-content: center;
    /* 水平置中 */
    background: #fff;
    /* 背景色為白色 */
    border-radius: 50%;
    /* 圓形邊框 */
    width: 40px;
    /* 寬度 */
    height: 40px;
    /* 高度 */
    border: 2px solid #fff;
    /* 白色邊框，可用於在地圖上創造間隔效果 */
}

/* 自訂圖示內的 SVG 樣式 */
.custom-icon svg {
    width: 28px;
    /* SVG 寬度 */
    height: 28px;
    /* SVG 高度 */
    display: block;
    /* 確保 SVG 不會有額外的底部空間 */
}

/* --- 彈出視窗 (Popup) 樣式 --- */
.leaflet-popup-content-wrapper {
    /* 你可以在這裡設定固定的寬度，但最大寬度更具彈性 */
    min-width: 200px;
    max-width: 300px !important;
    box-shadow: none !important;
}

.leaflet-popup-content {
    /* 確保寬度是自動的，這樣內容少時不會被強制撐開 */
    width: auto !important;

    /* 強制文字正常換行 */
    white-space: normal !important;

    /* 處理超長的單字或連結，強制它們換行 */
    overflow-wrap: break-word;
    word-wrap: break-word;
    /* 舊版瀏覽器相容 */
}

/*
.popup-content {
    min-width: 200px;
}*/

.popup-title {
    font-weight: bold;
    /* 粗體字 */
    font-size: 1.1em;
    /* 字體大小 */
    margin-bottom: 4px;
    /* 與下方元素的間距 */
}

.popup-tags {
    margin-bottom: 4px;
    /* 與下方元素的間距 */
}

.popup-note {
    color: #555;
    font-size: 0.9em;
    margin: 8px 0;
    overflow-wrap: break-word;
    /* 處理長備註換行，避免內容超出視窗 */
}

.tag {
    display: inline-block;
    /* 行內區塊元素，使其可以設定 padding 和 margin */
    background: #e0e0e0;
    /* 背景色 */
    color: #333;
    /* 文字顏色 */
    border-radius: 10px;
    /* 圓角 */
    padding: 2px 8px;
    /* 內邊距 */
    font-size: 0.85em;
    /* 字體大小 */
    margin-right: 4px;
    /* 與右方標籤的間距 */
}

.popup-address {
    color: #555;
    /* 文字顏色 */
    font-size: 0.95em;
    /* 字體大小 */
    margin-bottom: 6px;
    overflow-wrap: break-word;
    /* 處理長地址換行，避免內容超出視窗 */
    /* 與下方元素的間距 */
}

.popup-link {
    /* display: inline-block; 由 flex 容器管理 */
    margin-top: 0;
    /* 由 popup-links-container 控制間距 */
    color: #1976d2;
    /* 連結顏色 */
    text-decoration: underline;
    /* 加上底線 */
    font-size: 0.95em;
    /* 字體大小 */
}

.popup-links-container {
    display: flex;
    justify-content: space-between;
    /* 將 Google Map 和回饋連結推到兩側 */
    align-items: center;
    /* 垂直置中 */
    margin-top: 8px;
    /* 與上方內容的間距 */
}

.popup-feedback-link {
    color: #757575;
    /* 使用較柔和的灰色 */
    font-size: 0.9em;
    text-decoration: none;
}

.popup-feedback-link:hover {
    text-decoration: underline;
}

/* --- 帶有標籤的自訂標記 (店名文字) --- */
.custom-marker-with-label {
    display: flex;
    /* 使用 flexbox 排版 */
    align-items: center;
    /* 垂直置中 */
    white-space: nowrap;
    /* 文字不換行 */
    border-radius: 10px;
    /* 長條圓角 */
    background: #fff;
    /* 背景色 */
    border: 2px solid #fff;
    /* 邊框 */
    height: 30px;
    /* 高度 */
    max-width: 260px;
    /* 最大寬度 */
    overflow: hidden;
    /* 超出部分隱藏 */
}

.storeNameStyle {
    font-weight: bold;
    font-size: 1.05em;
    padding: 4px 14px;
    line-height: 1.8;
    white-space: nowrap;
    /* Prevent wrapping */
    overflow: hidden;
    /* Hide overflowing text */
    text-overflow: ellipsis;
    /* Add ellipsis to overflowing text */
    display: inline-block;
}

.storeNameStyle.taiwan-friendly {
    color: green;
    /* 台灣友善店家綠色 */
}

.storeNameStyle.grass-store {
    color: rgb(40, 200, 200);
    /* 小草店家 */
    ;
}

.storeNameStyle.red-store {
    color: red;
    /* 紅色店家 */
}



/* --- 篩選器開關按鈕 --- */
.filter-toggle {
    position: absolute;
    /* 絕對定位，相對於地圖容器 */
    top: 10px;
    /* 距離頂部 20px */
    right: 10px;
    /* 距離右側 20px */
    z-index: 1100;
    /* 堆疊順序，確保在其他元素之上 */
    background: #fff;
    /* 背景色 */
    border-radius: 10px;
    /* 圓角 */
    cursor: pointer;
    /* 滑鼠指標為手形 */
    transition: background 0.2s;
    /* 背景色變換動畫 */
}

/* --- 篩選器選單 --- */
.filter-menu {
    position: absolute;
    /* 絕對定位 */
    top: 60px;
    /* 距離頂部 60px (在開關按鈕下方) */
    right: 10px;
    /* 距離右側 20px */
    z-index: 1101;
    /* 堆疊順序，比開關按鈕更高 */
    background: #fff;
    /* 背景色 */
    border-radius: 12px;
    /* 圓角 */
    padding: 16px 18px 12px 18px;
    /* 內邊距 */
    min-width: 120px;
    /* 最小寬度 */
    font-size: 1em;
    /* 字體大小 */
    user-select: none;
    /* 禁止使用者選取文字 */
    display: none;
    /* 預設隱藏 */
}

.filter-title {
    font-weight: bold;
    /* 粗體字 */
    margin: 8px 0 4px 0;
    /* 外邊距 */
}

.filter-menu label {
    display: block;
    /* 區塊元素，使其佔滿整行 */
    margin-bottom: 3px;
    /* 與下方元素的間距 */
    cursor: pointer;
    /* 滑鼠指標為手形 */
}

.filter-menu input[type="checkbox"] {
    margin-right: 6px;
    /* 與右方文字的間距 */
}

/* 當篩選器選單啟用時顯示 */
.filter-menu.active {
    display: block;
}

/* --- 篩選器開關按鈕 --- */
.store-name-toggle {
    position: absolute;
    /* 絕對定位，相對於地圖容器 */
    top: 10px;
    /* 距離頂部 20px */
    right: 50px;
    /* 距離右側 20px */
    z-index: 1100;
    /* 堆疊順序，確保在其他元素之上 */
    background: #fff;
    /* 背景色 */
    border-radius: 10px;
    /* 圓角 */
    cursor: pointer;
    /* 滑鼠指標為手形 */
    user-select: none;
    /* 防止點擊時選取到文字 */
    transition: background 0.2s;
    /* 背景色變換動畫 */
}

#store-name-toggle.active svg text {
    fill: #888888;
    /* 文字變為白色以增加對比 */
}

#store-name-toggle.active svg rect {
    fill: #b6b6b6;
    /* 使用台rgb(104, 107, 105)開啟」狀態 */
}



/* --- 定位按鈕 --- */
.locate-btn {
    position: absolute;
    /* 絕對定位 */
    right: 10px;
    /* 距離右側 20px */
    bottom: 30px;
    /* 距離底部 20px */
    z-index: 1200;
    /* 堆疊順序，確保在最上層 */
    background: #fff;
    /* 背景色 */
    border-radius: 12px;
    /* 圓角 */
    cursor: pointer;
    /* 滑鼠指標為手形 */
    transition: background 0.2s;
    /* 背景色變換動畫 */
}

/* Info Toggle Button (bottom-left) */
.info-toggle {
    position: absolute;
    bottom: 30px;
    /* 避免與 Leaflet 版權資訊重疊 */
    left: 10px;
    z-index: 800;
    cursor: pointer;
    background-color: white;
    border-radius: 12px;
}

.info-toggle svg {
    display: block;
}

/* Info Menu Panel (bottom-left) */
.info-menu {
    position: absolute;
    bottom: 70px;
    /* 顯示在按鈕上方 */
    left: 10px;
    z-index: 800;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    width: 280px;
    max-height: 40vh;
    overflow-y: auto;
    display: none;
    /* 預設隱藏 */
    font-size: 14px;
    line-height: 1.5;
}

/* 用於 JS 切換顯示 */
.info-menu.show {
    display: block;
}

.info-title {
    font-weight: bold;
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.info-menu p {
    margin-top: 0;
    margin-bottom: 12px;
}

.info-menu a {
    color: #0078A8;
    text-decoration: none;
}

.info-menu a:hover {
    text-decoration: underline;
}

.install-button {
    /*display: none;*/
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#install-info-button {
    /*display: none;*/
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 10px;
    background-color: #ffffff;
    color: rgb(0, 0, 0);
    font-size: 16px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.2s ease-in-out;
}

.ios-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #f0f0f0;
    padding: 15px;
    text-align: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1001;
}


/* 搜尋容器樣式 */
.search-container {
    position: absolute;
    top: 10px;
    /* 距離頂部 10px */
    left: 50%;
    /* 將左邊緣移至中心 */
    transform: translateX(-50%);
    /* 再向左移動自身寬度的一半，以達到水平置中 */
    z-index: 1000;
    /* 確保在最上層 */
    display: flex;
    background-color: white;
    padding: 2.5px;
    border-radius: 5px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
}

#store-search-input {
    width: 125px;
    border: 1px solid #ccc;
    padding: 5px;
    border-radius: 3px;
    outline: none;
}

#store-search-btn {
    width: 50px;
    background-color: #007bff;
    color: white;
    border: none;
    padding: 5px;
    margin-left: 5px;
    border-radius: 3px;
    cursor: pointer;
}

#store-search-btn:hover {
    background-color: #0056b3;
}



/* 建議清單的下拉式選單樣式 */
.suggestions-dropdown {
    display: none;
    /* 預設為隱藏 */
    position: absolute;
    top: 100%;
    /* 定位在輸入框的正下方 */
    left: 0;
    /* 讓寬度與父容器 (search-container) 一致 */
    width: 100%;
    background-color: white;
    border: 1px solid #ddd;
    border-top: none;
    max-height: 250px;
    /* 避免列表過長 */
    overflow-y: auto;
    /* 當內容超出時顯示滾動條 */
    z-index: 1001;
    /* 確保在其他元素之上 */
    box-sizing: border-box;
    /* 確保 padding 和 border 不會增加寬度 */
}

/* 建議清單中每一個項目的樣式 */
.suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

/* 最後一個項目不要底線 */
.suggestion-item:last-child {
    border-bottom: none;
}

/* 滑鼠懸停時的背景變色效果 */
.suggestion-item:hover {
    background-color: #f5f5f5;
}

/* 建議項目中用來顯示距離的 span 樣式 */
.suggestion-distance {
    color: #888;
    font-size: 0.9em;
    margin-left: 8px;
    float: right;
    /* 讓距離靠右對齊 */
}