/* LearnDash layer 2/6: course page (status band, course rows). See base.css for the cascade strategy.
   The ".ld-course-status" rules style LearnDash's own info bar. The single course page replaces that bar with the panel of
   inc/course-page.php (assets/css/course-page.css), so they only apply where the panel is not rendered (fallback, info bar
   in other contexts): kept on purpose. */

/* ---- Course status: bar first, then one row with state + steps; no bordered band ---- */
.learndash-wrapper:not(.sddsg-b) {
	.ld-course-status, .ld-course-status.ld-course-status-enrolled { display: block !important; background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; margin-block: 0 1.5rem; }
	.ld-course-status .ld-progress { inline-size: 100%; }
	.ld-course-status .ld-progress.ld-progress-inline { /* LD's row-reverse + align-items:center would shrink the bar to width 0: stretch instead */
		flex-direction: column; align-items: stretch; justify-content: flex-start; inline-size: 100%;
		.ld-progress-bar { flex: 0 0 auto; inline-size: 100%; margin: 0; block-size: 0.75rem; background: color-mix(in srgb, var(--wp--preset--color--contrast) 18%, var(--wp--preset--color--base)) !important; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wp--preset--color--contrast) 10%, transparent); }
		.ld-progress-heading { inline-size: 100%; font-size: 1rem; line-height: 1.4; }
		.ld-progress-stats { inline-size: 100%; justify-content: space-between; text-align: start; }
		.ld-progress-percentage { margin: 0; }
		.ld-progress-steps { margin-inline-start: auto; text-align: end; }
		@media (max-width: 640px) { .ld-progress-heading { flex-direction: row; } .ld-progress-steps { margin-inline-start: 0; text-align: start; } }
	}
	.ld-course-status .ld-progress .ld-progress-percentage { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem); font-weight: 800; text-transform: none; letter-spacing: 0; color: var(--wp--preset--color--heading); }
}
.learndash-wrapper .ld-course-status .ld-progress,
.learndash-wrapper .ld-course-status.ld-course-status-enrolled .ld-progress.ld-progress-inline {
	display: flex; flex-direction: column; gap: 0.625rem; padding: 0; text-align: start; box-shadow: none;
	background: none !important; border: 0 !important; /* LD inline CSS */
}
.learndash-wrapper .ld-course-status .ld-progress { margin: 0 0 1.5rem; }
.learndash-wrapper .ld-course-status .ld-progress .ld-progress-bar { order: 1; block-size: 0.75rem; border-radius: var(--wp--custom--radius--pill); overflow: hidden; background: color-mix(in srgb, var(--wp--preset--color--contrast) 14%, transparent) !important; }
.learndash-wrapper .ld-course-status .ld-progress .ld-progress-heading { order: 2; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin: 0; text-align: start; }
.learndash-wrapper .ld-course-status .ld-progress .ld-progress-stats { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin: 0; inline-size: 100%; }
.learndash-wrapper .ld-course-status .ld-progress :is(.ld-progress-percentage, .ld-progress-steps) { text-align: start; }
.learndash-wrapper .ld-course-status .ld-progress .ld-progress-steps { font-size: 1.0625rem; font-weight: 600; color: var(--wp--preset--color--muted); }
.learndash-wrapper .ld-course-status .ld-progress .ld-progress-label { order: 3; flex-basis: 100%; margin: 0.25rem 0 0; font-size: 0.875rem; font-weight: 500; color: var(--wp--preset--color--muted); text-transform: none; letter-spacing: 0; }

