/**
 * Frontend styles for Cluberos Flipbook.
 */

.cluberos-flipbook-viewer {
	width: 100%;
	max-width: 100%;
	margin: 0 0 28px;
	padding: 14px;
	border: 1px solid #343a40;
	border-radius: 8px;
	background: #202428;
	box-sizing: border-box;
	color: #f8f9fa;
}

.cluberos-flipbook-viewer:fullscreen {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 100vh;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: #171a1d;
}

.cluberos-flipbook-viewer__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-bottom: 10px;
}

.cluberos-flipbook-viewer__zoom {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px;
	border: 1px solid rgba( 255, 255, 255, 0.14 );
	border-radius: 9px;
	background: rgba( 0, 0, 0, 0.22 );
}

.cluberos-flipbook-viewer__zoom-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 28px;
	padding: 0 8px;
	border: 0;
	border-radius: 7px;
	background: rgba( 255, 255, 255, 0.1 );
	color: #ffffff;
	cursor: pointer;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	transition: background-color 160ms ease, transform 160ms ease;
}

.cluberos-flipbook-viewer__zoom-button:hover,
.cluberos-flipbook-viewer__zoom-button:focus {
	background: rgba( 255, 255, 255, 0.2 );
	color: #ffffff;
	transform: translateY( -1px );
}

.cluberos-flipbook-viewer__fullscreen {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid rgba( 255, 255, 255, 0.18 );
	border-radius: 8px;
	background: rgba( 0, 0, 0, 0.28 );
	color: #ffffff;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
}

.cluberos-flipbook-viewer__fullscreen:hover,
.cluberos-flipbook-viewer__fullscreen:focus {
	background: rgba( 255, 255, 255, 0.14 );
	color: #ffffff;
}

.cluberos-flipbook-viewer__status {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 112px;
	color: #f8f9fa;
	font-weight: 600;
}

.cluberos-flipbook-viewer__page-input {
	width: 58px;
	min-height: 34px;
	padding: 4px 8px;
	border: 1px solid rgba( 255, 255, 255, 0.22 );
	border-radius: 8px;
	background: rgba( 255, 255, 255, 0.92 );
	color: #111111;
	font: inherit;
	font-weight: 700;
	text-align: center;
	box-sizing: border-box;
}

.cluberos-flipbook-viewer__page-input:focus {
	border-color: #ffffff;
	outline: 2px solid rgba( 255, 255, 255, 0.28 );
	outline-offset: 1px;
}

.cluberos-flipbook-viewer__page-separator,
.cluberos-flipbook-viewer__page-total {
	color: #f8f9fa;
}

.cluberos-flipbook-viewer__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 82vh;
	overflow: hidden;
}

.cluberos-flipbook-viewer__book {
	width: 100%;
	max-width: 1380px;
	height: 84vh;
	transition: transform 180ms ease;
	will-change: transform;
}

.cluberos-flipbook-viewer__page {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	overflow: hidden;
}

