/* Total Seminars Sample Chapter: the button and the read-only viewer. */

/* ---- Button: bottom left of .summary.entry-summary (astra-child single product) ------------- */

.summary.entry-summary:has(.totalsem-sample-chapter) {
	position: relative;
	padding-bottom: 64px;
}

.summary.entry-summary .totalsem-sample-chapter {
	position: absolute;
	left: 0;
	bottom: 0;
	margin: 0;
}

.totalsem-sample-chapter__button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border: 1px solid #334155;
	border-radius: 10px;
	background: #fff;
	color: #334155;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}

.totalsem-sample-chapter__button:hover,
.totalsem-sample-chapter__button:focus-visible {
	background: #334155;
	color: #fff;
}

.totalsem-sample-chapter__button:focus-visible {
	outline: 2px solid #ca1a2b;
	outline-offset: 2px;
}

.totalsem-sample-chapter__icon {
	flex: none;
}

/* ---- Dialog ------------------------------------------------------------------------------------ */

html.totalsem-sc-open {
	overflow: hidden;
}

dialog.totalsem-sc-modal {
	box-sizing: border-box;
	width: min(1040px, 96vw);
	max-width: 96vw;
	height: 92vh;
	max-height: 92vh;
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: #fff;
	color: #334155;
	box-shadow: 0 24px 64px rgba(15, 23, 42, .4);
	overflow: hidden;
}

dialog.totalsem-sc-modal::backdrop {
	background: rgba(15, 23, 42, .72);
}

.totalsem-sc-modal__frame {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.totalsem-sc-modal__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 12px 12px 20px;
	border-bottom: 1px solid #e2e8f0;
}

.totalsem-sc-modal__title {
	flex: 1 1 auto;
	margin: 0;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.3;
	color: #334155;
	text-transform: none;
	letter-spacing: normal;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.totalsem-sc-modal__close,
.totalsem-sc-modal__tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #334155;
	cursor: pointer;
}

.totalsem-sc-modal__close:hover,
.totalsem-sc-modal__tool:hover:not(:disabled) {
	background: #e2e8f0;
}

.totalsem-sc-modal__close:focus-visible,
.totalsem-sc-modal__tool:focus-visible,
.totalsem-sc-modal__pageno input:focus-visible {
	outline: 2px solid #ca1a2b;
	outline-offset: 1px;
}

.totalsem-sc-modal__tool:disabled {
	opacity: .35;
	cursor: default;
}

.totalsem-sc-modal__toolbar {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 28px;
	padding: 8px 12px;
	border-bottom: 1px solid #e2e8f0;
	background: #f8fafc;
}

.totalsem-sc-modal__group {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.totalsem-sc-modal__pageno {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 4px;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}

.totalsem-sc-modal__pageno input {
	width: 3.5em;
	min-height: 0;
	margin: 0;
	padding: 4px 6px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font-size: 14px;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.totalsem-sc-modal__pageno input::-webkit-outer-spin-button,
.totalsem-sc-modal__pageno input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

.totalsem-sc-modal__zoom {
	min-width: 3.5em;
	font-size: 14px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

/* ---- Pages ------------------------------------------------------------------------------------- */

.totalsem-sc-modal__pages {
	position: relative; /* offsetParent of the pages, so offsetTop is relative to the scroll box */
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	padding: 16px;
	background: #e2e8f0;
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
	overscroll-behavior: contain;
}

.totalsem-sc-modal__pages:focus-visible {
	outline: 2px solid #ca1a2b;
	outline-offset: -2px;
}

.totalsem-sc-page {
	position: relative;
	margin: 0 auto 16px;
	background: #fff;
	box-shadow: 0 1px 4px rgba(15, 23, 42, .25);
}

.totalsem-sc-page:last-child {
	margin-bottom: 0;
}

.totalsem-sc-page canvas {
	display: block;
	pointer-events: none;
}

.totalsem-sc-modal__status {
	margin: 0;
	padding: 8px 16px;
	font-size: 13px;
	text-align: center;
	color: #475569;
	border-top: 1px solid #e2e8f0;
}

.totalsem-sc-modal__status:empty {
	display: none;
}

.totalsem-sc-modal__status.is-error {
	color: #b91c1c;
}

/* ---- Phone ------------------------------------------------------------------------------------- */

@media (max-width: 640px) {
	dialog.totalsem-sc-modal {
		width: 100vw;
		max-width: 100vw;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
	}

	.totalsem-sc-modal__header {
		padding-left: 14px;
	}

	.totalsem-sc-modal__toolbar {
		gap: 8px 16px;
	}

	.totalsem-sc-modal__pages {
		padding: 10px;
	}

	.summary.entry-summary:has(.totalsem-sample-chapter) {
		padding-bottom: 56px;
	}
}

/* ---- Print: the viewer is not for printing --------------------------------------------------- */

@media print {
	dialog.totalsem-sc-modal,
	dialog.totalsem-sc-modal * {
		display: none !important;
	}
}
