/* ============================================================
   Online Catalog — PDF flipbook viewer
   ============================================================ */

.catalog-main { background: var(--blue); }

.catalog-viewer {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - var(--header-h));
	background: var(--blue);
}

/* Toolbar */
.catalog-bar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 18px;
	background: #0b1c30;
	color: #fff;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.catalog-bar-group { display: flex; align-items: center; gap: 8px; }
.catalog-bar-center { flex: 1 1 auto; justify-content: center; }
.catalog-bar-right { justify-content: flex-end; }

.catalog-back { color: rgba(255, 255, 255, 0.85); font-weight: 600; white-space: nowrap; }
.catalog-back:hover { color: #fff; }
.catalog-title { color: #fff; font-weight: 700; margin-left: 12px; white-space: nowrap; }

.catalog-pageind { color: rgba(255, 255, 255, 0.9); font-variant-numeric: tabular-nums; min-width: 74px; text-align: center; font-weight: 600; }

.catalog-btn {
	appearance: none;
	border: 1px solid rgba(255, 255, 255, 0.18);
	background: rgba(255, 255, 255, 0.06);
	color: #fff;
	min-width: 38px; height: 38px;
	padding: 0 12px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 1rem; line-height: 1;
	display: inline-flex; align-items: center; justify-content: center;
	transition: background var(--transition), border-color var(--transition);
}
.catalog-btn:hover { background: var(--rust); border-color: var(--rust); }
.catalog-dl { text-decoration: none; font-weight: 700; font-size: 0.9rem; }

/* Stage */
.catalog-stage {
	flex: 1 1 auto;
	position: relative;
	min-height: 72vh;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	padding: 22px;
	background:
		radial-gradient(120% 90% at 50% 0%, #1b3350 0%, var(--blue) 60%, #08131f 100%);
}

.flipbook { margin: 0 auto; }
.fb-page { background: #fff; overflow: hidden; }
.fb-page .fb-canvas { display: block; width: 100%; height: 100%; }

/* Loading + empty + fallback */
.catalog-loading {
	position: absolute; inset: 0;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: 14px; color: rgba(255, 255, 255, 0.85); font-weight: 600; z-index: 5;
}
.catalog-spinner {
	width: 40px; height: 40px; border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: var(--rust);
	animation: catalog-spin 0.9s linear infinite;
}
@keyframes catalog-spin { to { transform: rotate(360deg); } }

.catalog-empty { text-align: center; color: rgba(255, 255, 255, 0.9); }
.catalog-empty-hint { color: rgba(255, 255, 255, 0.6); font-size: 0.9rem; margin-top: 6px; }

.catalog-fallback { width: 100%; height: 100%; min-height: 72vh; border: 0; background: #fff; }
.catalog-noscript { color: #fff; text-align: center; padding: 20px; }
.catalog-noscript a { color: var(--rust-light); }

/* Thumbnails drawer */
.catalog-thumbs {
	flex: 0 0 auto;
	display: flex;
	gap: 10px;
	overflow-x: auto;
	padding: 12px 16px;
	background: #0b1c30;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.fb-thumb {
	flex: 0 0 auto;
	background: #fff;
	border: 2px solid transparent;
	border-radius: 6px;
	padding: 4px;
	cursor: pointer;
	display: flex; flex-direction: column; align-items: center; gap: 4px;
	width: 92px;
}
.fb-thumb canvas { width: 100%; height: auto; display: block; border-radius: 3px; }
.fb-thumb span { font-size: 11px; color: #333; }
.fb-thumb:hover { border-color: var(--rust); }

/* Fullscreen */
.catalog-viewer:fullscreen { height: 100vh; min-height: 100vh; }
.catalog-viewer:fullscreen .catalog-stage { min-height: 0; }

@media (max-width: 820px) {
	.catalog-title { display: none; }
	.catalog-bar { padding: 8px 10px; gap: 6px; }
	.catalog-btn { min-width: 34px; height: 34px; padding: 0 8px; }
	.catalog-bar-center { order: 3; flex-basis: 100%; }
	.catalog-bar { flex-wrap: wrap; }
	.catalog-stage { padding: 12px; min-height: 66vh; }
}
