﻿* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    background: #dfe3ea;

}

:root {
    --top-left-width: 370px;
    --floating-footer-width: 320px;
}

.app {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* 跑馬燈 */
/* 讓外層只顯示一行，超出的文字藏起來 */
.ticker {
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    background: rgba(255, 255, 255, 0.6);
}

/* 內層真正跑動的文字 */
.ticker-content {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    /* 一開始先在畫面右外側 */
    animation: ticker-move 90s linear infinite;
}

.ticker-content a {
    text-decoration: none;
    color: #000;
}

/* 動畫：從右到左一直跑 */
@keyframes ticker-move {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* 地圖底 */
.map {
    position: absolute;
    inset: 0;
    top: 26px;
    background: #cfd4e0;
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px), linear-gradient(180deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 80px 80px;
    z-index: 1;
}

/* 上方工具列 */
/* .top-bar {
    position: absolute;
    top: 26px;
    left: 0;
    right: 0;
    height: 60px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 20;
    pointer-events: none;
} */
/* 外層只負責定位整組 UI */
.top-group {
    position: absolute;
    top: 26px;
    left: 0;
    right: 0;
    padding: 0 16px;
    /* 原本 top-bar 的左右 padding 放這裡也可以 */
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* top-bar 跟 cms-card 的距離 */
    pointer-events: none;
    /* 如果你想讓地圖可點，把點擊權下放到子元素 */
}

.top-bar {
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    /* 空白區塊不擋地圖點擊；互動元件由子層承接 */
    pointer-events: none;
}

.top-left {
    flex: 0 0 auto;
    align-self: flex-start;
    width: min(var(--top-left-width), calc(100vw - 32px));
}

.top-center {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    align-self: flex-start;
    padding-top: 4px;
}

.top-right {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-left: auto;
    pointer-events: auto;
    align-self: flex-start;
    margin-top: 4px;
}

.update-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.85);
    padding: 6px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.update-time {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.btn-update {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 2px 6px;
    border: none;
    border-radius: 20px;
    background: #4a7bdb;
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    white-space: nowrap;
}

.btn-update:hover {
    background: #3a68c4;
    box-shadow: 0 4px 12px rgba(74, 123, 219, 0.3);
}

.btn-update:active {
    transform: translateY(1px);
}

.btn-update i {
    font-size: 12px;
    transition: transform 0.6s ease-in-out;
}

.btn-update.loading i {
    animation: spin 1s linear infinite;
}

/* 獨立方向選擇器浮動容器 */
.direction-selector-float {
    position: absolute;
    top: 65px;
    right: 16px;
    z-index: 100;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

/* 天氣資訊卡片 */
.weather-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 999px;
    padding: 3px 8px;
    border: 1px solid #ddd;
    flex: 0 0 auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.weather-icon {
    font-size: 20px;
    color: #ff9500;
    flex: 0 0 auto;
}

.weather-temp {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    flex: 0 0 auto;
}

.weather-temp span {
    font-size: 14px;
    font-weight: 700;
}

/* 方向選擇器 */
.direction-selector {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.95);
    width: 35px;
    flex: 0 0 auto;
}

.dir-btn {
    flex: 1;
    padding: 6px 10px;
    border: none;
    border-bottom: 1px solid #ccc;
    background: transparent;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    min-height: 32px;
    font-weight: 700;
}

.dir-btn:last-child {
    border-bottom: none;
}

.dir-btn:hover {
    background: #f0f1f5;
    color: #333;
}

.dir-btn.active {
    background: #4a7bdb;
    color: white;
}

.card-area {
    position: relative;
    align-self: flex-start;
    /* 置中；要靠左就用 flex-start */
    width: min(var(--top-left-width), calc(100vw - 32px));
    /* 卡片區寬度，可自己調整 */
    max-height: 70vh;
    /* 超過這個高度就開始捲動 */
    padding: 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    /* 垂直捲動 */
    pointer-events: auto;
    /* 區塊內可以滑、可以點 */
    display: none;
}

#card_area::-webkit-scrollbar {
    /* Chrome/Edge/Safari */
    width: 0;
    height: 0;
}

.card-area.show {
    display: block;
}

/* 捲動條美化（可選） */
.card-area::-webkit-scrollbar {
    width: 6px;
}

.card-area::-webkit-scrollbar-track {
    background: transparent;
}

.card-area::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 999px;
}

/* ====== 單筆 info-card ====== */
.info-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    font-size: 13px;
    color: #333;
    margin: 10px 0px;
}

.info-card-body {
    padding: 8px 12px;
    position: relative;
}

