/* ============================================================
   小琉球美食地圖 - 最終整合穩定版
   ============================================================ */

/* 1. 基礎設定與變數 */
:root {
    --primary: #006994;
    --accent: #d63031;
    --bg-color: #f8f9fa;
    --open-green: #22c55e;
    --closed-red: #ef4444;
    --nav-h: 60px;          /* 頂部全站導覽列高度 */
    --header-h: 60px;       /* 頁面標題高度 */
    --bottom-h: 65px;       /* 手機版底部導航高度 */
    --sidebar-w: 400px;     /* 電腦版側邊欄寬度 */
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    padding-top: var(--nav-h); /* 為全站導覽列預留空間 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 2. 導覽列與標題層級 */
#navbar-placeholder {
    position: relative;
    z-index: 20000 !important; /* 確保在所有人之上 */
}

.page-header {
    height: var(--header-h);
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    z-index: 100;
}

.page-header h1 { margin: 0; font-size: 1.1rem; color: var(--primary); font-weight: 900; }
.data-source { font-size: 0.65rem; color: #94a3b8; margin-top: 2px; }

/* 3. 主內容佈局 (PC版) */
.main-container {
    flex: 1;
    position: relative;
    display: flex;
    overflow: hidden;
}

/* 側邊清單容器 */
#shop-list-container {
    width: var(--sidebar-w);
    height: 100%;
    overflow-y: auto;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    z-index: 10;
    border-right: 1px solid #e2e8f0;
}

#map {
    flex: 1;
    height: 100%;
    position: relative;
}

/* 4. 篩選與分類列 */
.filter-bar {
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    padding: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
/* 篩選列頂部排版 */
.filter-row-top {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    gap: 10px; /* 按鈕與搜尋框的間距 */
    padding: 0 5px;
}

/* 搜尋框容器 */
.search-container {
    flex: 1; /* 讓搜尋框自動填滿剩餘空間 */
    max-width: 250px;
    background: #f1f5f9;
    border-radius: 50px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.search-container:focus-within {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.1);
}

.search-container i {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-right: 8px;
}

.search-container input {
    border: none;
    background: transparent;
    width: 100%;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-main);
    outline: none;
}

.search-container input::placeholder {
    color: #cbd5e1;
}

/* 手機版微調：如果螢幕太窄，縮小字體 */
@media (max-width: 400px) {
    .list-status-btn { padding: 8px 15px; font-size: 0.75rem; }
    .search-container { padding: 0 10px; }
}
/* 僅顯示營業中 (清單內按鈕) */
.filter-row-top {
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
}

.list-status-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.list-status-btn .status-dot {
    width: 8px; height: 8px; background: #cbd5e1; border-radius: 50%;
}

.list-status-btn.active {
    background: #f0fdf4;
    border-color: var(--open-green);
    color: #15803d;
}

.list-status-btn.active .status-dot {
    background: var(--open-green);
    animation: list-pulse-green 1.5s infinite;
}