/* ---- Course / profile rows: [title + status | progress | CTA] on desktop, stacked on mobile ---- */
.learndash-wrapper .ld-item-list.ld-course-list .ld-section-heading { display: flex; justify-content: space-between; align-items: baseline; margin-block-end: 0.75rem; }
.learndash-wrapper .ld-item-list.ld-course-list .ld-section-heading h3 { font-size: var(--wp--preset--font-size--large); margin: 0; }
.learndash-wrapper .ld-item-list.ld-course-list .ld-item-list-actions { display: none; } /* rows are always open */
.learndash-wrapper #ld-main-course-list { display: grid; gap: 0.875rem; }
.learndash-wrapper .ld-item-list-item.ld-item-list-item-course {
	display: grid; gap: 0.75rem 1.5rem; align-items: center; margin: 0; padding: 1rem 1.25rem; overflow: visible;
	grid-template-columns: minmax(0, 1fr); box-shadow: var(--wp--preset--shadow--sm);
}
.learndash-wrapper .ld-item-list-item.ld-item-list-item-course:hover { box-shadow: var(--wp--preset--shadow--md); }
.learndash-wrapper .ld-item-list .ld-item-list-item.ld-item-list-item-course > :is(.ld-item-list-item-preview, .ld-item-list-item-expanded) { display: contents; }
.learndash-wrapper .ld-item-list-item-course .ld-item-name { display: flex; align-items: center; gap: 0.75rem; font-size: var(--wp--preset--font-size--medium); text-decoration: none; padding: 0; }
.learndash-wrapper .ld-item-list-item-course .ld-item-details { display: flex; justify-content: flex-start; align-items: center; gap: 0.75rem; padding: 0; margin: 0; }
.learndash-wrapper .ld-item-list-item-course .ld-item-details .ld-status { display: none; } /* status shown by icon + progress */
.learndash-wrapper .ld-item-list .ld-item-list-item.ld-item-list-item-course .ld-item-list-item-expanded .ld-progress { margin: 0; padding: 0; border: 0; background: none; box-shadow: none; }
.learndash-wrapper .ld-item-list-item-course .ld-progress .ld-progress-heading { display: flex; justify-content: space-between; gap: 1rem; margin: 0 0 0.35rem; }
.learndash-wrapper .ld-item-list-item-course .ld-progress .ld-progress-label { display: none; }
.learndash-wrapper .ld-item-list-item-course .ld-progress .ld-progress-stats { display: flex; justify-content: space-between; inline-size: 100%; gap: 1rem; font-size: var(--wp--preset--font-size--x-small); }
.learndash-wrapper:not(.sddsg-b) .ld-item-list-item-course .ld-progress-percentage { font-weight: 700; text-transform: none; color: var(--wp--preset--color--heading) !important; }
.learndash-wrapper .ld-item-list-item-course .ld-item-details .sddsg-ld-cta { inline-size: 100%; }
@media (min-width: 48em) {
	.learndash-wrapper .ld-item-list-item.ld-item-list-item-course { grid-template-columns: minmax(0, 1fr) minmax(12rem, 18rem) 11rem; } /* fixed last column (fits certificate icon + CTA) so progress bars line up across rows */
	.learndash-wrapper .ld-item-list-item-course .ld-item-details { justify-content: flex-end; grid-column: 3; grid-row: 1; }
	.learndash-wrapper .ld-item-list-item-course .ld-item-name { grid-column: 1; grid-row: 1; }
	.learndash-wrapper .ld-item-list-item-course .ld-progress { grid-column: 2; grid-row: 1; }
}
@media (max-width: 47.99em) {
	.learndash-wrapper .ld-item-list .ld-item-list-item.ld-item-list-item-course .ld-progress { order: 2; }
	.learndash-wrapper .ld-item-list .ld-item-list-item.ld-item-list-item-course .ld-item-details { order: 3; }
}