.info-cctv {
    position: absolute;
    margin-left: auto;
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
    justify-self: right;
    transform: translateY(-40px);
}

.info-title {
    text-align: center;
    border-radius: 12px 12px 0 0;
    padding: 8px 12px;
    font-weight: 600;
    color: #fff;
    /* 跟 CMS 主色呼應 */
}

.info-title.red {
    background-color: darkred;
}

.info-title.pink {
    background-color: deeppink;
}

.info-title.purple {
    background-color: rebeccapurple;
}

.info-title.brown {
    background-color: saddlebrown;
}

.info-title.organge {
    background-color: #D45C00;
}

.info-title.skyblue {
    background-color: skyblue;
}

.info-title.blue {
    background-color: #2B2679;
}

.info-title.green {
    background-color: seagreen;
}

.info-title.darkgreen {
    background-color: #00783C;
}

.info-title.gray {
    background-color: #5C5C5C;
}

/* 讓圖+字垂直置中 */
.info-card .info-title span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* 取代 margin-right */
}

/* 共用 icon 外觀 */
.info-card .info-title span::before {
    content: "";
    display: inline-block;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
}

/* 各顏色/種類指定不同圖 */
.info-title.blue span::before {
    background-image: url("../image/icons/service_card.png");
}


/* 每一行文字 */
.info-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 4px;
}

.info-label {
    flex: 0 0 88px;
    width: 88px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.info-value {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.4;
}

.scroll-btn {
    position: sticky;
    bottom: 8px;
    left: 100%;
    transform: translateX(-50%);
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
    display: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
    background: #fff;
    z-index: 10;
}

.scroll-btn.down::before {
    content: "▾";
    font-size: 18px;
    line-height: 34px;
    display: block;
    text-align: center;
}

.scroll-btn.up::before {
    content: "▴";
    font-size: 18px;
    line-height: 34px;
    display: block;
    text-align: center;
}



.top-left,
.top-right {
    /*display: flex;*/
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    pointer-events: auto;
}

.top-left {
    flex: 0 0 auto;
    align-self: flex-start;
    width: min(var(--top-left-width), calc(100vw - 32px));
}


/* 共同的 icon 樣式 */
.top-center .btn-icon::before,
.top-right .btn-icon::before {
    content: "";
    width: 26px;
    height: 20px;
    /* 預設高度 */
    flex-shrink: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-bottom: 1px;
}

/* ---- 各按鈕預設圖 ---- */
.top-center .btn-icon.jam::before,
.top-right .btn-icon.jam::before {
    background-image: url("../image/icons/jam.png");
}

.top-center .btn-icon.ntf::before,
.top-right .btn-icon.ntf::before {
    background-image: url("../image/icons/ntf.png");
    height: 17px;
    /* ntf 比較矮 */
}

.top-center .btn-icon.construction::before,
.top-right .btn-icon.construction::before {
    background-image: url("../image/icons/construction.png");
    height: 17px;
    /* construction 比較矮 */
}

.top-center .btn-icon.cms::before,
.top-right .btn-icon.cms::before {
    background-image: url("../image/icons/cms.png");
    height: 17px;
    /* construction 比較矮 */
}

.top-center .btn-icon.cctv::before,
.top-right .btn-icon.cctv::before {
    background-image: url("../image/icons/CCTV_default.png");
}

.top-center .btn-icon.detour::before,
.top-center .btn-icon.alter::before,
.top-right .btn-icon.alter::before,
.top-right .btn-icon.detour::before {
    background-image: url("../image/icons/detour.png");
}

.top-center .btn-icon.shoulder::before,
.top-right .btn-icon.shoulder::before {
    background-image: url("../image/icons/shoulder.png");
}

.top-center .btn-icon.service::before,
.top-right .btn-icon.service::before {
    background-image: url("../image/icons/service.png");
}

.top-center .btn-icon.wthr::before,
.top-right .btn-icon.wthr::before {
    background-image: url("../image/icons/weather.png");
}

.top-center .btn-icon.prev::before,
.top-right .btn-icon.prev::before {
    background-image: url("../image/icons/preview.png");
}


/* ---- select 狀態：統一 icon 放大 ---- */
.top-center .btn-icon.select::before,
.top-right .btn-icon.select::before {
    height: 26px;
}

/* select 狀態替換圖片 */
.top-center .btn-icon.jam.select::before,
.top-right .btn-icon.jam.select::before {
    background-image: url("../image/icons/jam_select.png");
}

.top-center .btn-icon.ntf.select::before,
.top-right .btn-icon.ntf.select::before {
    background-image: url("../image/icons/ntf_select.png");
}

.top-center .btn-icon.construction.select::before,
.top-right .btn-icon.construction.select::before {
    background-image: url("../image/info/mkr_const.png");
}

.top-center .btn-icon.cms.select::before,
.top-right .btn-icon.cms.select::before {
    background-image: url("../image/icons/cms_select.png");
}

.top-center .btn-icon.cctv.select::before,
.top-right .btn-icon.cctv.select::before {
    background-image: url("../image/icons/CCTV_select.png");
}

.top-center .btn-icon.detour.select::before,
.top-center .btn-icon.alter.select::before,
.top-right .btn-icon.alter.select::before,
.top-right .btn-icon.detour.select::before {
    background-image: url("../image/icons/detour_select.png");
}

.top-center .btn-icon.shoulder.select::before,
.top-right .btn-icon.shoulder.select::before {
    background-image: url("../image/icons/shoulder_select.png");
}

.top-center .btn-icon.service.select::before,
.top-right .btn-icon.service.select::before {
    background-image: url("../image/icons/service_select.png");
}

.top-center .btn-icon.wthr.select::before,
.top-right .btn-icon.wthr.select::before {
    background-image: url("../image/icons/weather_select.png");
}

.top-center .btn-icon.prev.select::before,
.top-right .btn-icon.prev.select::before {
    background-image: url("../image/icons/preview_select.png");
}

.btn,
.icon-btn {
    border: none;
    outline: none;
    cursor: pointer;
    border-radius: 999px;
    height: 32px;
    padding: 0 14px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    /* box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16); */
    transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
    white-space: nowrap;
}

.btn:hover,
.icon-btn:hover {
    background: #f3f4f7;
}

.btn:active,
.icon-btn:active {
    transform: translateY(1px);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.12);
}