/* 橫向滾動分類 */
.filter-row-bottom {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.filter-row-bottom::-webkit-scrollbar { display: none; }

.cat-btn {
    border: 1px solid #e2e8f0;
    background: white;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}
.cat-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 5. 店家卡片 (清單模式) */
.shop-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-left: 6px solid var(--primary);
    transition: 0.2s;
    cursor: pointer;
}
.shop-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.shop-name { margin: 0; font-size: 1.05rem; font-weight: 900; color: #1e293b; }

.status-tag { font-size: 0.7rem; padding: 2px 8px; border-radius: 6px; font-weight: 800; }
.status-tag.open { background: #dcfce7; color: #166534; }
.status-tag.closed { background: #fee2e2; color: #991b1b; }

.info-row { display: flex; font-size: 0.85rem; color: #555; margin-top: 5px; align-items: center; gap: 8px; }
.info-row i { color: var(--primary); width: 15px; text-align: center; }

.action-buttons { display: flex; gap: 8px; margin-top: 12px; }
.btn { flex: 1; padding: 10px; border-radius: 8px; text-align: center; text-decoration: none; font-size: 0.85rem; font-weight: bold; border: none; cursor: pointer; }
.btn-nav { background: #e0f2fe; color: #0369a1; }

/* 6. 地圖浮動 UI (MapLibre) */

/* 地圖上方的玻璃感分類列 */
.map-category-overlay {
    position: absolute;
    top: 12px; left: 12px; right: 80px;
    z-index: 1000;
    pointer-events: none;
}

.map-category-overlay .filter-row-bottom {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    padding: 8px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* 地圖按鈕組 (右上) */
.map-custom-controls {
    position: absolute;
    top: 80px; /* 避開上方的分類列 */
    right: 12px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-btn {
    background: white;
    border: none;
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #334155;
    transition: 0.3s;
}

/* 呼吸燈按鈕 */
.pulse-btn .dot { width: 8px; height: 8px; background: #94a3b8; border-radius: 50%; }
.pulse-btn.active { border: 2px solid var(--open-green); color: var(--open-green); }
.pulse-btn.active .dot {
    background: var(--open-green);
    box-shadow: 0 0 8px var(--open-green);
    animation: list-pulse-green 1.5s infinite;
}

#nav-sat.active {
    background: var(--primary);
    color: white;
}

/* 7. 地圖 Marker 樣式 */
.custom-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateY(-50%);
    cursor: pointer;
}

.marker-label {
    background: white;
    color: #1e293b;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    border: 1px solid #e2e8f0;
    margin-bottom: 5px;
}

.marker-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.dot-open { background: var(--open-green); }
.dot-closed { background: var(--closed-red); }

/* 8. 📱 手機版 RWD 修正 */
@media (max-width: 768px) {
    #shop-list-container, #map {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        display: none;
    }

    .active-view { display: flex !important; }
    #map.active-view { display: block !important; }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        width: 100%;
        height: var(--bottom-h);
        background: white;
        border-top: 1px solid #f1f5f9;
        z-index: 5000;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .nav-item {
        flex: 1; border: none; background: none;
        display: flex; flex-direction: column;
        align-items: center; justify-content: center;
        color: #94a3b8; font-size: 0.75rem; font-weight: 700; gap: 4px;
    }
    .nav-item.active { color: var(--primary); }
    .nav-item i { font-size: 1.3rem; }

    /* 手機版按鈕位置調整 */
    .map-custom-controls { top: auto; bottom: 85px; right: 15px; }
    .map-category-overlay { top: 10px; right: 12px; }
}

/* 9. 其他 UI */
.loading { padding: 40px; text-align: center; color: #94a3b8; font-weight: 700; }

.lightbox {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.95); z-index: 30000;
    justify-content: center; align-items: center;
}
.lightbox img { max-width: 90%; max-height: 85%; object-fit: contain; }
.close-btn { position: absolute; top: 20px; right: 30px; color: white; font-size: 40px; cursor: pointer; }

/* 10. 動畫定義 */
@keyframes list-pulse-green {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   小琉球美食地圖 - PC/Mobile 分流優化版
   ============================================================ */

:root {
    --primary: #006994;
    --accent: #d63031;
    --bg-color: #f8f9fa;
    --open-green: #22c55e;
    --closed-red: #ef4444;
    --nav-h: 60px;
    --header-h: 60px;
    --sidebar-w: 400px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Noto Sans TC', sans-serif;
    margin: 0; padding: 0;
    background-color: var(--bg-color);
    padding-top: var(--nav-h);
    height: 100dvh;
    display: flex; flex-direction: column;
    overflow: hidden;
}

#navbar-placeholder { position: relative; z-index: 20000 !important; }

/* 頁面標題 */
.page-header {
    height: var(--header-h);
    background: white;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    z-index: 100;
}
.page-header h1 { margin: 0; font-size: 1.1rem; color: var(--primary); font-weight: 900; }

/* ============================================================
   小琉球美食地圖 - PC 左上控制項優化版
   ============================================================ */

/* ... (前面 :root 到 .page-header 維持不變) ... */

/* --- 💻 電腦版佈局修正 --- */
.main-container { flex: 1; position: relative; display: flex; overflow: hidden; }

#shop-list-container {
    width: var(--sidebar-w);
    height: 100%;
    overflow-y: auto;
    background: #f1f5f9;
    z-index: 10;
    border-right: 1px solid #e2e8f0;
}

#map { flex: 1; height: 100%; position: relative; }

/* ❌ 電腦版隱藏：地圖分類列、底部導航 */
.map-category-overlay, .bottom-nav { display: none; }

/* ✅ 電腦版控制項：橫向排列在左上角 */
.map-custom-controls {
    position: absolute; 
    top: 15px; 
    left: 15px; /* 貼齊地圖左側邊緣 */
    z-index: 1000; 
    display: flex; 
    flex-direction: row; /* 關鍵：電腦版改為橫向 */
    gap: 10px;
}

/* ❌ 電腦版隱藏地圖上的「營業中」按鈕，統一使用左側清單的篩選 */
@media (min-width: 769px) {
    #btn-open-filter { display: none !important; }
}

.control-btn {
    background: white; 
    border: none; 
    height: 40px; 
    padding: 0 16px;
    border-radius: 10px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    font-weight: 800; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    gap: 8px;
    color: #334155; 
    transition: all 0.2s ease;
    white-space: nowrap;
}

.control-btn:hover {
    background: #f8fafc;
    transform: translateY(-2px);
}

/* 衛星按鈕啟動顏色 */
#nav-sat.active { 
    background: var(--primary); 
    color: white; 
}

/* 標記與卡片樣式保持不變... */

/* ============================================================
   📱 手機版 RWD 修正 (保持原有的 App 體感)
   ============================================================ */
@media (max-width: 768px) {
    #shop-list-container, #map { width: 100%; position: absolute; top: 0; left: 0; height: 100%; display: none; }
    .active-view { display: flex !important; }
    #map.active-view { display: block !important; }
    
    /* 手機版導航與分類 */
    .map-category-overlay { display: block; position: absolute; top: 12px; left: 12px; right: 12px; z-index: 1000; }
    .bottom-nav { display: flex; position: fixed; bottom: 0; width: 100%; height: 70px; background: white; z-index: 5000; border-top: 1px solid #eee; }
    
    /* 📱 手機版控制項：恢復為右下角垂直排列，且顯示營業中按鈕 */
    .map-custom-controls { 
        top: auto; 
        bottom: 85px; 
        right: 15px; 
        left: auto; 
        flex-direction: column; /* 手機版維持直排 */
    }
    
    #btn-open-filter { display: flex !important; } /* 手機版地圖模式需要這個按鈕 */
}

/* 衛星按鈕啟動顏色 */
#nav-sat.active { background: var(--primary); color: white; }

/* 篩選列 */
.filter-bar { position: sticky; top: 0; background: white; z-index: 100; padding: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.filter-row-top { margin-bottom: 10px; display: flex; justify-content: center; }
.filter-row-bottom { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.filter-row-bottom::-webkit-scrollbar { display: none; }

.cat-btn { border: 1px solid #e2e8f0; background: white; padding: 6px 16px; border-radius: 50px; font-size: 0.85rem; color: #64748b; font-weight: 700; cursor: pointer; }
.cat-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* 店家卡片樣式維持... */
.shop-card { background: white; border-radius: 16px; padding: 16px; margin: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); border-left: 6px solid var(--primary); cursor: pointer; }
.status-tag { font-size: 0.7rem; padding: 2px 8px; border-radius: 6px; font-weight: 800; }
.status-tag.open { background: #dcfce7; color: #166534; }
.status-tag.closed { background: #fee2e2; color: #991b1b; }

/* 標記樣式 */
.custom-marker { display: flex; flex-direction: column; align-items: center; transform: translateY(-50%); }
.marker-label { background: white; color: #1e293b; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 900; white-space: nowrap; box-shadow: 0 4px 10px rgba(0,0,0,0.2); border: 1px solid #e2e8f0; margin-bottom: 5px; }
.marker-dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
.dot-open { background: var(--open-green); }
.dot-closed { background: var(--closed-red); }

/* 📱 手機版切換 RWD */
@media (max-width: 768px) {
    #shop-list-container, #map { width: 100%; position: absolute; top: 0; left: 0; height: 100%; display: none; }
    .active-view { display: flex !important; }
    #map.active-view { display: block !important; }
    
    /* 手機版顯示地圖分類列與底部導航 */
    .map-category-overlay { display: block; position: absolute; top: 12px; left: 12px; right: 12px; z-index: 1000; }
    .bottom-nav { display: flex; position: fixed; bottom: 0; width: 100%; height: 70px; background: white; z-index: 5000; border-top: 1px solid #eee; }
    .nav-item { flex: 1; border: none; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #94a3b8; font-size: 0.75rem; font-weight: 700; }
    .nav-item.active { color: var(--primary); }
    
    /* 手機版按鈕移到底部，防止擋到地圖 */
    .map-custom-controls { top: auto; bottom: 85px; right: 15px; left: auto; flex-direction: column; }
}

/* ============================================================
   UI/UX 升級與動畫
   ============================================================ */

/* 1. 按鈕懸浮與點擊動畫 */
.control-btn, .cat-btn, .btn, .nav-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.control-btn:hover, .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
}

.control-btn:active, .btn:active {
    transform: scale(0.95);
}

/* 2. 使用者定位藍點動畫 (iOS 風格) */
.user-location-dot {
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.user-location-dot .main-dot {
    width: 12px;
    height: 12px;
    background: #007AFF;
    border: 2px solid white;
    border-radius: 50%;
    z-index: 2;
}

.user-location-dot .pulse-ring {
    position: absolute;
    width: 30px;
    height: 30px;
    background: rgba(0, 122, 255, 0.3);
    border-radius: 50%;
    animation: user-pulse 2s infinite;
    z-index: 1;
}

@keyframes user-pulse {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* 3. 地圖氣泡 (Popup) UI 改裝 */
.maplibregl-popup-content {
    border-radius: 16px !important;
    padding: 15px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
    border: none !important;
}

.map-popup-card .popup-title {
    font-size: 16px;
    font-weight: 900;
    color: #1e293b;
    margin-bottom: 5px;
}

.map-popup-card .popup-status {
    font-size: 12px;
    margin-bottom: 10px;
    font-weight: 700;
}

.map-popup-card .popup-info {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 15px;
    line-height: 1.4;
}

.popup-nav-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: white !important;
    text-decoration: none;
    padding: 10px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 14px;
}

/* 完整時段面板基礎樣式 */
.full-hours-panel {
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-out;
    background: #f8fafc;
    border-radius: 12px;
    margin-top: 0;
    opacity: 0;
}

/* 展開狀態 */
.full-hours-panel.show {
    max-height: 300px;
    margin-top: 12px;
    padding: 12px;
    opacity: 1;
    border: 1px solid #e2e8f0;
}

.panel-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: #94a3b8;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 每一天的排版 */
.hour-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 4px 0;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
}

.hour-row:last-child { border-bottom: none; }

/* 當日高亮顯示 */
.hour-row.is-today {
    color: var(--primary);
    font-weight: 900;
    background: rgba(0, 105, 148, 0.05);
    margin: 0 -8px;
    padding: 4px 8px;
    border-radius: 4px;
}

/* 完整時段按鈕樣式 */
.btn-hours {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-hours:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* 調整按鈕間距 */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

/* ============================================================
   地圖彈窗 (Popup) Chill 風格美化
   ============================================================ */

/* 1. 覆寫 MapLibre 預設容器 */
.maplibregl-popup-content {
    border-radius: 24px !important; /* 跟店家卡片一致的圓角 */
    padding: 20px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12) !important;
    border: none !important;
    font-family: 'Noto Sans TC', sans-serif;
}

/* 移除預設的關閉按鈕樣式或微調它 */
.maplibregl-popup-close-button {
    font-size: 18px;
    color: #94a3b8;
    right: 10px;
    top: 5px;
    border: none;
    outline: none;
}

/* 彈窗內卡片佈局 */
.map-popup-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.popup-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #164e63; /* 深海藍 */
    margin-right: 15px; /* 避開關閉按鈕 */
}

/* 狀態標籤 */
.popup-status-row {
    margin: 4px 0;
}

.popup-status-tag {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 50px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.popup-status-tag.open { background: #ecfdf4; color: #10b981; }
.popup-status-tag.closed { background: #fff1f2; color: #f43f5e; }

.popup-status-tag i { font-size: 6px; }

/* 資訊列 */
.popup-info {
    margin: 4px 0 12px 0;
}

.popup-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #64748b;
}

.popup-info-item i {
    color: #0891b2; /* 海洋藍 */
    width: 14px;
}

/* 導航按鈕 - 藍色膠囊 */
.popup-nav-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: #0891b2 !important; /* 強制覆寫 */
    color: white !important;
    text-decoration: none;
    padding: 10px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.85rem;
    transition: 0.3s;
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.2);
}

.popup-nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(8, 145, 178, 0.3);
}

/* 調整彈窗小尖角 */
.maplibregl-popup-tip {
    border-top-color: white !important;
    border-bottom-color: white !important;
}

/* 地圖搜尋框包裝層 */
.map-search-wrapper {
    margin-top: 10px; /* 與上方分類列的間距 */
    background: rgba(255, 255, 255, 0.8); /* 半透明白 */
    backdrop-filter: blur(10px); /* 磨砂玻璃效果 */
    border-radius: 50px;
    display: flex;
    align-items: center;
    padding: 0 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    pointer-events: auto; /* 確保可以點擊輸入 */
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.map-search-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.map-search-wrapper i {
    color: var(--primary);
    font-size: 0.85rem;
    margin-right: 10px;
}

.map-search-wrapper input {
    border: none;
    background: transparent;
    width: 100%;
    padding: 10px 0;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
}

/* PC 版微調：地圖搜尋框不需要太寬 */
@media (min-width: 769px) {
    .map-search-wrapper {
        max-width: 300px;
    }
}

/* 手機版微調 */
@media (max-width: 768px) {
    .map-category-overlay {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
}
/* =========================================
   新增：首頁區塊樣式
   ========================================= */
#home-container {
    background: #ffffff;
    overflow-y: auto; /* 讓首頁可以上下滑動 */
    z-index: 10;
    display: none; /* 預設隱藏 */
}

/* 如果加上 active-view 就顯示 */
#home-container.active-view {
    display: block !important;
}

/* 電腦版排版 (與側邊欄同寬) */
@media (min-width: 769px) {
    #home-container {
        width: var(--sidebar-w);
        border-right: 1px solid #e2e8f0;
    }
    #shop-list-container.active-view {
        display: flex !important; /* 確保電腦版的列表是 flex 排版 */
    }
}

/* 手機版排版 (滿版) */
@media (max-width: 768px) {
    #home-container {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
    }
}
/* =========================================
   首頁區塊專屬樣式 (全新質感設計版)
   ========================================= */
#home-container {
    background: #ffffff; 
    overflow-y: auto;
    z-index: 10;
    display: none; 
    padding-bottom: 90px; /* 避開底部導航 */
}

#home-container.active-view {
    display: block !important;
}

@media (min-width: 769px) {
    #home-container {
        width: var(--sidebar-w);
        border-right: 1px solid #e2e8f0;
    }
}

@media (max-width: 768px) {
    #home-container {
        width: 100%;
        position: absolute;
        top: 0; left: 0;
        height: 100%;
    }
}

/* --- 大圖片視覺區 (Hero Banner) --- */
.hero-banner {
    position: relative;
    width: 100%;
    height: 260px;
    overflow: hidden;
}

.hero-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.65); /* 稍微調暗圖片讓文字更清楚 */
    transition: transform 5s ease;
}

