@charset "UTF-8";
.sidebar {
    position: fixed;
    top: 0;

    height: 100%;
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;

}
/* header內層 */
.sidebar-header-inner {
    width: 100%;
}
.header-title {
    font-size: 1.6rem;
    font-weight: 400;
    unicode-bidi: isolate;
    color: #014f5a;
    margin-block-start: 0.7rem;
    margin-block-end: 0.2rem;
    padding: 0 1rem;
}

.header-location {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0 0 0.5rem;
    padding: 0 1rem;
}
/* 左側選單 */
.sidebar.left {
    left: 0;
    transform: translateX(0);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.sidebar.left.collapsed {
    transform: translateX(-100%);
    /* 面板收在畫面外，但 .sidebar 的 box-shadow 是四面均散（模糊 10px），
       會從左緣滲出一條全高陰影。收合時直接不畫陰影。
       行動版（bottom sheet）的 0 -6px 24px 同理，也一併由此規則蓋掉。 */
    box-shadow: none;
}

/* 左側返回查詢按鈕
   作為 sidebar 子元素，absolute 定位突出右側，
   sidebar 的 transform 動畫會帶著它一起滑動。 */
.left-toggle-btn {
    position: absolute;
    top: 60px;
    right: -36px; /* 突出在 sidebar 右緣外側 */
    width: 36px;
    padding: 12px 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-left: 0;
    border-bottom-right-radius: 8px;
    border-top-right-radius: 8px;
    box-shadow: none;
    cursor: pointer;
    z-index: 1; /* 相對於 sidebar 內容即可，sidebar 本身已是 z-index:1001 */
    font-size: 0.85rem;
    display: flex; /* JS 切換 flex / none */
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #333;
}

/* 按鈕內文字垂直排列 */
.toggle-btn-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
}

/* ========================================
   篩選卡片（取代原右側 sidebar）
   ======================================== */
.filter-card {
    position: fixed;
    top: 20px;
    left: 20px;
    width: min(360px, calc(100vw - 40px));
    max-height: calc(100vh - 40px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.filter-brand-header {
    padding: 14px 16px 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fcfd 100%);
    border-bottom: 1px solid #dbeff4;
}

.filter-brand-logo {
    display: block;
    width: 100%;
    max-width: 318px;
    max-height: 56px;
    object-fit: contain;
    object-position: left center;
}

.filter-card-header {
    padding: 0.75rem 1rem;
    font-weight: bold;
    font-size: 1.1rem;
    color: #014f5a;
    border-bottom: 1px solid #eee;
}

.filter-card-body {
    padding: 1rem;
}

.filter-card .form-row {
    min-width: 0;
}

.filter-card .form-label {
    width: 100px;
}

.filter-card .form-select,
.filter-card .keyword-search-wrapper {
    flex: 1 1 0;
    min-width: 0;
}

.filter-card-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #eee;
}

.filter-validation-msg {
    margin: 0.4rem 0 0;
    color: #b91c1c;
    font-size: 0.8rem;
}

.filter-no-results-toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 3200;
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 11px 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: #064f5b;
    color: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.24);
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.filter-no-results-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.filter-no-results-toast i {
    color: #a5e2ec;
    font-size: 1.05rem;
}

@media (prefers-reduced-motion: reduce) {
    .filter-no-results-toast {
        transition: none;
    }
}

.filter-alert-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2500;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.filter-alert-backdrop.is-visible {
    opacity: 1;
}

.filter-alert-backdrop.is-closing {
    opacity: 0;
}

.filter-alert-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 10px)) scale(0.98);
    width: min(340px, calc(100vw - 40px));
    background: white;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    z-index: 2501;
    opacity: 0;
    transition:
        opacity 0.2s ease,
        transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 內容可能撐高（例如場次提醒同時有推薦海岸線與開放民眾參與的活動）：
   外層固定不捲、只讓 body 捲，確保標題列與底部按鈕永遠看得見。
   行動版另有 dvh 版本的加強規則，見 responsive.css。 */
.filter-alert-popup {
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
}

.filter-alert-popup .filter-alert-header,
.filter-alert-popup .filter-alert-footer {
    flex: 0 0 auto;
}

.filter-alert-popup .filter-alert-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.filter-alert-popup.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.filter-alert-popup.is-closing {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 8px)) scale(0.98);
}

.filter-alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0.75rem 1rem;
    background: #014f5a;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
}

.filter-alert-header--warning {
    background: #b91c1c;
}

.filter-alert-close-x {
    flex: 0 0 auto;
    min-width: 24px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.1rem;
    border: none;
    background: none;
    color: white;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
}

.filter-alert-close-x:hover {
    opacity: 1;
}

.filter-alert-body {
    padding: 1rem;
    color: #334155;
    font-size: 1rem;
    line-height: 1.5;
}

.filter-alert-body p {
    margin: 0;
}

.filter-alert-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #eee;
}

