/*
 * In-page document preview modal for rerouted BuddyBoss documents.
 *
 * SELF-CONTAINED + NAMESPACED (.schdoc-*). BB pages carry NO CIS chrome, so
 * nothing here depends on portal CSS or tokens (same constraint as the register
 * page). Every selector is prefixed .schdoc-* so nothing of ours leaks into BB
 * and — because we never style bare tags globally — no BB/theme rule reaches in
 * (the namespace-collision lesson). ALL inks are dark (navy/slate/teal); the
 * only light surfaces are backgrounds, so the light-ink checker stays clean
 * (no white text on a colour → no whitelist entry needed).
 *
 * The overlay sits above BB's sticky header (z-index ~9990) at 100000.
 */

.schdoc-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(15, 23, 42, 0.72);
	font-family: 'Rajdhani', system-ui, -apple-system, sans-serif;
	-webkit-font-smoothing: antialiased;
}

.schdoc-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 960px;
	max-height: 92vh;
	background: #ffffff;
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
	overflow: hidden;
}

.schdoc-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px 12px 18px;
	border-bottom: 1px solid #e2e8f0;
	background: #ffffff;
	flex: 0 0 auto;
}

.schdoc-title {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: #0f172a;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.schdoc-close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	font-size: 22px;
	line-height: 1;
	color: #334155;
	background: transparent;
	border: 0;
	border-radius: 9px;
	cursor: pointer;
}
.schdoc-close:hover { background: #f1f5f9; color: #0f172a; }
.schdoc-close:focus-visible { outline: 2px solid #227F77; outline-offset: 2px; }

.schdoc-body {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f1f5f9;
	overflow: auto;
}

/* PDF → native browser viewer via iframe (desktop / non-iOS). */
.schdoc-body iframe {
	width: 100%;
	height: 100%;
	min-height: 70vh;
	border: 0;
	background: #f1f5f9;
}

/* Image → contained, never larger than its box. */
.schdoc-body img {
	max-width: 100%;
	max-height: 100%;
	margin: auto;
	object-fit: contain;
	display: block;
}

/* iOS PDF fallback panel — iframes render PDFs unreliably on iOS Safari, so we
   show the filename + a prominent link straight to the endpoint instead. */
.schdoc-ios {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	padding: 40px 24px;
	text-align: center;
}
.schdoc-ios-name {
	font-size: 16px;
	font-weight: 600;
	color: #0f172a;
	word-break: break-word;
}

.schdoc-foot {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	padding: 12px 16px;
	border-top: 1px solid #e2e8f0;
	background: #ffffff;
	flex: 0 0 auto;
}

.schdoc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 16px;
	font-family: 'Rajdhani', system-ui, sans-serif;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	color: #0f172a;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 9px;
	cursor: pointer;
	text-decoration: none;
}
.schdoc-btn:hover { background: #f8fafc; border-color: #94a3b8; }
.schdoc-btn:focus-visible { outline: 2px solid #227F77; outline-offset: 2px; }

/* Primary accent — teal ink on a faint teal wash (NO white text → light-ink
   clean, no whitelist). */
.schdoc-btn--primary {
	color: #1c6e67;
	background: rgba(34, 127, 119, 0.10);
	border-color: #227F77;
}
.schdoc-btn--primary:hover { background: rgba(34, 127, 119, 0.18); border-color: #1c6e67; }

/* MOBILE — full-screen sheet (no floating card). */
@media (max-width: 600px) {
	.schdoc-overlay { padding: 0; }
	.schdoc-card {
		max-width: 100%;
		width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}
	.schdoc-body iframe { min-height: 0; }
	.schdoc-foot { flex-wrap: wrap; }
	.schdoc-btn { flex: 1 1 auto; }
}

/* MOTION — entrance only when the user allows it. */
@media (prefers-reduced-motion: no-preference) {
	.schdoc-overlay { animation: schdoc-fade 0.16s ease-out; }
	.schdoc-card { animation: schdoc-rise 0.18s ease-out; }
}
@keyframes schdoc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes schdoc-rise { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