.hero-banner:hover img {
    transform: scale(1.05); /* 滑鼠游標移上去微微放大 */
}

.banner-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px 25px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
}

.banner-content .badge {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    display: inline-block;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.banner-content h2 {
    margin: 0 0 5px 0;
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 1px;
}

.banner-content p {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.9;
}

/* --- 內容區域容器 --- */
.content-wrapper {
    padding: 0 25px;
}

/* --- 引言故事區 (Story Section) --- */
.story-section {
    margin: 30px 0;
}

.story-block {
    padding: 10px 0;
}

.story-block i {
    font-size: 1.8rem;
    color: #e2e8f0;
    margin-bottom: 15px;
    display: block;
}

.story-text {
    font-size: 1rem;
    color: #334155;
    line-height: 1.8;
    margin: 0 0 15px 0;
    font-weight: 500;
    text-align: justify;
}

.story-author {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 700;
    margin: 0;
    text-align: right;
}

.divider {
    height: 1px;
    background: #f1f5f9;
    margin: 25px 0;
}

/* --- 導覽按鈕區 (Action Grid) --- */
.action-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 40px;
}

.action-card {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    padding: 16px;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
    border-color: #e2e8f0;
}

.action-card:active {
    transform: scale(0.98);
}

.icon-box {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 15px;
    flex-shrink: 0;
}

