/* ==========================================================================
   DA Question Hub — tối giản, tinh tế
   UI tuân theo Theme Options: font/color kế thừa từ theme.
   Plugin chỉ định nghĩa layout, spacing, border, radius.
   Màu nhấn qua CSS var --dqh-accent (theme ghi đè được trên :root/body).
   ========================================================================== */

/* ---------- Tokens + wrap: đã chuyển vào dqh-shared.css ---------- */

/* Trạng thái đang lọc AJAX: mờ nhẹ + khóa tương tác bảng, tránh nhấp nháy khi reload. */
.dqh-wrap.is-loading .dqh-table-wrap,
.dqh-wrap.is-loading .dqh-pagination {
	opacity: .45;
	pointer-events: none;
	transition: opacity .15s ease;
}

/* ---------- Card khóa học (grid base + hover trong dqh-shared.css) ---------- */
.dqh-cards {
	margin-bottom: 28px;
}

.dqh-card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	text-decoration: none;
	color: inherit;
}

/* Card đang được chọn làm filter. */
.dqh-card.is-active {
	border-color: var(--dqh-accent);
	box-shadow: 0 0 0 2px var(--dqh-accent-soft), 0 8px 24px var(--dqh-accent-soft);
}

.dqh-card__icon {
	font-size: 22px;
	line-height: 1;
	color: var(--dqh-accent);
}

.dqh-card__name {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
	color: inherit;
}

.dqh-card__count {
	font-size: 12px;
	color: var(--dqh-muted);
}

/* ---------- Filter bar ---------- */
.dqh-filters {
	padding: 14px 16px;
	background: #ffffff;
	border: 1px solid var(--dqh-border);
	border-radius: 12px;
	margin-bottom: 16px;
}

/* 2 row: row 1 = title + Free + Reset; row 2 = 3 dropdown rộng. */
.dqh-filters__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.dqh-filters__row + .dqh-filters__row {
	margin-top: 12px;
}

.dqh-filters__field {
	flex: 1 1 220px;
	min-width: 200px;
}

.dqh-filters__field--title {
	flex: 2 1 280px;
}

/* Dropdown chứa tên dài ("081+ Kiếp Nạn - Data Insight Challenges"...) nên cần rộng. */
.dqh-filters__row--selects .dqh-filters__field {
	flex: 1 1 240px;
	min-width: 220px;
}

.dqh-filters__field input[type="search"] {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--dqh-border);
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	color: inherit;
	background: #ffffff;
	outline: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.dqh-filters__field input[type="search"]:focus {
	border-color: var(--dqh-accent);
	box-shadow: 0 0 0 3px var(--dqh-accent-soft);
}

/* Checkbox "Chỉ hiện Free" trong filter bar */
.dqh-filters__free {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border: 1px solid var(--dqh-border);
	border-radius: 8px;
	font-size: 14px;
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
	transition: border-color .15s ease, background .15s ease;
}

.dqh-filters__free:hover {
	border-color: var(--dqh-accent);
}

.dqh-filters__free input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.dqh-filters__free-box {
	width: 18px;
	height: 18px;
	border: 1.5px solid var(--dqh-border);
	border-radius: 5px;
	background: #ffffff;
	display: inline-block;
	transition: background .15s ease, border-color .15s ease;
}

.dqh-filters__free input:checked + .dqh-filters__free-box {
	background: var(--dqh-accent);
	border-color: var(--dqh-accent);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.5 3.5L13 5'/%3E%3C/svg%3E");
	background-size: 12px;
	background-position: center;
	background-repeat: no-repeat;
}

.dqh-filters__free:has(input:checked) {
	border-color: var(--dqh-accent);
	background: var(--dqh-accent-soft);
}

.dqh-filters__free .fa-lock-open {
	color: var(--dqh-accent);
}

/* ---------- Dropdown Choices.js (đồng bộ design system) ---------- */
.dqh-choices {
	margin-bottom: 0;
	font-size: 14px;
	font-family: inherit;
}

