/**
 * SUNMORTAR — form control primitives.
 *
 * Shared by the HR dashboard and the public intake forms. These live in
 * their own sheet because both screens render `.hr-input` and the
 * searchable dropdown; keeping them in dashboard.css left the public
 * forms with raw browser controls that the theme then restyled.
 *
 * Every rule is scoped under `.sunmv` so a bare theme selector such as
 * `input[type=date]` (0-1-1) cannot outrank us.
 *
 * @package SUNMORTAR_EV
 */

/* ====================================================================
 * Inputs
 * ================================================================= */

.sunmv .hr-input {
	width: 100%;
	min-height: 48px;
	padding: 12px 14px;
	border-radius: 12px;
	border: 1.5px solid color-mix(in srgb, var(--sun-ink) 14%, transparent);
	background: var(--sun-slab);
	color: var(--sun-ink);
	font-family: inherit;
	/* 16px floor stops iOS zooming when someone taps a field on a phone. */
	font-size: 16px;
	line-height: 1.45;
	box-shadow: inset 0 1px 2px rgba(65, 42, 0, 0.04);
	transition: border-color 0.16s var(--sun-ease), box-shadow 0.16s var(--sun-ease);
}

.sunmv textarea.hr-input { min-height: auto; resize: vertical; }

.sunmv .hr-input:focus {
	outline: none;
	border-color: var(--sun-amber);
	background: color-mix(in srgb, #fff 80%, var(--sun-base-1));
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--sun-amber) 20%, transparent);
}

.sunmv .hr-input--file {
	padding: 10px 12px;
	min-height: auto;
	font-size: 14px;
}

/* ====================================================================
 * Searchable dropdowns
 * ================================================================= */

.sunmv .sunmv-combo {
	position: relative;
	min-width: 0;
}

/* The native select still submits the form; it is simply not the thing
   the user points at. */
.sunmv .sunmv-combo__native {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	border: 0;
	opacity: 0;
	pointer-events: none;
}

.sunmv .sunmv-combo__field {
	position: relative;
	display: flex;
	align-items: center;
}

.sunmv .sunmv-combo__input {
	padding-inline-end: 40px;
	cursor: text;
	text-overflow: ellipsis;
}

.sunmv .sunmv-combo__caret {
	position: absolute;
	inset-inline-end: 14px;
	width: 10px;
	height: 10px;
	border-inline-end: 2px solid var(--sun-ink-3);
	border-block-end: 2px solid var(--sun-ink-3);
	transform: rotate(45deg) translateY(-25%);
	pointer-events: auto;
	cursor: pointer;
	transition: transform 0.16s var(--sun-ease);
}

.sunmv .sunmv-combo.is-open .sunmv-combo__caret {
	transform: rotate(-135deg) translateY(-25%);
}

.sunmv .sunmv-combo.is-disabled .sunmv-combo__caret {
	opacity: 0.4;
	cursor: not-allowed;
}

/*
 * The popup is a child of <body>, positioned in viewport coordinates by
 * combobox.js. It has to be, because every card and panel in this app sets
 * backdrop-filter — which creates a stacking context that no descendant
 * z-index can escape — and the table wrappers clip with overflow on top of
 * that. Anchored to the viewport there is no ancestor left to trap it.
 *
 * It carries `.sunmv` so the design tokens resolve out here; that also means
 * the panel's own layout rules land on it and must be undone.
 */
.sunmv.sunmv-combo__list {
	position: fixed;
	/*
	 * Layers in this plugin, low to high: backdrop 0, panel content 1,
	 * sticky sidebar 5, this popup, in-panel toast 99999, lightbox 100000.
	 * 9500 clears theme and Elementor chrome while still letting the WP
	 * admin bar (99999) stay on top, which is where it belongs.
	 */
	z-index: 9500;
	inset: auto;
	width: auto;
	max-height: 17rem;
	overflow-x: hidden;
	overflow-y: auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	border-radius: 14px;
	background: color-mix(in srgb, var(--sun-base-1) 97%, transparent);
	border: 1px solid var(--sun-glass-edge);
	box-shadow: 0 22px 44px -18px rgba(28, 26, 23, 0.5);
	-webkit-backdrop-filter: blur(18px) saturate(170%);
	backdrop-filter: blur(18px) saturate(170%);
	overscroll-behavior: contain;
	font-size: 15px;
	line-height: 1.5;
	text-align: start;
}

