/* vehicle.css — trang mẫu xe /xe/{make}/{model} (bản tab hoá theo export
   site/vehicle.html). Mobile-first; chỉ dùng token ngữ nghĩa từ tokens.css
   (KHÔNG hardcode màu/spacing/radius). Nạp SAU feed.css để override các class
   .veh-* cũ (header gọn) nếu trùng. */

.veh { display: block; padding-bottom: 24px; }

/* ---- Breadcrumb ---- */
.veh-crumbs {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: .8125rem; color: var(--muted); margin: 0 0 16px;
}
.veh-crumbs a { color: var(--muted); text-decoration: none; }
.veh-crumbs a:hover { color: var(--text); }
.veh-crumbs [aria-current="page"] { color: var(--text); font-weight: 600; }
.veh-crumb-sep { width: .85em; height: .85em; color: var(--faint); }

/* ---- Hero ---- */
.veh-hero { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.veh-hero-head { display: flex; flex-direction: column; gap: 8px; order: 1; }
.veh-hero-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.veh-chip {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px;
  border-radius: var(--r-pill); background: var(--surface-3);
  color: var(--muted); font-size: .75rem; font-weight: 600;
}
.veh-rate-inline { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--muted); }
.veh-rate-inline strong { color: var(--text); }
.veh-rate-inline .fa-icon { width: .9em; height: .9em; color: var(--warning); }
.veh-name { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin: 0; }
.veh-summary { color: var(--muted); line-height: 1.55; margin: 0; }
.veh-follow { margin-top: 4px; }
.veh-follow .btn { width: auto; min-width: 160px; }

/* Thư viện ảnh hero */
.veh-gallery {
  order: 0;
  border: 1px solid var(--border); border-radius: var(--r-xl);
  overflow: hidden; background: var(--surface);
}
/* height:auto BẮT BUỘC — nếu không, thuộc tính height="720" của <img> (chống CLS)
   sẽ thắng aspect-ratio (chỉ chi phối chiều 'auto'), khiến ảnh hỏng/đang tải phình
   cao 720px. height:auto → aspect-ratio 16:10 quyết định chiều cao. */
.veh-gallery-main {
  display: block; width: 100%; height: auto;
  aspect-ratio: 16 / 10; object-fit: cover; background: var(--surface-3);
}
.veh-thumbs { display: flex; gap: 8px; padding: 12px; }
.veh-thumb {
  flex: 1 1 0; height: 56px; border-radius: var(--r-sm);
  object-fit: cover; background: var(--surface-3); min-width: 0;
}
.veh-thumb-more {
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: .75rem; font-weight: 600;
}

/* 4 ô thông số nhanh */
.veh-quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; order: 2; }
.veh-quick-tile {
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 13px 15px; background: var(--surface);
}
.veh-quick-tile dt { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .75rem; margin: 0 0 6px; }
.veh-quick-tile dt .fa-icon { width: .9em; height: .9em; }
.veh-quick-tile dd { margin: 0; font-size: 1.125rem; font-weight: 600; }

/* ---- CTA giá ---- */
.veh-cta {
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
  padding: 18px; margin-bottom: 24px;
}
.veh-cta-price { display: flex; flex-direction: column; gap: 2px; }
.veh-cta-label { color: var(--muted); font-size: .75rem; }
.veh-cta-value { font-size: 1.625rem; font-weight: 700; }
.veh-cta-note { color: var(--muted); font-size: .75rem; }
.veh-cta-neutral {
  display: flex; align-items: center; gap: 8px;
  margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: .8125rem;
}
.veh-cta-neutral .fa-icon { flex: none; width: 1em; height: 1em; color: var(--accent); }

/* ---- Tabs (CSS-only: radio ẩn + :has()) ---- */
.veh-tabs { position: relative; display: block; }
.veh-tab-input {
  position: absolute; top: 0; left: 0; width: 1px; height: 1px;
  opacity: 0; margin: 0; pointer-events: none;
}
.veh-tablist {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 2px; overflow-x: auto;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  margin: 0 0 20px; scrollbar-width: none;
}
.veh-tablist::-webkit-scrollbar { display: none; }
.veh-tab {
  flex: none; padding: 14px; white-space: nowrap; cursor: pointer;
  color: var(--muted); font-size: .875rem; font-weight: 600;
  border-bottom: 2px solid transparent; min-height: 44px;
}
.veh-tab:hover { color: var(--text); }

.veh-panel { display: none; }

