/*
 * Bản đồ vùng cấm bay (page-templates/no-fly-zones.php). Tiền tố nf-, màu/khoảng cách theo biến --dj-* của site.css.
 * Màu vùng khớp lớp bản đồ trong no-fly.js: cấm bay đỏ, hạn chế bay cam.
 */
.nf {
	--nf-cb: #dc2626;
	--nf-cb-dark: #b91c1c;
	--nf-hcb: #d97706;
	--nf-hcb-dark: #b45309;
	--nf-ok: #15803d;
	--nf-radius: 12px;
	--nf-shadow: 0 6px 24px rgba(15, 23, 42, .16);
	background: #fff;
	color: var(--dj-text);
	font-family: var(--dj-font);
}
.nf a { color: var(--dj-blue); }
.nf .ag-hwrap { box-sizing: border-box; }
.nf-t-cb { color: var(--nf-cb-dark); }
.nf-t-hcb { color: var(--nf-hcb-dark); }

/* ---------- Mở đầu ---------- */
.nf-hero { padding: 40px 0 24px; }
.nf-hero__eyebrow { margin: 0 0 8px; color: var(--dj-blue); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.nf-hero__title { margin: 0 0 12px; color: var(--dj-head); font-size: clamp(26px, 3.4vw, 40px); line-height: 1.2; font-weight: 700; }
.nf-hero__lead { margin: 0; max-width: 780px; color: var(--dj-muted); font-size: 16px; line-height: 1.65; }

/* ---------- Khung bản đồ ---------- */
.nf-app { padding-bottom: 8px; }
.nf-app__frame {
	position: relative;
	height: clamp(520px, 76vh, 860px);
	border-radius: var(--nf-radius);
	overflow: hidden;
	background: #eef1f4;
	box-shadow: inset 0 0 0 1px var(--dj-line-2);
}
.nf-app__frame:fullscreen { height: 100%; border-radius: 0; }
.nf-map { position: absolute; inset: 0; }
.nf-app__source { margin: 10px 0 0; color: var(--dj-sub); font-size: 12.5px; line-height: 1.6; }

.nf-loading {
	position: absolute; inset: 0; z-index: 1;
	display: flex; align-items: center; justify-content: center; gap: 10px;
	color: var(--dj-muted); font-size: 14px; pointer-events: none;
}
.nf-loading[hidden] { display: none; }
.nf-loading__spin { width: 18px; height: 18px; border: 2px solid #cbd5e1; border-top-color: var(--dj-blue); border-radius: 50%; animation: nf-spin .8s linear infinite; }
@keyframes nf-spin { to { transform: rotate(360deg); } }

/* Cột nổi bên trái: ô tìm + thông báo + kết quả (xếp chồng, không đè nhau) */
.nf-side {
	position: absolute; top: 12px; left: 12px; z-index: 3;
	display: flex; flex-direction: column; gap: 8px;
	width: min(420px, calc(100% - 72px));
	max-height: calc(100% - 24px);
	pointer-events: none;
}
.nf-side > * { pointer-events: auto; }
.nf-bar { display: flex; gap: 8px; }

.nf-search { position: relative; flex: 1 1 auto; min-width: 0; }
.nf-search__icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--dj-sub); pointer-events: none; }
.nf .nf-search__input {
	box-sizing: border-box; width: 100%; height: 44px; margin: 0;
	padding: 0 14px 0 40px;
	border: 0; border-radius: 10px; background: #fff;
	box-shadow: var(--nf-shadow);
	font-size: 15px; color: var(--dj-head);
	outline: none;
}
.nf .nf-search__input:focus { box-shadow: var(--nf-shadow), 0 0 0 2px var(--dj-blue); }
.nf-search__list {
	position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 5;
	margin: 0; padding: 4px; list-style: none;
	max-height: min(360px, 50vh); overflow: auto;
	background: #fff; border-radius: 10px; box-shadow: var(--nf-shadow);
}
.nf-search__list[hidden] { display: none; }
.nf-search__list li { margin: 0; padding: 8px 10px; border-radius: 7px; cursor: pointer; line-height: 1.35; }
.nf-search__list li.is-active, .nf-search__list li:hover { background: var(--dj-blue-soft); }
.nf-search__name { display: block; color: var(--dj-head); font-size: 14.5px; }
.nf-search__meta { display: block; margin-top: 2px; color: var(--dj-sub); font-size: 12.5px; }
.nf-search__list li.nf-search__empty { color: var(--dj-sub); cursor: default; background: none; font-size: 13.5px; }

