/* ==========================================================================
   PDF Link Viewer – Frontend Styles
   ========================================================================== */

/* Container */
.plv-container {
	display: flex;
	flex-direction: column;
	margin: 1.5em auto;
	border: 1px solid #ddd;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
	font-family: inherit;
}

/* ── Header ── */
.plv-header {
	display: flex;
	align-items: center;
	gap: .6em;
	padding: .6em 1em;
	background: #f5f5f5;
	border-bottom: 1px solid #e0e0e0;
	flex-wrap: wrap;
}

.plv-header--notitle {
	justify-content: flex-end;
}

.plv-icon.dashicons {
	font-size: 1.3em;
	width: 1.3em;
	height: 1.3em;
	line-height: 1;
	color: #555;
	flex-shrink: 0;
}

.plv-title {
	flex: 1;
	font-weight: 600;
	font-size: .95em;
	color: #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.plv-download-btn {
	display: inline-flex;
	align-items: center;
	gap: .3em;
	padding: .3em .8em;
	background: #0073aa;
	color: #fff !important;
	border-radius: 4px;
	font-size: .8em;
	font-weight: 600;
	text-decoration: none !important;
	transition: background .2s;
	white-space: nowrap;
}

.plv-download-btn .dashicons {
	font-size: 1.1em;
	width: 1.1em;
	height: 1.1em;
	line-height: 1;
	color: #fff;
}

.plv-download-btn:hover {
	background: #005a87;
}

/* ── Viewer wrapper ── */
.plv-viewer-wrap {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #525659;
}

/* iframe mode */
.plv-iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: none;
}

/* ── PDF.js mode ── */
.plv-pdfjs-target {
	position: relative;
	width: 100%;
	height: 100%;
	overflow-y: auto;
	overflow-x: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	background: #525659;
	padding-bottom: 52px; /* space for controls */
}

.plv-canvas {
	display: block;
	max-width: 100%;
	margin: 1em auto 0;
	box-shadow: 0 2px 10px rgba(0,0,0,.4);
	background: #fff;
}

/* Controls bar */
.plv-pdfjs-controls {
	position: sticky;
	bottom: 0;
	left: 0;
	right: 0;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .5em;
	padding: .5em .8em;
	background: rgba(50, 54, 57, .95);
	backdrop-filter: blur(4px);
	z-index: 10;
	flex-wrap: wrap;
}

.plv-page-info {
	color: #eee;
	font-size: .85em;
	min-width: 6em;
	text-align: center;
}

.plv-zoom-label {
	color: #ccc;
	font-size: .8em;
	min-width: 3em;
	text-align: center;
}

.plv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2em;
	height: 2em;
	border: none;
	border-radius: 4px;
	background: #4a4e52;
	color: #fff;
	font-size: 1em;
	cursor: pointer;
	transition: background .15s;
}

.plv-btn .dashicons {
	font-size: 1em;
	width: 1em;
	height: 1em;
	line-height: 1;
	color: #fff;
}

.plv-btn:hover {
	background: #0073aa;
}

.plv-btn:disabled {
	opacity: .4;
	cursor: not-allowed;
}

/* Loading indicator */
.plv-loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .6em;
	color: #eee;
	font-size: .95em;
	background: #525659;
	z-index: 5;
}

.plv-spinner {
	display: inline-block;
	width: 1.4em;
	height: 1.4em;
	border: 3px solid rgba(255,255,255,.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: plv-spin 0.7s linear infinite;
}

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

/* Error state */
.plv-error {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .6em;
	color: #ffcdd2;
	font-size: .9em;
	text-align: center;
	padding: 1em;
	background: #525659;
	z-index: 5;
}

.plv-error a {
	color: #90caf9;
}

/* ── Footer ── */
.plv-footer {
	padding: .5em 1em;
	background: #f5f5f5;
	border-top: 1px solid #e0e0e0;
	text-align: right;
}

.plv-open-new {
	display: inline-flex;
	align-items: center;
	gap: .25em;
	font-size: .8em;
	color: #0073aa;
	text-decoration: none;
}

.plv-open-new .dashicons {
	font-size: 1.1em;
	width: 1.1em;
	height: 1.1em;
	line-height: 1;
}

.plv-open-new:hover {
	text-decoration: underline;
}

/* Error notice from shortcode */
.plv-shortcode-error {
	border: 1px solid #c00;
	padding: 10px;
	color: #c00;
	border-radius: 4px;
	margin: 1em 0;
}

/* ── Responsive ── */
@media (max-width: 600px) {
	.plv-pdfjs-controls {
		gap: .3em;
		padding: .4em .4em;
	}

	.plv-page-info {
		font-size: .75em;
	}
}
