/* PDF Block Styles */
.pdf-block {
	width: 100%;
	margin: 20px 0;
	border: 1px solid #ddd;
	border-radius: 8px;
	overflow: visible; /* オーバーフローを許可 */
	background: #fff;
	height: auto !important; /* 高さ制限を強制的に解除 */
}

.pdf-block-container {
	position: relative;
	width: 100%;
	height: auto !important; /* 高さ制限を強制的に解除 */
}

.pdf-block-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 200px;
	background: #f9f9f9;
}

.pdf-block-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #0073aa;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin-bottom: 10px;
}

.pdf-block-loading p {
	margin: 0;
	color: #666;
	font-size: 14px;
}

.pdf-block-error {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	background: #fff4e5;
	color: #d63638;
	text-align: center;
	padding: 20px;
	border: 2px solid #fe5126;
	border-radius: 8px;
	margin: 20px;
	position: relative;
	z-index: 10;
}

.pdf-block-error p {
	margin: 0;
	font-size: 16px;
	font-weight: bold;
}

.pdf-block-content {
	position: relative;
	width: 100%;
	height: auto; /* コンテンツに応じて自動調整 */
	min-height: 200px; /* 最小高さを設定 */
	padding-top: 100px;
	padding-bottom: 100px;
	/* padding-top: 60px;
	padding-bottom: 60px; */
	background: #fffaf2;
}

/* エラー時にコンテンツを非表示 */
.pdf-block-content.hidden {
	display: none !important;
}

.pdf-block-canvas {
	display: block;
	width: auto !important; /* 強制的に自動サイズ */
	height: auto !important; /* 強制的に自動サイズ */
	max-width: none; /* 最大幅制限を解除 */
	margin: 0 auto;
	/* PDFの描画開始位置をコントロール領域の下に設定 */
	transform: translateY(0);
	/* タッチ操作の最適化 */
	touch-action: manipulation;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	user-select: none;
}

/* PDFの内容がコントロール領域に重ならないようにする */
.pdf-block-canvas canvas,
.pdf-block-canvas iframe,
.pdf-block-canvas object,
.pdf-block-canvas embed {
	margin-top: 0 !important;
	padding-top: 0 !important;
	/* PDFの描画開始位置を上部コントロールの下に確実に配置 */
	position: relative;
	top: 0;
}

/* エラー時の追加ボタン */
.pdf-block-error-actions {
	display: none;
	position: relative;
	top: auto;
	left: auto;
	transform: none;
	flex-direction: column;
	gap: 15px;
	align-items: center;
	z-index: 20;
	background: #fff4e5;
	padding: 20px;
	border: 2px solid #fe5126;
	border-radius: 8px;
	box-shadow: none;
	margin: 20px;
}

.pdf-block-btn-download-error,
.pdf-block-btn-open-new-tab {
	background: #fff4e5;
	color: #fe5126;
	border: 1px solid rgba(0, 0, 0, 0.1);
	text-decoration: none;
	display: inline-block;
	padding: 12px 20px;
	border-radius: 4px;
	font-size: 14px;
	transition: all 0.2s ease;
	min-width: 160px;
	text-align: center;
}

.pdf-block-btn-download-error:hover,
.pdf-block-btn-open-new-tab:hover {
	background: #fe5126;
	color: white;
	transform: translateY(-1px);
	text-decoration: none;
}

.pdf-block-controls {
	position: absolute;
	bottom: 15px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 15px;
	padding: 8px 16px;
	background: #fff4e5;
	/* background: rgba(255, 255, 255, 0.95); */
	border-radius: 4px;
	/* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); */
	z-index: 20;
	border: 1px solid rgba(0, 0, 0, 0.1);
}

.pdf-block-btn {
	background: #fffaf2;
	/* background: #fe5126; */
	/* background: #0073aa; */
	color: #fe5126;
	/* color: white; */
	border: none;
	padding: 8px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	transition: all 0.2s ease;
	/* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
}

.pdf-block-btn:hover {
	background: #e0451f;
	color: white;
	/* background: #005a87; */
	transform: translateY(-1px);
	/* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); */
}

.pdf-block-btn:disabled,
.pdf-block-btn.disabled {
	background: #fffaf2;
	color: #fffaf2;
	/* background: #ccc;
	color: #999; */
	cursor: not-allowed;
	opacity: 0.6;
	transform: none;
}

.pdf-block-btn:disabled:hover,
.pdf-block-btn.disabled:hover {
	background: #fffaf2;
	color: #fffaf2;
	/* background: #ccc;
	color: #999; */
	transform: none;
	box-shadow: none;
}

.pdf-block-btn-prev,
.pdf-block-btn-next {
	font-weight: bold;
}

.pdf-block-page-info {
	font-size: 14px;
	color: #666;
	font-weight: 500;
}

.pdf-block-zoom-controls {
	position: absolute;
	top: 15px;
	right: 15px;
	display: flex;
	align-items: center;
	gap: 10px;
	background: #fff4e5;
	/* background: rgba(255, 255, 255, 0.9); */
	padding: 8px 12px;
	border-radius: 4px;
	/* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); */
	z-index: 20;
	/* border: 2px solid #fe5126; */
	border: 1px solid rgba(0, 0, 0, 0.1);
}

.pdf-block-zoom-level {
	font-size: 12px;
	color: #fe5126;
	min-width: 40px;
	text-align: center;
}

.pdf-block-download {
	position: absolute;
	top: 15px;
	left: 15px;
	z-index: 20;
}

.pdf-block-btn-download {
	background: #fff4e5;
	/* background: #00a32a; */
	text-decoration: none;
	display: inline-block;
	padding: 16px 12px;
	border-radius: 4px;
	/* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); */
	/* border: 2px solid #fe5126; */
	border: 1px solid rgba(0, 0, 0, 0.1);
}

.pdf-block-btn-download:hover {
	background: #fe5126;
	color: white;
	/* background: #008a20; */
}

.page-content a:hover {
	text-decoration: none !important;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
	.pdf-block-content {
		padding-top: 150px; /* 上部コントロール（ダウンロード）の高さ分 */
		/* padding-top: 60px;  */
		padding-bottom: 120px; /* モバイルではコントロールが2段になるため、より多くのパディング */
	}

	.pdf-block-controls {
		position: absolute;
		bottom: 60px; /* ズームコントロールの上に配置 */
		left: 50%;
		transform: translateX(-50%);
		flex-direction: row;
		gap: 10px;
		padding: 6px 12px;
		background: rgba(255, 255, 255, 0.95);
		border: 1px solid rgba(0, 0, 0, 0.1);
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	}

	/* .pdf-block-zoom-controls {
		position: absolute;
		bottom: 15px;
		right: 15px;
		padding: 6px 10px;
		background: rgba(255, 250, 242, 0.95);
		border: 1px solid rgba(0, 0, 0, 0.1);
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	} */

	.pdf-block-download {
		position: absolute;
		top: 15px;
		left: 15px;
	}

	.pdf-block-zoom-controls {
		top: 80px;
		right: auto;
		left: 15px;
	}
}

/* エディター用スタイル */
.pdf-block-editor {
	margin: 20px 0;
}

.pdf-block-preview {
	border: 1px solid #ddd;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}

.pdf-block-preview-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px;
	background: #f9f9f9;
	border-bottom: 1px solid #ddd;
}

.pdf-block-preview-header h4 {
	margin: 0;
	font-size: 16px;
	color: #333;
}

.pdf-block-preview-content {
	padding: 15px;
}

.pdf-block-preview-content iframe {
	border: 1px solid #ddd;
	border-radius: 4px;
}
