/*
 * Editor UI. Everything is scoped under .pcvb-app so it never touches the
 * theme or other plugins.
 *
 * Maintained by Wiselogix Technologies.
 */
.pcvb-app,
.pcvb-app *,
.pcvb-app *::before,
.pcvb-app *::after {
	box-sizing: border-box;
}

.pcvb-app {
	--pcvb-navy: #0f2a47;
	--pcvb-blue: #2f6f9f;
	--pcvb-green: #2f9e4f;
	--pcvb-green-soft: #ecf8ef;
	--pcvb-red: #b42318;
	--pcvb-red-soft: #fef3f2;
	--pcvb-text: #1e293b;
	--pcvb-muted: #52627a;
	--pcvb-line: #d5dde8;
	--pcvb-bg: #ffffff;
	--pcvb-card: #ffffff;
	/*
	 * Full-bleed: the builder needs the whole screen width. A boxed theme container (often
	 * about 1200px) would squeeze the CV preview, so the app breaks out of it.
	 */
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	padding: 20px clamp(12px, 1vw, 24px) 40px;
	background: var(--pcvb-bg);
	color: var(--pcvb-text);
	font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

.pcvb-app h2,
.pcvb-app h3,
.pcvb-app h4,
.pcvb-app p,
.pcvb-app legend {
	font-family: inherit;
	color: var(--pcvb-text);
}

.pcvb-sr,
.pcvb-sr-input {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Layout */
/* Page-level: stop the 100vw breakout from adding a horizontal scrollbar (this file loads only on builder pages). */
html,
body {
	overflow-x: clip;
}

/*
 * Side by side only when the preview column is wide enough to show the CV at 80% or more
 * (text stays readable). Below that width the Editor / Preview tabs are used instead.
 */
.pcvb-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); /* equal columns */
	gap: 16px;
	align-items: start;
}

.pcvb-tabs {
	display: none;
}

/* Plain white form; the preview side has no card of its own. */
.pcvb-editor {
	background: var(--pcvb-card);
	border: 1px solid var(--pcvb-line);
	border-radius: 4px;
	padding: 24px;
}

.pcvb-previewpane {
	position: sticky;
	top: 16px;
	align-self: start;
	min-width: 0;
}

/* The preview card fills the screen height and scrolls inside itself, so a long CV is never cut off. */
.pcvb-preview-card {
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 32px);
	min-height: 360px;
}

.pcvb-editor-head h2,
.pcvb-preview-head h2 {
	margin: 0 0 2px;
	font-size: 22px;
	font-weight: 700;
	color: var(--pcvb-navy);
	line-height: 1.25;
}

.pcvb-editor-head p,
.pcvb-preview-head p {
	margin: 0 0 18px;
	color: var(--pcvb-muted);
	font-size: 13.5px;
}

.pcvb-preview-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	flex-wrap: wrap;
	gap: 10px 14px;
	margin-bottom: 12px;
}

.pcvb-preview-head p {
	margin-bottom: 0;
}

.pcvb-preview-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.pcvb-zoom {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

/* Percentage is kept for screen readers only; the visible controls are just - + Fit and Full page preview. */
.pcvb-zoom-label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.pcvb-app .pcvb-zoom-btn {
	min-width: 36px;
	padding-left: 8px;
	padding-right: 8px;
	font-size: 18px;
	line-height: 1;
}

.pcvb-app .pcvb-zoom [aria-pressed='true'] {
	background: var(--pcvb-navy);
	border-color: var(--pcvb-navy);
	color: #fff;
}

.pcvb-app .pcvb-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.pcvb-preview-viewport {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	padding: 12px;
	border-radius: 4px;
	background: #e6e8eb; /* light grey, the CV sits on it as a white document */
}

/* The sizer carries the real (scaled) size so scrolling is correct; the CV inside is scaled with a transform. */
.pcvb-sizer {
	position: relative;
	margin: 0 auto;
	background: #fff;
	outline: 1px solid #cfd4da;
}

.pcvb-preview-scale {
	position: absolute;
	left: 0;
	top: 0;
	transform-origin: top left;
	width: 794px;
}

/* Sections */
.pcvb-section {
	margin: 0 0 32px;
	padding: 0;
	border: 0;
	min-width: 0;
}

.pcvb-section legend {
	display: block;
	width: 100%;
	padding: 0 0 8px;
	margin: 0 0 14px;
	font-size: 16px;
	font-weight: 700;
	color: var(--pcvb-navy);
	border-bottom: 1px solid var(--pcvb-line);
}

.pcvb-section-intro {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 14px;
	margin-bottom: 12px;
}

.pcvb-section-intro p {
	flex: 1 1 auto;
	margin: 0;
	color: var(--pcvb-muted);
	font-size: 13px;
}

.pcvb-section-intro .pcvb-btn {
	flex: 0 0 auto;
	white-space: nowrap;
}

/* Fields */
.pcvb-grid {
	display: grid;
	gap: 0 16px;
}

.pcvb-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pcvb-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.pcvb-field {
	margin-bottom: 16px;
	min-width: 0;
}

.pcvb-field > label,
.pcvb-label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 600;
	color: var(--pcvb-text);
}