.cluberos-flipbook-viewer__page canvas {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.cluberos-flipbook-viewer__arrow {
	position: absolute;
	top: 50%;
	z-index: 20;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: rgba( 0, 0, 0, 0.42 );
	color: #ffffff;
	cursor: pointer;
	font-size: 25px;
	font-weight: 400;
	line-height: 1;
	transform: translateY( -50% );
	transition: background-color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.cluberos-flipbook-viewer__arrow:hover,
.cluberos-flipbook-viewer__arrow:focus {
	background: rgba( 0, 0, 0, 0.68 );
	color: #ffffff;
	transform: translateY( -50% ) scale( 1.04 );
}

.cluberos-flipbook-viewer__arrow--prev {
	left: 10px;
}

.cluberos-flipbook-viewer__arrow--next {
	right: 10px;
}

.cluberos-flipbook-notice {
	padding: 12px 14px;
	border-left: 4px solid #1d2327;
	background: #f6f7f7;
}

@media (max-width: 1024px) {
	.cluberos-flipbook-viewer__stage {
		min-height: 76vh;
	}

	.cluberos-flipbook-viewer__book {
		height: 78vh;
		max-width: 700px;
	}
}

@media (max-width: 700px) {
	.cluberos-flipbook-viewer {
		padding: 8px;
		border-radius: 6px;
	}

	.cluberos-flipbook-viewer__toolbar {
		gap: 8px;
		justify-content: center;
	}

	.cluberos-flipbook-viewer__zoom {
		order: 3;
	}

	.cluberos-flipbook-viewer__fullscreen {
		width: 32px;
		height: 32px;
		font-size: 17px;
	}

	.cluberos-flipbook-viewer__page-input {
		width: 52px;
		min-height: 32px;
	}

	.cluberos-flipbook-viewer__stage {
		min-height: 68vh;
	}

	.cluberos-flipbook-viewer__book {
		height: 70vh;
		max-width: 460px;
	}

	.cluberos-flipbook-viewer__arrow {
		width: 30px;
		height: 38px;
		border-radius: 9px;
		font-size: 23px;
	}

	.cluberos-flipbook-viewer__arrow--prev {
		left: 5px;
	}

	.cluberos-flipbook-viewer__arrow--next {
		right: 5px;
	}
}

/**
 * Phone-only reading improvements (v0.7.0).
 * The desktop/tablet presentation above remains unchanged.
 */
.cluberos-flipbook-viewer--phone,
.cluberos-flipbook-viewer--phone .cluberos-flipbook-viewer__stage {
	touch-action: pan-y pinch-zoom;
}

.cluberos-flipbook-viewer--phone .cluberos-flipbook-viewer__stage {
	min-height: 58vh;
	overflow: hidden;
}

.cluberos-flipbook-viewer--phone .cluberos-flipbook-viewer__book {
	width: 100%;
	max-width: none;
	height: 62vh;
}

.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__stage {
	min-height: calc( 100vh - 82px );
}

.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__book {
	height: calc( 100vh - 96px );
}


/**
 * Phone fullscreen and gesture zoom improvements (v0.7.1).
 * Desktop layout remains unchanged.
 */
.cluberos-flipbook-viewer--phone .cluberos-flipbook-viewer__book {
	transform-origin: center center;
}

.cluberos-flipbook-viewer--phone .cluberos-flipbook-viewer__book.is-zoomed {
	cursor: move;
	touch-action: none;
}

.cluberos-flipbook-viewer--phone:fullscreen {
	width: 100vw;
	height: 100dvh;
	max-width: none;
	padding: 0;
	overflow: hidden;
}

.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__toolbar {
	position: absolute;
	top: max( 8px, env( safe-area-inset-top ) );
	left: 50%;
	z-index: 60;
	width: max-content;
	max-width: calc( 100vw - 16px );
	margin: 0;
	padding: 6px 8px;
	border-radius: 12px;
	background: rgba( 18, 21, 24, 0.84 );
	box-shadow: 0 6px 22px rgba( 0, 0, 0, 0.35 );
	transform: translateX( -50% );
	backdrop-filter: blur( 8px );
}

.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__stage {
	width: 100vw;
	height: 100dvh;
	min-height: 100dvh;
	overflow: hidden;
	touch-action: none;
}

.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__book {
	width: 100vw;
	height: 100dvh;
	max-width: none;
}

.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__arrow--prev {
	left: max( 8px, env( safe-area-inset-left ) );
}

.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__arrow--next {
	right: max( 8px, env( safe-area-inset-right ) );
}

@media (max-width: 700px) and (orientation: landscape) {
	.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__toolbar {
		top: 5px;
		padding: 4px 6px;
		transform: translateX( -50% ) scale( 0.9 );
		transform-origin: top center;
	}
}


/**
 * Compact phone fullscreen controls (v0.7.2).
 * Only the fullscreen/exit button remains visible; page changes are handled
 * by the side arrows while the page surface is reserved for pinch and pan.
 */
.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__toolbar {
	top: max( 8px, env( safe-area-inset-top ) );
	right: max( 8px, env( safe-area-inset-right ) );
	left: auto;
	width: auto;
	max-width: none;
	padding: 0;
	border-radius: 10px;
	background: transparent;
	box-shadow: none;
	transform: none;
	backdrop-filter: none;
}

.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__status,
.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__zoom {
	display: none;
}

.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__fullscreen {
	width: 42px;
	height: 42px;
	border: 1px solid rgba( 255, 255, 255, 0.24 );
	border-radius: 11px;
	background: rgba( 10, 12, 14, 0.64 );
	box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.28 );
	font-size: 21px;
	backdrop-filter: blur( 6px );
}

@media (max-width: 700px) and (orientation: landscape) {
	.cluberos-flipbook-viewer--phone:fullscreen .cluberos-flipbook-viewer__toolbar {
		top: max( 6px, env( safe-area-inset-top ) );
		right: max( 6px, env( safe-area-inset-right ) );
		transform: none;
	}
}