/* 雙鈕footer（取消／確定）：等寬並排 */
.filter-alert-actions {
    display: flex;
    gap: 10px;
}

.filter-alert-actions .main-btn,
.filter-alert-cancel {
    flex: 1 1 0;
}

.filter-alert-cancel {
    padding: 10px;
    /* 按鈕邊界對比 ≥ 3:1（1.4.11）；原 #cbd5e1 僅 1.70:1 */
    border: 1.5px solid #6b7280;
    border-radius: 10px;
    background: #fff;
    color: #475569;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
}

.filter-alert-cancel:hover {
    background: #f8fafc;
    border-color: #6b7280;
}

/* 離站確認：目的地網域 */
.leave-site-target {
    margin: 0.6rem 0 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.leave-site-host {
    color: #014f5a;
    font-weight: 600;
    word-break: break-all;
}

@media (prefers-reduced-motion: reduce) {
    .filter-alert-backdrop,
    .filter-alert-popup {
        transition-duration: 0.01ms;
    }
}

.filter-results {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    border-top: 1px solid transparent;
    background: #f8fcfd;
    transition: max-height 0.28s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.filter-results.is-visible {
    max-height: 360px;
    opacity: 1;
    border-top-color: #dbeff4;
    overflow-y: auto;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #c2e9f2 transparent;
}

.filter-results.is-visible::-webkit-scrollbar {
    width: 5px;
}

.filter-results.is-visible::-webkit-scrollbar-track {
    background: transparent;
}

.filter-results.is-visible::-webkit-scrollbar-thumb {
    background: #c2e9f2;
    border-radius: 100px;
    transition: background 0.2s ease;
}

.filter-results.is-visible:hover::-webkit-scrollbar-thumb {
    background: #90cfe0;
}

.filter-results.is-visible::-webkit-scrollbar-thumb:hover {
    background: #6bbdd4;
}

.filter-results-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 0.8rem 1rem 0.55rem;
}

.filter-results-title {
    margin: 0;
    color: #014f5a;
    font-size: 1.1rem;
    font-weight: 500;
}

.filter-results-summary {
    margin: 0.25rem 0 0;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.35;
}

.filter-results-clear {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
}

.filter-results-clear:hover {
    color: #014f5a;
    background: #edf8fb;
    border-color: #d4edf4;
}

.filter-results-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 0.75rem 0.9rem;
}

.filter-result-item {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0.65rem 0.75rem;
    background: #fff;
    border: 1px solid #e3eef2;
    border-radius: 8px;
    color: #0f172a;
    cursor: pointer;
    text-align: left;
}

.filter-result-item:hover {
    border-color: #9bd7e4;
    background: #f3fbfd;
}

.filter-result-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.filter-result-name {
    font-size: 1rem;
    font-weight: 500;
    color: #585858;
}

.filter-result-location {
    font-size: 0.78rem;
    color: #64748b;
}

.filter-result-badge {
    flex: 0 0 auto;
    min-width: 32px;
    padding: 0.22rem 0.45rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
}

.filter-result-badge--high {
    color: #166534;
    background: #dcfce7;
}

.filter-result-badge--medium {
    color: #92400e;
    background: #fef3c7;
}

.filter-result-badge--low {
    color: #991b1b;
    background: #fee2e2;
}

.filter-result-badges {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-result-badge--level-hard {
    color: #991b1b;
    background: #fee2e2;
}

.filter-result-badge--level-medium {
    color: #9a3412;
    background: #fed7aa;
}

.filter-result-badge--level-easy {
    color: #166534;
    background: #dcfce7;
}

.filter-result-badge--level-unrated {
    color: #4b5563;
    background: #e5e7eb;
}

.filter-empty-state {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #64748b;
    font-size: 0.9rem;
    border: 1px dashed #c8dbe1;
    border-radius: 8px;
    background: #fff;
}

/* 滾動區域：header + body 一起捲動 */
.sidebar-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: #c2e9f2 transparent;
}

/* 自訂滾動條（Chrome / Edge / Safari） */
.sidebar-scroll-area::-webkit-scrollbar {
    width: 5px;
}

.sidebar-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb {
    background: #c2e9f2;
    border-radius: 100px;
    transition: background 0.2s ease;
}

.sidebar-scroll-area:hover::-webkit-scrollbar-thumb {
    background: #90cfe0;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb:hover {
    background: #6bbdd4;
}

/* header：移除 padding，封面圖直接滿版，各元素自帶水平 padding */
.sidebar-header {
    padding: 0;
    position: relative;
}

/* 內容 */
.sidebar-content {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}
.content-title {
    display: flex;
    justify-content: center;
    font-size: 1.2em;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    font-weight: bold;
    unicode-bidi: isolate;
}

/* 內容區：不再自行 scroll，由 sidebar-scroll-area 統一處理 */
.sidebar-body {
    padding: 1rem;
}

