/* search-panel.css — 包車搜尋面板（照 charter .search-panel，改用橙色主色 #ed8323 + 12px 圓角）
   全部規則前綴 .csp，可與原 twig 版面共存 */
.csp, .csp *, .csp *::before, .csp *::after { box-sizing: border-box; }
/* hidden 屬性要壓過元件嘅 display 設定 */
.csp [hidden] { display: none !important; }

.csp {
    --csp-main: #ed8323;
    --csp-main-dark: #d9711a;
    --csp-soft: #fff3e8;
    --csp-line: #e6e6e6;
    --csp-ink: #212121;
    --csp-muted: #757575;
    --csp-r: 12px;
    margin: 24px 0;
}
.csp__panel {
    background: #fff;
    border: 1px solid var(--csp-line);
    border-radius: var(--csp-r);
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .06);
}
.csp__tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.csp__tab {
    padding: 9px 20px;
    border: 1px solid var(--csp-line);
    border-radius: var(--csp-r);
    background: #fff;
    color: #555;
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.csp__tab:hover, .csp__tab:focus { border-color: var(--csp-main); color: var(--csp-main); }
.csp__tab.is-active { background: var(--csp-main); border-color: var(--csp-main); color: #fff; font-weight: 700; }

.csp__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.csp__pair { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.csp__pair.is-single { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 767px) { .csp__pair { grid-template-columns: minmax(0, 1fr); } }
.csp__field { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.csp__field label { font-size: 12px; color: var(--csp-muted); line-height: 1.4; }
.csp__field input,
.csp__field select {
    width: 100%;
    height: 46px;
    padding: 0 12px;
    border: 1px solid var(--csp-line);
    border-radius: var(--csp-r);
    background-color: #fff;
    color: var(--csp-ink);
    font-size: 15px;
    line-height: 22px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
    -webkit-appearance: none;
    appearance: none;
}

/* 日期／時間：用自繪日曆圖示，四種圖示同一尺寸與右距 */
.csp__field input[type="datetime-local"]::-webkit-calendar-picker-indicator { display: none; }
.csp__field input[type="datetime-local"] { padding-right: 44px; }

/* 日期／時間、數字欄：同高度，避免同排高低不平 */
.csp__field input[type="datetime-local"],
.csp__field input[type="number"] { height: 46px; padding: 0 10px; }
.csp__field input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; }
.csp__field input[type="number"]::-webkit-inner-spin-button { height: 30px; }

/* 車型下拉：自訂箭嘴，避免 iOS／Android 原生樣式與其他欄位不一致 */
.csp__field select {
    padding: 0 34px 0 12px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cpath d='M7 9.5 11 13.5l4-4' fill='none' stroke='%23757575' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 22px 22px;
}
.csp__field input:focus,
.csp__field select:focus { border-color: var(--csp-main); box-shadow: 0 0 0 3px rgba(237, 131, 35, .15); }
.csp__field input, .csp__field select { text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.csp__field { min-width: 0; }
.csp__field input[readonly] { cursor: pointer; background: #fafafa; }
/* 建議清單（自建，跟隨元件樣式；AMap 內建清單唔用） */
.csp__sug {
    position: absolute;
    z-index: 40;
    top: calc(100% - 4px);
    left: 0;
    right: auto;
    min-width: 100%;
    width: 280px;
    max-width: 360px;
    max-height: 264px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--csp-line);
    border-radius: var(--csp-r);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .14);
}
.csp__sug li { padding: 9px 10px; border-radius: 8px; font-size: 13.5px; line-height: 1.45; color: var(--csp-ink); cursor: pointer; }
.csp__sug li + li { margin-top: 2px; }
.csp__sug li:hover, .csp__sug li.is-active { background: var(--csp-soft); }
.csp__sug-name { display: block; }
.csp__sug-sub { display: block; margin-top: 2px; font-size: 11.5px; color: var(--csp-muted); }
.csp__sug-empty { cursor: default; color: var(--csp-muted); }
.csp__sug-empty:hover { background: transparent; }

/* 欄位提示（唔靠 placeholder 講清楚操作） */
.csp__hint { display: flex; align-items: flex-start; gap: 6px; margin: 10px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--csp-muted); }
.csp__hint .fa { margin-top: 2px; color: var(--csp-main); }

.csp__field--link input { padding-right: 34px; }
.csp__field--link i,
.csp__field--link .csp__link-arrow {
    position: absolute;
    right: 12px;
    bottom: 0;
    width: 22px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--csp-main);
    font-size: 18px;
    pointer-events: none;
}
.csp__field--link .csp__link-arrow svg { display: block; }

/* 只顯示當前 charter-type 嘅欄位 */
.csp[data-type="oneway"] .csp__field[data-csp-for="roundtrip"],
.csp[data-type="oneway"] .csp__field[data-csp-for="rental"],
.csp[data-type="roundtrip"] .csp__field[data-csp-for="rental"],
.csp[data-type="rental"] .csp__field[data-csp-for="roundtrip"] { display: none; }

.csp__mid {
    margin-top: 12px;
    padding: 14px;
    background: var(--csp-soft);
    border: 1px solid #ffd9b8;
    border-radius: var(--csp-r);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}
.csp__mid[hidden] { display: none; }
.csp.is-mid-open .csp__grid,
.csp.is-mid-open .csp__submit { display: none; }
.csp__mid [data-csp-mid-done] { grid-column: 1 / -1; justify-self: end; }

.csp__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--csp-r);
    border: 0;
    font-size: 15px;
    cursor: pointer;
}
.csp__btn--ghost { background: #fff; border: 1px solid var(--csp-main); color: var(--csp-main); }
.csp__btn--ghost:hover, .csp__btn--ghost:focus { background: var(--csp-soft); }

.csp__submit {
    width: 100%;
    margin-top: 16px;
    padding: 13px 20px;
    border: 0;
    border-radius: var(--csp-r);
    background: var(--csp-main);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .5px;
    cursor: pointer;
    transition: background-color .2s ease;
}
.csp__submit:hover, .csp__submit:focus { background: var(--csp-main-dark); }

@media (min-width: 768px) {
    .csp__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .csp__mid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .csp__submit { max-width: 320px; }
}

/* ---------- 版面：表單 + 地圖（照 charter 原頁兩欄） ---------- */
.csp__layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.csp__map {
    position: relative;
    height: 460px;
    border: 1px solid var(--csp-line);
    border-radius: var(--csp-r);
    overflow: hidden;
    background: #f2f4f5;
}
.csp__map-canvas { width: 100%; height: 100%; min-height: 460px; }

.csp__btn--primary { background: var(--csp-main); border: 0; color: #fff; }
.csp__btn--primary:hover, .csp__btn--primary:focus { background: var(--csp-main-dark); color: #fff; }

@media (min-width: 992px) {
    .csp__layout { grid-template-columns: 480px minmax(0, 1fr); align-items: stretch; }
    .csp__map { height: auto; min-height: 460px; }
    .csp__map-canvas { min-height: 460px; }
}

/* 手機：建議清單跟輸入框同寬，避免超出畫面 */
@media (max-width: 767px) {
    .csp__sug { right: 0; width: auto; max-width: none; }
}

/* ---------- 欄位入口（地圖選點／清除） ---------- */
.csp__control { position: relative; display: flex; align-items: center; min-width: 0; }
.csp__control input { padding-right: 44px; text-overflow: ellipsis; }
.csp__pick, .csp__clear {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; color: var(--csp-muted); font-size: 14px; cursor: pointer;
}
.csp__pick { right: 12px; color: var(--csp-main); opacity: .85; }
.csp__pick:hover, .csp__pick:focus { opacity: 1; }
.csp__clear { right: 12px; }
.csp__pick:hover, .csp__pick:focus, .csp__clear:hover, .csp__clear:focus { background: var(--csp-soft); color: var(--csp-main); }
.csp__pick svg { display: block; width: 13px; height: 13px; }
/* 日期／時間：自繪日曆按鈕（避免同瀏覽器內建圖示重疊／遮住） */
.csp__date { z-index: 2; background: rgba(237, 131, 35, .10); border-radius: 8px; }
.csp__date:hover, .csp__date:focus { background: rgba(237, 131, 35, .20); }
.csp__control input[type="datetime-local"]::-webkit-calendar-picker-indicator { display: none; }
.csp__clear { font-size: 15px; line-height: 1; }
.csp__clear[hidden] { display: none; }

/* ---------- 熱門地點 chips ---------- */
.csp__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.csp__chips-label { font-size: 12px; color: var(--csp-muted); }
.csp__chip {
    padding: 6px 12px; border: 1px solid var(--csp-line); border-radius: 999px;
    background: #fff; color: var(--csp-ink); font-size: 12.5px; cursor: pointer;
}
.csp__chip:hover, .csp__chip:focus { border-color: var(--csp-main); color: var(--csp-main); background: var(--csp-soft); }
.csp__chip[disabled] { opacity: .55; cursor: default; }

/* 選點對話框（熱門地點＋地圖點擊共用） */
.csp__dlg {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(17, 24, 39, .45);
}
.csp__dlg[hidden] { display: none !important; }
.csp__dlg-card {
    width: 100%; max-width: 360px; padding: 18px 18px 16px;
    background: #fff; border-radius: var(--csp-r);
    box-shadow: 0 18px 40px rgba(17, 24, 39, .22);
}
.csp__dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.csp__dlg-title { font-size: 12.5px; font-weight: 700; color: var(--csp-muted); letter-spacing: .04em; }
.csp__dlg-close {
    width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: var(--csp-muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.csp__dlg-close:hover, .csp__dlg-close:focus { background: var(--csp-soft); color: var(--csp-main); }
.csp__dlg-place { margin: 8px 0 2px; font-size: 16px; font-weight: 700; color: var(--csp-ink); }
.csp__dlg-ask { margin: 0 0 14px; font-size: 12.5px; color: var(--csp-muted); }
.csp__dlg-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.csp__dlg-actions .csp__btn { width: 100%; justify-content: center; }
.csp__dlg-actions .csp__btn--ghost { grid-column: 1 / -1; }
.csp__dlg-actions .csp__btn[data-csp-choose-set="mid"] { grid-column: 1 / -1; }

/* ---------- 目標提示 pill（地圖左上） ---------- */
.csp__target {
    position: absolute; z-index: 6; top: 12px; left: 12px;
    display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 24px);
    padding: 6px 8px 6px 10px; border-radius: 999px;
    background: rgba(33, 33, 33, .88); color: #fff; font-size: 12.5px;
}
.csp__target span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csp__target button {
    width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .18); color: #fff; font-size: 11px; cursor: pointer;
}

/* 提示文字錯誤狀態 */
.csp__hint.is-error, .csp__hint.is-error .fa { color: #b42318; }

/* ---------- 全屏選點 sheet（手機） ---------- */
.csp__sheet { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; background: #fff; }
.csp__sheet[hidden] { display: none !important; }
.csp__sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--csp-line); }
.csp__sheet-title { font-size: 15px; font-weight: 700; color: var(--csp-ink); }
.csp__sheet-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--csp-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.csp__sheet-close:hover { background: var(--csp-soft); color: var(--csp-main); }
.csp__sheet-search { position: relative; display: flex; align-items: center; padding: 10px 16px; }
.csp__sheet-search input {
    width: 100%; min-height: 44px; padding: 0 14px;
    border: 1px solid var(--csp-line); border-radius: var(--csp-r); font-size: 14px; color: var(--csp-ink); outline: none;
}
.csp__sheet-search input:focus { border-color: var(--csp-main); box-shadow: 0 0 0 3px rgba(237, 131, 35, .15); }
.csp__sheet-search .csp__sug { top: calc(100% - 6px); left: 16px; right: 16px; width: auto; max-width: none; z-index: 60; }
.csp__sheet-map { position: relative; flex: 1 1 auto; min-height: 240px; background: #eef1f4; }
.csp__sheet-pin { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -100%); display: block; width: 30px; height: 30px; color: var(--csp-main); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35)); pointer-events: none; }
.csp__sheet-pin svg { display: block; width: 30px; height: 30px; }
.csp__sheet-hint {
    position: absolute; z-index: 3; left: 50%; top: calc(50% + 12px); transform: translateX(-50%);
    max-width: calc(100% - 32px); padding: 4px 10px; border-radius: 999px;
    background: rgba(33, 33, 33, .62); color: #fff; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none;
}
.csp__sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--csp-line); background: #fff; }
.csp__sheet-addr { min-height: 40px; margin-bottom: 10px; font-size: 13px; line-height: 1.5; color: var(--csp-ink); }
.csp__sheet-foot .csp__btn { width: 100%; }

@media (min-width: 768px) {
    .csp__sheet { display: none !important; }
}

/* 手機：欄位較寬，圖示加大方便點按 */
@media (max-width: 767px) {
    .csp__control input { padding-right: 52px; }
    .csp__pick, .csp__clear { width: 32px; height: 32px; border-radius: 8px; }
    .csp__pick { right: 12px; }
    .csp__clear { right: 12px; }
    .csp__pick svg { width: 15px; height: 15px; }
    .csp__clear { font-size: 17px; }
}

/* 手機：16px 避免 iOS focus 自動放大，控制項高度一致 */
@media (max-width: 767px) {
    .csp__field input, .csp__field select, .csp__control input { font-size: 16px; }
    .csp__field input, .csp__field select,
    .csp__field input[type="datetime-local"], .csp__field input[type="number"] { height: 48px; }
    .csp__control input { height: 48px; }
    .csp__field--link i, .csp__field--link .csp__link-arrow { height: 48px; width: 32px; }
    .csp__field select { background-size: 32px 32px; }
    .csp__field input[type="datetime-local"] { padding-right: 52px; }
}
