/* SURFLESSONS4YOU r30 — wizard round 3.
   Pastel #603 (action-bar stability), #608 (flexible-time checkbox + note),
   #615 (template-applied confirmation). Root causes are documented in
   sl4u-r30-wizard3.php; only the mechanics are noted here.
   Loaded on /post-a-lesson/, /onboarding-lesson/, ?post_id=<lesson> and on
   single lesson pages. */

/* ══ #603 — the step-3 action bar ══════════════════════════════════════════
   The floors themselves are set inline by sl4u-r30-wizard3.js from a real
   off-screen measurement of each button's busiest label. These two rules only
   keep the row from rubber-banding around them: nothing in `.ts-form-footer`
   may be the sole flex-grower, and no button may drop below its content. */
@media (min-width: 720px) {
	html body .sl4u-post-lesson .ts-form-footer .sl4u-r6-btn,
	html body .sl4u-post-lesson .ts-form-footer .ts-save-changes {
		flex: 0 0 auto !important;
		white-space: nowrap;
		justify-content: center !important;
	}
	/* `.ts-nextprev` (`flex: 1 1 220px`, sl4u-round4-post-lesson.php:348) was
	   the only growing item in the row, so it rubber-banded on every width
	   change to its right. Pin it and push the action group out with an auto
	   margin instead. */
	html body .sl4u-post-lesson .ts-form-footer .ts-nextprev {
		flex: 0 0 auto !important;
		margin-right: auto !important;
	}
	/* The floors themselves. `--sl4u-r30-w-*` is written on <body> by
	   sl4u-r30-wizard3.js from a real off-screen measurement of each button's
	   busiest label, so a button Vue re-creates mid-save is already the right
	   size on its first layout instead of flickering at its natural width.
	   Until the measurement lands the fallback is 0px, i.e. today's behaviour. */
	html body .sl4u-post-lesson .ts-form-footer .ts-prev          { min-width: var(--sl4u-r30-w-prev,    0px) !important; }
	html body .sl4u-post-lesson .ts-form-footer .ts-next          { min-width: var(--sl4u-r30-w-next,    0px) !important; }
	html body .sl4u-post-lesson .ts-form-footer .sl4u-r6-preview  { min-width: var(--sl4u-r30-w-preview, 0px) !important; }
	html body .sl4u-post-lesson .ts-form-footer .sl4u-r6-tpl      { min-width: var(--sl4u-r30-w-tpl,     0px) !important; }
	html body .sl4u-post-lesson .ts-form-footer .ts-save-changes  { min-width: var(--sl4u-r30-w-publish, 0px) !important; }
	/* Voxel's pending branch takes the label out of flow
	   (`.ts-loader-wrapper { position:absolute }`, forms.css), which is what
	   collapsed Publish to its padding. The floor above already stops that;
	   this only keeps the box from being forced narrower. */
	html body .sl4u-post-lesson .ts-form-footer .ts-save-changes.vx-pending {
		width: auto !important;
	}
}

/* ══ #615 — a list of templates, not a select + three buttons ══════════
   R32 reply: "can it just be blank, template x, template y … and when I click
   on it it simply opens up? no more buttons". The `<select>`, "Use template"
   and the trash button are kept in the DOM (sl4u-slots.php and
   sl4u-r6-fixes.php own them and are still the code path) but are taken off
   screen — `display:none` on a control is enough, and both files only ever
   read/click them programmatically from here.
   `.sl4u-r30-tpl-status` / `.sl4u-r30-tpl-cancel` are gone with the grace
   window they belonged to. */
html body .sl4u-post-lesson .sl4u-tpl-bar .sl4u-tpl-select,
html body .sl4u-post-lesson .sl4u-tpl-bar .sl4u-tpl-use,
html body .sl4u-post-lesson .sl4u-tpl-bar .sl4u-tpl-delete,
html body .sl4u-tpl-bar .sl4u-tpl-select,
html body .sl4u-tpl-bar .sl4u-tpl-use,
html body .sl4u-tpl-bar .sl4u-tpl-delete {
	display: none !important;
}

/* The bar keeps its label on line 1 and carries the list on line 2. */
html body .sl4u-post-lesson .sl4u-tpl-bar { flex-wrap: wrap !important; }

