/* ============================================================
   OTO - CHI TIẾT TIN XE (giao diện mới)
   ============================================================ */
.hm-detail { padding: 16px 0 40px; }

.hm-detail-row { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }

/* ---------- GALLERY ---------- */
.hm-gallery-main { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--hm-bg); border: 1px solid var(--hm-border); }
.hm-gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hm-gallery-counter { position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 4px; }
.hm-gallery-thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 10px; }
.hm-gallery-thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--hm-bg); padding: 0; display: block; }
.hm-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hm-gallery-thumb.active { border-color: var(--hm-red); }
.hm-gallery-more { position: absolute; inset: 0; background: rgba(0,0,0,.62); color: #fff; font-size: 11px; font-weight: 600; line-height: 1.4; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4px; }
.hm-gallery-more b { font-size: 14px; }
.hm-gallery-main img { cursor: zoom-in; }
.hm-gallery-zoom { position: absolute; right: 12px; bottom: 12px; width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; cursor: pointer; transition: background .2s; }
.hm-gallery-zoom:hover { background: var(--hm-red); }

/* ---------- LIGHTBOX FULL ALBUM ---------- */
.hm-lb { position: fixed; inset: 0; z-index: 9999; background: rgba(10,12,15,.95); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hm-lb[hidden] { display: none; }
.hm-lb-bar { position: absolute; top: 0; left: 0; right: 0; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; color: #fff; }
.hm-lb-counter { font-size: 14px; color: rgba(255,255,255,.85); }
.hm-lb-close { width: 40px; height: 40px; border: none; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 18px; cursor: pointer; transition: background .2s; }
.hm-lb-close:hover { background: var(--hm-red); }
.hm-lb-stage { max-width: 90vw; max-height: calc(100vh - 190px); display: flex; align-items: center; justify-content: center; }
.hm-lb-stage img { max-width: 100%; max-height: calc(100vh - 190px); object-fit: contain; border-radius: 6px; display: block; }
.hm-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border: none; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 17px; cursor: pointer; transition: background .2s; }
.hm-lb-nav:hover { background: var(--hm-red); }
.hm-lb-prev { left: 20px; }
.hm-lb-next { right: 20px; }
.hm-lb-strip { position: absolute; left: 0; right: 0; bottom: 0; height: 96px; display: flex; gap: 8px; align-items: center; padding: 0 18px; overflow-x: auto; }
.hm-lb-thumb { flex: 0 0 96px; height: 68px; border: 2px solid transparent; border-radius: 6px; overflow: hidden; padding: 0; background: none; cursor: pointer; opacity: .55; transition: opacity .2s, border-color .2s; }
.hm-lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hm-lb-thumb.active, .hm-lb-thumb:hover { opacity: 1; border-color: var(--hm-red); }

/* ---------- KHỐI NỘI DUNG ---------- */
.hm-detail-main .hm-box { margin-top: 20px; }

.hm-specs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 40px; }
.hm-spec { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f1f3f5; font-size: 14px; }
.hm-spec-label { color: var(--hm-muted); flex: 0 0 auto; }
.hm-spec-value { color: var(--hm-text); font-weight: 600; text-align: right; }

.hm-desc { font-size: 14px; line-height: 1.8; color: #374151; position: relative; }
.hm-desc.is-collapsed { max-height: 96px; overflow: hidden; }
.hm-desc.is-collapsed::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 44px; background: linear-gradient(180deg, rgba(255,255,255,0), #fff); }
.hm-desc p { margin: 0 0 10px; }
.hm-desc-toggle { background: none; border: none; color: var(--hm-red); font-size: 14px; cursor: pointer; padding: 10px 0 0; }

/* ---------- SIDEBAR ---------- */
.hm-detail-side { position: sticky; top: calc(var(--hm-header-h) + 16px); }
.hm-detail-side .hm-box { margin-top: 0; margin-bottom: 20px; }
.hm-detail-title { font-size: 22px; font-weight: 800; color: var(--hm-text); margin: 0 0 8px; line-height: 1.3; }
.hm-detail-price { font-size: 28px; font-weight: 900; color: var(--hm-red); margin-bottom: 12px; }

.hm-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.hm-badge { font-size: 12px; padding: 4px 10px; border-radius: 4px; border: 1px solid; }
.hm-badge-red { color: var(--hm-red); border-color: var(--hm-red); background: #fff5f5; }
.hm-badge-gray { color: var(--hm-muted); border-color: var(--hm-border); }

.hm-detail-meta { display: flex; flex-wrap: wrap; gap: 10px 16px; padding: 14px 0; margin-top: 12px; border-top: 1px solid var(--hm-border); }
.hm-detail-meta span { font-size: 13px; color: #4b5563; display: inline-flex; align-items: center; gap: 6px; }
.hm-detail-meta i { color: var(--hm-muted); }

.hm-actions { display: grid; gap: 10px; }
.hm-actions .hm-btn-red { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.hm-action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hm-btn-outline { border: 1px solid var(--hm-border); border-radius: 6px; padding: 10px; font-size: 14px; background: #fff; color: var(--hm-text); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: all .2s; }
.hm-btn-outline:hover { border-color: var(--hm-red); color: var(--hm-red); }
.hm-btn-outline.is-fav { color: var(--hm-red); border-color: var(--hm-red); }

/* Người bán */
.hm-seller { display: flex; gap: 12px; align-items: flex-start; }
.hm-seller img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.hm-seller-body { flex: 1; min-width: 0; }
.hm-seller-name { font-size: 15px; font-weight: 700; color: var(--hm-text); margin: 0 0 3px; }
.hm-seller-sub { display: block; font-size: 12px; color: var(--hm-muted); line-height: 1.7; }
.hm-seller-link { font-size: 13px; color: var(--hm-red); text-decoration: none; white-space: nowrap; }
.hm-seller-link:hover { text-decoration: underline; }

/* Vay ngân hàng */
.hm-loan-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; padding: 9px 0; border-bottom: 1px solid #f1f3f5; }
.hm-loan-row span { color: var(--hm-muted); }
.hm-loan-row strong { color: var(--hm-text); font-weight: 600; }
.hm-loan-total { background: var(--hm-bg); border-radius: 8px; padding: 12px 14px; margin: 14px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hm-loan-total span { font-size: 13px; color: var(--hm-text); font-weight: 600; }
.hm-loan-total strong { font-size: 16px; font-weight: 800; color: var(--hm-red); white-space: nowrap; }
.hm-loan-form { display: none; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.hm-loan-form.is-open { display: grid; }
.hm-loan-form label { display: block; font-size: 12px; color: var(--hm-muted); margin-bottom: 4px; }
.hm-loan-form input { width: 100%; height: 36px; border: 1px solid var(--hm-border); border-radius: 6px; padding: 0 10px; font-size: 14px; }
.hm-loan-form input:focus { outline: none; border-color: var(--hm-red); }
.hm-loan-btn { width: 100%; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 991px) {
	.hm-detail-row { grid-template-columns: 1fr; }
	.hm-detail-side { position: static; }
	.hm-gallery-thumbs { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 640px) {
	.hm-specs { grid-template-columns: 1fr; gap: 0; }
	.hm-gallery-thumbs { grid-template-columns: repeat(4, 1fr); }
	.hm-detail-price { font-size: 24px; }
	.hm-loan-form { grid-template-columns: 1fr; }
	.hm-lb-nav { display: none; } /* mobile dùng vuốt */
	.hm-lb-strip { height: 72px; }
	.hm-lb-thumb { flex: 0 0 72px; height: 52px; }
	.hm-lb-stage, .hm-lb-stage img { max-height: calc(100vh - 160px); }
}
