/* PhysioSurvey - front-end styles. Colours/radius/width come from CSS variables set per survey. */
.ps-root,
.ps-root *,
.ps-root *::before,
.ps-root *::after { box-sizing: border-box; }

.ps-root {
	--ps-primary: #0f766e;
	--ps-bg: #fff;
	--ps-text: #1f2937;
	--ps-radius: 12px;
	--ps-width: 420px;
	--ps-font: inherit;
	font-family: var(--ps-font);
	color: var(--ps-text);
	line-height: 1.45;
	font-size: 16px;
}

.ps-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.ps-dialog {
	position: relative;
	background: var(--ps-bg);
	color: var(--ps-text);
	border-radius: var(--ps-radius);
	width: min(var(--ps-width), calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	overflow: auto;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .22);
	outline: none;
}
.ps-body { padding: 24px 24px 20px; }

/* ---- placement ---- */
.ps-type-popup .ps-overlay {
	position: fixed; inset: 0; z-index: 999998;
	display: flex; align-items: center; justify-content: center;
	background: rgba(15, 23, 42, .55);
	padding: 16px;
}
.ps-type-popup:not(:has(.ps-overlay)) .ps-dialog {
	position: fixed; z-index: 999998; left: 50%; top: 50%; transform: translate(-50%, -50%);
}
.ps-type-slidein .ps-dialog { position: fixed; z-index: 999997; bottom: 16px; }
.ps-type-slidein.ps-pos-bottom-right .ps-dialog { right: 16px; }
.ps-type-slidein.ps-pos-bottom-left .ps-dialog { left: 16px; }
.ps-type-bar .ps-dialog {
	position: fixed; z-index: 999997; left: 0; right: 0; width: 100%; max-width: none;
	border-radius: 0; max-height: 60vh;
}
.ps-type-bar.ps-pos-bottom .ps-dialog { bottom: 0; }
.ps-type-bar.ps-pos-top .ps-dialog { top: 0; }
.ps-type-bar .ps-body { max-width: 720px; margin: 0 auto; }
.ps-type-inline .ps-dialog,
.ps-is-inline .ps-dialog { position: static; width: 100%; max-width: var(--ps-width); box-shadow: none; border: 1px solid rgba(0, 0, 0, .1); }
.ps-is-inline .ps-body { padding: 20px; }

/* ---- animation ---- */
.ps-root:not(.ps-preview):not(.ps-is-inline) .ps-dialog,
.ps-root:not(.ps-preview) .ps-overlay { transition: opacity .2s ease, transform .2s ease; }
.ps-anim-fade:not(.ps-in):not(.ps-preview):not(.ps-is-inline) .ps-dialog { opacity: 0; }
.ps-anim-slide.ps-type-slidein:not(.ps-in):not(.ps-preview) .ps-dialog { opacity: 0; transform: translateY(24px); }
.ps-anim-slide.ps-type-bar.ps-pos-bottom:not(.ps-in):not(.ps-preview) .ps-dialog { transform: translateY(100%); }
.ps-anim-slide.ps-type-bar.ps-pos-top:not(.ps-in):not(.ps-preview) .ps-dialog { transform: translateY(-100%); }
.ps-anim-slide.ps-type-popup:not(.ps-in):not(.ps-preview) .ps-dialog { opacity: 0; transform: translateY(24px); }
.ps-type-popup:not(.ps-in):not(.ps-preview) .ps-overlay { opacity: 0; }
.ps-anim-none .ps-dialog,
.ps-anim-none .ps-overlay { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
	.ps-root .ps-dialog, .ps-root .ps-overlay { transition: none !important; }
}

/* ---- preview (admin) ---- */
.ps-preview .ps-overlay { position: static; background: none; padding: 0; display: block; }
.ps-preview .ps-dialog,
.ps-preview.ps-type-slidein .ps-dialog,
.ps-preview.ps-type-bar .ps-dialog { position: relative; inset: auto; transform: none; margin: 0 auto; width: min(var(--ps-width), 100%); }
.ps-preview.ps-type-bar .ps-dialog { width: 100%; }

/* ---- content ---- */
.ps-close {
	position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
	border: 0; background: transparent; color: inherit; opacity: .55; cursor: pointer;
	font-size: 24px; line-height: 1; border-radius: 50%; padding: 0;
}
.ps-close:hover, .ps-close:focus-visible { opacity: 1; background: rgba(0, 0, 0, .06); }
.ps-title { margin: 0 28px 6px 0; font-size: 1.15em; font-weight: 600; line-height: 1.3; color: inherit; font-family: inherit; }
.ps-desc { margin: 0 0 12px; font-size: .92em; opacity: .8; }
.ps-progress { height: 4px; border-radius: 2px; background: rgba(0, 0, 0, .08); margin: 0 0 14px; overflow: hidden; }
.ps-progress span { display: block; height: 100%; background: var(--ps-primary); transition: width .25s ease; }