.sunmv.sunmv-combo__list[hidden] { display: none; }

/* Opened upward, because there was no room below: throw the shadow the
   other way so it still reads as sitting above the page. */
.sunmv.sunmv-combo__list--up {
	box-shadow: 0 -22px 44px -18px rgba(28, 26, 23, 0.5);
}

.sunmv .sunmv-combo__option {
	padding: 10px 12px;
	border-radius: 9px;
	font-size: 15px;
	line-height: 1.35;
	color: var(--sun-ink);
	cursor: pointer;
}

.sunmv .sunmv-combo__option mark {
	background: color-mix(in srgb, var(--sun-amber) 40%, transparent);
	color: inherit;
	border-radius: 3px;
	padding: 0 1px;
}

.sunmv .sunmv-combo__option.is-active {
	background: color-mix(in srgb, var(--sun-amber) 18%, transparent);
}

.sunmv .sunmv-combo__option.is-selected {
	font-weight: 700;
}

.sunmv .sunmv-combo__option.is-selected::after {
	content: "✓";
	float: inline-end;
	color: var(--sun-amber-deep);
}

.sunmv .sunmv-combo__empty {
	padding: 12px;
	font-size: 14.5px;
	color: var(--sun-ink-3);
	text-align: center;
}

/* ====================================================================
 * Photo framing
 *
 * Also a child of <body>, for the same reason the dropdown is, and it
 * carries `.sunmv` for the same reason too.
 * ================================================================= */

.sunmv.sunmv-crop {
	position: fixed;
	inset: 0;
	z-index: 9600;
	display: grid;
	place-items: center;
	width: auto;
	min-height: 0;
	margin: 0;
	padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
	border-radius: 0;
	background: rgba(20, 17, 12, 0.72);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	overflow: auto;
	animation: sunmv-crop-in 0.18s ease-out both;
}

@keyframes sunmv-crop-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.sunmv .sunmv-crop__box {
	display: grid;
	gap: 16px;
	width: min(420px, 100%);
	padding: clamp(18px, 3vw, 26px);
	border-radius: var(--sun-r-lg);
	background: var(--sun-base-1);
	border: 1px solid var(--sun-glass-edge);
	box-shadow: 0 40px 80px -30px rgba(20, 17, 12, 0.7);
}

.sunmv .sunmv-crop__head { display: grid; gap: 5px; }

.sunmv .sunmv-crop__title {
	margin: 0;
	font-family: var(--sun-font-display);
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--sun-ink);
}

.sunmv .sunmv-crop__hint {
	margin: 0;
	font-size: 14px;
	line-height: 1.45;
	color: var(--sun-ink-3);
	text-wrap: pretty;
}

.sunmv .sunmv-crop__stage {
	justify-self: center;
	border-radius: var(--sun-r-md);
	overflow: hidden;
	border: 1px solid var(--sun-hairline);
	box-shadow: inset 0 1px 3px rgba(65, 42, 0, 0.12);
}

.sunmv .sunmv-crop__canvas {
	display: block;
	width: min(270px, 60vw);
	height: auto;
	cursor: grab;
	touch-action: none;
}

.sunmv .sunmv-crop__canvas.is-dragging { cursor: grabbing; }

.sunmv .sunmv-crop__zoom {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 14px;
	font-weight: 600;
	color: var(--sun-ink-2);
}

.sunmv .sunmv-crop__range {
	flex: 1 1 auto;
	min-width: 0;
	accent-color: var(--sun-amber-deep);
}

.sunmv .sunmv-crop__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding-top: 14px;
	border-top: 1px solid var(--sun-hairline);
}

.sunmv .sunmv-crop__spacer { flex: 1 1 auto; }

@media (prefers-reduced-motion: reduce) {
	.sunmv.sunmv-crop { animation: none; }
}