.sl4u-r30-tpllist {
	flex: 1 1 100%;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 2px 0 0;
}
.sl4u-r30-tplrow {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid #E5E7EB;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}
.sl4u-r30-tplrow:hover { border-color: #c7d2fe; }
/* Set the moment a template is applied — the request is a round-trip followed
   by a navigation, and slots.php's own "Loading…" button label is hidden. */
.sl4u-r30-tplrow.is-busy { opacity: .55; pointer-events: none; border-color: #c7d2fe; }
html body .sl4u-post-lesson .sl4u-r30-tplpick,
.sl4u-r30-tplpick {
	appearance: none;
	border: 0;
	background: none;
	box-shadow: none;
	margin: 0;
	padding: 8px 4px 8px 12px;
	font-family: Montserrat, Inter, sans-serif;
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.2;
	color: #1c1917;
	cursor: pointer;
	text-align: left;
	max-width: 260px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.sl4u-r30-tplrow:hover .sl4u-r30-tplpick,
.sl4u-r30-tplpick:hover { color: #2145D9; }
.sl4u-r30-tplpick:focus-visible { outline: 2px solid #2145D9; outline-offset: -2px; }

html body .sl4u-post-lesson .sl4u-r30-tplkill,
.sl4u-r30-tplkill {
	appearance: none;
	border: 0;
	background: none;
	box-shadow: none;
	margin: 0;
	padding: 0 9px 0 6px;
	font-family: Montserrat, Inter, sans-serif;
	font-size: 16px;
	line-height: 1;
	font-weight: 700;
	color: #a8a29e;
	cursor: pointer;
	/* Hidden until the row is hovered or something inside it has focus — but
	   only where hover is real. On touch there is no hover state to reveal it,
	   so it stays visible (the `any-hover` query below is what switches it). */
	opacity: 1;
	transition: opacity .15s ease, color .15s ease;
}
.sl4u-r30-tplkill:hover { color: #b91c1c; }
.sl4u-r30-tplkill:focus-visible { outline: 2px solid #2145D9; outline-offset: -2px; opacity: 1; }
@media (any-hover: hover) {
	.sl4u-r30-tplkill { opacity: 0; }
	.sl4u-r30-tplrow:hover .sl4u-r30-tplkill,
	.sl4u-r30-tplrow:focus-within .sl4u-r30-tplkill { opacity: 1; }
}

.sl4u-r30-toast {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99991;
	max-width: 340px;
	padding: 12px 16px;
	border-radius: 10px;
	background: #ECFDF5;
	color: #047857;
	border: 1px solid #A7F3D0;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
	font-family: Inter, Montserrat, sans-serif;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	opacity: 1;
	transition: opacity .35s ease;
}
.sl4u-r30-toast.is-out { opacity: 0; }
@media (max-width: 719px) {
	.sl4u-r30-toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

/* ══ #608 — "Time is flexible" ═════════════════════════════════════════════
   Sits directly under the picker's date/time row, inside the WHEN card, and
   only renders for Semi-Private / Private (see ensureFlexRow() in the JS). */
.sl4u-post-lesson .sl4u-r30-flex {
	display: flex !important;
	align-items: flex-start;
	gap: 9px;
	margin: 10px 0 0 !important;
	padding: 10px 12px;
	border: 1px solid #e7e5e4;
	border-radius: 10px;
	background: #fafaf9;
	cursor: pointer;
	font-family: Inter, Montserrat, sans-serif;
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.35;
	color: #44403c;
}
.sl4u-post-lesson .sl4u-r30-flex:hover { border-color: #cbd5e1; }
/* The wizard renders Voxel's own `.checkmark` spans and neutralises native
   checkboxes (`appearance:none; border:0`), so an unstyled input here measured
   32x32 and completely invisible. Draw the box explicitly instead of fighting
   for `appearance:auto`, which is what every other tick on this form does. */
.sl4u-post-lesson .sl4u-r30-flex .sl4u-r30-flex-box {
	-webkit-appearance: none !important;
	appearance: none !important;
	box-sizing: border-box !important;
	display: inline-block !important;
	position: relative !important;
	flex: 0 0 16px;
	width: 16px !important;
	height: 16px !important;
	min-width: 16px !important;
	max-width: 16px !important;
	margin: 1px 0 0 !important;
	padding: 0 !important;
	border: 1.5px solid #a8a29e !important;
	border-radius: 4px !important;
	background: #fff !important;
	cursor: pointer;
}
.sl4u-post-lesson .sl4u-r30-flex .sl4u-r30-flex-box:checked {
	background: #2145D9 !important;
	border-color: #2145D9 !important;
}
.sl4u-post-lesson .sl4u-r30-flex .sl4u-r30-flex-box:checked::after {
	content: '';
	position: absolute;
	left: 4px;
	top: 1px;
	width: 4px;
	height: 8px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.sl4u-post-lesson .sl4u-r30-flex .sl4u-r30-flex-box:focus-visible {
	outline: 2px solid #2145D9;
	outline-offset: 2px;
}
.sl4u-post-lesson .sl4u-r30-flex .sl4u-r30-flex-txt { display: block; }

/* Lesson single page — the grey note next to the session time. */
.sl4u-r30-flexnote {
	display: block;
	margin-top: 2px;
	font-family: Inter, Montserrat, sans-serif;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0;
	color: #64748b;
}
