/**
 * 浮动搜索弹窗 (Floating Search Modal)
 * 前缀 dhfs- (daohang floating search) —— 独立命名空间，避免与主题现有样式冲突。
 * 由右侧悬浮工具栏的放大镜按钮 .daohang-floating-search 触发。
 * 主题色通过内联 CSS 变量 --dhfs-primary / --dhfs-secondary 注入（见 footer.php）。
 *
 * 设计要点：
 *  - 弹窗在视口内垂直 + 水平居中。
 *  - 仅保留「站内搜索」，移除全部站外搜索引擎。
 *  - 搜索栏三段（站内搜索标签 / 输入框 / 提交按钮）共用一条完整边框，
 *    垂直居中对齐；表单 overflow:hidden 保证圆角与边框完整（修复顶部边框不可见）。
 */

/* 遮罩层容器：居中显示 */
.dhfs-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center; /* 垂直居中 */
	justify-content: center; /* 水平居中 */
	padding: 24px;
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility .25s ease;
	-webkit-tap-highlight-color: transparent;
}
.dhfs-modal.is-open {
	opacity: 1;
	visibility: visible;
}

/* 打开时锁定页面滚动 */
body.dhfs-modal-open {
	overflow: hidden;
}

/* 半透明背景 */
.dhfs-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .5);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	cursor: pointer;
}

/* 对话框 */
.dhfs-dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 620px;
	transform: translateY(-16px) scale(.98);
	transition: transform .28s cubic-bezier(.2, .8, .25, 1);
}
.dhfs-modal.is-open .dhfs-dialog {
	transform: translateY(0) scale(1);
}

/* 搜索表单主体：统一边框 + 垂直居中（修复顶部边框不可见） */
.dhfs-form {
	position: relative;
	display: flex;
	align-items: stretch;
	height: 56px;
	background: #fff;
	border: 1px solid #b9c2d0; /* 清晰可见边框（含顶部）；原 #dfe3ea 过浅在白底+深色遮罩下几乎不可见 */
	border-radius: 12px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
	overflow: hidden; /* 裁剪内部子元素，保证圆角与边框完整 */
	transition: border-color .2s ease, box-shadow .2s ease;
}
.dhfs-form:focus-within {
	border-color: var(--dhfs-primary, #0099e5);
	box-shadow: 0 18px 50px rgba(0, 0, 0, .28), 0 0 0 4px rgba(0, 153, 229, .12);
}

/* 输入框（唯一的外层框内元素，无边框、无背景，避免嵌套框）
   用 input.dhfs-input 提升特异性(0,1,1)，确保压过主题目录全局 input 边框规则 */
input.dhfs-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	padding: 0 18px;
	margin: 0;
	border: 0;
	border-radius: 0; /* 清除 style.min.css 全局 input{border-radius:999px} 残留 */
	outline: 0;
	background: transparent;
	color: #333;
	font-size: 16px;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}
.dhfs-input::placeholder {
	color: #9aa3b2;
}

/* 提交按钮 */
.dhfs-submit {
	flex: 0 0 auto;
	width: 64px;
	height: 100%;
	border: 0;
	background: var(--dhfs-primary, #0099e5);
	color: #fff;
	font-size: 18px;
	cursor: pointer;
	transition: background .2s ease, filter .2s ease;
}
.dhfs-submit:hover {
	filter: brightness(.94);
}
.dhfs-submit:active {
	filter: brightness(.88);
}

/* 关闭按钮 */
.dhfs-close {
	position: absolute;
	top: -48px;
	right: 0;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
	color: #fff;
	font-size: 18px;
	line-height: 38px;
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}
.dhfs-close:hover {
	background: rgba(255, 255, 255, .28);
	transform: rotate(90deg);
}

/* ---------- 夜间模式 ---------- */
body.daohang-night-mode .dhfs-backdrop {
	background: rgba(0, 0, 0, .6);
}
body.daohang-night-mode .dhfs-form {
	background: #2b2f34;
	border-color: #3a3f45;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
}
body.daohang-night-mode .dhfs-form:focus-within {
	border-color: var(--dhfs-primary, #0099e5);
	box-shadow: 0 18px 50px rgba(0, 0, 0, .5), 0 0 0 4px rgba(0, 153, 229, .18);
}
body.daohang-night-mode .dhfs-input {
	color: #d8dce2;
}
body.daohang-night-mode .dhfs-input::placeholder {
	color: #8b919a;
}

/* ---------- 移动端适配 ---------- */
@media only screen and (max-width: 767px) {
	.dhfs-modal {
		padding: 18px;
	}
}
@media only screen and (max-width: 479px) {
	.dhfs-form {
		height: 52px;
	}
	.dhfs-input {
		padding: 0 14px;
		font-size: 15px;
	}
	.dhfs-submit {
		width: 54px;
		font-size: 16px;
	}
	.dhfs-close {
		top: -44px;
	}
}