.action-text {
    flex: 1;
}

.action-text h3 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    color: #1e293b;
    font-weight: 800;
}

.action-text p {
    margin: 0;
    font-size: 0.75rem;
    color: #64748b;
}

.action-card .arrow {
    color: #cbd5e1;
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.action-card:hover .arrow {
    color: var(--primary);
    transform: translateX(3px);
}

/* --- 頁尾資訊區 (Footer) --- */
.home-footer {
    background: #f8fafc;
    padding: 30px 25px;
    border-top: 1px solid #e2e8f0;
}

.footer-sponsors h4 {
    margin: 0 0 10px 0;
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 800;
}

.footer-sponsors p {
    margin: 5px 0;
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.5;
}

.footer-disclaimer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #cbd5e1;
}

.footer-disclaimer strong {
    display: block;
    color: #64748b;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.footer-disclaimer p {
    margin: 0;
    color: #94a3b8;
    font-size: 0.75rem;
    line-height: 1.6;
    text-align: justify;
}
/* =========================================
   電腦版專用：左側邊欄分頁切換器
   ========================================= */
.desktop-sidebar-tabs {
    display: none; /* 手機版預設隱藏 */
}

@media (min-width: 769px) {
    /* 顯示電腦版切換器 */
    .desktop-sidebar-tabs {
        display: flex;
        position: absolute;
        top: 0;
        left: 0;
        width: var(--sidebar-w); /* 400px */
        height: 50px;
        background: white;
        border-bottom: 1px solid #e2e8f0;
        border-right: 1px solid #e2e8f0;
        z-index: 20;
    }

    .d-tab {
        flex: 1;
        background: transparent;
        border: none;
        color: #94a3b8;
        font-weight: 800;
        font-size: 0.95rem;
        cursor: pointer;
        border-bottom: 3px solid transparent;
        transition: all 0.3s ease;
    }

    .d-tab:hover {
        color: #64748b;
        background: #f8fafc;
    }

    .d-tab.active {
        color: #086490; /* 琉行杯綠色 */
        border-bottom: 3px solid #086490;
    }

    /* 把首頁和清單的內容往下推，讓出頂部按鈕的空間 */
    #home-container, #shop-list-container {
        margin-top: 50px;
        height: calc(100% - 50px);
    }

    /* 🌟 核心修復：確保電腦版地圖永遠顯示，不受 active-view 影響 🌟 */
    #map {
        display: block !important;
    }

    /* 電腦版左側欄顯示邏輯 */
    #home-container { display: none; }
    #shop-list-container { display: none; }
    
    #home-container.active-view { display: block; }
    #shop-list-container.active-view { display: flex; flex-direction: column; }
}