.icon-btn {
    width: 30px;
    padding: 0;
    border-radius: 50%;
}

.hamburger {
    position: relative;
    width: 17px;
    height: 14px;
}

.hamburger span {
    position: absolute;
    left: 0;
    right: 0;
    height: 2.5px;
    background: #333;
    border-radius: 999px;
}

.hamburger span:nth-child(1) {
    top: 0;
}

.hamburger span:nth-child(2) {
    top: 6px;
}

.hamburger span:nth-child(3) {
    top: 12px;
}

.search-wrapper {
    position: relative;
    z-index: 60;
    /* 比地圖高，確保蓋得住 */
}

.search-box {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 16px;
    border-radius: 20px;
    background: #ffffff;
    height: 40px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
    width: 100%;
    transition: border-radius 0.15s ease, box-shadow 0.15s ease;
}

/* 面板開啟時（含行程預測模式），搜尋框底部角變方，與面板拼接 */
.search-wrapper:has(.search-panel.open) .search-box,
.search-wrapper:has(.search-panel.forecast-mode) .search-box {
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.10);
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    flex: 1;
    min-width: 0;
}

.search-box a {
    height: 60%
}

/* 搜尋面板（與搜尋框拼接為一張卡片） */
.search-panel {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    background: #ffffff;
    border-radius: 0 0 20px 20px;
    border-top: 1px solid #f0f0f0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
    padding: 0 10px;
    visibility: hidden;
    opacity: 0;
    transition: max-height 0.2s ease, opacity 0.15s ease, padding 0.15s ease, visibility 0s linear 0.2s;
    pointer-events: none;
}

.search-panel.open {
    max-height: 520px;
    overflow-y: auto;
    padding: 6px 10px 12px;
    visibility: visible;
    opacity: 1;
    transition: max-height 0.2s ease, opacity 0.15s ease, padding 0.15s ease, visibility 0s linear 0s;
    pointer-events: auto;
}

/* 標題（例如：車站） */
.search-panel-header {
    padding: 4px 4px 8px;
    font-size: 14px;
    border-bottom: 1px solid #e3e4ea;
    margin-bottom: 4px;
}

/* 每一筆搜尋結果 */
.search-result-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 4px;
    gap: 8px;
    cursor: pointer;
}

.search-result-item+.search-result-item {
    border-top: 1px solid #f0f1f5;
}

.search-result-item:hover {
    background: #f6f7fb;
    border-radius: 8px;
}



