/* PDF в модальном окне: внутри штатный просмотрщик браузера, как в новой вкладке */

.pdfm-overlay
{
	--pdfm-ink: #243447;
	--pdfm-accent: #2a5885;

	position: absolute;      /* привязан к документу: окно появляется у ссылки */
	left: 0;
	top: 0;
	width: 100%;
	z-index: 1000;
	display: none;
	background: rgba(26, 38, 52, 0.55);
	font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 13px;
	line-height: 1.4;
}

.pdfm-overlay.open { display: block; animation: pdfm-fade 0.14s ease-out; }

.pdfm-window
{
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	margin: 0 auto;
	box-sizing: content-box;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border: 1px solid rgba(15, 23, 32, 0.4);
	border-radius: 8px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25), 0 18px 48px rgba(0, 0, 0, 0.4);
	overflow: hidden;
}

.pdfm-overlay.open .pdfm-window { animation: pdfm-in 0.18s cubic-bezier(0.2, 0.8, 0.2, 1); }

@keyframes pdfm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pdfm-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes pdfm-rot { to { transform: rotate(360deg); } }

/* ---------- тонкая шапка: имя файла и две кнопки ---------- */

.pdfm-bar
{
	flex: 0 0 44px;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 8px 0 14px;
	background: #ffffff;
	border-bottom: 1px solid #dfe5eb;
	color: var(--pdfm-ink);
}

.pdfm-title
{
	flex: 1 1 0;
	min-width: 0;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pdfm-overlay .pdfm-btn
{
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: #41566b;
	cursor: pointer;
	transition: background-color 0.12s, color 0.12s;
}

.pdfm-overlay .pdfm-btn:hover { background: #eef3f8; color: var(--pdfm-accent); }
.pdfm-overlay .pdfm-btn:active { background: #e1e9f1; }
.pdfm-overlay .pdfm-btn:focus-visible { outline: 2px solid var(--pdfm-accent); outline-offset: 1px; }
.pdfm-overlay .pdfm-btn.pdfm-close:hover { background: #fdecea; color: #b3261e; }

.pdfm-btn svg
{
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
	pointer-events: none;
}

/* ---------- область просмотрщика ---------- */

.pdfm-stage
{
	position: relative;
	flex: 0 0 auto;
	background: #323639;     /* цвет фона штатного просмотрщика: без белой вспышки */
}

/* индикатор виден, пока браузер не нарисовал документ поверх него */
.pdfm-spin
{
	position: absolute;
	left: 50%;
	top: 50%;
	width: 24px;
	height: 24px;
	margin: -12px 0 0 -12px;
	border: 2px solid rgba(255, 255, 255, 0.25);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: pdfm-rot 0.8s linear infinite;
}

.pdfm-frame
{
	position: relative;
	z-index: 1;
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background: transparent;
}

@media (prefers-reduced-motion: reduce)
{
	.pdfm-overlay.open,
	.pdfm-overlay.open .pdfm-window { animation: none; }
	.pdfm-btn { transition: none; }
}