.dqh-choices .choices__inner {
	min-height: 0;
	padding: 8px 12px;
	background: #ffffff;
	border: 1px solid var(--dqh-border);
	border-radius: 8px;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.dqh-choices.is-focused .choices__inner,
.dqh-choices.is-open .choices__inner {
	border-color: var(--dqh-accent);
	box-shadow: 0 0 0 3px var(--dqh-accent-soft);
}

.dqh-choices .choices__list--single {
	padding: 0;
}

.dqh-choices .choices__list--single .choices__item {
	font-size: 14px;
	color: inherit;
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis; /* text dài: cắt + ... thay vì tràn */
}

.dqh-choices .choices__placeholder {
	color: var(--dqh-muted);
	opacity: 1;
}

.dqh-choices .choices__list--dropdown {
	border: 1px solid var(--dqh-border);
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
	z-index: 30;
}

.dqh-choices .choices__list--dropdown .choices__input {
	padding: 9px 12px;
	font-size: 14px;
	font-family: inherit;
	background: #ffffff;
	color: inherit;
}

.dqh-choices .choices__list--dropdown .choices__item {
	font-size: 14px;
	padding: 7px 12px;
	color: inherit;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis; /* tên dài: 1 dòng + ... -> dropdown gọn */
}

.dqh-choices .choices__list--dropdown .choices__item--selectable.is-highlighted {
	background: var(--dqh-accent-soft);
	color: var(--dqh-accent);
}

/* ---------- Buttons (base trong dqh-shared.css) ---------- */
.dqh-btn {
	padding: 9px 18px;
}

/* display:inline-flex ở trên đè thuộc tính hidden — phải ép none trở lại. */
.dqh-btn[hidden] {
	display: none !important;
}

/* Theme (vd: .entry-content a:hover) có specificity cao hơn .dqh-card:hover
   nên phải kèm .dqh-wrap để thắng: (0,3,0) > (0,2,1). */
.dqh-wrap .dqh-card,
.dqh-wrap .dqh-card:hover,
.dqh-wrap .dqh-card:focus,
.dqh-wrap .dqh-card:active {
	text-decoration: none;
}

.dqh-btn--primary {
	background: var(--dqh-accent);
	color: #ffffff;
}

.dqh-btn--primary:hover {
	background: var(--dqh-accent);
	filter: brightness(.92);
	color: #ffffff;
}

.dqh-btn--ghost {
	background: #ffffff;
	color: inherit;
	border-color: var(--dqh-border);
}

.dqh-btn--ghost:hover {
	background: #f3f4f6;
}

/* ---------- Bảng (base .dqh-table trong dqh-shared.css) ---------- */
/* KHÔNG đặt overflow-x mặc định: overflow tạo scroll-container sẽ "nhốt"
   sticky thead (không dính khi cuộn trang). Chỉ bật overflow trên mobile. */
.dqh-table-wrap {
	background: #ffffff;
	border: 1px solid var(--dqh-border);
	border-radius: 12px;
}

@media (max-width: 900px) {
	.dqh-table-wrap {
		overflow-x: auto;
	}
}

/* Dòng summary: số kết quả sau lọc + tiến độ đọc. */
.dqh-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 18px;
	font-size: 13px;
	color: var(--dqh-muted);
	margin-bottom: 10px;
}

.dqh-summary strong {
	color: inherit;
	font-weight: 700;
}

.dqh-summary__progress {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

/* Dải chip filter đang aktif: click ✕ = gỡ riêng filter đó. */
.dqh-active-chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-bottom: 10px;
}

.dqh-active-chips__label {
	font-size: 13px;
	color: var(--dqh-muted);
	margin-right: 2px;
}

.dqh-active-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border: 1px solid var(--dqh-accent);
	border-radius: 999px;
	background: var(--dqh-accent-soft);
	color: var(--dqh-accent);
	font-size: 12.5px;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	transition: background .15s ease;
}

.dqh-active-chip:hover {
	background: var(--dqh-accent);
	color: #ffffff;
}

.dqh-active-chip .fa-xmark {
	font-size: 11px;
}

.dqh-table thead th {
	text-align: left;
	padding: 12px 16px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--dqh-muted);
	background: #f9fafb;
	white-space: nowrap;
	border: 0; /* theme voice áp border cho td/th -> phải ghi đè tường minh */
	position: sticky;
	top: 0;
	z-index: 5;
}

/* Khi đăng nhập WP có admin bar 32px -> dịch sticky header xuống tương ứng. */
.admin-bar .dqh-table thead th {
	top: 32px;
}

.dqh-table tbody td {
	padding: 13px 16px;
	vertical-align: middle;
	color: inherit;
	border: 0; /* theme voice áp border-bottom cho td -> ghi đè tường minh */
}

.dqh-table tbody tr:hover {
	background: #f9fafb;
}

/* Chip màu Category/Topic: cùng tên -> cùng màu (hash theo tên, không cấu hình). */
.dqh-chip {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.4;
	white-space: nowrap;
}

