/**
 * Academy Content Protection — 課程頁內容保護樣式
 * 2026-07-31
 *
 * 沿用 B 站設計系統（.claude/skills/drex-b-site-design）：
 *   主色 #39fff5、深色漸層對話框、12px 圓角、Noto Sans TC、768/480 斷點
 * 僅新增本元件樣式，不覆寫任何既有 selector。
 */

/* 選取色已移至 course-ux.css（所有人載入，含管理員）*/

/* 圖片仍不可拖曳 */
html.academy-cp-on img,
html.academy-cp-on video {
	-webkit-user-drag: none;
	user-drag: none;
}

body.academy-cp-lock {
	overflow: hidden;
}

/* ───────── 遮罩 ───────── */

.academy-cp-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
	font-family: 'Noto Sans TC', sans-serif;
	background: rgba(10, 14, 20, 0.72);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.academy-cp-overlay[hidden] {
	display: none;
}

.academy-cp-overlay.is-open {
	opacity: 1;
}

.academy-cp-overlay--light {
	background: rgba(10, 14, 20, 0.6);
	-webkit-backdrop-filter: blur(5px);
	backdrop-filter: blur(5px);
}

/* ───────── 對話框 ───────── */

.academy-cp-dialog {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 540px;
	max-height: 88vh;
	display: flex;
	flex-direction: column;
	padding: 32px 32px 24px;
	border: 1px solid rgba(57, 255, 245, 0.18);
	border-radius: 12px;
	background: linear-gradient(180deg, #2c343b 0%, #424d59 100%);
	color: #ffffff;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
	transform: translateY(8px);
	transition: transform 0.3s ease;
}

.academy-cp-overlay.is-open .academy-cp-dialog {
	transform: translateY(0);
}

/* 使用規範：電腦版不超過畫面 60% */
.academy-cp-dialog--terms {
	max-width: min(60vw, 860px);
}

.academy-cp-dialog--sm {
	max-width: 440px;
	padding: 28px 28px 22px;
}

/* ───────── 文字 ───────── */

.academy-cp-title {
	margin: 0 0 10px;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.4;
	color: #ffffff;
	letter-spacing: 0.5px;
}

.academy-cp-title--sm {
	font-size: 19px;
	margin-bottom: 8px;
}

.academy-cp-lead {
	margin: 0 0 16px;
	font-size: 14px;
	line-height: 1.8;
	color: rgba(255, 255, 255, 0.7);
}

.academy-cp-text {
	margin: 0 0 20px;
	font-size: 14px;
	line-height: 1.9;
	color: rgba(255, 255, 255, 0.85);
}

.academy-cp-text strong {
	color: #39fff5;
	font-weight: 600;
}

.academy-cp-esc {
	margin: 14px 0 0;
	font-size: 12px;
	line-height: 1.6;
	text-align: center;
	color: rgba(255, 255, 255, 0.3);
}

.academy-cp-hint {
	margin: 8px 0 0;
	font-size: 12px;
	line-height: 1.6;
	text-align: center;
	color: rgba(255, 255, 255, 0.5);
}

.academy-cp-hint[hidden] {
	display: none;
}

/* ───────── 規範內文捲動區（自訂捲軸） ───────── */

.academy-cp-scroll {
	flex: 1 1 auto;
	min-height: 180px;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 20px 24px;
	margin-bottom: 18px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.22);
	font-size: 14px;
	line-height: 1.95;
	color: rgba(255, 255, 255, 0.85);

	/* Firefox */
	scrollbar-width: thin;
	scrollbar-color: rgba(57, 255, 245, 0.32) transparent;
}

.academy-cp-scroll:focus-visible {
	outline: 1px solid rgba(57, 255, 245, 0.45);
	outline-offset: 2px;
}

.academy-cp-scroll::-webkit-scrollbar {
	width: 8px;
}

.academy-cp-scroll::-webkit-scrollbar-track {
	background: transparent;
	margin: 8px 0;
}

.academy-cp-scroll::-webkit-scrollbar-thumb {
	background: rgba(57, 255, 245, 0.28);
	border-radius: 999px;
	transition: background 0.2s ease;
}

.academy-cp-scroll::-webkit-scrollbar-thumb:hover {
	background: rgba(57, 255, 245, 0.5);
}

.academy-cp-scroll h3 {
	margin: 22px 0 8px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.5;
	color: #39fff5;
}

.academy-cp-scroll h3:first-child {
	margin-top: 0;
}

.academy-cp-scroll p {
	margin: 0 0 12px;
	font-size: 14px;
	line-height: 1.95;
	letter-spacing: 0.4px;
	color: rgba(255, 255, 255, 0.85);
}

.academy-cp-scroll ul {
	margin: 0 0 14px;
	padding-left: 20px;
	list-style: disc;
}

.academy-cp-scroll li {
	margin-bottom: 8px;
	font-size: 14px;
	line-height: 1.85;
	color: rgba(255, 255, 255, 0.85);
}

.academy-cp-scroll a {
	color: #39fff5;
	text-decoration: underline;
}

/* ───────── 同意勾選 ───────── */

.academy-cp-agree {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	font-size: 14px;
	line-height: 1.7;
	text-align: center;
	color: rgba(255, 255, 255, 0.5);
	cursor: not-allowed;
	transition: color 0.3s ease;
}

.academy-cp-agree.is-ready {
	color: rgba(255, 255, 255, 0.85);
	cursor: pointer;
}