.pcvb-req { color: var(--pcvb-red); margin-left: 2px; }
.pcvb-opt { color: var(--pcvb-muted); font-weight: 400; }

.pcvb-app .pcvb-input {
	display: block;
	width: 100%;
	min-height: 42px;
	margin: 0;
	padding: 8px 12px;
	border: 1px solid #b8c4d3;
	border-radius: 4px;
	background: #ffffff;
	color: var(--pcvb-text);
	font: inherit;
	font-size: 15px;
	line-height: 1.4;
	box-shadow: none;
	appearance: auto;
}

.pcvb-app textarea.pcvb-input {
	min-height: 96px;
	resize: vertical;
}

.pcvb-app .pcvb-input:hover {
	border-color: #8b9bb0;
}

.pcvb-app .pcvb-input:focus,
.pcvb-app .pcvb-input:focus-visible {
	outline: 3px solid rgba(47, 111, 159, 0.35);
	outline-offset: 1px;
	border-color: var(--pcvb-blue);
}

.pcvb-app .pcvb-input[aria-invalid='true'] {
	border-color: var(--pcvb-red);
	background: var(--pcvb-red-soft);
}

.pcvb-hint {
	margin: 4px 0 0;
	font-size: 12.5px;
	color: var(--pcvb-muted);
}

.pcvb-error {
	margin: 4px 0 0;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--pcvb-red);
}

.pcvb-error[hidden] { display: none; }

.pcvb-age {
	margin: -8px 0 16px;
	font-size: 13px;
	color: var(--pcvb-muted);
	min-height: 1.2em;
}

/* Photo */
/* Photo: thumbnail on the left, actions on the right, one tidy row above the fields */
.pcvb-photo {
	display: flex;
	align-items: flex-start;
	gap: 20px;
	margin-bottom: 20px;
}

.pcvb-photo-side {
	flex: 1 1 auto;
	min-width: 0;
	max-width: 320px;
}

.pcvb-photo-buttons {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 14px;
	margin-bottom: 2px;
}

.pcvb-photo-frame {
	flex: 0 0 auto;
	width: 110px;
	aspect-ratio: 300 / 413; /* the exact shape of the CV photo frame */
	border: 1px solid #c4ccd6;
	border-radius: 4px;
	background: #f3f5f7;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pcvb-photo-frame[hidden] { display: none; }

.pcvb-photo-frame img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
}

.pcvb-photo-empty {
	font-size: 12px;
	color: var(--pcvb-muted);
}

.pcvb-photo-adjust {
	margin-top: 8px;
	border-top: 1px solid var(--pcvb-line);
	padding: 0 0 4px;
}

.pcvb-photo-adjust[hidden] { display: none; }

.pcvb-photo-adjust > summary {
	min-height: 36px;
	padding: 8px 0;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: var(--pcvb-navy);
}

.pcvb-photo-adjust .pcvb-field { margin-bottom: 6px; }
.pcvb-photo-adjust label { font-size: 12px; margin-bottom: 2px; }
.pcvb-photo-adjust input[type='range'] { width: 100%; margin: 0; }

/* Buttons */
.pcvb-app .pcvb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 44px;
	padding: 10px 16px;
	border: 1px solid transparent;
	border-radius: 4px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s;
}

.pcvb-app .pcvb-btn-sm {
	min-height: 36px;
	padding: 6px 12px;
	font-size: 13px;
}

.pcvb-app .pcvb-btn-outline {
	background: #fff;
	border-color: var(--pcvb-green);
	color: #1d6b34;
}

.pcvb-app .pcvb-btn-outline:hover { background: var(--pcvb-green-soft); }

.pcvb-app .pcvb-btn-danger {
	background: var(--pcvb-red-soft);
	border-color: #f3b4ae;
	color: var(--pcvb-red);
}

