/*!
 * LuuxTheorie — LearnDash overrides.
 *
 * Loaded AFTER LearnDash's own CSS with high priority and dependency-order
 * enforcement so our rules win the cascade even against LD's `!important`
 * declarations.
 *
 * Two responsibilities:
 *   1. Hide LearnDash's plugin-injected navigation / breadcrumbs that the
 *      theme replaces with its own UI (topic.php, lesson.php, quiz.php all
 *      render our own headers, next-topic links, quiz CTAs, etc.).
 *   2. Force LD's remaining injected content (quiz UI, alerts, buttons) to
 *      inherit theme tokens so dark mode reads correctly.
 */

/* ── 1. HIDE LD-INJECTED BREADCRUMBS & NAVIGATION ────────────────────────── */
/*
 * LearnDash's `learndash_content` filter adds a mini course-progress
 * breadcrumb + a "back to lesson" / "in this course" navigation heading above
 * the topic content. On topic/lesson templates our own back-button header and
 * course card handles this navigation, so LD's version is redundant. Hide it.
 *
 * On quiz templates we keep our own headers and hide LD's redundant chrome.
 */
.single-sfwd-topic .ld-breadcrumbs,
.single-sfwd-lessons .ld-breadcrumbs,
.single-sfwd-quiz .ld-breadcrumbs,
.single-sfwd-courses .ld-breadcrumbs,
.single-sfwd-topic .ld-course-navigation-heading,
.single-sfwd-lessons .ld-course-navigation-heading,
.single-sfwd-quiz .ld-course-navigation-heading,
.single-sfwd-topic .ld-course-status-content > .ld-course-status-seg-heading,
.single-sfwd-topic .learndash-wrapper .ld-course-navigation,
.single-sfwd-topic .learndash-wrapper .ld-course-status,
.single-sfwd-lessons .learndash-wrapper .ld-course-navigation,
.single-sfwd-lessons .learndash-wrapper .ld-course-status,
.single-sfwd-topic .learndash_topic_dots,
.single-sfwd-topic .learndash-course-list-wrapper,
.ld-focus-header,
.ld-focus-sidebar,
.learndash-wrapper .learndash_topic_dots,
.wpProQuiz_content .ld-breadcrumbs {
	display: none !important;
}

/* ── LD NAVIGATION SHORTCODE WRAP ────────────────────────────────────────── */
/*
 * `[ld_navigation]` renders `.learndash-shortcode-wrap-ld_navigation-{cid}_{lid}_{tid}`.
 * By default ld30 gives it hardcoded backgrounds + margins that clash with our
 * container. Reset those to a clean transparent wrap that inherits our layout.
 */
[class^="learndash-shortcode-wrap-ld_navigation"],
[class*=" learndash-shortcode-wrap-ld_navigation"] {
	background: transparent !important;
	background-color: transparent !important;
	padding: 0 !important;
	margin: 1.25rem 0 0 0 !important;
	border: 0 !important;
	box-shadow: none !important;
	color: var(--fg) !important;
}
[class^="learndash-shortcode-wrap-ld_navigation"] *,
[class*=" learndash-shortcode-wrap-ld_navigation"] * {
	color: inherit !important;
}
[class^="learndash-shortcode-wrap-ld_navigation"] .ld-content-actions,
[class*=" learndash-shortcode-wrap-ld_navigation"] .ld-content-actions {
	background: transparent !important;
	background-color: transparent !important;
	padding: 0 !important;
	border: 0 !important;
	margin: 1rem 0 0 0 !important;
	display: flex !important;
	gap: 0.75rem !important;
	flex-wrap: wrap !important;
}

/* ── LD MARK-COMPLETE BUTTON — styled to match theme primary ─────────────── */
/*
 * We deliberately KEEP LearnDash's native mark-complete button visible. It's
 * the reliable, always-works way for the learner to advance. Video-end can
 * also auto-click it (see view.js) so completion happens automatically when
 * a Bunny video ends, without depending on a REST round-trip.
 */
