/**
 * IIFF PDF Viewer - Frontend Styles
 * Swell テーマ対応
 */

.iiff-pdf-viewer-wrapper {
	width: 100%;
	box-sizing: border-box;
}

.iiff-pdf-viewer-wrapper * {
	box-sizing: border-box;
}

.iiff-pdf-viewer-container {
	display: flex;
	flex-direction: column;
	background: #f9f9f9;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.iiff-pdf-viewer-canvas-container {
	flex: 1;
	overflow: auto;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
}

.iiff-pdf-viewer-canvas {
	max-width: 100%;
	height: auto;
	display: block;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.iiff-pdf-viewer-toolbar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px;
	background: #f5f5f5;
	border-top: 1px solid #ddd;
	flex-wrap: wrap;
}

.iiff-pdf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 8px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 3px;
	cursor: pointer;
	font-size: 14px;
	color: #333;
	transition: all 0.2s ease;
	text-decoration: none;
}

.iiff-pdf-btn:hover:not(:disabled) {
	background: #e8e8e8;
	border-color: #999;
}

.iiff-pdf-btn:active:not(:disabled) {
	background: #d5d5d5;
}

.iiff-pdf-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.iiff-pdf-btn:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.iiff-pdf-page-info {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 14px;
	color: #666;
	white-space: nowrap;
}

.iiff-pdf-page-input {
	width: 50px;
	height: 32px;
	padding: 4px 8px;
	border: 1px solid #ddd;
	border-radius: 3px;
	font-size: 13px;
	text-align: center;
}

.iiff-pdf-page-input:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.iiff-pdf-page-total {
	font-size: 13px;
	color: #999;
}

.iiff-pdf-download {
	color: #0073aa;
}

.iiff-pdf-download:hover {
	color: #005a87;
}

/* エラー＆空状態 */
.iiff-pdf-viewer-error,
.iiff-pdf-viewer-empty {
	padding: 40px 20px;
	text-align: center;
	color: #d32f2f;
	font-size: 14px;
	background: #fff;
	min-height: 300px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.iiff-pdf-viewer-empty {
	color: #999;
}

/* レスポンシブ */
@media (max-width: 768px) {
	.iiff-pdf-viewer-toolbar {
		gap: 6px;
		padding: 10px;
	}

	.iiff-pdf-btn {
		min-width: 32px;
		height: 32px;
		font-size: 12px;
		padding: 0 6px;
	}

	.iiff-pdf-page-input {
		width: 40px;
		height: 28px;
		font-size: 12px;
	}

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

	.iiff-pdf-page-total {
		font-size: 11px;
	}
}

@media (max-width: 480px) {
	.iiff-pdf-viewer-toolbar {
		gap: 4px;
		padding: 8px;
	}

	.iiff-pdf-btn {
		min-width: 28px;
		height: 28px;
		font-size: 11px;
		padding: 0 4px;
	}

	.iiff-pdf-page-info {
		flex-direction: column;
		gap: 2px;
	}

	.iiff-pdf-page-input {
		width: 35px;
		height: 24px;
		font-size: 11px;
	}
}

/* Swellテーマ互換性 */
.wp-block-iiff-pdf-viewer-pdf {
	margin-bottom: 1.5em;
}

.wp-block-iiff-pdf-viewer-pdf .iiff-pdf-viewer-container {
	width: 100%;
}

/* ダークモード対応（将来） */
@media (prefers-color-scheme: dark) {
	.iiff-pdf-viewer-container {
		background: #2a2a2a;
		border-color: #444;
	}

	.iiff-pdf-viewer-canvas-container {
		background: #1a1a1a;
	}

	.iiff-pdf-viewer-toolbar {
		background: #2a2a2a;
		border-top-color: #444;
	}

	.iiff-pdf-btn {
		background: #3a3a3a;
		border-color: #555;
		color: #e8e8e8;
	}

	.iiff-pdf-btn:hover:not(:disabled) {
		background: #4a4a4a;
		border-color: #666;
	}

	.iiff-pdf-page-info,
	.iiff-pdf-page-total {
		color: #aaa;
	}

	.iiff-pdf-page-input {
		background: #3a3a3a;
		border-color: #555;
		color: #e8e8e8;
	}

	.iiff-pdf-viewer-error,
	.iiff-pdf-viewer-empty {
		background: #1a1a1a;
		color: #888;
	}
}