.pcvb-app .pcvb-btn-danger:hover { background: #fde4e1; }

.pcvb-app .pcvb-btn-primary {
	width: 100%;
	background: var(--pcvb-navy);
	color: #ffffff;
	font-size: 16px;
	min-height: 50px;
}

.pcvb-app .pcvb-btn-primary:hover { background: #0a1f36; }

.pcvb-app .pcvb-btn:focus-visible,
.pcvb-app .pcvb-linkbtn:focus-visible,
.pcvb-app .pcvb-tab:focus-visible,
.pcvb-app summary:focus-visible,
.pcvb-app input[type='checkbox']:focus-visible,
.pcvb-sr-input:focus-visible + .pcvb-photo-frame {
	outline: 3px solid rgba(47, 111, 159, 0.5);
	outline-offset: 2px;
}

.pcvb-photo label.pcvb-btn:focus-within,
.pcvb-photo:focus-within label.pcvb-btn {
	outline: 3px solid rgba(47, 111, 159, 0.5);
	outline-offset: 2px;
}

.pcvb-app .pcvb-linkbtn {
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--pcvb-blue);
	font: inherit;
	font-size: 13px;
	text-decoration: underline;
	cursor: pointer;
	text-align: left;
}

/* Secondary positions */
.pcvb-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 6px;
}

.pcvb-chips:empty { display: none; }

.pcvb-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 4px 3px 10px;
	border-radius: 999px;
	background: #e6eef7;
	color: var(--pcvb-navy);
	font-size: 13px;
	font-weight: 600;
}

.pcvb-chip button {
	width: 24px;
	height: 24px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--pcvb-navy);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}

.pcvb-chip button:hover { background: #cfdceb; }

.pcvb-details {
	border: 1px solid #b8c4d3;
	border-radius: 10px;
	background: #fff;
}

.pcvb-details > summary {
	min-height: 44px;
	padding: 10px 12px;
	cursor: pointer;
	font-size: 14px;
	color: var(--pcvb-muted);
}

.pcvb-checkgroups {
	padding: 4px 12px 12px;
	display: grid;
	gap: 10px;
}

.pcvb-checkgroup {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.pcvb-checkgroup legend {
	padding: 0;
	margin-bottom: 4px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--pcvb-muted);
	border: 0;
}

.pcvb-checkgroup .pcvb-checks {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
}

.pcvb-check {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 32px;
	font-size: 14px;
}

.pcvb-check input {
	width: 18px;
	height: 18px;
	margin: 0;
}

/* Repeaters */
.pcvb-empty {
	margin: 0 0 8px;
	padding: 14px;
	border: 1px dashed var(--pcvb-line);
	border-radius: 10px;
	color: var(--pcvb-muted);
	font-size: 13.5px;
	text-align: center;
}

.pcvb-empty[hidden] { display: none; }

.pcvb-record,
.pcvb-ref {
	margin-bottom: 12px;
	padding: 12px 0 0;
	border-top: 1px solid var(--pcvb-line);
}

.pcvb-record[data-included='false'] {
	opacity: 0.7;
}

.pcvb-record-head {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 10px;
}

.pcvb-record-head h4 {
	flex: 1 1 auto;
	margin: 0;
	font-size: 14.5px;
	font-weight: 700;
	color: var(--pcvb-navy);
}

.pcvb-switch {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
}

.pcvb-switch input {
	width: 20px;
	height: 20px;
	margin: 0;
}

.pcvb-stats-title {
	margin: 4px 0 6px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--pcvb-muted);
}

.pcvb-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 0 12px;
}

.pcvb-stats-note {
	margin: 0 0 8px;
	font-size: 13px;
	color: var(--pcvb-muted);
}

.pcvb-list-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.pcvb-list-head h3 {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: var(--pcvb-navy);
}

.pcvb-itemrow {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

.pcvb-itemrow .pcvb-field { flex: 1 1 auto; margin-bottom: 8px; }
.pcvb-itemrow .pcvb-btn { flex: 0 0 auto; }

/* Actions, status, summary */
.pcvb-actions { margin-top: 8px; }

.pcvb-status {
	min-height: 1.4em;
	margin: 10px 0 0;
	font-size: 13.5px;
	color: var(--pcvb-muted);
}

.pcvb-status[data-kind='error'] { color: var(--pcvb-red); font-weight: 600; }
.pcvb-status[data-kind='ok'] { color: #1d6b34; font-weight: 600; }

.pcvb-draft {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	margin-top: 6px;
	font-size: 12.5px;
	color: var(--pcvb-muted);
}

.pcvb-summary {
	margin: 0 0 16px;
	padding: 12px 14px;
	border: 1px solid #f3b4ae;
	border-radius: 10px;
	background: var(--pcvb-red-soft);
	color: var(--pcvb-red);
}

.pcvb-summary[hidden] { display: none; }
.pcvb-summary p { margin: 0 0 6px; font-weight: 700; color: var(--pcvb-red); }
.pcvb-summary ul { margin: 0; padding-left: 20px; }
.pcvb-summary a { color: var(--pcvb-red); text-decoration: underline; }

.pcvb-noscript {
	padding: 12px;
	background: #fff4e5;
	border-radius: 8px;
}

/* Loader and dialog */
.pcvb-loader {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: rgba(15, 42, 71, 0.88);
	color: #fff;
	font-weight: 600;
}

.pcvb-loader[hidden] { display: none; }
.pcvb-loader p { margin: 0; color: #fff; }

.pcvb-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: pcvb-spin 0.9s linear infinite;
}

@keyframes pcvb-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
	.pcvb-spinner { animation-duration: 3s; }
}

/* Full page preview: almost the whole screen, with its own zoom, so the complete CV can be read comfortably. */
.pcvb-dialog {
	width: min(1200px, 98vw);
	height: 96vh;
	max-width: 98vw;
	max-height: 96vh;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: #e3e9f0;
	overflow: hidden;
}

.pcvb-dialog[open] {
	display: flex;
	flex-direction: column;
}

.pcvb-dialog::backdrop { background: rgba(15, 42, 71, 0.75); }

.pcvb-dialog-bar {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 8px 14px;
	padding: 10px 14px;
	background: #fff;
	border-bottom: 1px solid var(--pcvb-line);
}

.pcvb-dialog-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	padding: 16px;
}