/* 完全自訂勾選框：關掉瀏覽器原生樣式，改用重點色外框 + 重點色勾勾 */
.academy-cp-dialog .academy-cp-agree input[type="checkbox"],
#acadCpAdminPreview .academy-cp-agree input[type="checkbox"] {
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	flex: 0 0 20px !important;
	box-sizing: border-box !important;
	width: 20px !important;
	height: 20px !important;
	min-width: 20px !important;
	min-height: 20px !important;
	aspect-ratio: 1 / 1 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
	border-radius: 4px !important;
	background: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	outline: none !important;
	cursor: inherit !important;
	transition: border-color 0.3s ease, background-color 0.3s ease !important;
}

/* 捲到底解鎖後：外框轉為重點色 */
.academy-cp-agree.is-ready input[type="checkbox"] {
	border-color: #39fff5 !important;
}

/* 勾選狀態：重點色外框 + 重點色勾勾 */
.academy-cp-dialog .academy-cp-agree input[type="checkbox"]:checked,
#acadCpAdminPreview .academy-cp-agree input[type="checkbox"]:checked {
	border-color: #39fff5 !important;
	background-color: rgba(57, 255, 245, 0.12) !important;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2339fff5' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: center !important;
	background-size: 13px 13px !important;
}

/* WordPress 後台的 forms.css 會用 Dashicons 在 checkbox 上再畫一個勾，
   會與我們的 SVG 勾勾重疊，這裡一併清掉（前台無此問題，加著無害）。 */
.academy-cp-dialog .academy-cp-agree input[type="checkbox"]::before,
.academy-cp-dialog .academy-cp-agree input[type="checkbox"]::after,
#acadCpAdminPreview .academy-cp-agree input[type="checkbox"]::before,
#acadCpAdminPreview .academy-cp-agree input[type="checkbox"]::after {
	content: none !important;
	display: none !important;
}

/* 鍵盤操作時才顯示聚焦框，滑鼠點擊不會出現 */
.academy-cp-dialog .academy-cp-agree input[type="checkbox"]:focus-visible,
#acadCpAdminPreview .academy-cp-agree input[type="checkbox"]:focus-visible {
	outline: 2px solid rgba(57, 255, 245, 0.45) !important;
	outline-offset: 2px !important;
}

.academy-cp-agree a {
	color: #39fff5;
	text-decoration: underline;
}

/* ───────── 按鈕（雙層 selector + !important 防外掛覆蓋） ───────── */

.academy-cp-actions {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 20px;
}

.academy-cp-dialog button.academy-cp-btn {
	all: unset !important;
	box-sizing: border-box !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 11px 26px !important;
	border-radius: 6px !important;
	font-family: 'Noto Sans TC', sans-serif !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.4 !important;
	text-align: center !important;
	cursor: pointer !important;
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease !important;
}

.academy-cp-dialog button.academy-cp-btn--accent {
	background-color: #39fff5 !important;
	color: #202020 !important;
}

.academy-cp-dialog button.academy-cp-btn--accent:hover:not(:disabled),
.academy-cp-dialog button.academy-cp-btn--accent:focus-visible:not(:disabled) {
	background-color: #2de6dc !important;
	color: #202020 !important;
}

.academy-cp-dialog button.academy-cp-btn--accent:disabled {
	background-color: rgba(57, 255, 245, 0.25) !important;
	color: rgba(32, 32, 32, 0.55) !important;
	cursor: not-allowed !important;
}

.academy-cp-dialog button.academy-cp-btn--ghost {
	background: transparent !important;
	border: 1px solid rgba(255, 255, 255, 0.3) !important;
	color: rgba(255, 255, 255, 0.7) !important;
}

.academy-cp-dialog button.academy-cp-btn--ghost:hover,
.academy-cp-dialog button.academy-cp-btn--ghost:focus-visible {
	border-color: #39fff5 !important;
	color: #39fff5 !important;
}

/* 關閉叉叉 */
.academy-cp-dialog button.academy-cp-close {
	all: unset !important;
	position: absolute !important;
	top: 14px !important;
	right: 16px !important;
	width: 32px !important;
	height: 32px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	border-radius: 50% !important;
	font-size: 24px !important;
	line-height: 1 !important;
	color: rgba(255, 255, 255, 0.5) !important;
	cursor: pointer !important;
	transition: color 0.3s ease, background-color 0.3s ease !important;
}

.academy-cp-dialog button.academy-cp-close:hover,
.academy-cp-dialog button.academy-cp-close:focus-visible {
	color: #39fff5 !important;
	background-color: rgba(57, 255, 245, 0.1) !important;
}

/* ───────── RWD ───────── */

@media (max-width: 768px) {
	.academy-cp-overlay {
		padding: 16px;
		align-items: flex-end;
	}

	.academy-cp-dialog,
	.academy-cp-dialog--terms,
	.academy-cp-dialog--sm {
		max-width: 100%;
		max-height: 86vh;
		padding: 26px 20px 20px;
	}

	.academy-cp-title {
		font-size: 20px;
	}

	.academy-cp-title--sm {
		font-size: 17px;
	}

	.academy-cp-scroll {
		padding: 16px 16px;
		min-height: 150px;
	}

	.academy-cp-actions {
		flex-direction: column-reverse;
		gap: 10px;
	}

	.academy-cp-dialog button.academy-cp-btn {
		width: 100% !important;
	}
}

@media (max-width: 480px) {
	.academy-cp-dialog,
	.academy-cp-dialog--terms,
	.academy-cp-dialog--sm {
		padding: 22px 16px 18px;
	}

	.academy-cp-scroll {
		font-size: 13px;
		line-height: 1.85;
	}
}

/* 尊重使用者的減少動態偏好 */
@media (prefers-reduced-motion: reduce) {
	.academy-cp-overlay,
	.academy-cp-dialog,
	.academy-cp-dialog button.academy-cp-btn {
		transition: none !important;
	}
}
