.catalog-flipbook {
	position: relative;
	width: 100%;
	min-height: 70vh;
	border: 1px solid lightgray;
	background: #f5f5f4;
	box-sizing: border-box;
}

.catalog-flipbook__toolbar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 1px solid #e0e0e0;
	background: #fff;
	flex-wrap: wrap;
}

.catalog-flipbook__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border: 1px solid #d8d8d8;
	border-radius: 4px;
	background: #fff;
	color: #585655;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.catalog-flipbook__btn:hover {
	border-color: #585655;
	background: #fafafa;
}

.catalog-flipbook__btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.catalog-flipbook__pages {
	min-width: 72px;
	color: #585655;
	font-size: 14px;
	text-align: center;
}

.catalog-flipbook__stage {
	position: relative;
}

.catalog-flipbook__stage:has(.catalog-flipbook__loader:not([hidden])) {
	min-height: calc(70vh - 65px);
}

.catalog-flipbook__viewport {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px 32px;
	box-sizing: border-box;
}

.catalog-flipbook__loader {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(255, 255, 255, 0.92);
	color: #585655;
	font-size: 16px;
	text-align: center;
}

.catalog-flipbook__loader[hidden] {
	display: none;
}

.catalog-flipbook__error {
	display: none;
	padding: 24px;
	color: #a94442;
	font-size: 16px;
	text-align: center;
}

.catalog-flipbook__error:not([hidden]) {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 240px;
}

.catalog-flipbook__simple {
	display: flex;
	align-items: stretch;
	justify-content: center;
	width: 100%;
	max-width: 920px;
	margin: 0 auto;
}

.catalog-flipbook__simple-page {
	width: 100%;
	background: #fff;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.catalog-flipbook__simple-page img {
	display: block;
	width: 100%;
	height: auto;
}

.catalog-flipbook__book {
	margin: 0 auto;
}

.catalog-flipbook--spread .catalog-flipbook__viewport {
	padding: 24px 12px 32px;
}

.catalog-flipbook--spread .catalog-flipbook__book {
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.catalog-flipbook__page {
	background: #fff;
	overflow: hidden;
}

.catalog-flipbook__page img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #fff;
}

.catalog-flipbook--fullscreen {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	gap: 10px;
	min-height: 100vh;
	padding: 10px;
	border: 0;
}

.catalog-flipbook--fullscreen .catalog-flipbook__toolbar {
	flex-shrink: 0;
	position: relative;
	z-index: 2;
	border-bottom: 0;
}

.catalog-flipbook--fullscreen .catalog-flipbook__stage {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
}

.catalog-flipbook--fullscreen .catalog-flipbook__viewport {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0;
	overflow: hidden;
}

.catalog-flipbook--fullscreen .catalog-flipbook__book {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 0;
	max-height: 100%;
	margin: 0;
}

.catalog-flipbook--fullscreen .catalog-flipbook__simple {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
}

.catalog-flipbook--fullscreen .catalog-flipbook__simple-page {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	line-height: 0;
}

.catalog-flipbook--fullscreen .catalog-flipbook__simple-page img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

@media (max-width: 767px) {
	.catalog-flipbook__viewport {
		padding: 16px 8px 24px;
	}

	.catalog-flipbook__btn {
		min-width: 36px;
		height: 36px;
	}
}