.learndash_mark_complete_button,
input.learndash_mark_complete_button,
button.learndash_mark_complete_button {
	background: var(--primary) !important;
	background-color: var(--primary) !important;
	color: var(--primary-fg) !important;
	border: 0 !important;
	border-radius: 1rem !important;
	padding: 0.875rem 1.5rem !important;
	font-weight: 700 !important;
	font-size: 0.9375rem !important;
	cursor: pointer !important;
	box-shadow: var(--shad-pop) !important;
	transition: opacity 0.15s, transform 0.15s !important;
	width: auto !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 0.5rem !important;
	text-decoration: none !important;
	font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important;
}
.learndash_mark_complete_button:hover,
button.learndash_mark_complete_button:hover {
	opacity: 0.92 !important;
	transform: translateY(-1px) !important;
}
.learndash_mark_incomplete_button {
	background: transparent !important;
	background-color: transparent !important;
	color: var(--muted-fg) !important;
	border: 1px solid var(--border) !important;
	border-radius: 1rem !important;
	padding: 0.75rem 1.25rem !important;
	font-weight: 600 !important;
	cursor: pointer !important;
}

/* Wrap for mark-complete form itself. */
#sfwd-mark-complete,
.sfwd-mark-complete,
form[name="sfwd-mark-complete"] {
	background: transparent !important;
	background-color: transparent !important;
	padding: 0 !important;
	margin: 1rem 0 0 0 !important;
	border: 0 !important;
	display: block !important;
}

/* ── 2. FORCE THEME COLORS ON LD/QUIZ SURFACES ───────────────────────────── */
/*
 * The quiz page relies on LearnDash's WPProQuiz to render questions and
 * answers. Its default CSS uses hard-coded light-mode colors. We override
 * every surface, text, border, and button to use our theme tokens.
 */

/* Wrapper backgrounds — all transparent, so our page background shows through. */
.learndash-wrapper,
.learndash-wrapper .ld-focus-content,
.learndash-wrapper .ld-item-list,
.learndash-wrapper .ld-tabs,
.learndash-wrapper .ld-tab-content,
.learndash-wrapper .ld-tabs-content,
.wpProQuiz_content,
.wpProQuiz_quiz,
.wpProQuiz_lock,
.wpProQuiz_reviewLegend,
.wpProQuiz_reviewSummary {
	background: transparent !important;
	color: var(--fg) !important;
}

/* Card-like surfaces get card background so they still stand out. */
.learndash-wrapper .ld-item-list-item,
.learndash-wrapper .ld-table-list-item,
.learndash-wrapper .ld-topic-list-item,
.learndash-wrapper .ld-lesson-list-item,
.learndash-wrapper .ld-alert,
.wpProQuiz_content .wpProQuiz_question,
.wpProQuiz_content .wpProQuiz_reviewQuestion,
.wpProQuiz_content .wpProQuiz_response,
.wpProQuiz_content .wpProQuiz_tipp,
.wpProQuiz_content .wpProQuiz_incorrect,
.wpProQuiz_content .wpProQuiz_correct {
	background: var(--card) !important;
	color: var(--fg) !important;
	border-color: var(--border) !important;
}

/* Text-level: EVERYTHING inside inherits so nothing is hardcoded-dark on dark bg. */
.learndash-wrapper *,
.wpProQuiz_content * {
	color: inherit !important;
}

/* Preserve certain semantic colors for correct/incorrect answers even in dark. */
.wpProQuiz_content .wpProQuiz_correct,
.wpProQuiz_content .wpProQuiz_correct * {
	color: oklch(0.68 0.15 155) !important;
}
.wpProQuiz_content .wpProQuiz_incorrect,
.wpProQuiz_content .wpProQuiz_incorrect * {
	color: oklch(0.72 0.18 27) !important;
}

