/**
 * com_scorm player styles
 */

.com-scorm-player {
	display: flex;
	flex-direction: column;
	min-height: 70vh;
}

.com-scorm-player__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	padding: 0.5rem 0.75rem;
	border-bottom: 1px solid var(--template-border-color, #ddd);
	margin-bottom: 0.5rem;
}

.com-scorm-player__title {
	margin: 0;
	font-size: 1.15rem;
	flex: 1 1 12rem;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Header status: multi-SCO progress + time-remaining countdown. */
.com-scorm-player__status {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex: 0 1 auto;
	font-size: 0.85rem;
	color: var(--template-text-color, #555);
}

.com-scorm-player__progress-sep {
	opacity: 0.5;
}

.com-scorm-player__time {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.com-scorm-player__time.is-expired {
	color: var(--template-danger-color, #b42318);
	font-weight: 600;
}

.com-scorm-player__actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex: 0 0 auto;
	/* Hug the right edge even when the title is hidden (show_title = No). */
	margin-left: auto;
}

/* The TOC drawer toggle is desktop-hidden; the sidebar is always visible there. */
.com-scorm-player__toc-toggle {
	display: none;
}

.com-scorm-player__body {
	display: flex;
	flex: 1 1 auto;
	min-height: 65vh;
}

.com-scorm-player__body--toc {
	gap: 0.75rem;
}

.com-scorm-player__toc {
	flex: 0 0 220px;
	overflow-y: auto;
	border-right: 1px solid var(--template-border-color, #ddd);
	padding-right: 0.5rem;
}

.com-scorm-player__toc-title {
	font-size: 0.95rem;
	margin: 0 0 0.5rem;
}

.com-scorm-player__toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.com-scorm-player__toc-item a {
	display: flex;
	align-items: baseline;
	gap: 0.4rem;
	padding: 0.35rem 0.5rem;
	border-radius: 0.25rem;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.com-scorm-player__toc-item a:hover {
	background: var(--template-bg-light, #f0f3f7);
}

.com-scorm-player__toc-item a:focus-visible {
	outline: 2px solid var(--template-link-color, #2a69b8);
	outline-offset: 1px;
}

.com-scorm-player__toc-item.is-active a,
.com-scorm-player__toc-item.is-active a:hover {
	background: var(--template-link-color, #2a69b8);
	color: #fff;
}

.com-scorm-player__toc-state {
	flex: 0 0 1em;
}

.com-scorm-player__frame-wrap {
	position: relative;
	flex: 1 1 auto;
	min-height: 65vh;
}

.com-scorm-player__frame {
	width: 100%;
	height: 100%;
	min-height: 65vh;
	border: 0;
	display: block;
	background: #fff;
}

/* ---- Fullscreen -------------------------------------------------------- */

/* When the frame wrapper is the fullscreen element it fills the viewport, so
   drop the min-height cap and let the iframe stretch edge to edge. */
.com-scorm-player__frame-wrap:fullscreen {
	min-height: 0;
	background: #000;
}

.com-scorm-player__frame-wrap:fullscreen .com-scorm-player__frame {
	min-height: 0;
	height: 100%;
}

/* ---- Loading overlay --------------------------------------------------- */

.com-scorm-player__loader {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--template-bg-light, #fff);
	z-index: 1;
}

.com-scorm-player__spinner {
	width: 2.5rem;
	height: 2.5rem;
	border: 3px solid var(--template-border-color, #ddd);
	border-top-color: var(--template-link-color, #2a69b8);
	border-radius: 50%;
	animation: com-scorm-spin 0.8s linear infinite;
}

@keyframes com-scorm-spin {
	to { transform: rotate(360deg); }
}

/* ---- Mobile: TOC becomes a collapsible drawer -------------------------- */

@media (max-width: 600px) {
	.com-scorm-player__toc-toggle {
		display: inline-block;
	}

	.com-scorm-player__body--toc {
		flex-direction: column;
	}

	.com-scorm-player__toc {
		flex-basis: auto;
		border-right: 0;
		border-bottom: 1px solid var(--template-border-color, #ddd);
		padding-right: 0;
		display: none;
	}

	.com-scorm-player__toc.is-open {
		display: block;
	}
}

@media (prefers-reduced-motion: reduce) {
	.com-scorm-player__spinner {
		animation-duration: 2s;
	}

	.com-scorm-player__toc-item a {
		transition: none;
	}
}

/* ---- Password gate ----------------------------------------------------- */

.com-scorm-gate {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding: 2rem 1rem;
	min-height: 50vh;
}

.com-scorm-gate__card {
	width: 100%;
	max-width: 26rem;
	text-align: center;
	padding: 2rem 1.5rem;
	border: 1px solid var(--template-border-color, #ddd);
	border-radius: 0.75rem;
	background: var(--template-bg-light, #fff);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.com-scorm-gate__icon {
	font-size: 2.25rem;
	line-height: 1;
	display: block;
	margin-bottom: 0.5rem;
}

.com-scorm-gate__title {
	margin: 0 0 0.35rem;
	font-size: 1.25rem;
	overflow-wrap: anywhere;
}

.com-scorm-gate__intro {
	margin: 0 0 1.25rem;
	color: var(--template-text-color, #555);
}

.com-scorm-gate__form {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	text-align: left;
}

.com-scorm-gate__label {
	font-weight: 600;
}

.com-scorm-gate__input {
	width: 100%;
}

.com-scorm-gate__submit {
	align-self: stretch;
	margin-top: 0.25rem;
}
