/* EasyExam PDF Viewer – viewer page */
:root { --cpv-bg: #2b2f36; --cpv-ad-w: 300px; --cpv-bar: #1c1f24; --cpv-accent: #2563eb; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body.cpv-viewer {
	display: flex;
	flex-direction: column;
	background: var(--cpv-bg);
	color: #e8eaed;
	font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	overflow: hidden;
}

/* top bar */
.cpv-bar {
	position: relative;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	padding: 6px 14px;
	background: var(--cpv-bar);
	box-shadow: 0 1px 6px rgba(0, 0, 0, .45);
	z-index: 6;
}
.cpv-title { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpv-tools { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.cpv-group { display: flex; align-items: center; gap: 4px; }

.cpv-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-width: 36px; height: 36px; padding: 0 8px;
	border: 0; border-radius: 6px; background: transparent; color: #e8eaed;
	cursor: pointer; text-decoration: none; font: inherit;
}
.cpv-btn:hover, .cpv-btn:focus-visible { background: rgba(255, 255, 255, .14); outline: none; }
.cpv-btn[aria-pressed="true"] { background: rgba(255, 255, 255, .2); }
.cpv-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cpv-btn-primary { background: var(--cpv-accent); color: #fff; padding: 0 14px; font-weight: 600; }
.cpv-btn-primary:hover, .cpv-btn-primary:focus-visible { background: var(--cpv-accent); filter: brightness(1.12); }

.cpv-pager { display: inline-flex; align-items: center; gap: 6px; color: #c9cdd2; }
#cpv-page, #cpv-search-input {
	height: 30px; padding: 0 8px; border: 1px solid #4b5160; border-radius: 5px;
	background: #2b2f36; color: #fff; font: inherit;
}
#cpv-page { width: 56px; text-align: center; -moz-appearance: textfield; }
#cpv-page::-webkit-outer-spin-button, #cpv-page::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#cpv-zoom { height: 30px; border: 1px solid #4b5160; border-radius: 5px; background: #2b2f36; color: #fff; font: inherit; padding: 0 6px; }

/* loading progress (thin line along the bottom of the bar) */
.cpv-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; overflow: hidden; transition: opacity .4s; }
.cpv-progress i { display: block; height: 100%; width: 0; background: var(--cpv-accent); transition: width .2s; }
.cpv-progress.cpv-indeterminate i { width: 35%; animation: cpv-slide 1.1s infinite ease-in-out; }
.cpv-progress.cpv-done { opacity: 0; }
@keyframes cpv-slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* search bar */
.cpv-searchbar {
	flex: 0 0 auto; display: flex; align-items: center; gap: 8px; justify-content: center;
	padding: 6px 14px; background: #262a31; border-bottom: 1px solid #3a3f4a; z-index: 5;
}
.cpv-searchbar[hidden] { display: none; }
#cpv-search-input { width: min(360px, 55vw); }
.cpv-search-count { min-width: 90px; color: #c9cdd2; font-size: 13px; }

/* three columns: ad | (thumbnails + pdf) | ad */
.cpv-layout { flex: 1 1 auto; display: flex; min-height: 0; }
.cpv-center { flex: 1 1 auto; display: flex; min-width: 0; position: relative; }

.cpv-ad {
	flex: 0 0 calc(var(--cpv-ad-w) + 20px);
	width: calc(var(--cpv-ad-w) + 20px);
	overflow: auto; padding: 14px 10px;
	display: flex; justify-content: center; align-items: flex-start;
}
.cpv-ad-inner { max-width: 100%; text-align: center; }
.cpv-ad-inner img, .cpv-ad-inner iframe, .cpv-ad-inner ins { max-width: 100%; }

/* thumbnails */
.cpv-thumbs {
	flex: 0 0 156px; width: 156px; overflow-y: auto; padding: 12px 10px;
	background: #22262c; border-right: 1px solid #3a3f4a;
	display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.cpv-thumbs[hidden] { display: none; }
.cpv-thumb { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding: 6px; border: 2px solid transparent; border-radius: 6px; background: transparent; color: #c9cdd2; cursor: pointer; font: inherit; }
.cpv-thumb:hover { background: rgba(255, 255, 255, .07); }
.cpv-thumb.cpv-active { border-color: var(--cpv-accent); background: rgba(255, 255, 255, .08); color: #fff; }
.cpv-thumb-img { display: block; width: 124px; max-width: 100%; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.cpv-thumb-img canvas { display: block; width: 100%; height: auto; }
.cpv-thumb-n { font-size: 12px; }

/* pdf stage */
.cpv-stage { flex: 1 1 auto; min-width: 0; overflow: auto; padding: 16px; position: relative; background: rgba(0, 0, 0, .18); touch-action: pan-x pan-y; }
.cpv-pages { display: flex; flex-direction: column; align-items: center; }
.cpv-page { position: relative; flex: 0 0 auto; margin: 0 0 14px; background: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, .5); overflow: hidden; }
.cpv-page canvas { display: block; }

.cpv-status { text-align: center; padding: 60px 20px; color: #c9cdd2; font-size: 15px; }
.cpv-status.cpv-error { color: #fca5a5; }

/* text layer (invisible text, used for search highlights) */
.cpv-text { position: absolute; inset: 0; overflow: hidden; line-height: 1; z-index: 2; transform-origin: 0 0; }
.cpv-text span, .cpv-text br { color: transparent; position: absolute; white-space: pre; transform-origin: 0 0; }
.cpv-text mark { background: rgba(255, 214, 0, .5); color: transparent; border-radius: 2px; padding: 0; margin: 0; }
.cpv-text mark.cpv-cur { background: rgba(255, 120, 0, .65); outline: 2px solid rgba(255, 120, 0, .9); }
.cpv-text ::selection { background: rgba(37, 99, 235, .35); }
body.cpv-no-select .cpv-text { pointer-events: none; user-select: none; -webkit-user-select: none; }

/* watermark */
.cpv-wm { position: absolute; inset: 0; pointer-events: none; user-select: none; z-index: 3; overflow: hidden; font-weight: 700; white-space: nowrap; }
.cpv-wm-dark { color: #000; }
.cpv-wm-light { color: #fff; text-shadow: 0 0 2px rgba(0, 0, 0, .35); }
.cpv-wm-single { display: flex; align-items: center; justify-content: center; }
.cpv-wm-single span { transform: rotate(-30deg); }
.cpv-wm-tile { inset: auto; left: -40%; top: -40%; width: 180%; height: 180%; display: flex; flex-wrap: wrap; align-content: space-around; justify-content: space-around; transform: rotate(-30deg); }

/* toast */
.cpv-toast {
	position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
	display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 8px;
	background: #111418; color: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); z-index: 20; transition: opacity .25s, transform .25s;
}
.cpv-toast.cpv-show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.cpv-toast button { border: 0; background: transparent; color: #93c5fd; cursor: pointer; font: inherit; font-weight: 600; padding: 0; }

/* mobile ad strip (shown by inline CSS below the ad breakpoint) */
.cpv-mobile-ad { display: none; flex: 0 0 auto; background: #15181c; border-top: 1px solid #3a3f4a; padding: 6px; text-align: center; max-height: 30vh; overflow: auto; z-index: 4; }
.cpv-mobile-ad-inner { max-width: 100%; display: inline-block; }
.cpv-mobile-ad-inner img, .cpv-mobile-ad-inner iframe, .cpv-mobile-ad-inner ins { max-width: 100%; }

/* password gate */
.cpv-gate-page { align-items: center; justify-content: center; }
.cpv-gate { width: min(380px, 92vw); padding: 32px 28px; text-align: center; background: #22262c; border: 1px solid #3a3f4a; border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); }
.cpv-gate-icon { width: 54px; height: 54px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.cpv-gate-icon svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cpv-gate h1 { margin: 0 0 4px; font-size: 20px; }
.cpv-gate-file { margin: 0 0 18px; color: #c9cdd2; overflow-wrap: anywhere; }
.cpv-gate-error { margin: 0 0 14px; padding: 8px 10px; border-radius: 6px; background: rgba(248, 113, 113, .15); color: #fecaca; }
.cpv-gate input[type=password] { width: 100%; height: 42px; padding: 0 12px; margin-bottom: 12px; border: 1px solid #4b5160; border-radius: 8px; background: #2b2f36; color: #fff; font: inherit; }
.cpv-gate button { width: 100%; height: 42px; border: 0; border-radius: 8px; background: var(--cpv-accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.cpv-gate button:hover { filter: brightness(1.1); }

body.cpv-no-select .cpv-page { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* small screens */
@media (max-width: 720px) {
	.cpv-bar { flex-wrap: wrap; gap: 6px 8px; padding: 6px 10px; }
	.cpv-title { flex: 1 1 60%; font-size: 14px; }
	.cpv-tools { width: 100%; justify-content: space-between; gap: 6px; }
	.cpv-btn-primary span { display: none; }
	.cpv-stage { padding: 8px; }
	.cpv-thumbs { position: absolute; left: 0; top: 0; bottom: 0; z-index: 4; box-shadow: 4px 0 18px rgba(0, 0, 0, .5); }
}

/* when printing is disabled, Ctrl/Cmd+P gives a blank page */
@media print {
	body.cpv-no-print > * { display: none !important; }
}
