/**
 * Z2W PDF Embed — Frontend Styles
 *
 * @package Z2WAdminSuite
 * @since   1.31.0
 */

/* ──────────────────────────────────────────────
   VIEWER CONTAINER
   ────────────────────────────────────────────── */

.z2w-pdf-viewer {
	position: relative;
	margin: 1.5em auto;
	background: #f5f5f5;
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	line-height: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.z2w-pdf-wrapper {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
}

/* ──────────────────────────────────────────────
   LOADING STATE
   ────────────────────────────────────────────── */

.z2w-pdf-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	gap: 12px;
	color: #666;
	font-size: 14px;
	line-height: 1.4;
}

.z2w-pdf-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #e0e0e0;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: z2w-pdf-spin 0.8s linear infinite;
}

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

/* ──────────────────────────────────────────────
   SCROLL CONTAINER
   ────────────────────────────────────────────── */

.z2w-pdf-scroll-container {
	flex: 1 1 auto;
	overflow: auto;
	position: relative;
	background: #525659;
}

/* Scrollbar display control */
.z2w-pdf-scroll-both {
	overflow: auto;
}

.z2w-pdf-scroll-vertical {
	overflow-x: hidden;
	overflow-y: auto;
}

.z2w-pdf-scroll-horizontal {
	overflow-x: auto;
	overflow-y: hidden;
}

.z2w-pdf-scroll-none {
	overflow: hidden;
}

/* ──────────────────────────────────────────────
   PAGES
   ────────────────────────────────────────────── */

