/* =============================================================================
   Sikulo PDF Viewer — viewer.css
   ============================================================================= */

/* ── Container ─────────────────────────────────────────────────────────────── */

.sikulo-pdf-viewer {
	position: relative;
	display: block;
	width: 100%;
	background: #e8e8e8;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	border-radius: 6px;
	overflow: hidden;
	outline: none;
	box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
	user-select: none;
}

/* ── Toolbar ───────────────────────────────────────────────────────────────── */

.spv-toolbar {
	display: flex;
	align-items: center;
	background: #1e1e1e;
	color: #fff;
	padding: 0 10px;
	height: 44px;
	flex-shrink: 0;
	transition: opacity 0.2s ease;
	z-index: 5;
}

/* Fixed: always visible, part of layout flow */
.spv-toolbar-fixed {
	position: relative;
	opacity: 1;
	pointer-events: auto;
}

/* Hover: overlays the PDF, hidden by default */
.spv-toolbar-hover {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	opacity: 0;
	pointer-events: none;
}

.sikulo-pdf-viewer:hover .spv-toolbar-hover,
.sikulo-pdf-viewer:focus-within .spv-toolbar-hover {
	opacity: 1;
	pointer-events: auto;
}

/* Always show toolbar in fullscreen */
.sikulo-pdf-viewer.spv-is-fullscreen .spv-toolbar-hover {
	position: relative;
	opacity: 1;
	pointer-events: auto;
}

/* ── Toolbar inner layout ─────────────────────────────────────────────────── */

.spv-toolbar-inner {
	display: flex;
	align-items: center;
	gap: 6px;
	width: 100%;
	overflow: hidden;
}

.spv-divider {
	width: 1px;
	height: 20px;
	background: rgba(255, 255, 255, 0.2);
	flex-shrink: 0;
	margin: 0 2px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.spv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 5px;
	color: #fff;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
	flex-shrink: 0;
}

.spv-btn svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

.spv-btn:hover:not( :disabled ) {
	background: rgba(255, 255, 255, 0.25);
	border-color: rgba(255, 255, 255, 0.35);
}

.spv-btn:active:not( :disabled ) {
	background: rgba(255, 255, 255, 0.35);
}

.spv-btn:disabled {
	opacity: 0.3;
	cursor: default;
}

/* ── Page counter ─────────────────────────────────────────────────────────── */

.spv-page-area {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 13px;
	flex-shrink: 0;
}

.spv-page-input {
	width: 44px;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 4px;
	color: #fff;
	text-align: center;
	padding: 4px 2px;
	font-size: 13px;
	appearance: textfield;
	-moz-appearance: textfield;
}

.spv-page-input:focus {
	outline: none;
	border-color: rgba(255, 255, 255, 0.6);
	background: rgba(255, 255, 255, 0.2);
}

.spv-page-input::-webkit-inner-spin-button,
.spv-page-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
}

.spv-page-sep,
.spv-page-total {
	color: rgba(255, 255, 255, 0.6);
	font-size: 13px;
}

/* ── Zoom area ────────────────────────────────────────────────────────────── */

.spv-zoom-area {
	display: flex;
	align-items: center;
	gap: 6px;
}

.spv-zoom-level {
	font-size: 12px;
	min-width: 38px;
	text-align: center;
	color: rgba(255, 255, 255, 0.8);
	flex-shrink: 0;
}

/* Fullscreen button lives at the far right */
.spv-fullscreen {
	margin-left: auto;
}

/* ── Canvas wrapper ─────────────────────────────────────────────────────────── */

.spv-canvas-wrapper {
	position: relative;
	display: block;
	margin: 0 auto;
	line-height: 0;          /* remove inline-block spacing */
	background: #fff;
}

.spv-canvas {
	display: block;
	max-width: 100%;
}

/* ── Annotation layer (links overlay) ─────────────────────────────────────── */

.annotationLayer {
	position: absolute;
	top: 0;
	left: 0;
	pointer-events: none;    /* container itself doesn't capture clicks */
	overflow: hidden;
}

.annotationLayer > section {
	position: absolute;
	pointer-events: auto;    /* each annotation captures its own click */
	cursor: pointer;
}

/* Link annotations — invisible but clickable */
.annotationLayer .linkAnnotation > a,
.annotationLayer .buttonWidgetAnnotation.pushButton > a {
	position: absolute;
	inset: 0;
	display: block;
}

/* Subtle yellow highlight on hover so users know it's clickable */
.annotationLayer .linkAnnotation > a:hover {
	background: rgba(255, 220, 0, 0.25);
	border-radius: 2px;
}

/* ── Loading overlay ──────────────────────────────────────────────────────── */

.spv-loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: rgba(232, 232, 232, 0.92);
	font-size: 14px;
	color: #555;
	z-index: 30;
	border-radius: inherit;
}

.spv-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 2px solid #ccc;
	border-top-color: #444;
	border-radius: 50%;
	animation: spv-spin 0.75s linear infinite;
	flex-shrink: 0;
}

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

.spv-error-msg {
	color: #b00;
	font-size: 14px;
}

/* ── Fullscreen ───────────────────────────────────────────────────────────── */

/* Native :fullscreen pseudo-class */
.sikulo-pdf-viewer:fullscreen,
.sikulo-pdf-viewer:-webkit-full-screen {
	display: flex;
	flex-direction: column;
	background: #111;
	border-radius: 0;
	overflow: auto;
}

.sikulo-pdf-viewer:fullscreen .spv-canvas-wrapper,
.sikulo-pdf-viewer:-webkit-full-screen .spv-canvas-wrapper {
	flex: 1;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	overflow: auto;
	width: 100% !important;
	background: #111;
	padding: 16px;
	box-sizing: border-box;
}

.sikulo-pdf-viewer:fullscreen .spv-canvas,
.sikulo-pdf-viewer:-webkit-full-screen .spv-canvas {
	box-shadow: 0 4px 32px rgba(0,0,0,0.6);
}

/* Class-based fallback (.spv-is-fullscreen added via JS) */
.sikulo-pdf-viewer.spv-is-fullscreen {
	display: flex;
	flex-direction: column;
	background: #111;
	border-radius: 0;
}

.sikulo-pdf-viewer.spv-is-fullscreen .spv-canvas-wrapper {
	flex: 1;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	overflow: auto;
	background: #111;
	padding: 16px;
	box-sizing: border-box;
}

/* ── Shortcode error message ─────────────────────────────────────────────── */

.sikulo-pdf-error {
	padding: 12px 16px;
	background: #fff3f3;
	border-left: 4px solid #c00;
	color: #c00;
	font-size: 14px;
	border-radius: 4px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media ( max-width: 520px ) {
	.spv-zoom-area {
		display: none;    /* hide zoom on very small screens to save space */
	}
	.spv-divider:last-of-type {
		display: none;
	}
}


button.spv-btn.spv-fullscreen {
    display: none;
}