/**
 * Property Single — gallery + lightbox thumbnail strip + sidebar form
 * Phase 10C: GLightbox integration + custom bottom thumbnail strip
 * Phase 10C HOTFIX: sidebar CF7 form width fix
 */

/* ── GALLERY PREVIEW CHÍNH ─────────────────────────────────────────────────── */

.dsnd-gallery__main {
	position: relative;
	overflow: hidden;
	border-radius: 10px;
	background: #111;
	line-height: 0; /* Tránh gap dưới img */
}

/* Ảnh chính — cursor hint mở lightbox */
.dsnd-gallery__img {
	cursor: zoom-in;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Nút zoom / đếm ảnh */
.dsnd-gallery__zoom {
	position: absolute;
	bottom: 10px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px;
	border: none;
	border-radius: 20px;
	background: rgba(0, 0, 0, .55);
	backdrop-filter: blur(6px);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	line-height: 1;
	transition: background .15s;
}

.dsnd-gallery__zoom:hover,
.dsnd-gallery__zoom:focus-visible {
	background: rgba(0, 0, 0, .8);
	outline: none;
}

/* ── THUMBNAIL STRIP DƯỚI PREVIEW ─────────────────────────────────────────── */

.dsnd-gallery__thumbs {
	display: flex;
	flex-direction: row;
	gap: 6px;
	margin-top: 8px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox */
	padding-bottom: 2px; /* Tránh cắt box-shadow */
}

.dsnd-gallery__thumbs::-webkit-scrollbar {
	display: none;
}

.dsnd-gallery__thumb {
	flex: 0 0 auto;
	width: 72px;
	height: 56px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 6px;
	overflow: hidden;
	cursor: pointer;
	background: #eee;
	transition: border-color .15s, opacity .15s;
	scroll-snap-align: start;
}

.dsnd-gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.dsnd-gallery__thumb:hover {
	border-color: rgba(var(--clr-gold-rgb, 185, 141, 69), .6);
	opacity: 1;
}

.dsnd-gallery__thumb.is-active {
	border-color: var(--clr-gold, #b98d45);
	box-shadow: 0 0 0 1px var(--clr-gold, #b98d45);
}

/* ── LIGHTBOX THUMBNAIL STRIP (inject vào .glightbox-container) ───────────── */

.dsnd-lb-thumbs {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 9999;
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 6px;
	padding: 14px 16px;
	/* Safe area iPhone notch / home indicator */
	padding-bottom: max(14px, calc(14px + env(safe-area-inset-bottom)));
	/* Gradient tối fade lên để không che ảnh đột ngột */
	background: linear-gradient(to top, rgba(0, 0, 0, .9) 0%, rgba(0, 0, 0, 0) 100%);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	/* Căn giữa nếu ít ảnh */
	justify-content: flex-start;
}

.dsnd-lb-thumbs::-webkit-scrollbar {
	display: none;
}

/* GLightbox: đẩy vùng slide lên để không bị che bởi thumbnail strip */
.glightbox-container .gslider {
	padding-bottom: 100px;
}

/* Thumbnail button trong lightbox */
.dsnd-lb-thumb {
	flex: 0 0 auto;
	width: 64px;
	height: 56px;
	padding: 0;
	border: 2px solid rgba(255, 255, 255, .25);
	border-radius: 5px;
	overflow: hidden;
	cursor: pointer;
	background: rgba(255, 255, 255, .1);
	opacity: .65;
	transition: border-color .15s, opacity .15s, transform .15s;
	scroll-snap-align: center;
}

.dsnd-lb-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.dsnd-lb-thumb:hover {
	opacity: .9;
	border-color: rgba(255, 255, 255, .6);
}

.dsnd-lb-thumb.is-active {
	opacity: 1;
	border-color: var(--clr-gold, #b98d45);
	transform: scale(1.1);
	box-shadow: 0 0 0 1px var(--clr-gold, #b98d45);
}

/* ── GLightbox OVERRIDES — căn chỉnh cho UX BĐS ──────────────────────────── */

/* Nút đóng — to hơn cho mobile */
.glightbox-container .gclose {
	width: 44px;
	height: 44px;
	top: 12px;
	right: 12px;
	border-radius: 50%;
	background: rgba(0, 0, 0, .55);
	backdrop-filter: blur(6px);
}

.glightbox-container .gclose:hover {
	background: rgba(0, 0, 0, .85);
}

/* Nút prev / next — vùng tap lớn hơn trên mobile */
.glightbox-container .gnav-btn {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: rgba(0, 0, 0, .45);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
}

.glightbox-container .gnav-btn:hover {
	background: rgba(0, 0, 0, .75);
}

/* Counter slide (nếu GLightbox hiển thị) */
.glightbox-container .gcounter {
	color: rgba(255, 255, 255, .75);
	font-size: 13px;
	font-weight: 600;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
	.dsnd-gallery__thumb {
		width: 60px;
		height: 50px;
	}

	.dsnd-lb-thumb {
		width: 54px;
		height: 48px;
	}

	/* Ít padding ngang hơn trên màn nhỏ */
	.dsnd-lb-thumbs {
		padding-left: 10px;
		padding-right: 10px;
		gap: 5px;
	}

	.glightbox-container .gslider {
		padding-bottom: 80px;
	}
}

@media (min-width: 1024px) {
	.dsnd-lb-thumb {
		width: 72px;
		height: 60px;
	}

	.dsnd-gallery__thumb {
		width: 88px;
		height: 68px;
	}
}

/* ── SIDEBAR CONTACT FORM — CF7 width fix ─────────────────────────────────────
   Đảm bảo input/textarea không tràn khỏi .dsnd-side-card.
   Các style này đặt ở đây thay vì pages.css để chắc chắn load trên single-property.
   ──────────────────────────────────────────────────────────────────────────── */

/* Card sidebar: tránh con overflow ra ngoài */
.dsnd-single-col--side .dsnd-side-card {
	overflow: hidden;        /* Cắt bất kỳ element con tràn */
	word-break: break-word;
}

/* CF7 wrapper: đảm bảo chiều rộng đúng */
.dsnd-single-col--side .dsnd-cf7-wrap,
.dsnd-single-col--side .wpcf7 {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

/* Tất cả form controls trong sidebar — full width, không overflow */
.dsnd-single-col--side .wpcf7 input[type="text"],
.dsnd-single-col--side .wpcf7 input[type="tel"],
.dsnd-single-col--side .wpcf7 input[type="email"],
.dsnd-single-col--side .wpcf7 input[type="number"],
.dsnd-single-col--side .wpcf7 input[type="url"],
.dsnd-single-col--side .wpcf7 select,
.dsnd-single-col--side .wpcf7 textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border: 1px solid var(--border, #dde3ea);
	border-radius: 6px;
	font-size: 14px;
	font-family: var(--font-sans, sans-serif);
	background: #fff;
	color: var(--text, #333);
	transition: border-color .15s;
	display: block;
}

.dsnd-single-col--side .wpcf7 input:focus,
.dsnd-single-col--side .wpcf7 textarea:focus,
.dsnd-single-col--side .wpcf7 select:focus {
	outline: none;
	border-color: var(--clr-gold, #b98d45);
	box-shadow: 0 0 0 3px rgba(185, 141, 69, .15);
}

/* Textarea: chiều cao cố định, resize dọc */
.dsnd-single-col--side .wpcf7 textarea {
	height: 100px;
	resize: vertical;
	min-height: 80px;
}

/* Wrapper từng field — margin chuẩn */
.dsnd-single-col--side .wpcf7 .wpcf7-form-control-wrap {
	display: block;
	width: 100%;
	margin-bottom: 12px;
}

/* Label rõ ràng */
.dsnd-single-col--side .wpcf7 label {
	display: block;
	font-size: 13px;
	font-weight: 500;
	margin-bottom: 4px;
	color: var(--text, #0a1628);
}

/* Checkbox / radio: không bị lệch */
.dsnd-single-col--side .wpcf7 .wpcf7-checkbox label,
.dsnd-single-col--side .wpcf7 .wpcf7-radio label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 400;
	cursor: pointer;
}

.dsnd-single-col--side .wpcf7 .wpcf7-checkbox input[type="checkbox"],
.dsnd-single-col--side .wpcf7 .wpcf7-radio input[type="radio"] {
	width: auto;
	max-width: auto;
	flex-shrink: 0;
}

/* Nút gửi — full width, style theme */
.dsnd-single-col--side .wpcf7 input[type="submit"],
.dsnd-single-col--side .wpcf7 .wpcf7-submit {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	padding: 12px 20px;
	border: none;
	border-radius: 6px;
	background: var(--navy, #0a1628);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	font-family: var(--font-sans, sans-serif);
	cursor: pointer;
	transition: background .15s, transform .1s;
	letter-spacing: .3px;
	margin-top: 4px;
}

.dsnd-single-col--side .wpcf7 input[type="submit"]:hover,
.dsnd-single-col--side .wpcf7 .wpcf7-submit:hover {
	background: var(--clr-gold, #b98d45);
	color: var(--navy, #0a1628);
}

.dsnd-single-col--side .wpcf7 input[type="submit"]:active,
.dsnd-single-col--side .wpcf7 .wpcf7-submit:active {
	transform: scale(.98);
}

/* Loading spinner khi đang gửi */
.dsnd-single-col--side .wpcf7 .wpcf7-spinner {
	display: inline-block;
	margin-left: 8px;
	vertical-align: middle;
}

/* Response message */
.dsnd-single-col--side .wpcf7 .wpcf7-response-output {
	margin-top: 10px;
	padding: 10px 12px;
	border-radius: 6px;
	font-size: 13px;
	box-sizing: border-box;
	width: 100%;
}

.dsnd-single-col--side .wpcf7 .wpcf7-mail-sent-ok {
	background: #edfaef;
	border: 1px solid #00a32a;
	color: #00a32a;
}

.dsnd-single-col--side .wpcf7 .wpcf7-validation-errors,
.dsnd-single-col--side .wpcf7 .wpcf7-mail-sent-ng {
	background: #fce7e7;
	border: 1px solid #d63638;
	color: #d63638;
}

/* Validation error tip dưới field */
.dsnd-single-col--side .wpcf7 .wpcf7-not-valid-tip {
	font-size: 12px;
	color: #d63638;
	display: block;
	margin-top: 3px;
}

/* ── CONTACT CARD — Broker header trong "Liên hệ nhanh" ───────────────────────
   Chỉ thêm phần header, CTA buttons giữ nguyên hoàn toàn.
   ──────────────────────────────────────────────────────────────────────────── */

/* Row: avatar + tên + subtitle */
.dsnd-contact-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--border, #e5e0d6);
}

/* Vòng tròn chứa avatar hoặc initials */
.dsnd-contact-av {
	flex-shrink: 0;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--navy, #1c2d4e);
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Ảnh avatar thật */
.dsnd-contact-av .dsnd-contact-av__img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

/* Fallback: 2 chữ cái đầu */
.dsnd-contact-av .dsnd-contact-av__initials {
	font-size: 18px;
	font-weight: 700;
	color: #fff;
	letter-spacing: 0.5px;
	line-height: 1;
	user-select: none;
}

/* Cột text bên phải avatar */
.dsnd-contact-info {
	flex: 1;
	min-width: 0; /* Tránh overflow với tên dài */
}

.dsnd-contact-name {
	font-weight: 700;
	font-size: 14px;
	color: var(--text, #1c2d4e);
	margin: 0 0 3px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3;
}

.dsnd-contact-sub {
	font-size: 11px;
	color: var(--text-muted, #888);
	margin: 0;
	line-height: 1.3;
}

/* Label "Phụ trách kinh doanh" — nằm trong cột text, ngay trên tên broker */
.dsnd-contact-label {
	font-size: 11px;
	color: var(--text-muted, #888);
	margin: 0 0 3px 0;
	line-height: 1.3;
}

/* Spacing giữa CTA buttons trong card — đảm bảo khoảng cách đẹp */
.dsnd-contact-card .dsnd-btn--block {
	margin-bottom: 8px;
}
.dsnd-contact-card .dsnd-btn--block:last-child {
	margin-bottom: 0;
}

/* Mobile: giảm nhẹ kích thước avatar cho màn nhỏ */
@media (max-width: 480px) {
	.dsnd-contact-av,
	.dsnd-contact-av .dsnd-contact-av__img {
		width: 48px;
		height: 48px;
	}
	.dsnd-contact-av .dsnd-contact-av__initials {
		font-size: 16px;
	}
}
