/**
 * Nju - Style cho bộ công cụ tiện ích.
 */

/* ---------- Khung tra từ điển ---------- */
.nju-dict {
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	padding: 16px;
	margin: 20px 0;
	max-width: 100%;
}

.nju-dict__bar {
	display: flex;
	gap: 8px;
}

.nju-dict__input {
	flex: 1;
	min-width: 0;
	border: 2px solid #e4e6eb;
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 1rem;
	font-family: inherit;
}
.nju-dict__input:focus {
	outline: none;
	border-color: var(--nju-fb-blue, #1877f2);
}

.nju-dict__btn {
	background: var(--nju-fb-blue, #1877f2);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 0 20px;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	white-space: nowrap;
}
.nju-dict__btn:hover {
	background: var(--nju-fb-blue-dark, #0c63d1);
}

.nju-dict__result {
	margin-top: 14px;
}

.nju-dict__msg {
	color: #65676b;
	margin: 0;
}
.nju-dict__msg--err {
	color: #d63333;
}

.nju-dict__card {
	border-top: 1px solid #eee;
	padding-top: 12px;
}

.nju-dict__head {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.nju-dict__word {
	font-size: 1.3em;
	text-transform: capitalize;
}

.nju-dict__ipa {
	color: #65676b;
	font-family: 'Noto Sans', 'Segoe UI', sans-serif;
	font-weight: 400;
}

.nju-dict__play {
	background: var(--nju-fb-blue, #1877f2);
	color: #fff;
	border: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	line-height: 1;
}
.nju-dict__play:hover {
	background: var(--nju-fb-blue-dark, #0c63d1);
}

.nju-dict__badge {
	background: #e7f3ff;
	color: var(--nju-fb-blue, #1877f2);
	font-size: 0.75rem;
	font-weight: 700;
	padding: 3px 9px;
	border-radius: 999px;
}

.nju-dict__muted {
	color: #999;
	font-size: 0.85rem;
	font-weight: 400;
}

.nju-dict__meanings {
	margin-top: 10px;
}

.nju-dict__pos {
	color: var(--nju-fb-blue, #1877f2);
	font-style: normal;
	margin: 10px 0 4px;
	font-size: 0.95rem;
}

.nju-dict__defs {
	margin: 0 0 0 1.2em;
	padding: 0;
}
.nju-dict__defs li {
	margin-bottom: 6px;
	font-weight: 400 !important;
	font-size: 0.95rem !important;
}

.nju-dict__ex {
	display: block;
	color: #8a8d91;
	font-weight: 400 !important;
	font-size: 0.88em !important;
	margin-top: 2px;
}

/* ---------- Thời gian đọc ---------- */
.nju-reading-time {
	display: inline-block;
	background: #f0f2f5;
	color: #65676b;
	padding: 4px 12px;
	border-radius: 999px;
	font-size: 0.85rem !important;
	font-weight: 600 !important;
}

/* ---------- Mục lục tự động ---------- */
.nju-toc {
	background: #fafbfc;
	border: 1px solid #eee;
	border-radius: 10px;
	padding: 16px 20px;
	margin: 20px 0;
}
.nju-toc__title {
	font-weight: 700 !important;
	margin: 0 0 8px;
	font-size: 1.05rem !important;
}
.nju-toc ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
.nju-toc__item {
	margin: 6px 0;
}
.nju-toc__item--h3 {
	padding-left: 1.2em;
	font-size: 0.95em;
}
.nju-toc a {
	color: var(--nju-fb-blue, #1877f2);
	text-decoration: none;
	font-weight: 600 !important;
}
.nju-toc a:hover {
	text-decoration: underline;
}

/* ---------- Thanh tiến trình đọc ---------- */
.nju-progress {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 4px;
	background: transparent;
	z-index: 9999;
}
.nju-progress__bar {
	display: block;
	height: 100%;
	width: 0%;
	background: var(--nju-fb-blue, #1877f2);
	transition: width 0.1s ease-out;
}

/* ---------- Nút lên đầu trang ---------- */
.nju-to-top {
	position: fixed;
	right: 20px;
	bottom: 20px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: none;
	background: var(--nju-fb-blue, #1877f2);
	color: #fff;
	font-size: 1.2rem;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
	z-index: 999;
}
.nju-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.nju-to-top:hover {
	background: var(--nju-fb-blue-dark, #0c63d1);
}

/* ---------- Di động ---------- */
@media screen and (max-width: 600px) {
	.nju-dict__bar {
		flex-direction: column;
	}
	.nju-dict__btn {
		padding: 10px;
	}
	.nju-to-top {
		right: 14px;
		bottom: 14px;
		width: 40px;
		height: 40px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nju-to-top {
		transition: none;
	}
	.nju-progress__bar {
		transition: none;
	}
}