/* Module durations (sddsg-core features/durations.php): total next to "Kursinhalt", duration at the end of each lesson row. */
.learndash-wrapper :is(.sddsg-course-total, .sddsg-row-duration) time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.learndash-wrapper :is(.sddsg-course-total, .sddsg-row-duration)::before {
	content: ""; display: inline-block; inline-size: 1em; block-size: 1em; margin-inline-end: .35em; vertical-align: -.15em; background: currentColor; opacity: .75;
	-webkit-mask: var(--sddsg-clock) center / contain no-repeat; mask: var(--sddsg-clock) center / contain no-repeat;
}
.learndash-wrapper { --sddsg-clock: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'><circle cx='12' cy='12' r='9'/><path d='M12 7v5l3 2'/></svg>"); }
.learndash-wrapper .ld-section-heading .sddsg-course-total { margin: 0 0 0 auto; padding-inline-start: 1rem; font-size: var(--wp--preset--font-size--small); font-weight: 700; color: var(--wp--preset--color--heading); white-space: nowrap; }
.learndash-wrapper .ld-section-heading:has(.sddsg-course-total) { flex-wrap: wrap; align-items: baseline; }
.learndash-wrapper .ld-item-details .sddsg-row-duration { margin-inline-end: .75rem; font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--muted); white-space: nowrap; }
.learndash-wrapper :is(.sddsg-course-total, .sddsg-row-duration) .screen-reader-text { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Phones: duration on its own line under the lesson title (aligned with the title), total under the heading. */
@media (max-width: 40em) {
	.learndash-wrapper .ld-item-list-item-preview:has(.sddsg-row-duration) { flex-wrap: wrap; row-gap: .125rem; }
	.learndash-wrapper .ld-item-list-item-preview:has(.sddsg-row-duration) .ld-item-details { display: flex !important; flex: 1 0 100% !important; inline-size: 100%; justify-content: flex-start !important; text-align: start; margin-inline: 0 !important; padding-inline-start: calc(24px + 1.25rem); } /* = status icon + gap: aligned with the title */
	.learndash-wrapper .ld-item-details .sddsg-row-duration { margin: 0; }
	.learndash-wrapper .ld-section-heading .sddsg-course-total { flex: 1 0 100%; order: 3; margin: .25rem 0 0; padding: 0; text-align: start; }
}
.sddsg-duration { margin-block: 0.75rem; color: var(--wp--preset--color--muted); }
.sddsg-duration strong { color: var(--wp--preset--color--heading); }

/* ---- Lesson / topic / quiz rows of the course page ---- */
/* Whole row is the hit area (stretched link, like the course cards); the duration sat outside the anchor. Controls in the details stay on top. */
.learndash-wrapper .ld-item-list-item:not(.ld-item-list-item-course) > .ld-item-list-item-preview { position: relative; }
.learndash-wrapper .ld-item-list-item:not(.ld-item-list-item-course) > .ld-item-list-item-preview > a.ld-item-name::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.learndash-wrapper .ld-item-list-item:not(.ld-item-list-item-course) > .ld-item-list-item-preview > .ld-item-details :is(a, button, .ld-expand-button, [data-ld-tooltip]) { position: relative; z-index: 1; }
/* Hover feedback: wash + underlined title (the border change alone was barely visible). */
.learndash-wrapper .ld-item-list-item:not(.ld-item-list-item-course) > .ld-item-list-item-preview:has(> a.ld-item-name:hover) { background: color-mix(in srgb, var(--wp--preset--color--heading) 6%, transparent); border-radius: inherit; }
.learndash-wrapper .ld-item-list-item:not(.ld-item-list-item-course) > .ld-item-list-item-preview > a.ld-item-name:hover .ld-item-title { text-decoration: underline; text-underline-offset: 0.2em; }
/* Phones: LD stacks the row as a centred column, so icon + title floated to the middle (status icons zigzag). Left-align everything.
   One class more than the row rule in responsive.css (loaded later). */
@media (max-width: 640px) {
	.learndash-wrapper .ld-item-list .ld-item-list-item:not(.ld-item-list-item-course) > .ld-item-list-item-preview { align-items: stretch; }
	.learndash-wrapper .ld-item-list .ld-item-list-item:not(.ld-item-list-item-course) > .ld-item-list-item-preview > .ld-item-name { justify-content: flex-start; text-align: start; }
	.learndash-wrapper .ld-item-list .ld-section-heading :is(h2, h3) { text-align: start; }
}

/* ---- Completed course: success green instead of the warning gold (LD prints no "complete" class here, only the inline width) ---- */
.learndash-wrapper:not(.sddsg-b) .ld-course-status .ld-progress .ld-progress-bar .ld-progress-bar-percentage[style*="width:100%"],
.learndash-wrapper:not(.sddsg-b) .ld-course-status .ld-progress .ld-progress-bar .ld-progress-bar-percentage[style*="width: 100%"] { background: var(--wp--preset--color--success) !important; }
.learndash-wrapper:not(.sddsg-b) .ld-course-status .ld-progress:has(.ld-progress-bar-percentage:is([style*="width:100%"], [style*="width: 100%"])) .ld-progress-percentage { color: var(--wp--preset--color--success) !important; }
/* Certificate download: LD's 27px mini button -> regular 44px target. */
.learndash-wrapper .ld-alert.ld-alert-certificate .ld-button { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; min-block-size: 2.75rem; flex: none; }

/* ---- Not enrolled: "Diesen Kurs belegen" (LD's custom colour kept navy under the dark tokens: 1.72:1) + LD's fixed grey labels ---- */
.learndash-wrapper:not(#_) .ld-course-status :is(#btn-join, .btn-join) {
	box-sizing: border-box; min-block-size: var(--sddsg-btn-h); opacity: 1; cursor: pointer; font-weight: var(--sddsg-btn-weight); box-shadow: var(--sddsg-btn-edge);
	background-color: var(--wp--preset--color--accent) !important; color: var(--wp--preset--color--on-accent) !important;
	&:hover { opacity: 1; background-color: var(--wp--preset--color--accent) !important; filter: var(--sddsg-btn-hover); box-shadow: var(--sddsg-btn-shadow-hover); }
	&:focus { opacity: 1; }
	&:focus-visible { opacity: 1; outline: var(--sddsg-ring); outline-offset: var(--sddsg-ring-offset); }
}
.learndash-wrapper .ld-course-status.ld-course-status-not-enrolled :is(.ld-course-status-label, .ld-course-status-price) { color: var(--wp--preset--color--muted); }
