/*!
 * tri-note.css — v1.0.0 (24/10/2026) — đi kèm tri-note.js (bôi từ có màu, ghi chú từ, Sổ từ).
 * Dùng chung therealielts.vn / tudien / mocktest: CHÉP NGUYÊN, đổi màu bằng biến bên dưới
 * (đặt lại trên :root hoặc body ở site mình), không sửa file. Font kế thừa từ trang. Luôn giao diện sáng.
 *
 * Biến (mặc định = token theme.json của WordPress, có giá trị dự phòng cho site không có token):
 *   --tri-note-primary   nút chính, link, viền đang chọn          (action)
 *   --tri-note-ink       chữ                                     (navy)
 *   --tri-note-muted     chữ phụ                                 (slate)
 *   --tri-note-bg        nền thanh / hộp / thẻ                   (white)
 *   --tri-note-line      viền                                    (ice)
 *   --tri-note-soft      nền nhạt (thông báo, nút phụ)           (ice-soft)
 *   --tri-note-danger    nút xoá                                 (red)
 *   --tri-note-z         lớp chồng của thanh / hộp
 *   --tri-note-yellow / -green / -blue / -pink / -orange   màu bút dạ quang (nền chỗ bôi)
 */

:root {
	--tri-note-primary: var(--wp--preset--color--action, #0053d1);
	--tri-note-ink: var(--wp--preset--color--navy, #091f5b);
	--tri-note-muted: var(--wp--preset--color--slate, #475467);
	--tri-note-bg: var(--wp--preset--color--white, #ffffff);
	--tri-note-line: var(--wp--preset--color--ice, #bad6eb);
	--tri-note-soft: var(--wp--preset--color--ice-soft, #eef5fb);
	--tri-note-danger: var(--wp--preset--color--red, #d92d20);
	--tri-note-z: 2147483000;
	--tri-note-yellow: #fff06a;
	--tri-note-green: #b7f0a4;
	--tri-note-blue: #b4dcff;
	--tri-note-pink: #ffc4e1;
	--tri-note-orange: #ffd29a;
}

/* ── chỗ bôi trong bài ─────────────────────────────────────────────────────── */

mark.tri-note-hl {
	background: var(--tri-note-yellow);
	color: inherit;
	padding: 0.05em 0;
	border-radius: 0.15em;
	box-decoration-break: clone;
	-webkit-box-decoration-break: clone;
	cursor: pointer;
	transition: box-shadow 0.2s ease;
}

mark.tri-note-hl[data-color="green"] { background: var(--tri-note-green); }
mark.tri-note-hl[data-color="blue"] { background: var(--tri-note-blue); }
mark.tri-note-hl[data-color="pink"] { background: var(--tri-note-pink); }
mark.tri-note-hl[data-color="orange"] { background: var(--tri-note-orange); }

mark.tri-note-hl:focus-visible {
	outline: 2px solid var(--tri-note-primary);
	outline-offset: 2px;
}

mark.tri-note-hl--note::after,
mark.tri-note-hl--book::after {
	content: "";
	display: inline-block;
	width: 0.42em;
	height: 0.42em;
	margin-left: 0.12em;
	vertical-align: super;
	border-radius: 50%;
	background: var(--tri-note-primary);
}

mark.tri-note-hl--flash {
	animation: tri-note-flash 0.8s ease 3;
}

@keyframes tri-note-flash {
	50% { box-shadow: 0 0 0 4px var(--tri-note-primary); }
}

/* ── thanh bôi + hộp sửa + thông báo ───────────────────────────────────────── */

.tri-note-ui,
.tri-note-ui *,
.tri-note-book,
.tri-note-book * {
	box-sizing: border-box;
}

.tri-note-bar,
.tri-note-pop {
	position: fixed;
	z-index: var(--tri-note-z);
	color: var(--tri-note-ink);
	background: var(--tri-note-bg);
	border: 1px solid var(--tri-note-line);
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(9, 31, 91, 0.18);
	font-size: 14px;
	line-height: 1.4;
	color-scheme: light;
}

.tri-note-bar[hidden],
.tri-note-pop[hidden],
.tri-note-toast[hidden],
.tri-note-book [hidden] {
	display: none !important;
}

.tri-note-bar {
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 4px;
	white-space: nowrap;
}

.tri-note-bar--long .tri-note-sw,
.tri-note-bar--long .tri-note-btn {
	opacity: 0.45;
}

.tri-note-bar__sep {
	width: 1px;
	height: 22px;
	margin: 0 4px;
	background: var(--tri-note-line);
}

.tri-note-sw,
.tri-note-btn,
.tri-note-pbtn,
.tri-note-pop__x,
.tri-note-toast__x,
.tri-note-book__k {
	font: inherit;
	color: inherit;
	margin: 0;
	border: 0;
	background: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.tri-note-sw {
	display: inline-grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border-radius: 50%;
}

.tri-note-sw__dot {
	display: block;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--tri-note-yellow);
	box-shadow: inset 0 0 0 1px rgba(9, 31, 91, 0.18);
}

[data-color="green"] > .tri-note-sw__dot { background: var(--tri-note-green); }
[data-color="blue"] > .tri-note-sw__dot { background: var(--tri-note-blue); }
[data-color="pink"] > .tri-note-sw__dot { background: var(--tri-note-pink); }
[data-color="orange"] > .tri-note-sw__dot { background: var(--tri-note-orange); }

.tri-note-sw:hover,
.tri-note-btn:hover,
.tri-note-pop__x:hover,
.tri-note-toast__x:hover {
	background: var(--tri-note-soft);
}

.tri-note-sw.is-on .tri-note-sw__dot {
	box-shadow: 0 0 0 2px var(--tri-note-bg), 0 0 0 4px var(--tri-note-primary);
}

.tri-note-sw:focus-visible,
.tri-note-btn:focus-visible,
.tri-note-pbtn:focus-visible,
.tri-note-pop__x:focus-visible,
.tri-note-toast__x:focus-visible,
.tri-note-book__k:focus-visible {
	outline: 2px solid var(--tri-note-primary);
	outline-offset: 1px;
}

.tri-note-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 34px;
	padding: 0 10px;
	border-radius: 10px;
	font-weight: 600;
}

.tri-note-ui svg,
.tri-note-book svg {
	width: 18px;
	height: 18px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.tri-note-pop {
	width: min(340px, calc(100vw - 16px));
	padding: 12px;
}

.tri-note-pop__head {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-bottom: 8px;
}

.tri-note-pop__quote {
	flex: 1;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.tri-note-pop__x,
.tri-note-toast__x {
	display: inline-grid;
	place-items: center;
	width: 30px;
	height: 30px;
	flex: none;
	border-radius: 50%;
	color: var(--tri-note-muted);
}

.tri-note-pop__colors {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 2px;
	margin-bottom: 8px;
}

.tri-note-pop__tag {
	margin-left: 6px;
	font-size: 13px;
	color: var(--tri-note-muted);
}

.tri-note-pop__ta {
	display: block;
	width: 100%;
	min-height: 72px;
	padding: 8px 10px;
	font: inherit;
	font-size: 16px; /* iOS không phóng to khi gõ */
	color: var(--tri-note-ink);
	background: var(--tri-note-bg);
	border: 1px solid var(--tri-note-line);
	border-radius: 10px;
	resize: vertical;
}

.tri-note-pop__ta:focus {
	outline: 2px solid var(--tri-note-primary);
	outline-offset: 0;
	border-color: transparent;
}

.tri-note-pop__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}

.tri-note-pbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 36px;
	padding: 6px 12px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	color: var(--tri-note-ink);
	background: var(--tri-note-soft);
}

.tri-note-pbtn:hover {
	box-shadow: inset 0 0 0 1px var(--tri-note-line);
}

.tri-note-pbtn--main,
.tri-note-pbtn.is-on {
	color: var(--tri-note-bg);
	background: var(--tri-note-primary);
}

.tri-note-pbtn--del {
	margin-left: auto;
	color: var(--tri-note-danger);
	background: none;
}

.tri-note-pop__foot {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin-top: 10px;
	padding-top: 8px;
	border-top: 1px solid var(--tri-note-line);
	font-size: 13px;
}

.tri-note-link {
	color: var(--tri-note-primary);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.tri-note-toast {
	position: fixed;
	left: 50%;
	bottom: calc(16px + var(--tri-consent-h, 0px));
	z-index: var(--tri-note-z);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	width: max-content;
	max-width: calc(100vw - 24px);
	padding: 10px 8px 10px 14px;
	transform: translateX(-50%);
	color: var(--tri-note-ink);
	background: var(--tri-note-bg);
	border: 1px solid var(--tri-note-line);
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(9, 31, 91, 0.18);
	font-size: 14px;
	line-height: 1.4;
}

.tri-note-toast--err {
	border-color: var(--tri-note-danger);
}

.tri-note-toast__msg {
	flex: 1 1 200px;
}

/* Nút "Lưu vào sổ từ" của cả mục từ (data-tri-note-save) — site tự tạo kiểu, đây chỉ trạng thái đã lưu */
[data-tri-note-save].is-saved {
	color: var(--tri-note-bg);
	background: var(--tri-note-primary);
	border-color: var(--tri-note-primary);
}

/* ── Sổ từ của tôi ─────────────────────────────────────────────────────────── */

.tri-note-book {
	color: var(--tri-note-ink);
	font-size: 15px;
	line-height: 1.5;
	color-scheme: light;
}

.tri-note-book__notice {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	margin-bottom: 16px;
	padding: 12px 14px;
	background: var(--tri-note-soft);
	border-radius: 14px;
}

.tri-note-book__notice > span {
	flex: 1 1 260px;
}

.tri-note-book__top {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.tri-note-book__search,
.tri-note-book__sel,
.tri-note-book__label input {
	min-height: 40px;
	padding: 6px 12px;
	font: inherit;
	font-size: 16px;
	color: var(--tri-note-ink);
	background: var(--tri-note-bg);
	border: 1px solid var(--tri-note-line);
	border-radius: 10px;
}

.tri-note-book__search {
	flex: 1 1 240px;
	min-width: 0;
}

.tri-note-book__sel {
	flex: 0 1 auto;
	max-width: 100%;
}

.tri-note-book__kind {
	display: inline-flex;
	padding: 3px;
	background: var(--tri-note-soft);
	border-radius: 999px;
}

.tri-note-book__k {
	min-height: 34px;
	padding: 4px 14px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
}

.tri-note-book__k.is-on {
	color: var(--tri-note-bg);
	background: var(--tri-note-primary);
}

.tri-note-book__tools {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.tri-note-book__labels {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 8px;
	margin-top: 12px;
	padding: 12px;
	border: 1px solid var(--tri-note-line);
	border-radius: 14px;
}

.tri-note-book__label {
	display: flex;
	align-items: center;
	gap: 8px;
}

.tri-note-book__lname {
	width: 72px;
	flex: none;
	font-size: 13px;
	color: var(--tri-note-muted);
}

.tri-note-book__label input {
	flex: 1;
	min-width: 0;
}

.tri-note-book__count {
	margin: 14px 0 8px;
	font-size: 14px;
	color: var(--tri-note-muted);
}

.tri-note-book__list {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tri-note-book__empty {
	padding: 24px 16px;
	text-align: center;
	color: var(--tri-note-muted);
	background: var(--tri-note-soft);
	border-radius: 14px;
}

.tri-note-book__more {
	display: flex;
	margin: 14px auto 0;
}

.tri-note-card {
	padding: 14px 16px;
	background: var(--tri-note-bg);
	border: 1px solid var(--tri-note-line);
	border-left: 6px solid var(--tri-note-yellow);
	border-radius: 14px;
	overflow-wrap: anywhere;
}

.tri-note-card[data-color="green"] { border-left-color: var(--tri-note-green); }
.tri-note-card[data-color="blue"] { border-left-color: var(--tri-note-blue); }
.tri-note-card[data-color="pink"] { border-left-color: var(--tri-note-pink); }
.tri-note-card[data-color="orange"] { border-left-color: var(--tri-note-orange); }

.tri-note-card__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 8px;
}

.tri-note-card__text {
	font-size: 17px;
	margin-right: 4px;
}

.tri-note-card__tag,
.tri-note-card__badge {
	padding: 1px 8px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 999px;
	background: var(--tri-note-yellow);
}

.tri-note-card__tag[data-color="green"] { background: var(--tri-note-green); }
.tri-note-card__tag[data-color="blue"] { background: var(--tri-note-blue); }
.tri-note-card__tag[data-color="pink"] { background: var(--tri-note-pink); }
.tri-note-card__tag[data-color="orange"] { background: var(--tri-note-orange); }

.tri-note-card__badge {
	background: var(--tri-note-soft);
}

.tri-note-card__badge--lost {
	color: var(--tri-note-danger);
}

.tri-note-card__ctx,
.tri-note-card__note,
.tri-note-card__meta {
	margin: 6px 0 0;
}

.tri-note-card__ctx {
	color: var(--tri-note-muted);
}

.tri-note-card__ctx mark.tri-note-hl {
	cursor: default;
}

.tri-note-card__note {
	white-space: pre-line;
}

.tri-note-card__note.is-empty {
	font-style: italic;
	color: var(--tri-note-muted);
}

.tri-note-card__meta {
	font-size: 13px;
	color: var(--tri-note-muted);
}

.tri-note-card__meta a {
	color: var(--tri-note-primary);
}

.tri-note-card__acts {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: 10px;
}

.tri-note-card__acts .tri-note-pop__colors {
	margin: 0;
}

.tri-note-card__edit {
	margin-top: 8px;
}

@media (max-width: 600px) {
	.tri-note-btn__txt {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.tri-note-btn {
		padding: 0 8px;
	}

	.tri-note-sw {
		width: 36px;
		height: 36px;
	}
}

@media (prefers-reduced-motion: reduce) {
	mark.tri-note-hl--flash {
		animation: none;
		box-shadow: 0 0 0 3px var(--tri-note-primary);
	}
}

@media print {
	.tri-note-ui {
		display: none !important;
	}
}
