/*
 * Milky Way Custom LMS front end.
 * Fonts and text color are inherited from the theme. The accent color defaults
 * to Divi's accent (Theme Options) and can be changed with the
 * sb_lms_accent_color filter or by overriding --sb-accent in Divi's custom CSS.
 * Only plugin classes are styled, so lesson content built in Divi is untouched.
 */
.sb-lms {
	--sb-accent: #2563eb;
	--sb-on-accent: #fff;
	--sb-success: #2f7d4f;
	--sb-line: rgba(0, 0, 0, 0.12);
	--sb-subtle: rgba(0, 0, 0, 0.04);
	--sb-muted: rgba(0, 0, 0, 0.6);
	--sb-radius: 6px;
	font-family: inherit;
	color: inherit;
	line-height: 1.5;
}
.sb-lms *,
.sb-lms *::before,
.sb-lms *::after { box-sizing: border-box; }
.sb-lms [hidden] { display: none !important; }

/* Divi builder pages are full width. Plugin blocks sit in a Divi row (.et_pb_row),
   which takes the content width set in Divi and lines up with the page title. */
.sb-lms .sb-row { padding: 0 !important; }
.sb-lms--builder .sb-curriculum,
.sb-lms--builder .sb-grid { margin-bottom: 54px; }

/* Course featured image */
.sb-lms .sb-course-hero { margin: 0 0 32px !important; padding: 0; }
.sb-lms .sb-course-hero__img { display: block; width: 100%; height: auto; max-width: none; border-radius: var(--sb-radius); }

/* Buttons */
.sb-lms .sb-btn {
	display: inline-block;
	padding: 0.6em 1.15em;
	border: 1px solid var(--sb-accent);
	border-radius: var(--sb-radius);
	background: var(--sb-accent);
	color: var(--sb-on-accent) !important;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none !important;
	cursor: pointer;
}
.sb-lms .sb-btn:hover { filter: brightness(0.92); }
.sb-lms .sb-btn:focus-visible,
.sb-lms a:focus-visible { outline: 2px solid var(--sb-accent); outline-offset: 2px; }
.sb-lms .sb-btn--block { display: block; width: 100%; }
.sb-lms .sb-btn--ghost {
	background: transparent;
	border-color: var(--sb-line);
	color: inherit !important;
}
.sb-lms .sb-btn--ghost:hover { filter: none; background: var(--sb-subtle); }
.sb-lms .sb-btn--success { background: var(--sb-success); border-color: var(--sb-success); }
.sb-lms .sb-btn[disabled] { opacity: 0.6; cursor: wait; }

/* Badges */
.sb-lms .sb-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	background: var(--sb-subtle);
	color: var(--sb-muted);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
}
.sb-lms .sb-badge--success { background: rgba(47, 125, 79, 0.12); color: var(--sb-success); }

/* Notices */
.sb-lms .sb-notice {
	margin: 20px 0;
	padding: 20px 22px;
	border: 1px solid var(--sb-line);
	border-radius: var(--sb-radius);
	background: var(--sb-subtle);
}
.sb-lms .sb-notice--warning { border-left: 4px solid #c68a00; }
.sb-lms .sb-notice h3 { margin: 0 0 6px; padding: 0; font-size: 18px; }
.sb-lms .sb-notice p { margin: 0 0 10px; padding: 0; }
.sb-lms .sb-notice p:last-child { margin-bottom: 0; }
.sb-lms .sb-admin-note { margin: 0 0 12px; padding: 0; color: var(--sb-muted); font-size: 14px; }
.sb-lms .sb-section-title { margin: 40px auto 0; padding: 0; }

/* Course and group cards */
.sb-lms .sb-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 24px;
	margin: 24px 0;
}
.sb-lms .sb-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--sb-line);
	border-radius: var(--sb-radius);
	background: #fff;
}
.sb-lms .sb-card__thumb {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--sb-subtle);
}
.sb-lms .sb-card__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}
.sb-lms .sb-card__thumb--empty {
	background: linear-gradient(135deg, var(--sb-accent), #111827);
	opacity: 0.85;
}
.sb-lms .sb-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 6px;
	padding: 18px 20px 20px;
}
.sb-lms .sb-card__body .sb-badge { align-self: flex-start; }
.sb-lms .sb-card__title { margin: 0; padding: 0; font-size: 18px; line-height: 1.35; }
.sb-lms .sb-card__title a { color: inherit; text-decoration: none; }
.sb-lms .sb-card__title a:hover { color: var(--sb-accent); }
.sb-lms .sb-card__meta { margin: 0; padding: 0; color: var(--sb-muted); font-size: 14px; }
.sb-lms .sb-card__excerpt { margin: 4px 0 0; padding: 0; font-size: 15px; }
.sb-lms .sb-card__foot { margin-top: auto; padding-top: 14px; }
.sb-lms .sb-card__foot .sb-progress { margin: 0 0 14px; }