/* Đổi tab active + panel hiển thị theo radio :checked (one rule / tab). */
.veh-tabs:has(#veh-tab-overview:checked) .veh-tab--overview,
.veh-tabs:has(#veh-tab-specs:checked) .veh-tab--specs,
.veh-tabs:has(#veh-tab-qa:checked) .veh-tab--qa,
.veh-tabs:has(#veh-tab-review:checked) .veh-tab--review,
.veh-tabs:has(#veh-tab-charger:checked) .veh-tab--charger {
  color: var(--text); border-bottom-color: var(--accent);
}
.veh-tabs:has(#veh-tab-overview:checked) .veh-panel--overview,
.veh-tabs:has(#veh-tab-specs:checked) .veh-panel--specs,
.veh-tabs:has(#veh-tab-qa:checked) .veh-panel--qa,
.veh-tabs:has(#veh-tab-review:checked) .veh-panel--review,
.veh-tabs:has(#veh-tab-charger:checked) .veh-panel--charger {
  display: block;
}
/* Focus ring trên label khi radio tương ứng nhận focus bàn phím. */
.veh-tabs:has(#veh-tab-overview:focus-visible) .veh-tab--overview,
.veh-tabs:has(#veh-tab-specs:focus-visible) .veh-tab--specs,
.veh-tabs:has(#veh-tab-qa:focus-visible) .veh-tab--qa,
.veh-tabs:has(#veh-tab-review:focus-visible) .veh-tab--review,
.veh-tabs:has(#veh-tab-charger:focus-visible) .veh-tab--charger {
  outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--r-sm);
}

/* ---- Sao tổng hợp / review ---- */
.veh-stars { display: inline-flex; align-items: center; gap: 1px; }
.veh-star { width: 1em; height: 1em; color: var(--border-strong); }
.veh-star.on { color: var(--warning); }

/* ---- Panel: Tổng quan ---- */
.veh-lede { font-size: 1rem; line-height: 1.7; margin: 0 0 20px; }
.veh-proscons { display: grid; gap: 14px; }
.veh-pc { border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; background: var(--surface); }
.veh-pc-head { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .875rem; font-weight: 600; }
.veh-pc-head .fa-icon { width: 1em; height: 1em; }
.veh-pc-pros .veh-pc-head { color: var(--accent); }
.veh-pc-cons .veh-pc-head { color: var(--warning); }
.veh-pc ul { margin: 0; padding-left: 18px; font-size: .875rem; line-height: 1.7; }

/* ---- Panel: Thông số ---- */
.veh-specs { display: flex; flex-direction: column; gap: 22px; }
.veh-specgroup-name { font-size: .8125rem; font-weight: 600; color: var(--muted); margin: 0 0 10px; }
.veh-spectable { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface); margin: 0; }
.veh-specrow { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--border); }
.veh-specrow:first-child { border-top: 0; }
.veh-specrow dt { color: var(--muted); font-size: .875rem; margin: 0; }
.veh-specrow dd { margin: 0; font-size: .875rem; font-weight: 600; text-align: right; }
.veh-specrow .fa-icon { width: 1.05em; height: 1.05em; }
.veh-spec-yes { color: var(--accent); }
.veh-spec-no { color: var(--faint); }

/* ---- Panel: Hỏi đáp ---- */
.veh-qa { display: flex; flex-direction: column; gap: 12px; }
.veh-qa-item {
  display: flex; gap: 14px; padding: 16px; text-decoration: none; color: inherit;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.veh-qa-item:hover { border-color: var(--border-strong); }
.veh-qa-up { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; width: 44px; }
.veh-qa-up .mono { font-size: .9375rem; font-weight: 600; }
.veh-qa-uplabel { font-size: .625rem; color: var(--faint); }
.veh-qa-body { min-width: 0; }
.veh-qa-title { display: block; font-size: .9375rem; font-weight: 600; line-height: 1.35; margin-bottom: 6px; }
.veh-qa-meta { font-size: .8125rem; color: var(--muted); }
.veh-qa-ask { align-self: flex-start; margin-top: 4px; width: auto; }

/* ---- Panel: Review ---- */
.veh-rev-summary {
  display: flex; gap: 22px; flex-wrap: wrap; align-items: center;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); padding: 18px; margin-bottom: 16px;
}
.veh-rev-score { text-align: center; }
.veh-rev-avg { font-size: 2.5rem; font-weight: 700; line-height: 1; }
.veh-rev-score .veh-stars { margin: 6px 0 4px; font-size: .9375rem; }
.veh-rev-count { font-size: .75rem; color: var(--muted); }
.veh-rev-dist { flex: 1 1 180px; display: flex; flex-direction: column; gap: 6px; }
.veh-rev-bar { display: flex; align-items: center; gap: 10px; font-size: .75rem; color: var(--muted); }
.veh-rev-bar-star { width: 10px; text-align: center; }
.veh-rev-track { flex: 1; height: 7px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.veh-rev-fill { display: block; height: 100%; background: var(--warning); border-radius: var(--r-pill); }
.veh-rev-pct { width: 36px; text-align: right; }

.veh-reviews { display: flex; flex-direction: column; gap: 12px; }
.veh-review { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 16px; }
.veh-review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.veh-review-avatar { width: 36px; height: 36px; border-radius: var(--r-pill); object-fit: cover; flex: none; }
.veh-review-id { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.veh-review-name { font-size: .875rem; font-weight: 600; }
.veh-review-id .veh-stars { font-size: .75rem; }
.veh-review-ago { margin-left: auto; font-size: .75rem; }
.veh-review-body { margin: 0; font-size: .875rem; line-height: 1.6; }

/* ---- Panel: Trạm tương thích ---- */
.veh-station-note {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--info-soft); color: var(--info);
  font-size: .8125rem; margin: 0 0 14px;
}
.veh-station-note .fa-icon { flex: none; width: 1em; height: 1em; }
.veh-stations { display: flex; flex-direction: column; gap: 10px; }
.veh-station {
  display: flex; align-items: center; gap: 14px; padding: 15px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.veh-station-ico {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px;
  border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent);
}
.veh-station-ico .fa-icon { width: 1.15em; height: 1.15em; }
.veh-station-body { flex: 1; min-width: 0; }
.veh-station-name { font-size: .90625rem; font-weight: 600; }
.veh-station-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; font-size: .78125rem; color: var(--muted); }
.veh-station-price { font-size: .8125rem; font-weight: 600; flex: none; }

/* ---- Empty state (dùng chung các tab) ---- */
.veh-emptybox {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; padding: 40px 24px; color: var(--muted);
}
.veh-emptybox-ico {
  display: grid; place-items: center; width: 52px; height: 52px;
  border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent);
}
.veh-emptybox-ico .fa-icon { width: 24px; height: 24px; }
.veh-emptybox p { margin: 0; max-width: 34ch; line-height: 1.55; }

/* ---- Từ md trở lên: nới rộng bố cục ---- */
@media (min-width: 768px) {
  .veh-proscons { grid-template-columns: 1fr 1fr; }
  .veh-name { font-size: 2rem; }
}

/* H-3: ghi đè h1 căn giữa toàn cục (base.css) — tiêu đề mẫu xe căn trái cho khớp body. */
.veh-name { text-align: left; }

/* Tablist dính DƯỚI header ngang mới (không lùi 0 = lọt dưới header sticky). */
.veh-tablist { top: var(--chrome-header-h, 60px); }

/* ── Bố cục 2 cột (desktop, khớp reference vehicle.html) ─────────────────────────
   Header ngang mới cho trang rộng ~1180px → dựng grid:
   hàng 1: breadcrumb (cả 2 cột) · hàng 2: hero 2-col (gallery | head+specs) cả 2 cột
   hàng 3: nội dung tab (trái) | CTA giá dính (phải 320px). DOM: crumbs, hero, cta, tabs. */
@media (min-width: 1024px) {
  .veh {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    column-gap: 28px;
    align-items: start;
  }
  .veh-crumbs { grid-column: 1 / -1; margin-bottom: 18px; }

  /* Hero chiếm cả 2 cột + tự chia 2 cột bên trong (ảnh trái, đầu mục + thông số phải). */
  .veh-hero {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 24px;
    align-items: start;
  }
  .veh-gallery { grid-column: 1; grid-row: 1 / span 2; margin: 0; }
  .veh-hero-head { grid-column: 2; grid-row: 1; }
  .veh-quick { grid-column: 2; grid-row: 2; align-self: start; }

  /* Hàng 3: tab trái · CTA giá phải (dính). */
  .veh-tabs { grid-column: 1; grid-row: 3; min-width: 0; }
  .veh-cta {
    grid-column: 2;
    grid-row: 3;
    position: sticky;
    top: calc(var(--chrome-header-h, 60px) + 16px);
    margin-bottom: 0;
  }

  /* Cột tab đủ rộng → khôi phục tab thoáng (bỏ thu gọn cũ vì hết hẹp). */
  .veh-tab { padding: 14px 12px; font-size: .875rem; }
}

/* ---- Lightbox: ảnh/thumbnail bấm được (con trỏ + hover) ---- */
.veh-gallery [data-veh-open] { cursor: zoom-in; }
.veh-gallery-main[data-veh-open] { transition: filter var(--dur-fast, 150ms) ease; }
.veh-gallery-main[data-veh-open]:hover { filter: brightness(.94); }
.veh-thumb[data-veh-open]:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.veh-gallery [data-veh-open]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.veh-thumb-more { border: 0; cursor: zoom-in; font: inherit; }
.veh-thumb-more:hover { background: var(--accent); color: #fff; }
.veh-media[hidden] { display: none; }
/* Video trong lightbox (Spotlight media:node) — façade được di chuyển vào khung xem;
   cấp kích thước rõ ràng (không thì button co về 0 width khi không có poster) + che
   spinner mặc định của Spotlight. Bấm play → đổi sang <video> + HLS (handler chung). */
#spotlight .veh-media-item { width: min(92vw, 1100px); max-width: 92vw; background: #000; }
#spotlight .vfacade { width: 100%; height: auto; max-height: 82vh; aspect-ratio: 16 / 9; border-radius: 0; }
#spotlight .veh-media-item video { width: 100%; max-height: 82vh; background: #000; }

/* ---- Tab Tổng quan: nội dung biên tập (description CMS) ---- */
.veh-overview-doc { font-size: 1rem; line-height: 1.75; color: var(--text); }
.veh-overview-doc > :first-child { margin-top: 0; }
.veh-overview-doc h2 { font-size: 1.375rem; font-weight: 700; line-height: 1.3; margin: 26px 0 10px; }
.veh-overview-doc h3 { font-size: 1.0625rem; font-weight: 600; line-height: 1.35; margin: 22px 0 8px; }
.veh-overview-doc h4 { font-size: .9375rem; font-weight: 600; margin: 18px 0 6px; }
.veh-overview-doc p { margin: 0 0 14px; }
.veh-overview-doc ul, .veh-overview-doc ol { margin: 0 0 14px; padding-left: 20px; }
.veh-overview-doc li { margin: 4px 0; }
.veh-overview-doc a { color: var(--accent); text-decoration: underline; }
.veh-overview-doc blockquote {
  margin: 0 0 14px; padding: 10px 16px; border-left: 3px solid var(--accent);
  background: var(--surface-3); border-radius: var(--r-sm); color: var(--muted);
}
.veh-overview-doc figure { margin: 0 0 18px; }
.veh-overview-doc figure img, .veh-overview-doc p img {
  display: block; width: 100%; height: auto; border-radius: var(--r-md); background: var(--surface-3);
}
.veh-overview-doc figcaption { margin-top: 8px; font-size: .8125rem; color: var(--muted); text-align: center; }
.veh-overview-doc .vfacade { width: 100%; border-radius: var(--r-md); margin-bottom: 18px; }
.veh-overview-doc + .veh-proscons { margin-top: 22px; }

/* ---- Tab Review: banner kết quả + khối viết đánh giá ---- */
.veh-rev-flash {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-radius: var(--r-md); margin: 0 0 16px; font-size: .875rem;
}
.veh-rev-flash .fa-icon { flex: none; width: 1.1em; height: 1.1em; }
.veh-rev-flash-ok { background: var(--accent-soft); color: var(--accent); }
.veh-rev-flash-err { background: var(--danger-soft); color: var(--danger); }
.veh-rev-login { width: auto; margin-bottom: 18px; }
.veh-rev-done {
  display: flex; align-items: center; gap: 8px; margin: 0 0 18px;
  padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: .875rem;
}
.veh-rev-done .fa-icon { flex: none; width: 1.1em; height: 1.1em; color: var(--accent); }

.veh-rev-form {
  display: flex; flex-direction: column; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); padding: 18px; margin: 0 0 20px;
}
.veh-rate-field { border: 0; padding: 0; margin: 0; }
.veh-rev-label { display: block; font-size: .8125rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
/* Sao: đảo chiều (row-reverse) để hover/checked tô đầy các sao ≤ giá trị (CSS thuần). */
.veh-rate-stars { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.veh-rate-radio { position: absolute; width: 1px; height: 1px; opacity: 0; } /* ẩn nhưng vẫn focus được bằng phím */
.veh-rate-star {
  cursor: pointer; line-height: 0; color: var(--border-strong);
  transition: color var(--dur-fast, 150ms) ease, transform var(--dur-fast, 150ms) ease;
}
.veh-rate-ico { width: 30px; height: 30px; }
.veh-rate-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.veh-rate-star:hover, .veh-rate-star:hover ~ .veh-rate-star,
.veh-rate-radio:checked ~ .veh-rate-star { color: var(--warning); }
.veh-rate-star:hover { transform: scale(1.08); }
.veh-rate-radio:focus-visible + .veh-rate-star { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.veh-rev-textarea {
  width: 100%; resize: vertical; min-height: 92px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg);
  color: var(--text); font: inherit; font-size: .9375rem; line-height: 1.6;
}
.veh-rev-textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.veh-rev-submit { width: auto; align-self: flex-start; }

/* ---- Tab Trạm tương thích: group theo tỉnh/thành ---- */
.veh-station-groups { display: flex; flex-direction: column; gap: 22px; }
.veh-station-city {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px;
  font-size: .9375rem; font-weight: 700;
}
.veh-station-city .fa-icon { flex: none; width: 1em; height: 1em; color: var(--accent); }
.veh-station-city-n {
  margin-left: auto; min-width: 24px; height: 22px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); background: var(--surface-3); color: var(--muted);
  font-size: .75rem; font-weight: 600;
}
