/* =============================================================
   Divi PDF Viewer — pdf-viewer.css
   All rules are scoped under .dpdfv-container to avoid
   conflicts with Divi or any other theme/plugin styles.
   ============================================================= */

/* ── Outer container ─────────────────────────────────────────── */
.dpdfv-container {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	background: #f4f4f4;
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	color: #333;
}

/* ── Toolbar ─────────────────────────────────────────────────── */
.dpdfv-toolbar {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	background: #2c2c2c;
	color: #eee;
	flex-shrink: 0;
	flex-wrap: wrap;
}

.dpdfv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	padding: 0 10px;
	background: #444;
	color: #eee;
	border: 1px solid #666;
	border-radius: 3px;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	transition: background 0.15s ease, color 0.15s ease;
	user-select: none;
	-webkit-user-select: none;
}

.dpdfv-btn:hover:not(:disabled) {
	background: #0073aa;
	border-color: #005177;
	color: #fff;
}

.dpdfv-btn:focus-visible {
	outline: 2px solid #00a0d2;
	outline-offset: 2px;
}

.dpdfv-btn:disabled {
	opacity: 0.4;
	cursor: default;
}

.dpdfv-page-info {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	color: #ccc;
	font-size: 13px;
	white-space: nowrap;
}

.dpdfv-divider {
	display: inline-block;
	width: 1px;
	height: 20px;
	background: #555;
	margin: 0 4px;
	flex-shrink: 0;
}

.dpdfv-zoom-level {
	display: inline-block;
	min-width: 42px;
	text-align: center;
	color: #ccc;
	font-size: 12px;
	white-space: nowrap;
}

/* ── Canvas wrapper ──────────────────────────────────────────── */
.dpdfv-canvas-wrap {
	position: relative;
	overflow: auto;
	background: #888;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	box-sizing: border-box;
}

.dpdfv-canvas {
	display: block;
	margin: 16px auto;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
	background: #fff;
	/* Prevent the browser from treating the canvas as an image that can be saved */
	-webkit-user-drag: none;
	user-drag: none;
	-webkit-user-select: none;
	user-select: none;
}

/* ── Overlay (blocks right-click / long-press save) ──────────── */
.dpdfv-overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	/* Transparent — users can still see through, but the canvas is not
	   the topmost hit-target for context-menu events. */
	background: transparent;
	cursor: default;
	/* Disable pointer events on iOS so scrolling still works.
	   Right-click is suppressed via the JS contextmenu listener instead. */
	pointer-events: none;
}

/* ── Loading indicator ───────────────────────────────────────── */
.dpdfv-loading {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: rgba(136, 136, 136, 0.85);
	color: #fff;
	font-size: 14px;
	pointer-events: none;
}

.dpdfv-loading.dpdfv-hidden {
	display: none;
}

/* Spinner */
.dpdfv-spinner {
	display: inline-block;
	width: 32px;
	height: 32px;
	border: 4px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: dpdfv-spin 0.75s linear infinite;
}

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

/* ── Error state ─────────────────────────────────────────────── */
.dpdfv-error {
	padding: 12px 16px;
	margin: 0;
	background: #fef0f0;
	border: 1px solid #f5a0a0;
	border-radius: 4px;
	color: #a00;
	font-size: 13px;
}

/* ── Responsive adjustments ──────────────────────────────────── */
@media (max-width: 480px) {
	.dpdfv-toolbar {
		gap: 4px;
		padding: 6px 8px;
	}

	.dpdfv-btn {
		min-width: 28px;
		height: 28px;
		font-size: 14px;
	}
}
