/*
 * Plate Store: trang danh sách / chi tiết biển số.
 * Mọi màu là biến CSS: theme ghi đè trong :root hoặc .plate-store mà không sửa file này.
 */
.plate-store {
    --plate-accent: #d0021b;        /* giá ở trang chi tiết, mục đang chọn */
    --plate-buy-bg: #ffc107;        /* nút Đặt mua */
    --plate-buy-color: #1f2937;
    --plate-consult-bg: #2563eb;    /* nút Nhận tư vấn */
    --plate-consult-color: #fff;
    --plate-border: #e5e7eb;
    --plate-soft: #f5f6f8;          /* nền dải tiêu đề, đầu bảng */
    --plate-muted: #6b7280;
    margin: 16px 0 40px;
    font-size: 14px;
}
.plate-store a { text-decoration: none; }
/* Một phần trang đứng riêng trong element Page Builder: khoảng cách do builder quyết định. */
.plate-store--section { margin: 0; }
.plate-store--section > .plate-box:last-child, .plate-store--section > .plate-filter { margin-bottom: 0; }
.plate-store.is-loading .plate-store__results { opacity: .45; pointer-events: none; transition: opacity .15s; }

/* ---------------------------------------------------------------- biển số vẽ như biển thật */
.plate-visual {
    --plate-bg: #fff; --plate-text: #111;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 4px 12px; border: 2px solid #111; border-radius: 6px; background: var(--plate-bg); color: var(--plate-text);
    box-shadow: inset 0 0 0 2px var(--plate-bg), inset 0 0 0 3px rgba(0, 0, 0, .55);
    font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif; font-weight: 700; line-height: 1.05; letter-spacing: .5px; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.plate-visual__line { display: block; }
.plate-visual--car { font-size: 20px; }
.plate-visual--bike { font-size: 16px; padding: 4px 14px; }
/* Biển xe máy 2 hàng như biển thật: hai hàng CÙNG cỡ chữ, hàng dưới (dãy số) giãn chữ
   nên rộng hơn hàng trên (mã tỉnh + seri). Giãn theo em nên đúng cho mọi cỡ (--sm, --lg). */
.plate-visual--bike .plate-visual__line:last-child { letter-spacing: .12em; margin-top: .04em; }
/* Bảng danh sách: biển là thứ khách đến xem, phải đọc được ngay. */
.plate-visual--sm { min-width: 150px; }
.plate-visual--sm.plate-visual--car { font-size: 25px; padding: 5px 14px; }
.plate-visual--sm.plate-visual--bike { font-size: 23px; padding: 4px 16px; min-width: 120px; }
.plate-visual--lg { border-width: 4px; border-radius: 12px; }
.plate-visual--lg.plate-visual--car { font-size: 64px; padding: 14px 34px; }
.plate-visual--lg.plate-visual--bike { font-size: 52px; padding: 12px 40px; line-height: 1.1; }

/* ---------------------------------------------------------------- nút chung */
.plate-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 4px; padding: 6px 14px; background: var(--plate-buy-bg); color: var(--plate-buy-color); font-weight: 600; cursor: pointer; white-space: nowrap; }
.plate-btn:hover { filter: brightness(.95); color: var(--plate-buy-color); }
.plate-btn--buy { padding: 5px 12px; }
.plate-btn--consult { padding: 5px 12px; background: var(--plate-consult-bg); color: var(--plate-consult-color); }
.plate-btn--consult:hover { color: var(--plate-consult-color); }
.plate-btn--lg { padding: 10px 28px; font-size: 16px; text-transform: uppercase; }
.plate-btn--search { border-radius: 0 4px 4px 0; padding: 0 16px; }

