/* Khối Phòng nổi bật – card-grid, kèm thẻ phòng dùng chung (parts/room-card.php, cả trang /phong/). Mobile trước, mốc 640px / 1024px. */

/* ---- Lưới: số cột theo số thẻ để 1, 2, 3 hạng phòng vẫn cân ---- */

.vh-rooms-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--vh-card-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.vh-rooms-grid__item {
	display: flex;
	min-width: 0;
}

.vh-rooms-grid__item > .vh-room-card {
	flex: 1 1 auto;
}

.vh-rooms-more {
	display: flex;
	justify-content: center;
	margin: 1.5rem 0 0;
}

.vh-rooms-more__link {
	gap: 0.375rem;
}

.vh-rooms-more__count {
	font-weight: var(--vh-fw-body);
}

/* ---- Thẻ phòng dọc, skin plain ---- */

.vh-room-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	height: 100%;
	overflow: hidden;
	border: 1px solid var(--vh-color-border);
	border-radius: var(--vh-radius-card);
	background: var(--vh-color-card);
	color: var(--vh-color-text);
	box-shadow: var(--vh-shadow-card);
}

.vh-room-card__media {
	position: relative;
	flex: none;
}

/* Khung 4:3 quyết định tỉ lệ; ảnh chỉ bo 2 góc trên nhờ overflow của thẻ. */
.vh-room-card__frame {
	position: relative;
	aspect-ratio: var(--vh-ratio-room-card, 4 / 3);
	overflow: hidden;
	background: var(--vh-color-surface);
}

.vh-room-card__frame > :not(.vh-room-card__nav) {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border-radius: 0;
}

.vh-room-card__frame img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.vh-room-card__frame .vh-ph {
	height: 100%;
	aspect-ratio: auto;
	border-radius: 0;
}

/* Carousel vuốt ngang bằng scroll-snap, chạy được cả khi chưa có JS. */
.vh-room-card__track {
	display: flex;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.vh-room-card__track::-webkit-scrollbar {
	display: none;
}

.vh-room-card__slide {
	position: relative;
	flex: 0 0 100%;
	min-width: 0;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.vh-room-card__slide > * {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	border-radius: 0;
}

@media (prefers-reduced-motion: no-preference) {
	.vh-room-card__track {
		scroll-behavior: smooth;
	}
}

/* Mũi tên trên ảnh: nút tròn 48px, chỉ hiện với chuột (điện thoại đã vuốt được). */
.vh-room-card__nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: none;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin-top: -24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--vh-color-card);
	color: var(--vh-color-text);
	box-shadow: var(--vh-shadow-card);
	cursor: pointer;
}

.vh-room-card__nav--prev {
	left: 0.5rem;
}

.vh-room-card__nav--next {
	right: 0.5rem;
}

.vh-room-card__nav[disabled],
.vh-room-card__nav[aria-disabled="true"] {
	opacity: 0;
	pointer-events: none;
}

/* Nút ở đầu/cuối dãy ảnh vẫn giữ tiêu điểm bàn phím: hiện mờ thay vì biến mất (WCAG 2.4.7). */
.vh-room-card__nav[aria-disabled="true"]:focus-visible {
	opacity: 0.4;
	pointer-events: auto;
	cursor: default;
}

@media (hover: hover) and (pointer: fine) {
	.vh-room-card__nav {
		display: inline-flex;
	}
}

/* G1: điều khiển trên ảnh dùng vòng đôi trắng 2px + đậm 2px. */
.vh-room-card__nav:focus-visible {
	outline: 2px solid var(--vh-color-focus);
	outline-offset: 2px;
	box-shadow: 0 0 0 2px var(--vh-color-focus-on-deep);
}

.vh-room-card__track:focus-visible {
	outline: 3px solid var(--vh-color-focus);
	outline-offset: -3px;
}

/* Vòng đôi vẽ bằng lớp phủ của khung để luôn nằm trên ảnh. */
.vh-room-card__frame:has(.vh-room-card__track:focus-visible)::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
	box-shadow: inset 0 0 0 2px var(--vh-color-focus), inset 0 0 0 4px var(--vh-color-focus-on-deep);
}

/* Chấm và bộ đếm nằm dưới ảnh, không đè chữ lên ảnh. */
.vh-room-card__pager {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 0.5rem;
	min-height: 28px;
	padding: 0.5rem var(--vh-card-pad) 0;
}

.vh-room-card__dots {
	grid-column: 2;
	display: flex;
	align-items: center;
	gap: 6px;
}

.vh-room-card__dots > * {
	display: block;
	width: 6px;
	height: 6px;
	padding: 0;
	border: 0;
	border-radius: 3px;
	background: var(--vh-color-border-strong);
}

.vh-room-card__dots > .is-active,
.vh-room-card__dots > [aria-current="true"],
.vh-room-card__dots > [aria-selected="true"] {
	width: 16px;
	background: var(--vh-color-primary);
}

@media (prefers-reduced-motion: no-preference) {
	.vh-room-card__dots > * {
		transition: width 0.2s ease, background-color 0.2s ease;
	}
}

.vh-room-card__count {
	grid-column: 3;
	justify-self: end;
	color: var(--vh-color-muted);
	font-size: var(--vh-fs-small);
	font-variant-numeric: tabular-nums;
}