.z2w-pdf-pages {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.z2w-pdf-page {
	position: relative;
	margin: 0;
	line-height: 0;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.z2w-pdf-page + .z2w-pdf-page {
	margin-top: 4px;
}

.z2w-pdf-page-placeholder {
	min-height: 400px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.z2w-pdf-page-placeholder::after {
	content: '';
	width: 28px;
	height: 28px;
	border: 3px solid #e0e0e0;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: z2w-pdf-spin 0.8s linear infinite;
}

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

/* ──────────────────────────────────────────────
   TOOLBAR
   ────────────────────────────────────────────── */

.z2w-pdf-toolbar {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 6px 10px;
	background: rgba(41, 41, 41, 0.92);
	color: #fff;
	font-size: 13px;
	line-height: 1;
	transition: opacity 0.25s ease;
	z-index: 10;
	position: absolute;
	left: 0;
	right: 0;
}

.z2w-pdf-toolbar--top {
	top: 0;
	border-radius: 4px 4px 0 0;
}

.z2w-pdf-toolbar--bottom {
	bottom: 0;
	border-radius: 0 0 4px 4px;
}

/* Hover visibility */
.z2w-pdf-toolbar-hover .z2w-pdf-toolbar {
	opacity: 0;
	pointer-events: none;
}

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

/* Always visible */
.z2w-pdf-toolbar-always .z2w-pdf-toolbar {
	opacity: 1;
	pointer-events: auto;
}

.z2w-pdf-toolbar-spacer {
	flex: 1;
}

/* Buttons */
.z2w-pdf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 4px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease;
}

.z2w-pdf-btn:hover {
	background: rgba(255, 255, 255, 0.15);
}

.z2w-pdf-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.z2w-pdf-btn:disabled:hover {
	background: transparent;
}

.z2w-pdf-btn svg {
	display: block;
}

/* Page input */
.z2w-pdf-page-info {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	font-size: 13px;
	color: #ccc;
	line-height: 1;
}

.z2w-pdf-page-input {
	width: 42px;
	height: 26px;
	padding: 2px 4px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	font-size: 13px;
	text-align: center;
	-moz-appearance: textfield;
}

.z2w-pdf-page-input::-webkit-inner-spin-button,
.z2w-pdf-page-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.z2w-pdf-page-input:focus {
	outline: none;
	border-color: #0073aa;
	background: rgba(255, 255, 255, 0.2);
}

.z2w-pdf-page-total {
	white-space: nowrap;
}

/* ──────────────────────────────────────────────
   SEARCH OVERLAY
   ────────────────────────────────────────────── */

.z2w-pdf-search-overlay {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 6px 10px;
	background: rgba(41, 41, 41, 0.95);
	z-index: 12;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
}

.z2w-pdf-search-input {
	flex: 1;
	min-width: 120px;
	height: 28px;
	padding: 4px 8px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	font-size: 13px;
}

.z2w-pdf-search-input::placeholder {
	color: rgba(255, 255, 255, 0.5);
}

.z2w-pdf-search-input:focus {
	outline: none;
	border-color: #0073aa;
	background: rgba(255, 255, 255, 0.2);
}

.z2w-pdf-search-results {
	font-size: 12px;
	color: #aaa;
	white-space: nowrap;
	min-width: 60px;
	text-align: center;
}

/* ──────────────────────────────────────────────
   FULLSCREEN MODE
   ────────────────────────────────────────────── */

.z2w-pdf-viewer.z2w-pdf-fullscreen {
	border-radius: 0;
	border: none;
}

.z2w-pdf-viewer.z2w-pdf-fullscreen .z2w-pdf-wrapper {
	height: 100vh;
}

.z2w-pdf-viewer.z2w-pdf-fullscreen .z2w-pdf-scroll-container {
	height: 100% !important;
}

.z2w-pdf-viewer.z2w-pdf-fullscreen .z2w-pdf-toolbar {
	border-radius: 0;
}

/* Fullscreen close (X) button */
.z2w-pdf-fullscreen-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease;
}

.z2w-pdf-fullscreen-close:hover {
	background: rgba(0, 0, 0, 0.85);
}

.z2w-pdf-fullscreen-close svg {
	display: block;
}

/* Center pages in fullscreen */
.z2w-pdf-viewer.z2w-pdf-fullscreen .z2w-pdf-pages {
	align-items: center;
	justify-content: flex-start;
	min-height: 100%;
}

.z2w-pdf-viewer.z2w-pdf-fullscreen .z2w-pdf-canvas {
	max-width: calc(100vw - 40px) !important;
	max-height: calc(100vh - 60px) !important;
	object-fit: contain;
}

/* ──────────────────────────────────────────────
   MOBILE THUMBNAIL MODE
   ────────────────────────────────────────────── */

.z2w-pdf-viewer.z2w-pdf-mobile-mode {
	text-align: center;
	padding: 16px;
	background: #f7f7f7;
}

.z2w-pdf-mobile-thumb {
	position: relative;
	display: inline-block;
	max-width: 100%;
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.z2w-pdf-mobile-canvas {
	display: block;
	max-width: 100%;
	height: auto;
}

.z2w-pdf-mobile-btn {
	display: block;
	width: 100%;
	max-width: 300px;
	margin: 16px auto 0;
	padding: 14px 24px;
	border: none;
	border-radius: 6px;
	background: #0073aa;
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease;
	line-height: 1.4;
}

.z2w-pdf-mobile-btn:hover {
	background: #005f8c;
}

.z2w-pdf-mobile-btn:active {
	background: #004d73;
}

/* ──────────────────────────────────────────────
   ERROR STATE
   ────────────────────────────────────────────── */

.z2w-pdf-error {
	color: #d63638;
	font-style: italic;
	font-size: 14px;
}

.z2w-pdf-error-msg {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	gap: 8px;
	padding: 24px;
	text-align: center;
	font-size: 14px;
	line-height: 1.5;
	color: #666;
}

.z2w-pdf-error-msg a {
	color: #0073aa;
	text-decoration: none;
	font-weight: 600;
}

.z2w-pdf-error-msg a:hover {
	text-decoration: underline;
}

/* ──────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────── */

@media screen and (max-width: 600px) {
	.z2w-pdf-toolbar {
		padding: 4px 6px;
		gap: 2px;
	}

	.z2w-pdf-btn {
		width: 28px;
		height: 28px;
	}

	.z2w-pdf-btn svg {
		width: 14px;
		height: 14px;
	}

	.z2w-pdf-page-input {
		width: 36px;
		height: 24px;
		font-size: 12px;
	}

	.z2w-pdf-page-info {
		font-size: 12px;
	}

	.z2w-pdf-search-input {
		min-width: 80px;
		font-size: 12px;
	}
}