/* Footer 固定 */
.sidebar-footer {
    padding: 1rem;
}

/* 底部按鈕 */
.main-btn {
    width: 100%;
    padding: 10px;
    background: #c2e9f2;
    color: #014f5a;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
}
/* 其他按鈕 */
.btn {
    padding: 0.5rem 1.1rem;
    background: #c2e9f2;
    color: #014f5a;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
}
.view-btn {
    padding: 0.4rem 1rem;
    background: #c2e9f2;
    color: #014f5a;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;

    &:hover {
        background: #a0d4e0;
    }
}
/* 關鍵字查詢輸入框 */
.keyword-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.keyword-search-wrapper .form-input {
    width: 100%;
    min-width: 0;
    height: 30px;
    padding: 0 28px 0 11px;
    /* 邊框對比 ≥ 3:1（1.4.11） */
    border: 1px solid #858e9c;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    box-sizing: border-box;
}

.keyword-search-wrapper .form-input:hover {
    /* 邊框對比 ≥ 3:1（1.4.11）；原 #999 僅 2.85:1 */
    border-color: #6b7280;
}

.keyword-search-wrapper .form-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
}

.keyword-clear-btn {
    position: absolute;
    right: 8px;
    width: 24px;
    min-width: 24px;
    height: 24px;
    min-height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    /* #6b7280 = 4.83:1（原 #9ca3af 僅 2.54:1） */
    color: #6b7280;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
}

.keyword-clear-btn:hover {
    color: #374151;
}

/* ========================================
   地圖圖例
   ======================================== */
.map-legend {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    align-items: stretch;
    background: white;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    min-width: 188px;
    overflow: hidden;
    transform: translateX(0);
    transition: transform 0.2s ease;
}

.map-legend-content {
    min-width: 140px;
    padding: 10px 14px;
}

.map-legend-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    font-weight: 600;
    color: #014f5a;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.basemap-icon {
    color: #014f5a;
}

.map-legend-divider {
    height: 1px;
    margin: 4px 0;
    background: #eee;
}

.map-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
}

.map-legend-icon-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 1rem;
    color: #333;
}

.map-zoom-controls {
    width: 42px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e5f4f7;
    background: #f8fcfd;
}

.map-zoom-btn {
    flex: 1 1 0;
    min-height: 42px;
    border: none;
    background: transparent;
    color: #014f5a;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.map-zoom-btn + .map-zoom-btn {
    border-top: 1px solid #e5f4f7;
}

.map-zoom-btn:hover {
    background: #c2e9f2;
}

.map-zoom-btn:focus-visible {
    outline: 2px solid #4a90e2;
    outline-offset: -3px;
}

/* Toggle switch */
.legend-toggle {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.legend-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.legend-toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 20px;
    transition: background 0.2s ease;
}

.legend-toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.legend-toggle input:checked + .legend-toggle-slider {
    background: #014f5a;
}

.legend-toggle input:checked + .legend-toggle-slider::before {
    transform: translateX(14px);
}

.legend-toggle input:focus-visible + .legend-toggle-slider {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* 段落大標 */
.paragragh-title {
    font-size: 1.1em;
    margin-block-start: 0.5em;
    margin-block-end: 0.5em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    font-weight: bold;
    unicode-bidi: isolate;
}

/* ========================================
   資訊頁 — Section Header（左色條 + 淺底）
   ======================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 600;
    padding: 8px 10px 8px 10px;
    border-left: 4px solid;
    border-radius: 6px;
    margin: 0.3em 0 0.5em 0;
    cursor: pointer;
    user-select: none;
    /* 可摺疊的區塊標題是真正的 <button>（原為 <p role="button">，
       鍵盤完全按不到）；以下幾條讓 button 不帶原生外觀，
       與非互動的 <h4 class="section-header"> 版本外觀一致。 */
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    font-family: inherit;
}

.section-header-main {
    display: flex;
    align-items: center;
    gap: 7px;
}

.section-header-chevron {
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.section-header[aria-expanded="false"] .section-header-chevron {
    transform: rotate(-90deg);
}

.section-body {
    overflow: hidden;
    max-height: 800px;
    opacity: 1;
    transition: max-height 0.25s ease, opacity 0.2s ease;
}

.section-body.collapsed {
    max-height: 0;
    opacity: 0;
}

.section-header--blue {
    background: #f0f6ff;
    border-left-color: #4a90e2;
    color: #003470;
}

.section-header--green {
    background: #e8f7e0;
    border-left-color: #5aad1e;
    color: #2a6b09;
}

.section-header--orange {
    background: #fff4e0;
    border-left-color: #f59e0b;
    color: #935b05;
}

.section-header--teal {
    background: #e7f7f4;
    border-left-color: #2aa889;
    color: #0c6b5e;
}

.section-header--grey {
    background: #f0f0f0;
    border-left-color: #b0b0b0;
    color: #666666;
}