/* Progress */
.sb-lms .sb-progress { margin: 16px 0; }
.sb-lms .sb-progress__label {
	display: flex;
	justify-content: space-between;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 600;
}
.sb-lms .sb-progress__track { height: 6px; overflow: hidden; border-radius: 3px; background: var(--sb-line); }
.sb-lms .sb-progress__fill { height: 100%; background: var(--sb-success); transition: width 0.3s ease; }

/* Curriculum */
.sb-lms .sb-curriculum {
	margin: 40px 0;
	border: 1px solid var(--sb-line);
	border-radius: var(--sb-radius);
	background: #fff;
	overflow: hidden;
}
.sb-lms .sb-curriculum__head {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 20px 24px;
	border-bottom: 1px solid var(--sb-line);
}
.sb-lms .sb-curriculum__title { margin: 0; padding: 0; font-size: 20px; }
.sb-lms .sb-curriculum__meta { margin: 2px 0 0; padding: 0; color: var(--sb-muted); font-size: 14px; }
.sb-lms .sb-curriculum > .sb-progress,
.sb-lms .sb-curriculum > .sb-enroll { margin: 0; padding: 16px 24px; border-bottom: 1px solid var(--sb-line); }
.sb-lms .sb-curriculum__empty { margin: 0; padding: 28px 24px; color: var(--sb-muted); text-align: center; }
.sb-lms .sb-curriculum__list { margin: 0; padding: 0; list-style: none; }
.sb-lms .sb-lesson-row {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0;
	padding: 14px 24px;
	border-bottom: 1px solid var(--sb-line);
}
.sb-lms .sb-lesson-row:last-child { border-bottom: 0; }
.sb-lms .sb-lesson-row__num {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: 1px solid var(--sb-line);
	border-radius: 50%;
	font-size: 13px;
	font-weight: 600;
}
.sb-lms .sb-lesson-row.is-complete .sb-lesson-row__num { border-color: var(--sb-success); background: var(--sb-success); color: #fff; }
.sb-lms .sb-lesson-row__title { flex: 1; color: inherit; font-weight: 600; text-decoration: none; }
.sb-lms a.sb-lesson-row__title:hover { color: var(--sb-accent); }
.sb-lms .sb-lesson-row__state { color: var(--sb-muted); font-size: 13px; }
.sb-lms .sb-lesson-row.is-locked .sb-lesson-row__title { color: var(--sb-muted); }

/* Enroll box */
.sb-lms .sb-enroll p { margin: 0 0 10px; padding: 0; }
.sb-lms .sb-enroll p:last-child { margin-bottom: 0; }
.sb-lms .sb-enroll__buy { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 10px; }
.sb-lms .sb-enroll__price { font-weight: 600; }
.sb-lms .sb-enroll__login { font-size: 14px; }

/* Lesson view */
.sb-lms .sb-lesson-view__bar {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	margin: 0 0 4px;
	font-size: 14px;
}
.sb-lms .sb-lesson-view__back { color: var(--sb-accent); font-weight: 600; text-decoration: none; }
.sb-lms .sb-lesson-view__back::before { content: "\2039\00a0"; }
.sb-lms .sb-lesson-view__count { color: var(--sb-muted); }
.sb-lms .sb-video {
	position: relative;
	margin: 24px auto 30px;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--sb-radius);
	background: #000;
}
.sb-lms .sb-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.sb-lms .sb-lesson-nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 14px;
	margin-top: 48px;
	margin-bottom: 40px;
	padding-top: 24px;
	border-top: 1px solid var(--sb-line);
}
.sb-lms .sb-lesson-nav__right { display: flex; flex-wrap: wrap; gap: 10px; }
.sb-lms .sb-lesson-nav__msg { flex-basis: 100%; margin: 0; color: #b32d2e; font-size: 14px; }

/* Quiz */
.sb-lms .sb-quiz { margin: 32px 0 0; }
.sb-lms .sb-quiz__intro { margin: 0 0 20px; padding: 0; color: var(--sb-muted); font-size: 15px; }
.sb-lms .sb-quiz__list { margin: 0; padding: 0; list-style: none; counter-reset: sbq; }
.sb-lms .sb-quiz__q {
	counter-increment: sbq;
	margin: 0 0 18px;
	padding: 20px 22px;
	border: 1px solid var(--sb-line);
	border-radius: var(--sb-radius);
	background: #fff;
}
.sb-lms .sb-quiz__q fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.sb-lms .sb-quiz__text { display: block; width: 100%; margin: 0 0 12px; padding: 0; font-size: 17px; font-weight: 600; line-height: 1.45; }
.sb-lms .sb-quiz__text::before { content: counter(sbq) ". "; }
.sb-lms .sb-quiz__text p { display: inline; margin: 0; padding: 0; }
.sb-lms .sb-quiz__hint { margin: -6px 0 10px; padding: 0; color: var(--sb-muted); font-size: 14px; }
.sb-lms .sb-quiz__answers { display: grid; gap: 8px; }
.sb-lms .sb-quiz__answer {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid var(--sb-line);
	border-radius: var(--sb-radius);
	cursor: pointer;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.45;
}
.sb-lms .sb-quiz__answer:hover { background: var(--sb-subtle); }
.sb-lms .sb-quiz__answer input { flex-shrink: 0; margin: 0.3em 0 0; accent-color: var(--sb-accent); }
.sb-lms .sb-quiz__answer span p { margin: 0; padding: 0; }
.sb-lms .sb-quiz__answer:has(input:checked) { border-color: var(--sb-accent); }
.sb-lms .sb-quiz__q.is-missing { border-color: #c68a00; }
.sb-lms .sb-quiz.is-graded .sb-quiz__answer { cursor: default; }
.sb-lms .sb-quiz.is-graded .sb-quiz__answer:hover { background: none; }
.sb-lms .sb-quiz.is-graded .sb-quiz__answer.is-correct-answer { border-color: var(--sb-success); background: rgba(47, 125, 79, 0.08); }
.sb-lms .sb-quiz.is-graded .sb-quiz__answer.is-wrong-choice { border-color: #b32d2e; background: rgba(179, 45, 46, 0.06); }
.sb-lms .sb-quiz__q.is-right { border-left: 4px solid var(--sb-success); }
.sb-lms .sb-quiz__q.is-wrong { border-left: 4px solid #b32d2e; }
.sb-lms .sb-quiz__feedback { margin-top: 12px; font-size: 15px; }
.sb-lms .sb-quiz__q.is-right .sb-quiz__feedback strong { color: var(--sb-success); }
.sb-lms .sb-quiz__q.is-wrong .sb-quiz__feedback strong { color: #b32d2e; }
.sb-lms .sb-quiz__explanation { margin-top: 4px; }
.sb-lms .sb-quiz__explanation p { margin: 0 0 6px; padding: 0; }
.sb-lms .sb-quiz__actions { display: flex; gap: 10px; margin-top: 8px; }
.sb-lms .sb-quiz__result:empty { display: none; }
.sb-lms .sb-quiz__result { margin-top: 16px; }
.sb-lms .sb-quiz__score { margin: 0; padding: 14px 16px; border-radius: var(--sb-radius); font-weight: 600; }
.sb-lms .sb-quiz__score.is-passed { background: rgba(47, 125, 79, 0.1); color: var(--sb-success); }
.sb-lms .sb-quiz__score.is-not-passed { background: var(--sb-subtle); }
.sb-lms .sb-quiz__error { margin: 10px 0 0; padding: 0; color: #b32d2e; font-size: 14px; }

/* Course completion and certificates */
.sb-lms .sb-course-done,
.sb-lms .sb-curriculum__cert {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 16px 20px;
	border-radius: var(--sb-radius);
	background: rgba(47, 125, 79, 0.1);
	font-weight: 600;
}
.sb-lms .sb-course-done { margin: 0 0 40px; }
.sb-lms .sb-course-done[hidden] { display: none; }
.sb-lms .sb-course-done p { margin: 0; padding: 0; }
.sb-lms .sb-curriculum > .sb-curriculum__cert { margin: 0; border-radius: 0; border-bottom: 1px solid var(--sb-line); }
.sb-lms .sb-card__cert { display: block; margin-top: 10px; color: var(--sb-accent); font-size: 14px; font-weight: 600; text-align: center; }
.sb-lms .sb-lesson-row .sb-badge { flex-shrink: 0; }

@media (max-width: 600px) {
	.sb-lms .sb-lesson-row,
	.sb-lms .sb-curriculum__head,
	.sb-lms .sb-curriculum > .sb-progress,
	.sb-lms .sb-curriculum > .sb-enroll,
	.sb-lms .sb-curriculum > .sb-curriculum__cert { padding-left: 16px; padding-right: 16px; }
	.sb-lms .sb-quiz__q { padding: 16px; }
	.sb-lms .sb-lesson-nav__right,
	.sb-lms .sb-lesson-nav__right .sb-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.sb-lms .sb-progress__fill { transition: none; }
}