/* Off-screen host used while creating the PDF */
.pcvb-export-host {
	position: fixed;
	left: -10000px;
	top: 0;
	width: 794px;
	pointer-events: none;
}

/* Narrow screens (tablet, phone, small laptop): Editor / Preview tabs, preview uses the full width */
@media (max-width: 1279px) {
	.pcvb-app { padding: 12px 10px 32px; }

	.pcvb-preview-card { max-height: none; }
	.pcvb-preview-viewport { overflow: auto; max-height: calc(100vh - 150px); }

	.pcvb-tabs {
		display: flex;
		gap: 0;
		margin-bottom: 12px;
		border-bottom: 1px solid var(--pcvb-line);
	}

	.pcvb-app .pcvb-tab {
		flex: 1 1 50%;
		min-height: 44px;
		border: 0;
		border-bottom: 3px solid transparent;
		border-radius: 0;
		background: transparent;
		color: var(--pcvb-muted);
		font: inherit;
		font-size: 15px;
		font-weight: 600;
		cursor: pointer;
	}

	.pcvb-app .pcvb-tab[aria-selected='true'] {
		border-bottom-color: var(--pcvb-green);
		color: var(--pcvb-navy);
	}

	.pcvb-layout { display: block; }
	.pcvb-previewpane { position: static; }
	.pcvb-app[data-tab='editor'] .pcvb-previewpane { display: none; }
	.pcvb-app[data-tab='preview'] .pcvb-editor { display: none; }
	.pcvb-editor { padding: 16px; }
}

@media (max-width: 640px) {
	.pcvb-photo { gap: 14px; }
	.pcvb-photo-frame { width: 88px; }
	.pcvb-dialog { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
	.pcvb-dialog-body { padding: 8px; }
	.pcvb-preview-viewport { padding: 8px; }
	.pcvb-grid-2,
	.pcvb-grid-3 { grid-template-columns: 1fr; }
	.pcvb-section-intro { flex-direction: column; }
	.pcvb-preview-head { flex-direction: column; }
}

/* Phone preview: Reading view (reflowed, readable) or the real A4 page with zoom */
.pcvb-viewmode,
.pcvb-viewnote { display: none; }

@media (max-width: 767px) {
	.pcvb-viewmode { display: inline-flex; gap: 6px; }
	.pcvb-app .pcvb-viewmode [aria-pressed='true'] {
		background: var(--pcvb-navy);
		border-color: var(--pcvb-navy);
		color: #fff;
	}
	.pcvb-app[data-view='read'] .pcvb-zoom { display: none; }
	.pcvb-app[data-view='read'] .pcvb-viewnote { display: block; margin: 8px 0 0; }
	.pcvb-preview-viewport.pcvb-reading {
		max-height: none;
		overflow: visible;
		padding: 0;
		background: transparent;
	}
	.pcvb-reading .pcvb-sizer { width: auto !important; height: auto !important; }
	.pcvb-reading .pcvb-preview-scale { position: static; width: auto; transform: none !important; }
}


/* Free / Premium: a plain link to the other page (normal navigation, no script) */
.pcvb-modebar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin: 0 0 12px;
	padding: 0 0 10px;
	border-bottom: 1px solid var(--pcvb-line);
}

.pcvb-modebar-label {
	font-size: 15px;
	font-weight: 700;
	color: var(--pcvb-navy);
}

.pcvb-app .pcvb-modebar-link {
	font-size: 13px;
	color: var(--pcvb-blue);
	text-decoration: underline;
}

/* Hints inside empty fields (placeholders): light gray */
.pcvb-input::placeholder {
	color: #9ca3af;
	opacity: 1;
}