/* Answer options — override the plugin's <li> defaults with rounded touch targets. */
.wpProQuiz_content .wpProQuiz_questionList,
.wpProQuiz_content .wpProQuiz_questionList > li {
	background: transparent !important;
	border: 0 !important;
	list-style: none !important;
	padding: 0 !important;
	margin: 0 0 0.5rem 0 !important;
}
.wpProQuiz_content .wpProQuiz_questionListItem {
	display: block !important;
	padding: 0.875rem 1rem !important;
	border-radius: 0.875rem !important;
	background: var(--card) !important;
	border: 1px solid var(--border) !important;
	transition: border-color 0.15s !important;
}
.wpProQuiz_content .wpProQuiz_questionListItem:hover {
	border-color: var(--sec) !important;
}
.wpProQuiz_content .wpProQuiz_questionListItem input[type="radio"],
.wpProQuiz_content .wpProQuiz_questionListItem input[type="checkbox"] {
	margin-right: 0.75rem !important;
	accent-color: var(--sec);
}

/* Buttons */
.learndash-wrapper .ld-button,
.learndash-wrapper input[type="submit"],
.wpProQuiz_content .wpProQuiz_button,
.wpProQuiz_content .wpProQuiz_button2,
.wpProQuiz_content input[type="button"],
.wpProQuiz_content input[type="submit"] {
	background: var(--primary) !important;
	color: var(--primary-fg) !important;
	border: 0 !important;
	border-radius: 0.875rem !important;
	padding: 0.75rem 1.25rem !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	box-shadow: var(--shad-soft) !important;
	transition: opacity 0.15s !important;
}
.learndash-wrapper .ld-button:hover,
.wpProQuiz_content .wpProQuiz_button:hover,
.wpProQuiz_content .wpProQuiz_button2:hover {
	opacity: 0.92 !important;
}

/* Progress bar */
.learndash-wrapper .ld-progress-bar,
.wpProQuiz_content .wpProQuiz_reviewDiv {
	background: var(--muted) !important;
	border: 1px solid var(--border) !important;
	border-radius: 0.5rem !important;
}
.learndash-wrapper .ld-progress-bar-percentage,
.wpProQuiz_content .wpProQuiz_reviewColor {
	background: var(--sec) !important;
}

/* Alerts / info boxes */
.learndash-wrapper .ld-alert-warning {
	background: oklch(0.72 0.13 75 / 0.15) !important;
	border-color: oklch(0.72 0.13 75 / 0.40) !important;
	color: var(--fg) !important;
}
.learndash-wrapper .ld-alert-success,
.wpProQuiz_content .wpProQuiz_correct {
	background: oklch(0.68 0.15 155 / 0.15) !important;
	border-color: oklch(0.68 0.15 155 / 0.40) !important;
}
.learndash-wrapper .ld-alert-danger,
.wpProQuiz_content .wpProQuiz_incorrect {
	background: oklch(0.72 0.18 27 / 0.15) !important;
	border-color: oklch(0.72 0.18 27 / 0.40) !important;
}

/* Links inside LD content follow theme */
.learndash-wrapper a,
.wpProQuiz_content a {
	color: var(--sec) !important;
	text-decoration: underline !important;
}

/* Text inputs / textareas */
.learndash-wrapper input[type="text"],
.learndash-wrapper input[type="email"],
.learndash-wrapper input[type="password"],
.learndash-wrapper textarea,
.wpProQuiz_content input[type="text"],
.wpProQuiz_content textarea {
	background: var(--card) !important;
	color: var(--fg) !important;
	border: 1px solid var(--border) !important;
	border-radius: 0.75rem !important;
	padding: 0.5rem 0.75rem !important;
}

/* Kill leaked inline whites */
.learndash-wrapper [style*="background: #fff"],
.learndash-wrapper [style*="background:#fff"],
.learndash-wrapper [style*="background-color: #fff"],
.learndash-wrapper [style*="background-color:#fff"],
.learndash-wrapper [style*="background: white"],
.learndash-wrapper [style*="background-color: white"],
.wpProQuiz_content [style*="background: #fff"],
.wpProQuiz_content [style*="background:#fff"],
.wpProQuiz_content [style*="background-color: #fff"] {
	background: var(--card) !important;
}
.learndash-wrapper [style*="color: #000"],
.learndash-wrapper [style*="color:#000"],
.learndash-wrapper [style*="color: black"],
.wpProQuiz_content [style*="color: #000"],
.wpProQuiz_content [style*="color:#000"] {
	color: var(--fg) !important;
}