.dqh-chip--0  { background: #e0f2fe; color: #0369a1; }
.dqh-chip--1  { background: #dcfce7; color: #15803d; }
.dqh-chip--2  { background: #fef9c3; color: #a16207; }
.dqh-chip--3  { background: #fee2e2; color: #b91c1c; }
.dqh-chip--4  { background: #ede9fe; color: #6d28d9; }
.dqh-chip--5  { background: #ffedd5; color: #c2410c; }
.dqh-chip--6  { background: #fce7f3; color: #be185d; }
.dqh-chip--7  { background: #cffafe; color: #0e7490; }
.dqh-chip--8  { background: #e0e7ff; color: #4338ca; }
.dqh-chip--9  { background: #f1f5f9; color: #475569; }
.dqh-chip--10 { background: #ecfccb; color: #4d7c0f; }
.dqh-chip--11 { background: #fdf4ff; color: #a21caf; }

.dqh-td-title {
	min-width: 240px;
}

.dqh-title {
	color: inherit;
	text-decoration: none;
	font-weight: 500;
}

.dqh-title:hover {
	color: var(--dqh-accent);
}

.dqh-title--locked {
	color: var(--dqh-muted);
}

.dqh-lock-icon {
	margin-right: 4px;
	font-size: 13px;
	color: var(--dqh-accent);
}

.dqh-title--locked .dqh-lock-icon {
	color: var(--dqh-muted);
}

/* Badge "New": bài publish trong N ngày (N cấu hình trong Settings). */
.dqh-badge-new {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 8px;
	background: var(--dqh-accent);
	color: #ffffff;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.6;
	text-transform: uppercase;
	vertical-align: middle;
}

.dqh-empty {
	text-align: center;
	color: var(--dqh-muted);
	padding: 32px !important;
}

/* Empty state: nút xóa bộ lọc ngay tại chỗ, không phải cuộn lên tìm Reset. */
.dqh-empty-reset {
	display: inline-flex;
	margin-left: 10px;
	padding: 5px 14px;
	font-size: 13px;
	vertical-align: middle;
}

/* ---------- Checkbox đã đọc ---------- */
.dqh-read {
	position: relative;
	display: inline-flex;
	cursor: pointer;
}

.dqh-read input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.dqh-read__box {
	width: 18px;
	height: 18px;
	border: 1.5px solid var(--dqh-border);
	border-radius: 5px;
	background: #ffffff;
	transition: background .15s ease, border-color .15s ease;
	display: inline-block;
}

.dqh-read input:checked + .dqh-read__box {
	background: var(--dqh-accent);
	border-color: var(--dqh-accent);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.5 3.5L13 5'/%3E%3C/svg%3E");
	background-size: 12px;
	background-position: center;
	background-repeat: no-repeat;
}

.dqh-read--disabled {
	cursor: not-allowed;
	opacity: .4;
}

/* ---------- Pagination ---------- */
.dqh-pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 20px;
	flex-wrap: wrap;
}

.dqh-page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	height: 34px;
	padding: 0 8px;
	border: 1px solid var(--dqh-border);
	border-radius: 8px;
	color: inherit;
	text-decoration: none;
	font-size: 13px;
	transition: border-color .15s ease, background .15s ease;
}

.dqh-page:hover {
	border-color: var(--dqh-accent);
	color: var(--dqh-accent);
}

.dqh-page--current {
	background: var(--dqh-accent);
	border-color: var(--dqh-accent);
	color: #ffffff;
}

.dqh-page--disabled {
	opacity: .4;
	cursor: default;
	pointer-events: none;
}

/* Dấu … trong pagination rút gọn: không phải link, không border. */
.dqh-page--dots {
	border: 0;
	cursor: default;
	color: var(--dqh-muted);
}

/* ---------- Modal ---------- */
.dqh-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
}

.dqh-modal.is-open {
	display: flex;
}

.dqh-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(17, 24, 39, .55);
}

.dqh-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 420px;
	margin: 16px;
	padding: 32px 28px;
	background: #ffffff;
	border-radius: 16px;
	text-align: center;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
	/* Màu chữ kế thừa theme — không hardcode */
	color: inherit;
}

.dqh-modal__icon {
	font-size: 34px;
	margin-bottom: 12px;
	color: var(--dqh-accent);
}

.dqh-modal__text {
	font-size: 15px;
	line-height: 1.6;
	margin: 0 0 22px;
}

.dqh-modal__actions {
	display: flex;
	justify-content: center;
	gap: 10px;
}

/* ---------- Notice khóa trên single post ---------- */
.dqh-locked-notice {
	position: relative;
	padding: 48px 28px 40px;
	background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
	border: 1px solid var(--dqh-border);
	border-radius: 16px;
	text-align: center;
	overflow: hidden;
}

/* Dải màu nhấn trên cùng */
.dqh-locked-notice::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: var(--dqh-accent);
}

/* Icon khóa trong vòng tròn có nền nhạt */
.dqh-locked-notice__badge {
	width: 72px;
	height: 72px;
	margin: 0 auto 18px;
	border-radius: 50%;
	background: var(--dqh-accent-soft);
	color: var(--dqh-accent);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 30px;
}

.dqh-locked-notice__title {
	font-size: 20px;
	font-weight: 700;
	margin: 0 0 8px;
	color: inherit;
}

.dqh-locked-notice__text {
	font-size: 15px;
	line-height: 1.6;
	color: var(--dqh-muted);
	margin: 0 auto 22px;
	max-width: 480px;
}

.dqh-locked-notice__btn {
	gap: 8px;
	padding: 10px 24px;
}

/* ---------- Responsive (grid responsive trong dqh-shared.css) ---------- */
@media (max-width: 560px) {
	.dqh-filters {
		flex-direction: column;
		align-items: stretch;
	}
}