.ps-options { display: grid; gap: 8px; margin: 12px 0 4px; }
.ps-opt {
	display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
	border: 1px solid rgba(0, 0, 0, .18); border-radius: calc(var(--ps-radius) * .6); margin: 0;
}
.ps-opt:hover { border-color: var(--ps-primary); }
.ps-opt:has(input:checked) { border-color: var(--ps-primary); background: color-mix(in srgb, var(--ps-primary) 10%, transparent); }
.ps-opt input { accent-color: var(--ps-primary); margin: 0; width: 18px; height: 18px; flex: none; }
.ps-opt-text { font-size: .95em; }

.ps-text {
	display: block; width: 100%; margin: 12px 0 4px; padding: 10px 12px; font: inherit; color: inherit;
	background: transparent; border: 1px solid rgba(0, 0, 0, .25); border-radius: calc(var(--ps-radius) * .6);
}
.ps-text:focus { outline: 2px solid var(--ps-primary); outline-offset: 1px; border-color: var(--ps-primary); }
.ps-other-wrap { margin: 0; }
.ps-other-wrap[hidden] { display: none; }
.ps-other-wrap .ps-text { margin-top: 0; }

.ps-scale-wrap { margin: 14px 0 6px; }
.ps-scale { display: flex; gap: 6px; flex-wrap: wrap; }
.ps-scale-btn {
	flex: 1 1 0; min-width: 40px; padding: 8px 0; cursor: pointer; font: inherit; color: inherit;
	border: 1px solid rgba(0, 0, 0, .2); background: transparent; border-radius: calc(var(--ps-radius) * .6);
}
.ps-scale-btn:hover, .ps-scale-btn:focus-visible { border-color: var(--ps-primary); outline: none; }
.ps-scale-nps .ps-scale-btn { min-width: 30px; padding: 10px 0; font-size: .9em; }
.ps-scale-nps .ps-scale-btn.is-on { background: var(--ps-primary); border-color: var(--ps-primary); color: #fff; }
.ps-scale-rating_star { flex-wrap: nowrap; }
.ps-scale-rating_star .ps-scale-btn { border: 0; font-size: 2em; line-height: 1; padding: 2px 0; color: rgba(0, 0, 0, .22); }
.ps-scale-rating_star .ps-scale-btn.is-on { color: #f59e0b; }
.ps-scale-rating_emoji .ps-scale-btn { font-size: 1.7em; line-height: 1; padding: 8px 0; }
.ps-scale-rating_emoji .ps-scale-btn.is-on { border-color: var(--ps-primary); background: color-mix(in srgb, var(--ps-primary) 12%, transparent); }
.ps-scale-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: .8em; opacity: .7; }

.ps-yesno { display: flex; gap: 10px; margin: 14px 0 6px; }
.ps-yn-btn {
	flex: 1; padding: 10px 12px; cursor: pointer; font: inherit; color: inherit; background: transparent;
	border: 1px solid rgba(0, 0, 0, .2); border-radius: calc(var(--ps-radius) * .6);
}
.ps-yn-btn:hover { border-color: var(--ps-primary); }
.ps-yn-btn.is-on { background: var(--ps-primary); border-color: var(--ps-primary); color: #fff; }

.ps-error { margin: 8px 0 0; color: #b91c1c; font-size: .88em; }
.ps-error[hidden] { display: none; }

.ps-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.ps-btn {
	display: inline-block; padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
	border-radius: calc(var(--ps-radius) * .6); border: 1px solid transparent; line-height: 1.2;
}
.ps-btn-primary { background: var(--ps-primary); color: #fff; }
.ps-btn-primary:hover { filter: brightness(1.08); color: #fff; }
.ps-btn-primary:disabled { opacity: .6; cursor: default; }
.ps-btn-ghost { background: transparent; color: inherit; border-color: rgba(0, 0, 0, .2); }
.ps-btn:focus-visible, .ps-close:focus-visible { outline: 2px solid var(--ps-primary); outline-offset: 2px; }
.ps-cta { margin-top: 12px; }

@media (max-width: 480px) {
	.ps-type-slidein .ps-dialog { left: 8px !important; right: 8px !important; bottom: 8px; width: auto; }
	.ps-body { padding: 20px 16px 16px; }
	.ps-scale-nps { gap: 4px; }
	.ps-scale-nps .ps-scale-btn { min-width: 26px; }
}
