/* PLD Courses — front-end styles */

:root {
	--pldc-brand: #1B55B5;        /* buttons / interactive accents */
	--pldc-brand-dark: #17489b;   /* button hover */
	--pldc-brand-tint: #f1f5fc;   /* ghost button hover */
	--pldc-brand-line: #c2d3ef;   /* ghost button border */
	--pldc-heading: #0B204F;      /* headings and headline figures */
}

.pldc { max-width: none; width: 100%; }

/* Plain text links in brand blue instead of the theme's light blue.
   :where() keeps this at class-level specificity so buttons, card titles
   and lesson states declared further down still win. */
.pldc :where(a) { color: var(--pldc-brand); }
.pldc :where(a:hover) { color: var(--pldc-brand-dark); }

/* --- Headings --- */
.pldc h2,
.pldc h3,
.pldc h4,
.pldc-modal-box h3 { color: var(--pldc-heading); }
.pldc-course-card h3 a { color: var(--pldc-heading); text-decoration: none; }
.pldc-course-card h3 a:hover { color: var(--pldc-brand); text-decoration: underline; }
.pldc input[type=text],
.pldc input[type=email],
.pldc input[type=password] { width: 100%; max-width: 360px; padding: 8px; }

/* --- Buttons --- */
.pldc-btn {
	display: inline-block;
	padding: 10px 18px;
	background: var(--pldc-brand);
	color: #fff;
	border: 0;
	border-radius: 4px;
	cursor: pointer;
	text-decoration: none;
	transition: transform .12s ease, opacity .12s ease, box-shadow .12s ease;
}
.pldc-btn:hover { background: var(--pldc-brand-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(27,85,181,.24); }
.pldc-btn:active { transform: translateY(0); }
.pldc-btn-alt { background: #1d9e75; }
.pldc-btn-alt:hover { background: #178a65; box-shadow: 0 4px 10px rgba(29,158,117,.24); }
.pldc-btn-ghost { background: transparent; color: var(--pldc-brand); border: 1px solid var(--pldc-brand-line); }
.pldc-btn-ghost:hover { color: var(--pldc-brand-dark); background: var(--pldc-brand-tint); border-color: var(--pldc-brand); }
.pldc-btn-complete:hover { background: #1d9e75; box-shadow: 0 4px 10px rgba(29,158,117,.24); }

.pldc-errors { background: #fbeaea; border-left: 4px solid #c00; padding: 8px 14px; margin-bottom: 16px; }
.pldc-errors p { margin: 4px 0; }
.pldc-meta { font-size: .9em; color: #555; margin: 4px 0; }
.pldc-complete { color: #1d9e75; font-weight: 600; }

/* --- Progress bars --- */
.pldc-progress-bar {
	background: #eaeaea;
	border-radius: 99px;
	height: 10px;
	overflow: hidden;
	margin: 10px 0 6px;
	position: relative;
}
.pldc-progress-bar span {
	display: block;
	height: 100%;
	width: 0;
	border-radius: 99px;
	background: linear-gradient(90deg, #1d9e75, #4fc29d);
	transition: width 1s cubic-bezier(.2,.8,.2,1);
}
.pldc-progress-bar-sm { height: 6px; margin: 6px 0 4px; }

/* --- Stats panel (level bar on top, metrics underneath) --- */
.pldc-stats {
	background: #f7f8f9;
	border: 1px solid #e3e5e8;
	border-radius: 10px;
	padding: 18px 20px;
	margin-bottom: 28px;
}
.pldc-level-row { margin-bottom: 16px; }
.pldc-level-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 16px;
}
.pldc-level-name { font-weight: 700; font-size: 1.05em; color: var(--pldc-heading); }
.pldc-level-next { font-size: .82em; color: #6b7075; }
.pldc-level-row .pldc-progress-bar { height: 12px; margin: 10px 0 0; }

.pldc-stat-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px;
	border-top: 1px solid #e6e8ea;
	padding-top: 16px;
}
.pldc-stat { text-align: center; min-width: 0; }
.pldc-stat-value { display: block; font-size: 1.6em; font-weight: 700; line-height: 1.2; color: var(--pldc-heading); }
.pldc-stat-sub { font-size: .55em; font-weight: 600; color: #8a8f94; }
.pldc-stat-label { display: block; font-size: .78em; text-transform: uppercase; letter-spacing: .06em; color: #6b7075; margin-top: 2px; }

/* --- Course cards (full width rows) --- */
.pldc-course-list {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	margin-bottom: 32px;
}
.pldc-course-card {
	display: flex;
	align-items: center;
	gap: 22px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 10px;
	padding: 18px 22px;
	transition: box-shadow .18s ease, transform .18s ease;
}
.pldc-course-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-2px); }
.pldc-course-card h3 { margin: 0 0 2px; }
.pldc-course-card.is-complete { border-color: #b2e3d3; background: #f8fdfb; }
.pldc-card-badge { flex: 0 0 84px; text-align: center; margin: 0; }
.pldc-card-badge img {
	max-width: 84px;
	height: auto;
	animation: pldc-badge-in .6s cubic-bezier(.2,1.2,.3,1) both;
}
.pldc-card-main { flex: 1 1 auto; min-width: 0; }
.pldc-card-progress { display: flex; align-items: center; gap: 12px; }
.pldc-card-progress .pldc-progress-bar { flex: 1 1 auto; margin: 8px 0 6px; }
.pldc-card-percent { flex: 0 0 auto; font-size: .85em; font-weight: 700; color: #1d9e75; min-width: 42px; text-align: right; }
.pldc-card-actions {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 168px;
	margin: 0;
}
.pldc-card-actions .pldc-btn { text-align: center; }
.pldc-btn-share { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.pldc-share-icon { flex: 0 0 auto; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* --- Course view header --- */
.pldc-course-header { display: flex; gap: 20px; align-items: center; }
.pldc-header-badge img { max-width: 90px; height: auto; }
.pldc-header-progress { flex: 1; min-width: 0; }

/* --- Layout --- */
.pldc-layout { display: flex; gap: 28px; align-items: flex-start; margin-top: 20px; }
.pldc-sidebar { flex: 0 0 260px; border: 1px solid #ddd; border-radius: 8px; padding: 14px 18px; }
.pldc-lesson { flex: 1; min-width: 0; }
.pldc-lesson-nav { list-style: none; margin: 0; padding: 0; }
.pldc-lesson-nav li { margin: 0; padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.pldc-lesson-nav li.is-current > a { font-weight: 700; }
.pldc-lesson-nav li.is-done > a { color: #167a5b; }
.pldc-lesson-nav a { text-decoration: none; transition: padding-left .15s ease; display: block; }
.pldc-lesson-nav a:hover { padding-left: 4px; }
.pldc-lesson-nav li.is-locked { opacity: .55; }
.pldc-locked-lesson { cursor: not-allowed; }
.pldc-tick { display: inline-block; width: 18px; color: #1d9e75; }

.pldc-embed { margin: 20px 0; }
.pldc-embed iframe { max-width: 100%; }
.pldc-lesson-actions { margin: 24px 0; }
.pldc-lesson-nav-links { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid #eee; padding-top: 16px; }
.pldc-lesson-nav-links .pldc-next { margin-left: auto; }

.pldc-redeem { border-top: 1px solid #eee; padding-top: 20px; margin-top: 8px; }
.pldc-redeem form { display: flex; gap: 10px; align-items: center; }
.pldc-redeem input[type=text] { max-width: 220px; }

/* --- Achievements --- */
.pldc-achievements { margin: 32px 0; }
.pldc-achievements-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 16px;
}
.pldc-achievements-head h3 { margin: 0; }
.pldc-achievements-count { font-size: .85em; color: #6b7075; }
.pldc-achievements-count strong { color: var(--pldc-heading); }
.pldc-achievements-track { margin: 10px 0 16px; }
.pldc-achievements-track span { background: linear-gradient(90deg, #c9a227, #f1cd4e); }

/* Flex (not auto-fill grid) so the last row stretches instead of
   leaving a single orphan tile next to an empty gap. */
.pldc-achievement-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.pldc-achievement {
	flex: 1 1 240px;
	display: flex;
	align-items: center;
	gap: 12px;
	text-align: left;
	padding: 14px 16px;
	background: #fff;
	border: 1px solid #e3e5e8;
	border-radius: 10px;
	transition: transform .18s ease, box-shadow .18s ease;
}
.pldc-achievement-icon {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.35em;
	line-height: 1;
	background: #f1f2f4;
}
.pldc-achievement-text { min-width: 0; }
.pldc-achievement-title { display: block; font-weight: 600; font-size: .95em; line-height: 1.3; color: var(--pldc-heading); }
.pldc-achievement-desc { display: block; font-size: .8em; color: #6b7075; margin-top: 2px; }
.pldc-achievement-date { display: block; font-size: .74em; font-weight: 600; color: #9a7d1e; margin-top: 4px; }

.pldc-achievement.is-earned { background: #fffdf5; border-color: #ead9a0; }
.pldc-achievement.is-earned .pldc-achievement-icon { background: #fbf0cd; box-shadow: 0 0 0 3px rgba(234,217,160,.4); }
.pldc-achievement.is-earned:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }

.pldc-achievement.is-locked { background: #fafbfb; border-style: dashed; border-color: #dfe2e5; }
.pldc-achievement.is-locked .pldc-achievement-icon { opacity: .55; font-size: 1.1em; }
.pldc-achievement.is-locked .pldc-achievement-title { color: #767b80; font-weight: 500; }

/* --- Confetti canvas --- */
.pldc-confetti-canvas {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 99998;
}

/* --- Completion modal --- */
.pldc-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.pldc-modal[hidden] { display: none; }
.pldc-modal-backdrop { position: absolute; inset: 0; background: rgba(15,18,20,.6); animation: pldc-fade-in .25s ease both; }
.pldc-modal-box {
	position: relative;
	background: #fff;
	border-radius: 12px;
	padding: 34px 32px 28px;
	max-width: 440px;
	width: 100%;
	text-align: center;
	box-shadow: 0 24px 60px rgba(0,0,0,.3);
	animation: pldc-pop-in .45s cubic-bezier(.2,1.2,.3,1) both;
}
.pldc-modal-box h3 { margin: 4px 0 10px; font-size: 1.6em; }
.pldc-modal-close { position: absolute; top: 8px; right: 12px; background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: #8a8f94; padding: 4px; }
.pldc-modal-close:hover { color: var(--pldc-heading); }
.pldc-modal-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .74em; color: #1d9e75; font-weight: 700; margin: 0; }
.pldc-modal-badge { margin-bottom: 14px; }
.pldc-modal-badge img { max-width: 150px; height: auto; animation: pldc-badge-in .7s .1s cubic-bezier(.2,1.4,.3,1) both; }
.pldc-modal-badge-fallback span { font-size: 64px; display: inline-block; animation: pldc-badge-in .7s .1s cubic-bezier(.2,1.4,.3,1) both; }
.pldc-modal-points { color: #1d9e75; font-weight: 700; margin: 10px 0 18px; animation: pldc-fade-up .5s .35s both; }
.pldc-modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* --- Badge sharing --- */
.pldc-share { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e3e5e8; }
.pldc-share-title { margin: 0 0 10px; font-size: .74em; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6b7280; }
.pldc-share-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pldc-share-link { display: inline-flex; align-items: center; padding: 6px 13px; font: inherit; font-size: .85em; font-weight: 600; line-height: 1.3; color: var(--pldc-brand); background: #fff; border: 1px solid var(--pldc-brand-line); border-radius: 999px; cursor: pointer; text-decoration: none; transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
.pldc-share-link:hover,
.pldc-share-link:focus-visible { color: #fff; background: var(--pldc-brand); border-color: var(--pldc-brand); }
.pldc-share-link.is-copied { color: #fff; background: #1d9e75; border-color: #1d9e75; }
.pldc-share-link[hidden] { display: none; }
.pldc-share-extra { margin: 10px 0 0; font-size: .85em; }
.pldc-share-header { margin-top: 16px; padding: 16px 20px; background: #fafbfc; border: 1px solid #ddd; border-radius: 10px; scroll-margin-top: 120px; }
.pldc-share-header .pldc-share-links { justify-content: flex-start; }

/* --- Toasts --- */
.pldc-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.pldc-toast {
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--pldc-heading);
	color: #fff;
	padding: 12px 18px 12px 14px;
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(0,0,0,.25);
	max-width: 320px;
	transform: translateX(120%);
	transition: transform .4s cubic-bezier(.2,.9,.3,1), opacity .3s ease;
	pointer-events: auto;
}
.pldc-toast.is-in { transform: translateX(0); }
.pldc-toast.is-out { opacity: 0; transform: translateX(120%); }
.pldc-toast-icon { font-size: 1.7em; line-height: 1; }
.pldc-toast-title { font-weight: 700; font-size: .95em; }
.pldc-toast-desc { font-size: .8em; opacity: .8; }

/* --- Keyframes --- */
@keyframes pldc-pop-in {
	from { opacity: 0; transform: scale(.85) translateY(20px); }
	to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes pldc-badge-in {
	from { opacity: 0; transform: scale(.4) rotate(-14deg); }
	to   { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes pldc-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pldc-fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* --- Responsive --- */
@media (max-width: 782px) {
	.pldc-layout { flex-direction: column; }
	.pldc-sidebar { flex: none; width: 100%; }
	.pldc-course-header { flex-direction: column; text-align: center; }
	.pldc-course-card { flex-direction: column; align-items: stretch; gap: 14px; }
	.pldc-card-badge { flex: none; align-self: center; }
	.pldc-card-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; }
	.pldc-card-actions .pldc-btn { flex: 1 1 auto; }
	.pldc-share-header .pldc-share-links { justify-content: center; }
	.pldc-toasts { left: 20px; right: 20px; }
	.pldc-toast { max-width: none; }
}

@media (max-width: 560px) {
	.pldc-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 10px; }
	.pldc-stat-value { font-size: 1.4em; }
}

/* --- Accessibility: respect reduced motion --- */
@media (prefers-reduced-motion: reduce) {
	.pldc-progress-bar span,
	.pldc-btn,
	.pldc-course-card,
	.pldc-achievement,
	.pldc-lesson-nav a,
	.pldc-share-link,
	.pldc-toast { transition: none !important; }
	.pldc-modal-box,
	.pldc-modal-backdrop,
	.pldc-modal-badge img,
	.pldc-modal-badge-fallback span,
	.pldc-modal-points,
	.pldc-card-badge img { animation: none !important; }
}