.result-icon {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    margin-top: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(14, 20, 35, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: linear-gradient(135deg, #f4f7ff, #e9f0ff);
    color: #2f5fd0;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.result-icon i {
    font-size: 14px;
    line-height: 1;
}

.search-result-item:hover .result-icon {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 6px 14px rgba(14, 20, 35, 0.2);
    filter: saturate(1.1);
}

.result-icon.icon-neutral {
    background: linear-gradient(135deg, #f0f4fb, #e4ebf8);
    color: #4a5568;
}

.result-icon.icon-blue {
    background: linear-gradient(135deg, #e7f0ff, #d8e7ff);
    color: #1d4ed8;
}

.result-icon.icon-cyan {
    background: linear-gradient(135deg, #dff8ff, #cff4ff);
    color: #0f7090;
}

.result-icon.icon-indigo {
    background: linear-gradient(135deg, #ecebff, #dfddff);
    color: #4338ca;
}

.result-icon.icon-violet {
    background: linear-gradient(135deg, #f2ebff, #e9ddff);
    color: #7c3aed;
}

.result-icon.icon-slate {
    background: linear-gradient(135deg, #eef2f7, #e2e8f0);
    color: #334155;
}

.result-icon.icon-green {
    background: linear-gradient(135deg, #e6f9e8, #d6f4da);
    color: #15803d;
}

.result-icon.icon-emerald {
    background: linear-gradient(135deg, #dcfdf1, #cdf8ea);
    color: #047857;
}

.result-icon.icon-orange {
    background: linear-gradient(135deg, #fff2df, #ffe6c4);
    color: #c2410c;
}

.result-icon.icon-amber {
    background: linear-gradient(135deg, #fff7d8, #ffedb8);
    color: #b45309;
}

.result-icon.icon-rose {
    background: linear-gradient(135deg, #ffe7ee, #ffd7e3);
    color: #be185d;
}

.result-icon.icon-red {
    background: linear-gradient(135deg, #ffe5e5, #ffd6d6);
    color: #b91c1c;
}

.result-text {
    flex: 1;
}

.result-title {
    font-size: 14px;
    margin-bottom: 2px;
}

.result-sub {
    font-size: 12px;
    color: #777;
}

/* 搜尋面板：提示文字 */
.search-result-hint {
    padding: 12px 8px;
    font-size: 13px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-history-header {
    padding: 8px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 2px;
}

/* 搜尋面板：交流道結果卡片 */
.search-ic-result {
    padding: 12px 8px 8px;
}

.ic-result-name {
    font-size: 16px;
    font-weight: 700;
    color: #3730a3;
    margin-bottom: 4px;
}

.ic-result-name i {
    color: #667eea;
    margin-right: 4px;
}

.ic-result-name-current {
    color: #0f766e;
}

.ic-result-name-current i {
    color: #0f766e;
}

.ic-result-dist {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
}

.ic-result-divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.16), rgba(15, 118, 110, 0.16));
    margin: 12px 0;
}

.ic-route-summary {
    margin: 8px 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8faff, #f2f8ff);
    border: 1px solid #dde7ff;
}

.ic-route-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #1d4ed8;
    margin-bottom: 8px;
}

.ic-route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ic-route-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 11px;
    font-weight: 700;
}

.ic-route-chip-primary {
    background: #dbeafe;
    color: #1d4ed8;
}

.ic-route-chip-success {
    background: #dcfce7;
    color: #166534;
}

.ic-route-note {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}

/* ── Route Step Timeline ───────────────────────────────── */
.ic-route-steps {
    margin: 10px 0 4px;
    padding: 6px 0 2px 4px;
    max-height: 220px;
    overflow-y: auto;
    border-top: 1px solid #dde7ff;
}

.ic-step-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}

.ic-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3b82f6;
    border: 2px solid #93c5fd;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.ic-step-node-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: #1e40af;
    flex: 1;
}

.ic-step-road {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin-left: 8px;
}

.ic-step-vline {
    width: 4px;
    height: 22px;
    background: linear-gradient(to bottom, #3b82f6 0%, #6366f1 100%);
    border-radius: 2px;
    flex-shrink: 0;
}

.ic-step-road-name {
    font-size: 0.72rem;
    color: #475569;
    flex: 1;
}

.ic-step-road-km {
    font-size: 0.68rem;
    font-weight: 700;
    color: #2563eb;
    background: rgba(59, 130, 246, 0.1);
    padding: 1px 6px;
    border-radius: 8px;
    white-space: nowrap;
}

.ic-step-weather {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.67rem;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 1px 6px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.ic-step-road-badge {
    font-size: 0.67rem;
    font-weight: 700;
    color: #1e40af;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    padding: 1px 6px;
    border-radius: 5px;
    white-space: nowrap;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* ── Route Stats Row ─────────────────────────────────── */
.ic-route-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    /*margin-top: 10px;*/
    padding-top: 1px;
    /*border-top: 2px solid #e2e8f0;*/
}

.ic-route-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: #475569;
}

.ic-route-stat-item i {
    color: #64748b;
    font-size: 0.72rem;
}

.ic-route-stat-item b {
    color: #1e293b;
    font-weight: 700;
}

.ic-result-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ic-map-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    transition: opacity 0.15s;
}

.ic-map-link:hover {
    opacity: 0.85;
}

.ic-google {
    background: #4285f4;
}

.ic-apple {
    background: #1d1d1f;
}

.ic-direction-badge {
    display: inline-flex;
    align-items: center;
    background: #3730a3;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    margin-left: 6px;
    vertical-align: middle;
}

.ic-duration-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #059669;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    margin-left: 4px;
    vertical-align: middle;
}

mark {
    background: #fef08a;
    border-radius: 2px;
    padding: 0 1px;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #009245, #f8e71c, #f5a623, #d0021b);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.top-small-text {
    font-size: 12px;
    color: #666;
}

/* 左側選單 */
.side-menu {
    position: absolute;
    top: 26px;
    left: 0;
    bottom: 0;
    width: 260px;
    background: #ffffff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.25);
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
    z-index: 25;
    display: flex;
    flex-direction: column;
}

.side-menu.open {
    transform: translateX(0);
}

.side-header {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid #e3e5ec;
    font-weight: 600;
    font-size: 16px;
}

/* 菜單項目列表 */
.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 菜單項目基礎樣式 */
.menu-item {
    padding: 12px 16px;
    margin: 4px 8px;
    cursor: pointer;
    color: #333;
    font-size: 16px;
    display: flex;
    align-items: center;
    position: relative;
    border-radius: 20px;
    transition: all 0.2s ease;
}

/* 懸停效果 - pill 樣式 */
.menu-item:hover {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
    box-shadow: 0 2px 8px rgba(74, 123, 219, 0.15);
    transform: translateX(4px);
}

/* 圖標樣式 */
.menu-icon {
    margin-right: 15px;
    width: 24px;
    text-align: center;
    color: #555;
}

/* 特別針對 '即時路況' 的強調樣式 */
.current-selected {
    background-color: #e0f0ff;
    color: #1a73e8;
    font-weight: bold;
    border-radius: 4px;
    padding-left: 10px;
    width: calc(100% - 40px);
}

.menu-link {
    display: flex;
    text-decoration: none;
    color: inherit;
    width: 100%
}

/* ============================================================ */
/* SideBar---Start
/* ============================================================ */
.group-header {
    font-weight: bold;
    color: #333;
}

/* 展開/收合箭頭 */
.toggle-icon {
    margin-left: auto;
    transition: transform 0.3s;
}

/* 當子菜單展開時，箭頭旋轉 180 度 */
.group-header.active .toggle-icon i {
    transform: rotate(-90deg);
}

/* 子菜單容器 */
.sub-menu {
    list-style: none;
    padding: 4px 0 4px 18px;
    margin: 0 0 0 36px;
    position: relative;
    /* ← 確保 overflow 裁切 ::before */
    /* ↓ 移除 border-left，改由 ::before 控制 */
    max-height: 300px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.sub-menu.collapsed {
    max-height: 0;
    opacity: 0;
    /* ↓ 不再需要 border-left: none */
}

/* 子菜單項目 */
.sub-menu-item {
    padding: 8px 0px;
    margin: 2px 8px;
    font-size: 15px;
    color: #555;
    cursor: pointer;
    position: relative;
    border-radius: 16px;
    transition: all 0.2s ease;
}

/* L 形彎曲連接線 */
.sub-menu-item::before {
    content: '';
    position: absolute;
    left: -27px;
    top: -9999px;
    /* ← 向上無限延伸，被 overflow:hidden 裁切 */
    bottom: 50%;
    /* ← 每項都在自己的垂直中心停止 */
    width: 16px;
    border-left: 2px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    border-bottom-left-radius: 8px;
    background: none;
    height: auto;
}

.sub-menu-item a:hover {
    color: #28a745;
    background-color: rgba(40, 167, 69, 0.08);
    transform: translateX(4px);
}

.sub-menu-item a {
    color: inherit;
    text-decoration: none;
    display: block;
    padding: 4px 8px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.sub-menu-item a:hover {
    color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

.side-footer {
    margin-top: auto;
    padding: 10px 16px 16px;
    font-size: 12px;
    color: #999;
}

.menu-link.active,
.sub-menu-item a.active {
    background-color: #e8f5e9;
    color: #218838;
    font-weight: 500;
    border-left: 4px solid #28a745;
    padding-left: calc(1em - 3px);
    border-radius: 12px;
    padding: 4px 16px;
}

/* ============================================================ */
/* SideBar---Start
/* ============================================================ */


/* 更多資訊 dropdown */
.more-menu {
    position: fixed;
    /* 改成固定在視窗，方便對齊按鈕 */
    width: 160px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
    padding: 8px 0;
    font-size: 14px;
    z-index: 40;
    display: none;
}

.more-menu.open {
    display: block;
}

.more-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 1px solid #e6e6e6;
    /* 下邊線 */
}

/* 最後一個不要線 */
.more-item:last-child {
    border-bottom: none;
}

/* 固定佔位，不跑版 */
.more-item::before {
    content: "";
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background-image: var(--icon, none);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform-origin: center;
    transition: transform .15s ease, background-image .15s ease;
}

/* 選取：換圖 + 放大，但不改 width/height */
.more-item.select::before {
    background-image: var(--icon-selected, var(--icon));
    transform: scale(var(--icon-scale, 1.2));
}

/* 各功能只設定變數 */
.more-item.cctv {
    --icon: url("../image/icons/CCTV_default.png");
    --icon-selected: url("../image/icons/CCTV_select.png");
    --icon-scale: 1.25;
    /* 想更大就 1.3～1.5 */
}

.more-item.cms {
    --icon: url("../image/icons/CMS.png");
    --icon-selected: url("../image/icons/CMS_select.png");
    --icon-scale: 1.35;
}

    .more-item.detour,
    .more-item.alter {
        --icon: url("../image/icons/detour.png");
        --icon-selected: url("../image/icons/detour_select.png");
        --icon-scale: 1.35;
    }

.more-item.shoulder {
    --icon: url("../image/icons/shoulder.png");
    --icon-selected: url("../image/icons/shoulder_select.png");
    --icon-scale: 1.35;
}

.more-item.service {
    --icon: url("../image/icons/service.png");
    --icon-selected: url("../image/icons/service_select.png");
    --icon-scale: 1.35;
}

.more-item.wthr {
    --icon: url("../image/icons/weather.png");
    --icon-selected: url("../image/icons/weather_select.png");
    --icon-scale: 1.35;
}

.more-item.prev {
    --icon: url("../image/icons/preview.png");
    --icon-selected: url("../image/icons/preview_select.png");
    --icon-scale: 1.35;
}

.more-item.ntf {
    --icon: url("../image/icons/ntf.png");
    --icon-selected: url("../image/icons/ntf_select.png");
    --icon-scale: 1.35;
}

.more-item.construction {
    --icon: url("../image/icons/construction.png");
    --icon-selected: url("../image/icons/construction_select.png");
    --icon-scale: 1.35;
}

.more-item.jam {
    --icon: url("../image/icons/jam.png");
    --icon-selected: url("../image/icons/jam_select.png");
    --icon-scale: 1.35;
}

.more-item:hover {
    background: #f4f5f9;
}

.more-item-icon {
    width: 25px;
    height: 20px;
    text-align: center;
    font-size: 18px;
    background-repeat: no-repeat;
}

.bottom-area {
    position: absolute;
    /* 如果要固定在下方中央就用這段 */
    left: 500px;
    bottom: 10px;
    transform: translateX(-50%);
    /* ---------------------------- */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* 速度圖例群組（兩個圖例並排） */
.speed-legend-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

/* 速度圖例膠囊條 */
.speed-legend {
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    padding: 4px 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif;
    z-index: 1;
    height: 64px;
    align-content: center;
}

.bottom-footer {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    padding: 5px 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif;
    font-size: 13px;
    white-space: nowrap;
    z-index: 1;
}

.bottom-footer a {
    color: #000;
    font-weight: 500;
    text-decoration: none;
    padding: 0 12px;
    /*line-height: 1.6;*/
}

/*.bottom-footer a + a {
    border-left: 1px solid #ccc;
}*/

.bottom-footer a:hover {
    color: #1a73e8;
    text-decoration: underline;
}


/* 即時影像面板 */
.camera-panel {
    display: none;
    /* ✅ 初始隱藏，完全不占空間 */
    position: absolute;
    right: 12px;
    bottom: 0;
    background: #ffffff;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
    border-radius: 12px;
    transform: translateY(100%);
    /* 初始位置在下方 */
    transition: all 1s ease-out;
    z-index: 35;
    width: 60vw;
    max-width: calc(100vw - 24px);
}

.camera-panel.open {
    display: block;
    /* ✅ 打開時顯示 */
    transform: translateY(0%);
    /* ✅ 滑動上來 */
}

.camera-panel.close {
    display: none;
    transform: translateY(100%);
}

.cam-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    background-color: steelblue;
    border-radius: 12px 12px 0 0;
    padding: 9px 14px 7px;
}

.cam-tabs {
    display: flex;
    gap: 8px;
}

.cam-tab {
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid #cfd3df;
    font-size: 13px;
    cursor: pointer;
    background: #1e88e5;
    color: #fff;
}

.cam-tab.active {
    border-color: #1e88e5;
    background: #f5f6fa;
    color: #555;
}

.cam-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    padding: 0 10px 10px;
    overflow: hidden;
}

.cam-card {
    min-width: 270px;
    max-width: 270px;
    border-radius: 10px;
    background: #f7f8fb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    font-size: 12px;
    flex-shrink: 0;
}

.cam-img {
    height: 185px;
    background: #000;
    /* 不一定要，純備用底色 */
    overflow: hidden;
    /* 避免圖片溢出 */
    cursor: pointer;
}

/* ★ 讓圖片填滿 cam-img 且維持比例裁切 */
.cam-img img {
    width: 100%;
    /* height: 100%; */
    object-fit: cover;
    /* 重要：等比例裁切填滿 */
    display: block;
    /* 移除 img 預設空隙 */
}

.cam-body {
    padding: 6px 8px 8px;
    background: #ffffff;
}

.cam-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    /* 垂直置中 icon + 文字 */
    gap: 4px;
    /* 圖片與文字的間距 */
}

.cam-meta {
    color: #888;
    font-size: 11px;
}

.cam-close {
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    color: #fff;
}

.cam-close img {
    height: 100%;
}

/* 右側地圖控制（定位 + 放大縮小） */
.map-control {
    position: absolute;
    right: 18px;
    bottom: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 20;
}

.circle-btn {
    width: 34px;
    height: 34px;
    border-radius: 30%;
    border: none;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    /*font-size: 18px;*/
    flex: 0 0 auto;
    padding: 5px;
}

.zoom-box {
    width: 34px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.zoom-btn {
    border: none;
    background: #ffffff;
    cursor: pointer;
    height: 32px;
    font-size: 20px;
}

.zoom-divider {
    height: 1px;
    background: #e2e3e9;
    margin: 0 4px;
}

/* 右下角 即時影像 pill */
.cam-toggle {
    position: absolute;
    right: 18px;
    bottom: 16px;
    z-index: 20;
}

.cam-toggle-btn {
    border: none;
    border-radius: 22px;
    padding: 8px 14px;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}

.cam-icon {
    font-size: 16px;
}

.cam-text {
    margin-right: 4px;
}

.cam-arrow {
    font-size: 14px;
    color: #555;
}

/* 遮罩 */
.overlay {
    position: absolute;
    inset: 26px 0 0 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 22;
    display: none;
}

.overlay.show {
    display: block;
}

#pLevelBarBar {
    display: none;
}





/* 服務區popup修改 - start */
span.srv_icon {
    display: inline-block;
    height: 28px;
    width: 28px;
    background: url("../image/service_area/srv_food.png") no-repeat center center;
    background-size: 100% 100%;
    margin: 0 3px;
}

span.srv_icon.srv_toilet {
    background-image: url("../image/service_area/srv_toilet.png");
}

span.srv_icon.srv_gas {
    background-image: url("../image/service_area/srv_gas.png");
}

span.srv_icon.srv_rest {
    background-image: url("../image/service_area/srv_rest.png");
}

span.srv_icon.srv_pray {
    background-image: url("../image/service_area/srv_pray.png");
}

span.srv_icon.srv_charger {
    background-image: url("../image/service_area/srv_charger.png");
}

span.srv_icon.srv_vendor {
    background-image: url("../image/service_area/srv_vendor.png");
}

span.srv_icon.hide {
    display: none;
}

.msgbox_weather_icon {
    width: 26px;
    vertical-align: middle;
}

/* 服務區popup修改 - end */


/* file: _gis_charge */
.charge_box_wrapper {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: stretch;
    -ms-flex-align: stretch;
    align-items: stretch;
    -webkit-box-pack: start;
    -ms-flex-pack: start;
    justify-content: flex-start;
    margin-top: 8px;
    margin-bottom: 16px;
}

.charge_box {
    width: 80px;
    border-radius: 8px;
    border: 1px solid #aaa;
    background-color: #ebf4d7;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    font-size: 13px;
    margin-right: 10px;
}

span.charge_bigger_font {
    font-size: 16px;
    padding-left: 4px;
}

.charge_available,
.charge_total,
.charge_col_left {
    width: 100%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.charge_col_left {
    color: #666;
    border-bottom: 1px solid #aaa;
}

.charge_available {
    color: #00783c;
    border-bottom: 1px solid #aaa;
}

.charge_total {
    color: #666;
}


/* ============================================================ */
/*                     服務區                                   */
/* ============================================================ */
p.msg_in_gas,
p.msg_in_charger,
p.msg_in_cctvtitle {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: start;
    -ms-flex-pack: start;
    justify-content: flex-start;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dotted #8dc21f;
}


hr {
    margin: 16px 0;
}


@media (max-width: 768px) {

    .top-bar {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 6px;
    }

    .search-box {
        width: calc(100vw - 32px);
    }

    .top-center {
        order: 2;
        width: auto;
        flex: 1;
        gap: 4px;
        margin-top: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        /* 按鈕超出時可水平滑動 */
        scrollbar-width: none;
    }

    .top-center::-webkit-scrollbar {
        display: none;
    }

    .top-center .btn {
        padding: 0 6px;
        font-size: 11px;
        height: 26px;
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .top-right {
        order: 3;
        margin-left: 0;
        gap: 4px;
        width: auto;
    }

    .update-info {
        padding: 4px 8px;
        gap: 4px;
        font-size: 9px;
        white-space: nowrap;
    }

    .update-time {
        font-size: 9px;
    }

    .btn-update {
        padding: 1px 3px;
        font-size: 9px;
    }

    /* === 方向選擇器 === */
    .direction-selector-float {
        top: 90px;
        right: 8px;
    }

    .direction-selector {
        min-width: 30px;
    }

    .dir-btn {
        padding: 5px 8px;
        min-height: 26px;
        font-size: 11px;
    }

    /* === 天氣資訊：縮小尺寸 === */
    .weather-info {
        padding: 0px 6px;
        gap: 1px;
    }

    .weather-icon {
        font-size: 16px;
    }

    .weather-temp {
        font-size: 11px;
    }

    .weather-temp span {
        font-size: 12px;
    }

    /* === 速度圖例：限制圖片大小，圖例堆疊 === */
    .bottom-area {
        left: 25%;
        bottom: 25px;
        transform: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .speed-legend {
        padding: 3px 10px;
    }

    .speed-legend img {
        max-width: calc(40vw);
        /* 防止超出螢幕 */
        height: auto;
        display: block;
    }

    /* === 卡片區：自適應寬度 === */
    .card-area {
        width: min(var(--top-left-width), calc(100vw - 32px));
        max-width: var(--top-left-width);
    }

    /* === 底部圖例：移到左側，避免被 cam-toggle 遮住 === */
    /* .bottom-area {
        left: 16px;
        bottom: 70px;
        transform: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }*/

    /* === 地圖控制：避免被 camera-panel 遮住 === */
    .map-control {
        bottom: 80px;
    }

    /* === 即時影像按鈕：往上移，避免與 floating-footer 重疊 === */
    .cam-toggle {
        right: 8px;
    }

    /* === 更多資訊選單位置修正 === */
    .more-menu {
        right: 8px;
        left: auto;
        max-width: calc(100vw - 16px);
    }

    /* === 側邊欄寬度 === */
    .side-menu {
        width: 80%;
    }

    /* === 即時影像按鈕：隱藏文字，只保留圖示 === */
    .cam-toggle-btn .cam-text {
        display: none;
    }
}

@media (max-width: 1024px) {
    .camera-panel {
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        border-radius: 12px 12px 0 0;
    }

    .top-center {
        gap: 6px;
        flex-wrap: wrap;
    }

    .top-center .btn {
        padding: 0 10px;
        font-size: 12px;
        height: 28px;
    }

    /* 底部圖例重新置中 */
    /*    .bottom-area {
        left: 50%;
        transform: translateX(-50%);
    }*/
}

/* ====== Card Area 收折 ====== */
.card-area-wrapper {
    display: flex;
    align-items: flex-start;
    pointer-events: none;
    /* ← wrapper 本身不擋點擊 */
}

/* 收折按鈕：預設隱藏，card-area 有 .show 才顯示 */
.card-collapse-btn {
    display: none;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 24px;
    width: 30px;
    min-height: 40px;
    background: rgba(255, 255, 255, 0.6);
    border: none;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background 0.2s;
    z-index: 10;
    pointer-events: auto;
    font-size: 20px
}

.card-collapse-btn:hover {
    background: #ececec;
}

.card-area-wrapper:has(.card-area.show) .card-collapse-btn {
    display: flex;
}

.card-area-wrapper.collapsed .card-area {
    display: none !important;
}

.card-area-wrapper.collapsed .card-collapse-btn {
    display: flex;
    border-radius: 8px;
}

.card-collapse-btn i {
    transition: transform 0.3s ease;
    pointer-events: none;
}

.card-area-wrapper.collapsed .card-collapse-btn i {
    transform: rotate(180deg);
}