.nf-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px;
	min-height: 44px; margin: 0; padding: 0 16px;
	border: 1px solid var(--dj-line-2); border-radius: 10px; background: #fff;
	color: var(--dj-head); font-size: 14px; font-weight: 600; line-height: 1; text-transform: none; letter-spacing: 0;
	text-decoration: none; cursor: pointer; white-space: nowrap;
}
.nf a.nf-btn { color: var(--dj-head); }
.nf-btn:hover { border-color: #c9ced4; }
.nf-btn--primary, .nf a.nf-btn--primary { background: var(--dj-blue); border-color: var(--dj-blue); color: #fff; }
.nf-btn--primary:hover { background: #0050c8; border-color: #0050c8; }
.nf-btn--locate { flex: 0 0 auto; border: 0; box-shadow: var(--nf-shadow); }
.nf-btn--locate svg { color: var(--dj-blue); }
.nf-btn--locate.is-busy svg { animation: nf-spin 1s linear infinite; }

/* Chú giải + bật/tắt lớp */
.nf-legend {
	position: absolute; left: 12px; bottom: 12px; z-index: 2;
	padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .96); box-shadow: var(--nf-shadow);
	font-size: 13.5px; color: var(--dj-head);
}
.nf-legend__item { display: flex; align-items: center; gap: 8px; margin: 0; padding: 3px 0; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.nf-legend__item input { width: 16px; height: 16px; margin: 0; accent-color: var(--dj-blue); }
.nf-legend__hint { margin: 6px 0 0; color: var(--dj-sub); font-size: 12px; }
.nf-swatch { display: inline-block; width: 16px; height: 12px; border-radius: 3px; }
.nf-swatch--cb { background: rgba(239, 68, 68, .55); box-shadow: inset 0 0 0 1.5px var(--nf-cb-dark); }
.nf-swatch--hcb { background: rgba(245, 158, 11, .55); box-shadow: inset 0 0 0 1.5px var(--nf-hcb-dark); }

/* Thông báo lỗi/nhắc */
.nf-status { padding: 10px 12px; border-radius: 10px; background: #fff7ed; color: #9a3412; box-shadow: var(--nf-shadow); font-size: 13.5px; line-height: 1.5; }
.nf-status[hidden] { display: none; }
.nf-status a { color: inherit; text-decoration: underline; }
noscript .nf-status { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 4; }

/* Thẻ kết quả kiểm tra */
.nf-result {
	position: relative; overflow: auto;
	padding: 14px 16px 12px; border-radius: var(--nf-radius); background: #fff; box-shadow: var(--nf-shadow);
	border-left: 5px solid #94a3b8;
	font-size: 14px; line-height: 1.5;
}
.nf-result[hidden] { display: none; }
.nf-result--cb { border-left-color: var(--nf-cb); }
.nf-result--hcb { border-left-color: var(--nf-hcb); }
.nf-result--ok { border-left-color: var(--nf-ok); }
.nf-result--info { border-left-color: var(--dj-blue); }
.nf-result p { margin: 0; }
.nf-result__close {
	position: absolute; top: 6px; right: 6px;
	width: 32px; height: 32px; min-height: 0; margin: 0; padding: 0;
	border: 0; border-radius: 8px; background: none; color: var(--dj-sub); font-size: 22px; line-height: 1; cursor: pointer;
}
.nf-result__close:hover { background: var(--dj-soft); color: var(--dj-head); }
.nf-result__verdict { padding-right: 28px; font-size: 16px; font-weight: 700; color: var(--dj-head); }
.nf-result--cb .nf-result__verdict { color: var(--nf-cb-dark); }
.nf-result--hcb .nf-result__verdict { color: var(--nf-hcb-dark); }
.nf-result--ok .nf-result__verdict { color: var(--nf-ok); }
.nf-result--wait .nf-result__verdict { color: var(--dj-muted); font-weight: 600; }
.nf-result .nf-result__note { margin-top: 4px; color: var(--nf-hcb-dark); font-size: 13px; }
.nf-result .nf-result__place { margin-top: 6px; padding-right: 28px; color: var(--dj-head); font-weight: 600; }
.nf-result--info .nf-result__place { margin-top: 0; }
.nf-result__place small { display: block; color: var(--dj-sub); font-size: 12.5px; font-weight: 400; }
.nf-result .nf-result__text { margin-top: 6px; color: var(--dj-text); }
.nf-result .nf-result__coord { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; color: var(--dj-sub); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.nf-result .nf-result__links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--dj-line-2); font-size: 13.5px; font-weight: 600; }
.nf-link { margin: 0; padding: 0; min-height: 0; border: 0; background: none; color: var(--dj-blue); font: inherit; font-weight: 600; text-transform: none; letter-spacing: 0; cursor: pointer; }
.nf-link:hover { text-decoration: underline; }

/* Ghim điểm kiểm tra */
.nf-pin { width: 30px; height: 40px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); cursor: default; }
.nf-pin path { fill: #64748b; }
.nf-pin--cb path { fill: var(--nf-cb); }
.nf-pin--hcb path { fill: var(--nf-hcb); }
.nf-pin--ok path { fill: var(--nf-ok); }
/* Nhún ở <svg> bên trong, KHÔNG ở .nf-pin: MapLibre đặt vị trí marker bằng transform trên chính phần tử
   đó — animation transform ở đây đè lên vị trí, ghim xám "bay" qua lại góc bản đồ (lỗi 08/11/2026). */
.nf-pin svg { display: block; }
.nf-pin--wait svg { animation: nf-bob .9s ease-in-out infinite alternate; }
@keyframes nf-bob { to { transform: translateY(-4px); } }

/* Điều khiển MapLibre: khớp phong cách thẻ */
.nf .maplibregl-ctrl-group { border-radius: 10px; box-shadow: var(--nf-shadow); }
.nf .maplibregl-ctrl-group button { min-height: 0; margin: 0; padding: 0; }
.nf .maplibregl-ctrl-attrib { font-size: 11px; }
.nf .maplibregl-cooperative-gesture-screen { font-family: var(--dj-font); font-size: 15px; }

/* ---------- Các bước ---------- */
.nf-h2 { margin: 0 0 18px; color: var(--dj-head); font-size: clamp(22px, 2.4vw, 28px); line-height: 1.3; font-weight: 700; }
.nf-steps { padding-top: 48px; padding-bottom: 8px; }
.nf-steps__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.nf-steps__item { margin: 0; padding: 20px; border-radius: var(--nf-radius); background: var(--dj-soft); }
.nf-steps__num {
	display: inline-flex; align-items: center; justify-content: center;
	width: 30px; height: 30px; margin-bottom: 10px; border-radius: 50%;
	background: var(--dj-blue); color: #fff; font-weight: 700; font-size: 14px;
}
.nf-steps__item h3 { margin: 0 0 6px; color: var(--dj-head); font-size: 17px; font-weight: 700; }
.nf-steps__item p { margin: 0; color: var(--dj-muted); font-size: 14.5px; line-height: 1.6; }

/* ---------- Nội dung soạn trong wp-admin ---------- */
.nf-content { padding-top: 40px; }
.nf-content__body { max-width: 820px; font-size: 16px; line-height: 1.75; }
.nf-content__body h2 { margin: 32px 0 12px; color: var(--dj-head); font-size: 24px; line-height: 1.35; font-weight: 700; }
.nf-content__body h3 { margin: 24px 0 8px; color: var(--dj-head); font-size: 19px; font-weight: 700; }
.nf-content__body p, .nf-content__body ul, .nf-content__body ol { margin: 0 0 14px; }
.nf-content__body li { margin-bottom: 6px; }

/* ---------- Gọi hành động ---------- */
.nf-cta { padding-top: 40px; padding-bottom: 64px; }
.nf-cta__box {
	display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap;
	padding: 28px 32px; border-radius: var(--nf-radius); background: var(--dj-blue-soft);
}
.nf-cta__title { margin: 0 0 6px; color: var(--dj-head); font-size: 22px; font-weight: 700; line-height: 1.35; }
.nf-cta__box p { margin: 0; color: var(--dj-muted); }
.nf-cta__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Điện thoại / máy tính bảng ---------- */
@media (max-width: 899px) {
	.nf-steps__list { grid-template-columns: 1fr; }
}
@media (max-width: 639px) {
	.nf-hero { padding: 24px 0 16px; }
	.nf-hero__lead { font-size: 15px; }
	.nf-app { padding-left: 0; padding-right: 0; }
	.nf-app__frame { height: 74vh; min-height: 480px; border-radius: 0; box-shadow: none; }
	.nf-app__source { padding: 0 var(--dj-gutter); }
	/* Cột nổi phủ cả khung: ô tìm ở trên, thẻ kết quả dạt xuống đáy (bottom sheet) */
	.nf-side { inset: 8px; width: auto; max-height: none; gap: 6px; }
	.nf-bar { margin-right: 52px; }   /* chừa cột nút zoom/toàn màn hình */
	.nf-result { margin-top: auto; }
	.nf-app__frame:has(.nf-result:not([hidden])) .nf-legend { display: none; }
	.nf-btn--locate { width: 44px; padding: 0; }
	.nf-btn--locate span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.nf-result { max-height: 42%; font-size: 13.5px; }
	.nf-legend { left: 8px; bottom: 8px; padding: 8px 10px; }
	.nf-legend__hint { display: none; }
	.nf-cta__box { padding: 22px 20px; }
}

/* Điện thoại: cụm nút liên hệ nổi của site (inc/site.php) đè lên thẻ kết quả → ẩn tạm khi bản đồ đang trong màn hình
   (no-fly.js gắn class nf-map-in-view); cuộn sang phần khác của trang thì hiện lại. */
@media (max-width: 639px) {
	body.nf-map-in-view .ag-float { opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s .2s; }
}
