/* Catalog — trang DANH SÁCH xe /xe (lưới mẫu xe điện).
   Token canonical từ tokens.css (DESIGN.md). KHÔNG hardcode hex/spacing/radius.
   Brand = xanh lá #00B86B (var(--accent)). Mobile-first: 1 cột → 2 (sm) → 3 (lg).
   Phong cách bám bản reskin trang mẫu xe (vehicle.css): card r-xl, tile r-md,
   shadow-sm, badge accent-soft/glass, số liệu mono, sao warning. */

.cat {
  display: block;
  max-width: 1180px;
  margin: 0 auto;
  padding: 4px 0 32px;
}

/* ===== Tiêu đề trang ===== */
.cat-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
}
.cat-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}
.cat-eyebrow .fa-icon { width: 1em; height: 1em; }
.cat-title {
  font-size: clamp(1.625rem, 1.2rem + 2vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
  text-align: left;
}
.cat-sub {
  font-size: .9375rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
  max-width: 62ch;
}

/* ===== Chip lọc hãng (scroll ngang trên mobile) ===== */
.cat-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 22px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cat-filters::-webkit-scrollbar { display: none; }
.cat-filters-lead {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-right: 4px;
  color: var(--faint);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cat-filters-lead .fa-icon { width: 1em; height: 1em; }
.cat-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur, 150ms) ease, background var(--dur, 150ms) ease,
    border-color var(--dur, 150ms) ease;
}
.cat-chip:hover { color: var(--text); border-color: var(--border-strong); }
.cat-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
/* Biến thể nhỏ cho chip trong panel "Bộ lọc" (mật độ cao hơn). */
.cat-chip-sm {
  height: 32px;
  padding: 0 12px;
  font-size: .8125rem;
}

/* ===== Thanh công cụ lọc (loại xe + sắp xếp + bộ lọc) ===== */
.cat-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

/* Loại xe: segmented control (Tất cả / Ô tô / Xe máy) */
.cat-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-3);
}
.cat-seg-btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur, 150ms) ease, background var(--dur, 150ms) ease;
}
.cat-seg-btn:hover { color: var(--text); }
.cat-seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-seg-btn.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.cat-tools-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Dropdown <details> bản địa (sắp xếp + bộ lọc) — hoạt động không-JS */
.cat-dd { position: relative; }
.cat-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: .8125rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: border-color var(--dur, 150ms) ease, background var(--dur, 150ms) ease;
}
.cat-dd-btn::-webkit-details-marker { display: none; }
.cat-dd-btn:hover { border-color: var(--border-strong); }
.cat-dd-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-dd[open] > .cat-dd-btn { border-color: var(--accent); }
.cat-dd-btn .fa-icon { width: .95em; height: .95em; color: var(--muted); }
.cat-dd-lbl strong { font-weight: 700; color: var(--text); }
.cat-dd-caret { transition: transform var(--dur, 150ms) ease; }
.cat-dd[open] > .cat-dd-btn .cat-dd-caret { transform: rotate(180deg); }
/* Badge số filter đang bật */
.cat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: .6875rem;
  font-weight: 700;
}

/* Menu sắp xếp (danh sách dọc) */
.cat-dd-menu,
.cat-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: cat-dd-in var(--dur, 150ms) ease;
}
@keyframes cat-dd-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cat-dd-menu {
  min-width: 200px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cat-dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: .875rem;
  text-decoration: none;
}
.cat-dd-item:hover { background: var(--surface-3); color: var(--text); }
.cat-dd-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cat-dd-item.on { color: var(--text); font-weight: 600; }
.cat-dd-tick { width: 1em; height: 1em; color: var(--accent); }

/* Panel "Bộ lọc" (nhóm kiểu dáng / phân khúc / giá) */
.cat-dd-wide .cat-panel {
  width: min(340px, calc(100vw - 32px));
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cat-fg { display: flex; flex-direction: column; gap: 9px; }
.cat-fg-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.cat-fg-title .fa-icon { width: 1em; height: 1em; }
.cat-fg-opts { display: flex; flex-wrap: wrap; gap: 7px; }

/* Hàng "Xóa bộ lọc" */
.cat-reset-row { margin: -8px 0 18px; }
.cat-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 500;
  text-decoration: none;
}
.cat-reset:hover { color: var(--danger); }
.cat-reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.cat-reset .fa-icon { width: .95em; height: .95em; }

@media (max-width: 480px) {
  .cat-tools { gap: 8px; }
  .cat-seg { flex: 1 1 auto; justify-content: space-between; }
  .cat-tools-right { flex: 1 1 100%; justify-content: flex-end; }
  .cat-dd-lbl { display: none; } /* nút sắp xếp gọn còn icon trên màn hẹp */
}

/* ===== Lưới thẻ ===== */
.cat-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 640px) {
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
}

/* ===== Thẻ mẫu xe ===== */
.cat-card {
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur, 150ms) ease, box-shadow var(--dur, 150ms) ease,
    border-color var(--dur, 150ms) ease;
}
.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.cat-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}
.cat-card-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--r-xl);
}

/* ảnh hero 16:10 (khớp thư viện hero trang mẫu xe) */
.cat-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-3);
  overflow: hidden;
}
/* height:auto BẮT BUỘC — height="..." của <img> (chống CLS) chỉ chi phối chiều
   'auto'; aspect-ratio container quyết định khung 16:10, img phủ kín. */
.cat-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--dur, 300ms) ease;
}
.cat-card:hover .cat-card-img { transform: scale(1.045); }
.cat-card-noimg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--faint);
}
.cat-card-noimg .fa-icon { width: 40px; height: 40px; }
.cat-card-tag {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  border: 1px solid color-mix(in srgb, var(--border-strong) 60%, transparent);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text);
  font-size: .75rem;
  font-weight: 600;
}
.cat-card-tag .fa-icon { width: .85em; height: .85em; color: var(--muted); }

/* thân thẻ */
.cat-card-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px 15px;
  flex: 1;
}
.cat-card-make {
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
}
.cat-card-name {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  margin: 0;
}
.cat-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}
.cat-card-rate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .8125rem;
  color: var(--muted);
}
.cat-card-rate strong { color: var(--text); font-weight: 600; }
.cat-star { width: 1em; height: 1em; }
.cat-star.on { color: var(--warning); }

.cat-card-price {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: .8125rem;
}
.cat-card-price-lbl { color: var(--muted); font-size: .75rem; }
.cat-card-price strong { color: var(--text); font-weight: 600; font-size: .875rem; }

/* ===== Xem thêm ===== */
.cat-more {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}
.cat-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  min-width: 180px;
}
.cat-more-btn .fa-icon { width: .9em; height: .9em; }

/* ===== Trạng thái rỗng ===== */
.cat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 56px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--r-xl);
}
.cat-empty-ico {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
}
.cat-empty-ico .fa-icon { width: 24px; height: 24px; }
.cat-empty p { margin: 0; max-width: 34ch; line-height: 1.55; }