/* ---------------------------------------------------------------- bộ lọc */
.plate-filter { background: var(--plate-soft); border: 1px solid var(--plate-border); border-radius: 6px; padding: 12px; margin-bottom: 16px; }
.plate-filter__top { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.plate-filter__search { display: flex; }
.plate-filter__search .form-control { border-radius: 4px 0 0 4px; font-size: 16px; letter-spacing: .3px; text-transform: uppercase; }
.plate-filter__search .form-control::placeholder { text-transform: none; }
.plate-filter__hint { font-size: 12px; color: var(--plate-muted); margin: 6px 0 4px; }
.plate-filter__hint code { background: #fff; border: 1px solid var(--plate-border); border-radius: 3px; padding: 0 4px; color: inherit; font-size: 12px; }
.plate-filter__groups { display: flex; flex-wrap: wrap; column-gap: 20px; }

.plate-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
/* Chip phải là khối chứa của ô input ẩn: không thì input (absolute) thoát khỏi hàng chip cuộn ngang
   trên điện thoại và kéo giãn cả trang theo chiều ngang. */
.plate-chip { position: relative; }
.plate-chip input { position: absolute; opacity: 0; pointer-events: none; }
.plate-chip span { display: inline-block; padding: 6px 14px; border: 1px solid var(--plate-border); border-radius: 4px; background: #fff; cursor: pointer; transition: border-color .15s; }
.plate-chip span:hover { border-color: #9ca3af; }
.plate-chip input:checked + span { border-color: var(--plate-buy-bg); background: var(--plate-buy-bg); color: var(--plate-buy-color); font-weight: 600; }
.plate-chip input:focus-visible + span { outline: 2px solid #2563eb; outline-offset: 2px; }

/* ---------------------------------------------------------------- bố cục */
.plate-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.plate-layout--3 { grid-template-columns: 240px minmax(0, 1fr) 240px; }
.plate-box { background: #fff; border: 1px solid var(--plate-border); border-radius: 6px; margin-bottom: 16px; overflow: hidden; }
.plate-box > :not(.plate-box__title):not(.plate-list):not(.plate-store__results) { margin-left: 12px; margin-right: 12px; }
.plate-box__title { margin: 0; padding: 10px 12px; background: var(--plate-soft); border-bottom: 1px solid var(--plate-border); font-size: 15px; font-weight: 700; text-transform: uppercase; }
.plate-store__intro { padding: 12px 0; line-height: 1.7; }

/* ---------------------------------------------------------------- sidebar */
.plate-side__box { border: 1px solid var(--plate-border); border-radius: 6px; margin-bottom: 16px; overflow: hidden; background: #fff; }
.plate-side__title { padding: 10px 12px; background: var(--plate-soft); border-bottom: 1px solid var(--plate-border); font-weight: 700; }
.plate-side__title i { color: var(--plate-muted); margin-right: 4px; }
.plate-side ul { list-style: none; margin: 0; padding: 0; }
.plate-side li + li { border-top: 1px solid var(--plate-border); }
.plate-side li a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 14px; color: #374151; }
.plate-side li a:hover { background: var(--plate-soft); color: var(--plate-accent); }
.plate-side li a.is-active { color: var(--plate-accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--plate-accent); }
.plate-side__count { color: var(--plate-muted); font-size: 12px; }

/* ---------------------------------------------------------------- bảng */
.plate-list { padding: 10px 12px 12px; }
.plate-list__summary { margin-bottom: 8px; color: var(--plate-muted); }
.plate-list__empty { padding: 36px 16px; text-align: center; border: 1px dashed var(--plate-border); border-radius: 6px; color: var(--plate-muted); }
.plate-table-wrap { overflow-x: auto; }
.plate-table { width: 100%; border-collapse: collapse; }
.plate-table th, .plate-table td { padding: 7px 8px; border: 1px solid var(--plate-border); text-align: center; vertical-align: middle; }
.plate-table thead th { background: var(--plate-soft); font-weight: 700; white-space: nowrap; }
.plate-table tbody tr:nth-child(even) { background: #fcfcfd; }
.plate-table tbody tr:hover { background: #fff8e1; }
.plate-table__stt { width: 52px; color: var(--plate-muted); }
.plate-table__province small { display: block; color: var(--plate-muted); }
.plate-table__price { font-weight: 700; white-space: nowrap; }
.plate-table__points { width: 80px; }
.plate-table__action { width: 130px; }
.plate-table td.plate-table__plate { padding: 10px 8px; }
.plate-table__meta { display: none; margin-top: 4px; color: var(--plate-muted); font-size: 12px; line-height: 1.2; }
.plate-list__pagination { margin-top: 14px; display: flex; justify-content: center; }

.plate-badge { display: inline-block; font-size: 11px; line-height: 1; padding: 3px 6px; margin: 2px 0 2px 4px; border-radius: 3px; background: #f3f4f6; color: #374151; vertical-align: 3px; font-weight: 500; }
/* "Nổi bật": nhãn nhỏ gắn góc trên phải tấm biển, không chiếm chỗ trên hàng. */
.plate-table__link { position: relative; display: inline-block; }
.plate-flag { position: absolute; top: -8px; right: -10px; padding: 2px 6px; border-radius: 3px; background: var(--plate-accent); color: #fff; font-size: 10px; font-weight: 700; line-height: 1.2; text-transform: uppercase; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
/* Biển đang giữ chỗ: nhãn nhạt thay cho nút (không nhận yêu cầu), tấm biển mờ đi một chút. */
.plate-held { display: inline-block; padding: 5px 10px; border-radius: 4px; background: #f3f4f6; color: var(--plate-muted); font-size: 13px; line-height: 1.3; }
.plate-table tbody tr.is-held .plate-visual { opacity: .7; }

/* ---------------------------------------------------------------- chi tiết */
.plate-detail__summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px 28px; align-items: center; padding: 18px 0 8px; }
.plate-detail__visual { display: flex; justify-content: center; }
.plate-detail__facts { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.plate-detail__facts dt { color: var(--plate-muted); font-weight: 400; }
.plate-detail__facts dd { margin: 0; }
.plate-detail__price { font-size: 22px; font-weight: 800; color: var(--plate-accent); margin-right: 6px; }
.plate-detail__old { display: block; color: var(--plate-muted); }
.plate-type { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; font-weight: 600; vertical-align: 3px; }
.plate-type--sale { background: #dcfce7; color: #166534; }
.plate-type--consult { background: #dbeafe; color: #1e40af; }
.plate-detail__held { margin-bottom: 14px; padding: 8px 12px; border-radius: 4px; background: #fef3c7; color: #92400e; }
.plate-detail__contact { padding: 12px 0; color: #374151; }
.plate-detail__hotline { display: inline-block; margin-left: 6px; font-size: 18px; font-weight: 700; color: #2563eb; }

/* Bố cục Page Builder: cột danh mục và cột nội dung là hai cột của builder, không có khe giữa. */
@media (min-width: 992px) {
    .plate-store--section > .plate-side { margin-right: 16px; }
}

/* ---------------------------------------------------------------- form yêu cầu */
.plate-request { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.plate-box > .plate-request { padding: 12px 0 14px; }
.plate-box > .plate-request__done { margin-top: 12px; margin-bottom: 12px; }
.plate-request.is-loading { opacity: .6; pointer-events: none; }
.plate-request__title { grid-column: 1 / -1; font-size: 17px; font-weight: 700; }
.plate-request__field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.plate-request__field--full { grid-column: 1 / -1; }
.plate-request__field span { font-size: 13px; color: var(--plate-muted); }
.plate-request__field b { color: var(--plate-accent); }
.plate-request .form-control.is-invalid { border-color: var(--plate-accent); }
.plate-request__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.plate-request__actions { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 4px; }
.plate-request__submit { flex-direction: column; gap: 0; min-width: 240px; padding: 10px 24px; font-size: 16px; text-transform: uppercase; }
.plate-request__submit small { font-size: 12px; font-weight: 400; text-transform: none; opacity: .9; }
.plate-request__submit--consult, .plate-request__submit--general { background: var(--plate-consult-bg); color: var(--plate-consult-color); }
.plate-request__hotline a { font-size: 18px; font-weight: 700; color: #2563eb; }
.plate-request__result { grid-column: 1 / -1; }
.plate-request__result:empty { display: none; }
.plate-request__result.is-error { padding: 8px 12px; border-radius: 4px; background: #fef2f2; color: #b91c1c; }
.plate-request__done { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 6px; background: #ecfdf5; color: #065f46; }
.plate-request__done i { font-size: 22px; }

/* ---------------------------------------------------------------- cột yêu cầu mới */
.plate-recent ul { margin: 0; padding: 0; list-style: none; }
.plate-recent li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--plate-border); }
.plate-recent li:first-child { border-top: 0; }
.plate-recent__name { font-weight: 500; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate-recent__phone { color: var(--plate-muted); font-size: 13px; }
.plate-recent__meta { text-align: right; }
.plate-recent__badge { display: inline-block; padding: 3px 8px; border-radius: 3px; background: #f97316; color: #fff; font-size: 12px; white-space: nowrap; }
.plate-recent__badge--consult, .plate-recent__badge--general { background: var(--plate-consult-bg); }
.plate-recent__date { display: block; margin-top: 4px; color: var(--plate-muted); font-size: 12px; }

/* ---------------------------------------------------------------- element chung (trang chủ...) */
.plate-el { margin: 0; }
.plate-el__title { margin-bottom: 10px; font-size: 18px; font-weight: 700; text-transform: uppercase; }
.plate-el__more { margin-top: 12px; text-align: center; }
.plate-el--search .plate-filter__search { max-width: 640px; }
.plate-el--search .plate-chips { margin-top: 10px; }
.plate-province-grid { display: grid; grid-template-columns: repeat(var(--plate-cols, 4), minmax(0, 1fr)); gap: 8px; }
.plate-province-grid__item { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 10px 12px; border: 1px solid var(--plate-border); border-radius: 6px; background: #fff; color: #374151; font-weight: 500; }
.plate-province-grid__item:hover { border-color: var(--plate-accent); color: var(--plate-accent); }
.plate-province-grid__count { color: var(--plate-muted); font-size: 12px; font-weight: 400; }

/* ---------------------------------------------------------------- màn hình nhỏ */
@media (max-width: 991px) {
    .plate-layout, .plate-layout--3 { grid-template-columns: minmax(0, 1fr); }
    .plate-layout__left { order: 2; }
    .plate-layout__right { order: 3; }
    /* Bố cục Page Builder: cột HTML đứng trước (danh mục) xếp chồng lên TRÊN danh sách.
       Đẩy cột danh mục + cột "PlateRecentRequestsElement" xuống dưới, chỉ trong hàng có khối chính của
       plugin (element đặt riêng ở trang chủ không bị ảnh hưởng). Mốc 991px trùng mốc
       xếp chồng của builder (widthTablet / widthMobile = 100%). */
    .build-content:has(> .build-column .PlateIndexResultsElement, > .build-column .PlateDetailSummaryElement) > .build-column:has(.PlateIndexSidebarElement),
    .build-content:has(> .build-column .PlateIndexResultsElement, > .build-column .PlateDetailSummaryElement) > .build-column:has(.PlateDetailSidebarElement) { order: 2; }
    .build-content:has(> .build-column .PlateIndexResultsElement, > .build-column .PlateDetailSummaryElement) > .build-column:has(.PlateRecentRequestsElement) { order: 3; }
    .plate-filter__top { grid-template-columns: 1fr 1fr; }
    .plate-filter__search { grid-column: 1 / -1; }
    .plate-province-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575px) {
    .plate-table__stt, .plate-table__points, .plate-table__province { display: none; }
    .plate-table__meta { display: block; }
    .plate-table th, .plate-table td { padding: 6px 4px; }
    .plate-table__action { width: auto; }
    .plate-btn--buy, .plate-btn--consult { padding: 4px 8px; font-size: 13px; white-space: normal; }
    /* Hàng nút chọn nhanh: một dòng cuộn ngang thay vì nhiều dòng chiếm hết màn hình. */
    .plate-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
    .plate-chip { flex: 0 0 auto; }
    .plate-chip span { white-space: nowrap; }
    .plate-detail__summary { grid-template-columns: minmax(0, 1fr); }
    .plate-visual--lg.plate-visual--car { font-size: 40px; padding: 10px 20px; }
    .plate-visual--lg.plate-visual--bike { font-size: 34px; padding: 10px 26px; }
    .plate-visual--sm { min-width: 0; }
    .plate-visual--sm.plate-visual--car { font-size: 19px; padding: 4px 8px; }
    .plate-visual--sm.plate-visual--bike { font-size: 18px; padding: 3px 10px; }
    .plate-detail__facts { grid-template-columns: 100px minmax(0, 1fr); }
    .plate-request { grid-template-columns: 1fr; }
    .plate-request__submit { min-width: 0; width: 100%; }
}