/* ---- Thân thẻ ---- */

.vh-room-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.75rem;
	padding: 1rem var(--vh-card-pad) var(--vh-card-pad);
}

.vh-room-card__name {
	margin: 0;
	overflow-wrap: anywhere;
}

.vh-room-card__link {
	color: inherit;
	text-decoration: none;
}

.vh-room-card__link:hover {
	color: var(--vh-color-primary);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.vh-room-card__link:focus-visible {
	outline: 3px solid var(--vh-color-focus);
	outline-offset: 2px;
	border-radius: 2px;
}

.vh-room-card__specs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--vh-color-muted);
	font-size: var(--vh-fs-small);
	line-height: 1.4;
}

.vh-room-card__spec {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
}

.vh-room-card__spec .vh-i {
	flex: none;
	color: var(--vh-color-muted);
}

/* "Không cửa sổ" ghi thẳng, đậm hơn để khách không bỏ sót. */
.vh-room-card__spec--warn {
	color: var(--vh-color-text);
	font-weight: var(--vh-fw-medium);
}

.vh-room-card__hl {
	display: grid;
	gap: 0.375rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--vh-fs-small);
	line-height: 1.45;
}

.vh-room-card__hl li {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.vh-room-card__hl .vh-i {
	flex: none;
	color: var(--vh-color-success);
}

.vh-room-card__note {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0;
	padding: 0.5rem 0.75rem;
	border-left: 3px solid var(--vh-color-primary);
	border-radius: var(--vh-radius-input);
	background: var(--vh-color-surface);
	color: var(--vh-color-text);
	font-size: var(--vh-fs-small);
	line-height: 1.45;
}

.vh-room-card__note .vh-i {
	flex: none;
	color: var(--vh-color-primary);
}

/* Chân thẻ dồn xuống đáy để các thẻ cùng hàng thẳng nút. */
.vh-room-card__foot {
	display: grid;
	gap: 0.75rem;
	margin-top: auto;
	padding-top: 0.75rem;
	border-top: 1px solid var(--vh-color-border);
}

.vh-room-card__stock {
	margin: 0;
}

/* Nhãn tồn phòng A1: tint + accent-ink (6,38:1); hết phòng dùng màu cảnh báo. */
.vh-room-card__stock .vh-chip {
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	padding: 0.125rem 0.625rem;
	border-radius: var(--vh-radius-chip);
	font-size: var(--vh-fs-small);
	font-weight: var(--vh-fw-medium);
}

.vh-room-card__stock .vh-chip--low {
	background: var(--vh-color-accent);
	color: var(--vh-color-accent-ink);
}

.vh-room-card__stock .vh-chip--danger {
	background: var(--vh-color-surface);
	color: var(--vh-color-danger);
}

.vh-room-card__stock .vh-chip--success {
	background: var(--vh-color-surface);
	color: var(--vh-color-success);
}

.vh-room-card__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 0.25rem;
	margin: 0;
}

.vh-room-card__price .vh-price__from {
	color: var(--vh-color-muted);
	font-size: var(--vh-fs-small);
}

.vh-room-card__price .vh-price__value {
	color: var(--vh-color-text);
	font-family: var(--vh-font-heading);
	font-size: var(--vh-fs-price);
	font-weight: var(--vh-fw-heading);
	line-height: 1.25;
	font-variant-numeric: tabular-nums;
}

.vh-room-card__price .vh-price__unit {
	color: var(--vh-color-muted);
	font-size: var(--vh-fs-small);
}

.vh-room-card__price .vh-price__note {
	flex-basis: 100%;
	color: var(--vh-color-muted);
	font-size: var(--vh-fs-small);
}

.vh-room-card__price--ask .vh-price__note {
	color: var(--vh-color-text);
	font-weight: var(--vh-fw-medium);
}

/* Hai nút cạnh nhau khi đủ chỗ, tự xuống dòng khi thẻ hẹp (lưới 4 cột). */
.vh-room-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.vh-room-card__actions > .vh-btn {
	flex: 1 1 8rem;
	min-height: var(--vh-btn-h-mobile);
}

@media (min-width: 640px) {
	.vh-rooms-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.vh-rooms-grid--n1 {
		grid-template-columns: minmax(0, 560px);
		justify-content: center;
	}

	.vh-rooms-grid--n2 {
		max-width: 920px;
		margin-inline: auto;
	}

	/* Số thẻ lẻ trên 2 cột: thẻ cuối nằm giữa, không lệch về trái. */
	.vh-rooms-grid--odd > .vh-rooms-grid__item:last-child {
		grid-column: 1 / -1;
		justify-self: center;
		width: calc((100% - var(--vh-card-gap)) / 2);
	}
}

@media (min-width: 1024px) {
	.vh-rooms-grid--n3,
	.vh-rooms-grid--n5,
	.vh-rooms-grid--n6 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.vh-rooms-grid--n4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	/* 3 cột: bỏ căn giữa thẻ lẻ của bố cục 2 cột. */
	.vh-rooms-grid--odd > .vh-rooms-grid__item:last-child {
		grid-column: auto;
		justify-self: stretch;
		width: auto;
	}

	.vh-room-card__actions > .vh-btn {
		min-height: var(--vh-btn-h);
	}
}
