:root {
    --primary: #3264ff;
    --primary-dark: #2350d8;
    --orange: #ff6f00;
    --green: #06aebd;
    --text: #0f294d;
    --muted: #8592a6;
    --border: #dadfe6;
    --bg: #f5f7fa;
    --card: #fff;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
button { font: inherit; cursor: pointer; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn-primary {
    background: var(--primary); color: #fff; border: 0; border-radius: 6px;
    padding: 8px 20px; font-weight: 600;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
    border: 1px solid var(--primary); color: var(--primary); background: #fff;
    border-radius: 6px; padding: 6px 16px;
}

/* ---------- header ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { font-size: 20px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.main-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.main-nav a { color: var(--text); padding: 8px 10px; border-radius: 6px; white-space: nowrap; }
.main-nav a:hover { background: var(--bg); }
.main-nav a.active { color: var(--primary); font-weight: 600; background: #ebf0ff; }
.main-nav a.disabled { color: var(--muted); }
.header-right { display: flex; gap: 12px; align-items: center; white-space: nowrap; }

/* ---------- search bar ---------- */
.search-bar {
    display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap;
    background: #fff; padding: 16px; border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(15, 41, 77, .08);
}
.field { display: flex; flex-direction: column; flex: 1 1 160px; }
.field-sm { flex: 0 1 110px; }
.field span { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field select, .field input {
    height: 40px; border: 1px solid var(--border); border-radius: 6px; padding: 0 10px;
    font: inherit; color: var(--text); background: #fff;
}
.route-arrow { align-self: center; padding-top: 18px; color: var(--muted); }
.btn-search { height: 40px; padding: 0 32px; }

.hero {
    background: linear-gradient(135deg, #1d3c8f, #3264ff 60%, #50a5ff);
    color: #fff; padding: 48px 0 56px;
}
.hero h1 { margin: 0 0 4px; font-size: 32px; }
.hero-sub { margin: 0 0 24px; opacity: .85; }
.alert { background: #fff3f0; color: #d93a1d; border: 1px solid #ffc9bd; padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }

.search-strip { background: linear-gradient(135deg, #1d3c8f, #3264ff); padding: 16px 0; }

/* ---------- index ---------- */
.section-title { margin: 32px 0 16px; }
.route-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.route-card {
    background: #fff; border-radius: var(--radius); padding: 20px; color: var(--text);
    border: 1px solid var(--border); transition: box-shadow .15s;
}
.route-card:hover { box-shadow: 0 6px 20px rgba(15, 41, 77, .12); }
.route-name { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.route-name .arrow { color: var(--muted); }
.route-cta { margin-top: 12px; color: var(--primary); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 32px 0; text-align: center; }
.features p { margin: 4px 0 0; }

/* ---------- search result ---------- */
.page-title { font-size: 22px; margin: 20px 0 12px; }

.date-strip {
    display: flex; overflow-x: auto; background: #fff; border-radius: var(--radius);
    border: 1px solid var(--border); scrollbar-width: thin;
}
.date-cell {
    flex: 0 0 110px; border: 0; border-right: 1px solid var(--border); background: none;
    padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text);
}
.date-cell:last-child { border-right: 0; }
.date-cell:hover { background: var(--bg); }
.date-label { font-size: 12px; }
.date-price { font-weight: 600; }
.date-cell.cheapest .date-price { color: var(--green); }
.date-cell.selected { background: #ebf0ff; box-shadow: inset 0 -3px 0 var(--primary); }
.date-cell.selected .date-price { color: var(--primary); }

.result-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; margin: 16px 0 40px; align-items: start; }

.filters { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); padding: 4px 16px; position: sticky; top: 72px; }
.filter-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.filter-group { padding: 12px 0; border-bottom: 1px solid var(--border); }
.filter-group:last-child { border-bottom: 0; }
.filter-group h4 { margin: 0 0 8px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.check span { flex: 1; }
.check em { font-style: normal; color: var(--muted); font-size: 12px; }
.check input { accent-color: var(--primary); margin: 0; }

.result-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 12px; flex-wrap: wrap; }
.result-head strong { font-size: 16px; margin-right: 8px; }

.sort-tabs { display: flex; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 12px; }
.sort-tab {
    flex: 1; border: 0; background: none; padding: 10px; display: flex; flex-direction: column;
    align-items: center; border-right: 1px solid var(--border); color: var(--text);
}
.sort-tab b { font-size: 15px; }
.sort-tab.active { box-shadow: inset 0 -3px 0 var(--primary); color: var(--primary); }
.sort-more { display: flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--muted); white-space: nowrap; }
.sort-more select { border: 1px solid var(--border); border-radius: 4px; padding: 4px; font: inherit; }

.flight-card {
    background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
    padding: 12px 16px; margin-bottom: 10px; transition: box-shadow .15s;
}
.flight-card:hover { box-shadow: 0 4px 16px rgba(15, 41, 77, .1); }
.tags { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 1px 6px; border-radius: 3px; }
.tag-green { background: #e6f8f9; color: #048c98; }
.tag-blue { background: #ebf0ff; color: var(--primary); }
.tag-orange { background: #fff1e5; color: var(--orange); }

.flight-row { display: grid; grid-template-columns: 150px 1fr 160px; align-items: center; gap: 16px; }
.airline { display: flex; align-items: center; gap: 8px; }
.airline-logo {
    width: 32px; height: 32px; border-radius: 50%; background: #ebf0ff; color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.timeline { display: flex; align-items: center; gap: 12px; }
.point { text-align: center; min-width: 60px; }
.time { font-size: 20px; font-weight: 600; }
.time sup { font-size: 11px; color: var(--orange); margin-left: 2px; }
.line { flex: 1; text-align: center; font-size: 12px; }
.bar { position: relative; height: 1px; background: var(--border); margin: 6px 0; display: flex; justify-content: space-evenly; }
.dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--muted); background: #fff; margin-top: -3px; }
.stops { color: var(--muted); }
.price-box { text-align: right; }
.price { font-size: 20px; font-weight: 700; color: var(--orange); }
.member-price { font-size: 12px; color: var(--green); margin: 2px 0 6px; }
.layover { font-size: 12px; color: var(--muted); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }

.special-fares {
    display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center;
    background: #fff8f0; border: 1px solid #ffe0bf; border-radius: var(--radius); padding: 10px 16px; margin-bottom: 10px; font-size: 13px;
}
.special-fares span::before { content: "✓ "; color: var(--orange); }

.recommend-dates { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); padding: 12px 16px; margin-bottom: 10px; }
.recommend-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.recommend-list button {
    border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 8px;
    display: flex; flex-direction: column; color: var(--text);
}
.recommend-list button:hover { border-color: var(--primary); }
.recommend-list b { color: var(--orange); }

.empty { background: #fff; border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }
.more { text-align: center; margin: 16px 0; }
.breadcrumb { margin-top: 24px; color: var(--muted); font-size: 12px; }

/* ---------- footer ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--border); padding: 32px 0 16px; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.footer-grid h4 { margin: 0 0 8px; }
.footer-grid a { display: block; color: var(--muted); padding: 2px 0; }
.copyright { margin-top: 24px; color: var(--muted); font-size: 12px; }

/* ---------- RWD ---------- */
@media (max-width: 860px) {
    .result-layout { grid-template-columns: 1fr; }
    .filters { position: static; }
    .flight-row { grid-template-columns: 1fr; }
    .price-box { text-align: left; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
    .recommend-list { grid-template-columns: repeat(2, 1fr); }
    .footer-grid, .features { grid-template-columns: repeat(2, 1fr); }
    .main-nav { display: none; }
    .sort-more { display: none; }
}

/* ================= 越南行程：航班討論頁 ================= */
.trip-hero { background: linear-gradient(135deg, #b3122f, #e8473b 55%, #f6b73c); color: #fff; padding: 36px 0 40px; }
.trip-hero h1 { margin: 4px 0; font-size: 28px; }
.trip-kicker { opacity: .9; font-weight: 600; }
.flight-switch { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.flight-switch a { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: 6px 16px; font-weight: 600; }
.flight-switch a.on { background: #fff; color: #b3122f; border-color: #fff; }
.tag-chosen { background: #2bb673; color: #fff; font-weight: 700; }
.trip-main { padding: 20px 16px 40px; }

.decided {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    background: #e9f9ef; border: 2px solid #2bb673; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px;
}
.decided-label { font-weight: 700; color: #1c8c55; }
.decided-flight { display: flex; gap: 12px; flex-wrap: wrap; font-size: 16px; }

.both-liked { background: #fff0f5; border: 1px solid #ffc6da; border-radius: var(--radius); padding: 10px 16px; margin-bottom: 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { background: #fff; border: 1px solid #ff8fb5; color: #d6336c; border-radius: 999px; padding: 2px 10px; font-size: 13px; }

.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tip { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.tip-title { font-weight: 600; margin-bottom: 2px; }

.trip-card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 16px; margin-bottom: 12px; scroll-margin-top: 80px;
}
.trip-card.is-liked { border: 2px solid #ff8fb5; }
.trip-card.is-chosen { border: 2px solid #2bb673; box-shadow: 0 0 0 4px #e9f9ef; }
.trip-card:target { box-shadow: 0 0 0 3px #ebf0ff; }
.trip-row { display: grid; grid-template-columns: 150px 1fr 160px; align-items: center; gap: 16px; }

.tag-gray { background: #eef1f5; color: #5c6b80; }
.tag-red { background: #fff0f0; color: #d93a1d; }
.tag-purple { background: #f3edff; color: #7048e8; }

.same-aircraft { margin-top: 8px; background: #fff9db; color: #8a6d00; border-radius: 6px; padding: 6px 10px; font-size: 13px; }


.discuss { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.discuss form { margin: 0; }
.votes { display: flex; gap: 6px; }
.vote-btn { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 4px 12px; color: var(--text); }
.vote-btn.on { background: #ffe3ee; border-color: #ff8fb5; color: #d6336c; font-weight: 600; }
.note-form { display: flex; gap: 6px; flex: 1; min-width: 220px; }
.note-form input { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; font: inherit; min-width: 0; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

.source { margin-top: 16px; }

@media (max-width: 860px) {
    .tips { grid-template-columns: 1fr; }
    .trip-row { grid-template-columns: 1fr; }
    .trip-row .price-box { text-align: left; }
    .main-nav { display: flex; }
    .main-nav a.disabled, .main-nav a[href$="/flights"]:not([href*="trip"]) { display: none; }
}

/* ---------- 行程總覽 / 回程比較 / 航段 ---------- */
.route-overview { display: flex; align-items: stretch; gap: 8px; margin-bottom: 16px; overflow-x: auto; }
.route-step {
    flex: 1 0 170px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 12px; display: flex; flex-direction: column; color: var(--text);
}
.route-step:hover { border-color: var(--primary); }
.step-date { font-size: 12px; color: var(--muted); }
.step-title { font-weight: 700; font-size: 15px; }
.step-price { color: var(--orange); font-size: 13px; font-weight: 600; }
.route-stay {
    flex: 0 0 auto; display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 0 6px; font-size: 13px; color: #44546a;
}
.route-stay b { color: var(--text); }


.leg { margin-top: 28px; scroll-margin-top: 70px; }
.leg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; border-bottom: 2px solid var(--text); padding-bottom: 6px; margin-bottom: 8px; }
.leg-head h2 { margin: 0; font-size: 20px; }
.leg-route { margin-left: 8px; color: #44546a; font-weight: 500; }
.leg-note { background: #f0f5ff; border-radius: 6px; padding: 8px 12px; font-size: 13px; margin: 8px 0; }
.day-head { font-size: 15px; margin: 16px 0 8px; }


/* ---------- 每日行程 ---------- */
:root { --north: #c0392b; --north-bg: #fdf0ee; --central: #0b7a75; --central-bg: #e8f6f5; --transfer: #6c4bd8; --transfer-bg: #f2eefd; --leave: #f6c90e; }
.region-north { --rc: var(--north); --rbg: var(--north-bg); }
.region-central { --rc: var(--central); --rbg: var(--central-bg); }
.region-transfer { --rc: var(--transfer); --rbg: var(--transfer-bg); }

/* 每天一張卡 */
.day-sec { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 4px 0 28px; scroll-margin-top: 72px; }
.day-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--rbg); border-left: 6px solid var(--rc); padding: 14px 18px; }
.day-no { background: var(--rc); color: #fff; border-radius: 4px; padding: 2px 10px; font-size: 15px; font-weight: 700; }
.day-date b { font-size: 28px; margin-right: 6px; }
.day-date span { font-size: 20px; font-weight: 700; color: var(--rc); }
.day-bar h2 { margin: 0; font-size: 23px; flex: 1; min-width: 200px; }
.day-tags { display: flex; gap: 6px; align-items: center; }
.day-region { color: var(--rc); font-weight: 600; font-size: 16px; }
.day-tags .tag { font-size: 15px; padding: 1px 8px; }
.tag-leave { background: var(--leave); color: #5c4600; font-weight: 700; }
.tag-holiday { background: #eef1f5; color: #5c6b80; }
.day-sec.is-leave .day-bar { box-shadow: inset 0 -4px 0 var(--leave); }

.day-table { width: 100%; border-collapse: collapse; font-size: 19px; line-height: 1.6; }
.day-table th { background: #f5f7fa; color: #5c6b80; font-size: 15px; font-weight: 600; text-align: left; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.day-table td { padding: 14px 16px; border-bottom: 1px solid #e6eaf0; vertical-align: top; }
.day-table th + th, .day-table td + td { border-left: 1px solid #e6eaf0; }
.day-table tbody tr:last-child td { border-bottom: none; }
.day-table tbody tr:nth-child(even) td { background: #fafbfc; }
.day-table .c-time { width: 88px; font-weight: 700; font-variant-numeric: tabular-nums; color: #44546a; text-align: center; white-space: nowrap; }
.day-table .c-icon { width: 44px; text-align: center; padding-left: 0; padding-right: 0; }
.day-table td.c-icon + td { border-left: none; }
.day-table th.c-icon + th { border-left: none; }
.day-table .c-text { font-weight: 500; }
.day-table .c-note { width: 38%; color: #5c6b80; font-size: 16px; }
.day-table .inline-note { display: none; }
.day-table tr.kind-flight td { background: #f0f5ff !important; }
.day-table tr.kind-flight .c-time, .day-table tr.kind-flight .c-text { color: var(--primary); font-weight: 700; }
.day-table tr.kind-hotel td { background: #ecf9f1 !important; }
.day-table tr.kind-hotel .c-time, .day-table tr.kind-hotel .c-text { color: #1c8c55; font-weight: 700; }

@media (max-width: 600px) {
    .day-bar { gap: 8px 12px; padding: 12px 14px; }
    .day-bar h2 { flex-basis: 100%; order: 3; font-size: 20px; }
    .day-table thead { display: none; }
    .day-table { font-size: 17px; }
    .day-table td { padding: 10px; }
    .day-table .c-time { width: 64px; }
    .day-table .c-icon { width: 30px; }
    .day-table .c-note { display: none; }
    .day-table .inline-note { display: block; color: #5c6b80; font-size: 15px; font-weight: 400; margin-top: 2px; }
}

/* ---------- 下龍灣一日遊比較 ---------- */
.halong-notes { display: grid; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; font-size: 16px; line-height: 1.7; }
.halong-wrap { overflow-x: auto; background: #fff; border: 1px solid #c9d1dc; border-radius: var(--radius); margin-bottom: 28px; }
.halong-table { width: 100%; border-collapse: collapse; font-size: 17px; min-width: 760px; }
.halong-table th { background: var(--text); color: #fff; text-align: left; padding: 10px 14px; font-weight: 600; white-space: nowrap; }
.halong-table td { padding: 12px 14px; border-top: 1px solid #e6eaf0; }
.halong-table td + td, .halong-table th + th { border-left: 1px solid #e6eaf0; }
.halong-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.halong-table .price { color: var(--orange); font-weight: 700; }
.halong-table tr.is-hercules td:first-child { box-shadow: inset 4px 0 0 #f6c90e; }

.tour-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; margin-bottom: 20px; scroll-margin-top: 72px; }
.tour-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tour-head h2 { margin: 0; font-size: 21px; }
.tour-price { color: var(--orange); font-weight: 700; font-size: 18px; }
.tour-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: #44546a; font-size: 15px; margin: 8px 0 12px; }
.tour-table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.7; }
.tour-table th { width: 64px; text-align: left; vertical-align: top; color: #5c6b80; font-weight: 600; padding: 10px 12px; background: #f5f7fa; border: 1px solid #e6eaf0; white-space: nowrap; }
.tour-table td { padding: 10px 12px; border: 1px solid #e6eaf0; }
.tour-link { display: inline-block; margin-top: 10px; font-weight: 600; }
.halong-table td:nth-child(n+5) { white-space: nowrap; }
