/* Flipbook Viewer Styles */

/* Reset body for standalone flipbook page */
body:has(#flipbook-wrapper) {
	margin: 0;
	padding: 0;
	overflow: hidden;
}

/* Full-screen wrapper - fits exactly in viewport, no scroll */
#flipbook-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100vh;
	background: var(--color-secundario);
	padding: 20px 20px 10px;
	box-sizing: border-box;
	overflow: hidden;
	user-select: none;
	-webkit-user-select: none;
}

/* === DESKTOP viewer wrap === */
#flipbook-viewer-wrap {
	position: relative;
}

/* === MOBILE viewer wrap === */
#flipbook-viewer-wrap-mobile {
	position: relative;
}

/* Toggle: desktop visible, mobile hidden on >= 769px */
@media (min-width: 769px) {
	.flipbook-mobile {
		display: none !important;
	}
}

/* Toggle: mobile visible, desktop hidden on <= 768px */
@media (max-width: 768px) {
	.flipbook-desktop {
		display: none !important;
	}
}

/* Boundary overlays - absorb mouse events on forbidden sides */
#flipBoundaryLeft,
#flipBoundaryRight {
	position: absolute;
	top: 0;
	width: 50%;
	height: 100%;
	z-index: 5;
	cursor: default;
}

#flipBoundaryLeft {
	left: 0;
}

#flipBoundaryRight {
	right: 0;
}

/* Mobile boundary overlays - 50% to block only the side with no more pages */
#flipBoundaryLeftMobile,
#flipBoundaryRightMobile {
	position: absolute;
	top: 0;
	width: 50%;
	height: 100%;
	z-index: 5;
	cursor: default;
}

#flipBoundaryLeftMobile {
	left: 0;
}

#flipBoundaryRightMobile {
	right: 0;
}

/* Book viewers */
#flipbook-viewer,
#flipbook-viewer-mobile {
	margin: 0 auto;
	position: relative;
}

#flipbook-viewer .flip-page,
#flipbook-viewer-mobile .flip-page {
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

/* Page bar (segment slider with thumbnail tooltip) */
#flipbook-pagebar {
	position: relative;
	width: 100%;
	max-width: 700px;
	margin-top: 12px;
	padding: 8px 0;
	flex-shrink: 0;
}

/* Tooltip */
#flipbookTooltip {
	position: absolute;
	bottom: 34px;
	transform: translateX(-50%);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s;
	z-index: 10;
	display: flex;
	flex-direction: column;
	align-items: center;
}

#flipbookTooltipThumb {
	width: 80px;
	height: 110px;
	background: #fff;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 4px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

#flipbookTooltipNum {
	margin-top: 4px;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	font-size: 11px;
	padding: 2px 7px;
	border-radius: 4px;
	white-space: nowrap;
}

/* Range slider */
#flipbookPageBar {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 6px;
	border-radius: 3px;
	outline: none;
	cursor: pointer;
	background: linear-gradient(to right, var(--color-primario) 0%, rgba(255, 255, 255, 0.15) 0%);
	transition: height 0.15s;
}

#flipbookPageBar:hover {
	height: 10px;
}

/* Webkit (Chrome, Safari, Edge) */
#flipbookPageBar::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
	transition: transform 0.15s;
}

#flipbookPageBar:hover::-webkit-slider-thumb {
	transform: scale(1.2);
}

#flipbookPageBar:active::-webkit-slider-thumb {
	transform: scale(1.3);
}

/* Firefox */
#flipbookPageBar::-moz-range-track {
	height: 6px;
	border-radius: 3px;
	background: transparent;
}

#flipbookPageBar::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	border: none;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

#flipbookPageBar::-moz-range-progress {
	background: var(--color-primario);
	border-radius: 3px;
	height: 6px;
}

/* Bottom info row: page info + download button */
#flipbook-bottom-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin-top: 4px;
	flex-shrink: 0;
}

#flipbook-bottom-row .flip-page-info {
	color: rgba(255, 255, 255, 0.5);
	font-size: 13px;
	user-select: none;
}

#flipbook-bottom-row .flip-download-btn {
	color: rgba(255, 255, 255, 0.5);
	cursor: pointer;
	font-size: 22px;
	transition: color 0.2s;
	line-height: 1;
}

#flipbook-bottom-row .flip-download-btn:hover {
	color: rgba(255, 255, 255, 0.9);
}

/* Loading */
#flipbook-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	color: #fff;
	gap: 15px;
}

#flipbook-loading .spinner {
	width: 40px;
	height: 40px;
	border: 3px solid rgba(255, 255, 255, 0.2);
	border-top-color: #fff;
	border-radius: 50%;
	animation: flipbook-spin 0.8s linear infinite;
}

@keyframes flipbook-spin {
	to { transform: rotate(360deg); }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
	#flipbook-wrapper {
		padding: 10px 10px 6px;
	}

	#flipbook-pagebar {
		max-width: 90%;
		margin-top: 8px;
	}

	#flipbook-bottom-row .flip-page-info {
		font-size: 11px;
	}

	#flipbook-bottom-row .flip-download-btn {
		font-size: 20px;
	}

	#flipbookTooltipThumb {
		width: 60px;
		height: 82px;
	}
}

/* Hotspot wrapper — halo fijo, tamaño constante, nunca transiciona */
.flipbook-hotspot {
	position: absolute;
	border-radius: 50%;
	background: rgba(0,0,0,0.5);
	pointer-events: none;
	z-index: 2;
}

/* Punto interactivo dentro del halo */
.flipbook-hotspot-dot {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	box-sizing: border-box;
	cursor: pointer;
	pointer-events: auto;
	transition: width 0.3s ease, height 0.3s ease, border-width 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.flipbook-hotspot-dot:hover {
	width: var(--hs-size-hover) !important;
	height: var(--hs-size-hover) !important;
	border-width: var(--hs-bw-hover) !important;
	background-color: var(--hs-color) !important;
	border-color: var(--hs-border) !important;
}

/* Show tooltip on hover via pure CSS */
.flipbook-hotspot-dot:hover .flipbook-hotspot-tooltip {
	opacity: 1;
}

/* Hotspot tooltip */
.flipbook-hotspot-tooltip {
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	margin-bottom: 8px;
	background: rgba(0,0,0,0.85);
	color: #fff;
	padding: 6px 12px;
	border-radius: 6px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s;
	z-index: 4;
	font-size: 13px;
	line-height: 1.4;
	max-width: 200px;
}

.flipbook-hotspot-tooltip-title {
	font-weight: 600;
	font-size: 14px;
}

.flipbook-hotspot-tooltip-subtitle {
	font-size: 11px;
	opacity: 0.8;
	white-space: normal;
}

.flipbook-hotspot-tooltip-price {
	font-weight: 700;
	font-size: 14px;
	margin-top: 2px;
}

/* Inner wrapper for hotspot positioning - keeps .flip-page clean for StPageFlip */
/* isolation: isolate contains hotspot z-index within this wrapper */
.flip-page-inner {
	position: relative;
	width: 100%;
	height: 100%;
	isolation: isolate;
}

/* Mobile responsive */
@media (max-width: 768px) {
	.flipbook-hotspot-tooltip {
		font-size: 11px;
		padding: 4px 8px;
	}
}
