/* Longevity Lab Builder — front-end */

.llb-app {
	--llb-blue: #2563eb;
	--llb-blue-soft: #eff6ff;
	--llb-green: #16a34a;
	--llb-text: #0f172a;
	--llb-muted: #64748b;
	--llb-border: #e2e8f0;
	--llb-bg: #f8fafc;
	--llb-card: #ffffff;
	--llb-danger: #dc2626;
	--llb-radius: 14px;
	--llb-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
	color: var(--llb-text);
	font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
	line-height: 1.45;
	box-sizing: border-box;
}

.llb-app *,
.llb-app *::before,
.llb-app *::after {
	box-sizing: border-box;
}

.llb-loading {
	padding: 40px;
	text-align: center;
	color: var(--llb-muted);
}

.llb-notice {
	padding: 16px 18px;
	border-radius: 10px;
	background: #fff7ed;
	border: 1px solid #fed7aa;
	color: #9a3412;
}

.llb-shell {
	max-width: 1180px;
	margin: 0 auto;
	padding: 8px 0 40px;
}

.llb-header {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	align-items: flex-start;
	margin-bottom: 24px;
}

.llb-title {
	margin: 0 0 6px;
	font-size: 2rem;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.llb-subtitle {
	margin: 0;
	color: var(--llb-muted);
	max-width: 520px;
}

.llb-header__right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
}

.llb-updated {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--llb-muted);
	font-size: 0.92rem;
	white-space: nowrap;
}

.llb-member-picker {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.9rem;
	color: var(--llb-muted);
}

.llb-member-picker select {
	min-width: 180px;
	border: 1px solid var(--llb-border);
	border-radius: 8px;
	padding: 6px 10px;
	background: #fff;
}

.llb-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 280px;
	gap: 24px;
	align-items: start;
}

.llb-shell--dual {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.llb-panel {
	width: 100%;
}

.llb-panel--builder {
	padding-bottom: 8px;
}

.llb-panel--answer {
	padding-top: 8px;
}

.llb-panel-divider {
	height: 1px;
	background: var(--llb-border);
	margin: 32px 0;
}

.llb-layout--builder {
	grid-template-columns: 1fr;
}

.llb-layout--full {
	display: block;
}

.llb-builder-fields {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
	min-width: 0;
}

.llb-main {
	min-width: 0;
}

.llb-sidebar {
	position: sticky;
	top: 24px;
}

.llb-howto {
	background: var(--llb-card);
	border: 1px solid var(--llb-border);
	border-radius: var(--llb-radius);
	padding: 18px 18px 8px;
	box-shadow: var(--llb-shadow);
}

.llb-howto h3 {
	margin: 0 0 14px;
	font-size: 1rem;
}

.llb-howto ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.llb-howto li {
	display: flex;
	gap: 12px;
	margin-bottom: 16px;
}

.llb-howto__icon {
	width: 32px;
	height: 32px;
	border-radius: 999px;
	background: var(--llb-blue-soft);
	color: var(--llb-blue);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}

.llb-howto strong {
	display: block;
	font-size: 0.92rem;
}

.llb-howto p {
	margin: 2px 0 0;
	color: var(--llb-muted);
	font-size: 0.85rem;
}

.llb-viewonly {
	margin: 0 0 12px;
	padding: 10px 12px;
	background: #f1f5f9;
	border-radius: 8px;
	color: var(--llb-muted);
	font-size: 0.85rem;
}

.llb-empty-board {
	border: 2px dashed var(--llb-border);
	border-radius: var(--llb-radius);
	padding: 48px 24px;
	text-align: center;
	background: #fff;
}

.llb-empty-board__icon {
	color: #94a3b8;
	margin-bottom: 12px;
}

.llb-section {
	background: var(--llb-card);
	border: 1px solid var(--llb-border);
	border-radius: var(--llb-radius);
	box-shadow: var(--llb-shadow);
	margin-bottom: 18px;
	overflow: hidden;
	border-top: 3px solid var(--llb-accent, var(--llb-blue));
}

.llb-section__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
}

.llb-section__icon {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.llb-section__collapse,
.llb-collapse-btn {
	appearance: none;
	border: 0;
	background: transparent;
	padding: 0;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex: 1;
	text-align: left;
	cursor: pointer;
	color: inherit;
	min-width: 0;
}

.llb-section__titles,
.llb-subsection__titles {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
}

.llb-section__titles strong,
.llb-subsection__titles strong {
	font-size: 1.05rem;
}

.llb-section__titles span,
.llb-subsection__titles span {
	color: var(--llb-muted);
	font-size: 0.88rem;
}

.llb-chevron {
	transition: transform 0.18s ease;
	color: var(--llb-muted);
	display: inline-flex;
}

.llb-chevron.is-open {
	transform: rotate(180deg);
}

.llb-section__body {
	padding: 8px 16px 16px;
	border-top: 1px solid var(--llb-border);
}

.llb-subsection {
	border: 1px solid var(--llb-border);
	border-radius: 12px;
	margin: 12px 0;
	background: #fff;
	border-left: 4px solid var(--llb-accent, var(--llb-blue));
}

.llb-subsection__head {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 12px 12px 8px;
}

.llb-subsection__body {
	padding: 0 12px 12px;
}

.llb-question {
	border: 1px solid var(--llb-border);
	border-radius: 12px;
	padding: 12px;
	margin: 10px 0;
	background: #fcfcfd;
}

.llb-question__head {
	display: flex;
	gap: 8px;
	align-items: flex-start;
}

.llb-question__main {
	flex: 1;
	min-width: 0;
}

.llb-question__title-row {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}

.llb-qnum {
	font-weight: 700;
}

.llb-qtext {
	font-weight: 600;
	flex: 1;
}

.llb-drag {
	cursor: grab;
	color: #94a3b8;
	display: inline-flex;
	padding-top: 4px;
}

.llb-inline-input {
	border: 1px solid transparent;
	background: transparent;
	border-radius: 8px;
	padding: 4px 8px;
	width: 100%;
	font: inherit;
	color: inherit;
}

.llb-inline-input:hover,
.llb-inline-input:focus {
	border-color: var(--llb-border);
	background: #fff;
	outline: none;
}

.llb-inline-input--title {
	font-weight: 700;
	font-size: 1.05rem;
}

.llb-inline-input--muted {
	color: var(--llb-muted);
	font-size: 0.88rem;
}

.llb-btn,
.llb-text-btn,
.llb-add-answer,
.llb-link,
.llb-view-all {
	appearance: none;
	border: 0;
	background: transparent;
	cursor: pointer;
	font: inherit;
}

.llb-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	border-radius: 10px;
	font-weight: 600;
}

.llb-btn--primary {
	background: var(--llb-blue);
	color: #fff;
}

.llb-btn--primary:hover {
	background: #1d4ed8;
}

.llb-btn--ghost {
	background: #f1f5f9;
	color: var(--llb-text);
}

.llb-text-btn,
.llb-add-answer,
.llb-view-all,
.llb-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--llb-blue);
	font-weight: 600;
	font-size: 0.92rem;
	padding: 4px 0;
}

.llb-link--danger,
.llb-menu__item--danger {
	color: var(--llb-danger) !important;
}

.llb-section__footer-actions,
.llb-section__actions,
.llb-subsection__actions {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
	margin: 4px 0 8px;
}

.llb-add-section-wrap {
	margin-top: 8px;
}

.llb-entries {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.llb-empty-answers {
	border: 1px dashed var(--llb-border);
	border-radius: 10px;
	padding: 22px 12px;
	text-align: center;
	color: var(--llb-muted);
	background: #fff;
}

.llb-empty-answers__icon {
	color: #cbd5e1;
	margin-bottom: 6px;
}

.llb-empty-answers p {
	margin: 0;
	font-size: 0.9rem;
}

.llb-entry {
	border: 1px solid var(--llb-border);
	border-radius: 10px;
	background: #fff;
	overflow: hidden;
}

.llb-entry__toggle {
	width: 100%;
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 12px;
	align-items: center;
	padding: 12px 14px;
	border: 0;
	background: transparent;
	cursor: pointer;
	text-align: left;
	font: inherit;
	color: inherit;
}

.llb-entry.is-open .llb-entry__toggle {
	grid-template-columns: 1fr auto;
	border-bottom: 1px solid var(--llb-border);
}

.llb-entry__stamp {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--llb-muted);
	font-size: 0.86rem;
	white-space: nowrap;
}

.llb-entry__snippet {
	color: var(--llb-text);
	font-size: 0.92rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.llb-entry__chevron {
	color: var(--llb-muted);
	display: inline-flex;
	transition: transform 0.18s ease;
}

.llb-entry.is-open .llb-entry__chevron {
	transform: rotate(180deg);
}

.llb-entry__body {
	padding: 14px;
}

.llb-entry__toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 8px;
}

.llb-entry__field {
	margin-bottom: 12px;
}

.llb-label {
	display: block;
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--llb-muted);
	margin-bottom: 6px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.llb-richtext {
	font-size: 0.95rem;
}

.llb-richtext p {
	margin: 0 0 0.6em;
}

.llb-entry__footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding-top: 8px;
	border-top: 1px solid var(--llb-border);
	color: var(--llb-muted);
	font-size: 0.85rem;
}

.llb-entry-form {
	border: 1px solid #bfdbfe;
	background: var(--llb-blue-soft);
	border-radius: 12px;
	padding: 14px;
	margin-bottom: 8px;
}

.llb-entry-form__title {
	font-weight: 700;
	margin-bottom: 10px;
}

.llb-entry-form__actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 12px;
}

.llb-entry-form .wp-editor-wrap,
.llb-entry-form .mce-tinymce {
	margin-bottom: 10px;
}

.llb-menu {
	position: relative;
	flex: 0 0 auto;
}

.llb-icon-btn {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--llb-muted);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.llb-icon-btn:hover {
	background: rgba(15, 23, 42, 0.06);
}

.llb-menu__panel {
	display: none;
	position: absolute;
	right: 0;
	top: 100%;
	z-index: 20;
	min-width: 180px;
	background: #fff;
	border: 1px solid var(--llb-border);
	border-radius: 10px;
	box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
	padding: 6px;
}

.llb-menu.is-open .llb-menu__panel {
	display: block;
}

.llb-menu__item {
	display: block;
	width: 100%;
	text-align: left;
	border: 0;
	background: transparent;
	padding: 8px 10px;
	border-radius: 8px;
	cursor: pointer;
	font: inherit;
	color: var(--llb-text);
}

.llb-menu__item:hover {
	background: #f8fafc;
}

.llb-sort-placeholder {
	border: 2px dashed #93c5fd;
	border-radius: 12px;
	background: #eff6ff;
	min-height: 56px;
	margin: 10px 0;
}

@media (max-width: 900px) {
	.llb-layout {
		grid-template-columns: 1fr;
	}

	.llb-sidebar {
		position: static;
		order: -1;
	}

	.llb-header {
		flex-direction: column;
	}

	.llb-header__right {
		align-items: flex-start;
	}
}

/* ============================================================
   Builder fields (Admin) — labelled inputs + Save button
   ============================================================ */
.llb-field-label {
	display: block;
	font-size: 0.72rem;
	font-weight: 700;
	color: var(--llb-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin: 6px 0 3px;
}

.llb-field-input {
	width: 100%;
	border: 1px solid var(--llb-border);
	border-radius: 8px;
	padding: 8px 10px;
	font: inherit;
	color: var(--llb-text);
	background: #fff;
}

.llb-field-input:focus {
	outline: none;
	border-color: var(--llb-blue);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.llb-field-input--title {
	font-weight: 600;
}

.llb-builder-fields__save {
	display: flex;
	justify-content: flex-end;
	margin-top: 8px;
}

.llb-btn--save {
	background: var(--llb-blue);
	color: #fff;
	padding: 6px 16px;
	border-radius: 8px;
	font-size: 0.85rem;
	opacity: 0.5;
}

.llb-btn--save.is-active {
	opacity: 1;
}

.llb-btn--save[disabled] {
	cursor: default;
}

.llb-icon-only {
	flex: 0 0 auto;
	width: 32px;
	justify-content: center;
}

/* ============================================================
   Rich text editor (custom, theme-independent)
   ============================================================ */
.llb-rte {
	border: 1px solid var(--llb-border);
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
}

.llb-rte__toolbar {
	display: flex;
	gap: 2px;
	padding: 6px;
	border-bottom: 1px solid var(--llb-border);
	background: #f8fafc;
}

.llb-rte__btn {
	min-width: 30px;
	height: 30px;
	border: 1px solid transparent;
	border-radius: 6px;
	background: transparent;
	cursor: pointer;
	font-size: 0.9rem;
	color: var(--llb-text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 8px;
}

.llb-rte__btn:hover {
	background: #e2e8f0;
}

.llb-rte__hl {
	background: #fde68a;
	padding: 0 3px;
	border-radius: 3px;
	font-weight: 700;
}

.llb-rte__area p {
	margin: 0 0 0.6em;
}

/* Standalone editors (opted-in textareas anywhere on the site). */
.llb-rte--standalone {
	font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
	margin-bottom: 12px;
}

.llb-rte--standalone .llb-rte__btn {
	font-family: inherit !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	box-shadow: none !important;
	min-height: 0 !important;
	line-height: normal !important;
	color: #0f172a !important;
	background: transparent !important;
	border: 1px solid transparent !important;
}

.llb-rte--standalone .llb-rte__btn:hover {
	background: #e2e8f0 !important;
}

.llb-rte--standalone .llb-rte__area {
	background: #fff;
}

.llb-rte__area {
	min-height: 120px;
	padding: 12px 14px;
	font-size: 0.95rem;
	color: var(--llb-text);
	outline: none;
	line-height: 1.5;
}

.llb-rte__area:empty::before {
	content: attr(data-placeholder);
	color: #94a3b8;
	pointer-events: none;
}

.llb-rte__area ul,
.llb-rte__area ol {
	margin: 0 0 0.5em;
	padding-left: 1.4em;
}

/* ============================================================
   THEME OVERRIDES — force plugin styling over the WP theme.
   High specificity (#llb-app) + !important on the essentials.
   ============================================================ */
#llb-app,
#llb-app * {
	box-sizing: border-box;
}

#llb-app {
	color: var(--llb-text) !important;
	font-family: "Segoe UI", system-ui, -apple-system, sans-serif !important;
}

#llb-app h1.llb-title {
	color: var(--llb-text) !important;
	font-size: 2rem !important;
	line-height: 1.2 !important;
	font-weight: 700 !important;
	margin: 0 0 6px !important;
	padding: 0 !important;
	text-transform: none !important;
}

#llb-app .llb-subtitle {
	color: var(--llb-muted) !important;
	text-transform: none !important;
}

/* Neutralise theme button styling, then reapply ours. */
#llb-app button {
	font-family: inherit !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	line-height: normal !important;
	box-shadow: none !important;
	text-shadow: none !important;
	min-height: 0 !important;
	width: auto;
}

#llb-app .llb-btn {
	border: 0 !important;
	border-radius: 10px !important;
	cursor: pointer !important;
}

#llb-app .llb-btn--primary,
#llb-app .llb-btn--save {
	background: var(--llb-blue) !important;
	color: #fff !important;
}

#llb-app .llb-btn--primary:hover,
#llb-app .llb-btn--save.is-active:hover {
	background: #1d4ed8 !important;
}

#llb-app .llb-btn--ghost {
	background: #f1f5f9 !important;
	color: var(--llb-text) !important;
}

#llb-app .llb-text-btn,
#llb-app .llb-add-answer,
#llb-app .llb-view-all,
#llb-app .llb-link {
	background: transparent !important;
	color: var(--llb-blue) !important;
	border: 0 !important;
	box-shadow: none !important;
}

#llb-app .llb-link--danger,
#llb-app .llb-menu__item--danger {
	color: var(--llb-danger) !important;
}

#llb-app input[type="text"],
#llb-app .llb-field-input,
#llb-app .llb-inline-input {
	font-family: inherit !important;
	color: var(--llb-text) !important;
	background: #fff !important;
	line-height: 1.4 !important;
}

#llb-app .llb-inline-input {
	background: transparent !important;
}

#llb-app .llb-section,
#llb-app .llb-subsection,
#llb-app .llb-question,
#llb-app .llb-entry,
#llb-app .llb-howto,
#llb-app .llb-rte {
	color: var(--llb-text) !important;
}

#llb-app a {
	box-shadow: none !important;
}

#llb-app .llb-richtext {
	color: var(--llb-text) !important;
}

#llb-app .llb-richtext ul,
#llb-app .llb-richtext ol {
	margin: 0 0 0.6em !important;
	padding-left: 1.4em !important;
	list-style-position: outside !important;
}

#llb-app .llb-richtext ul { list-style: disc !important; }
#llb-app .llb-richtext ol { list-style: decimal !important; }

/* Builder head alignment (taller labelled fields). */
.llb-panel--builder .llb-section__head,
.llb-shell--builder .llb-section__head,
.llb-panel--builder .llb-subsection__head,
.llb-shell--builder .llb-subsection__head {
	align-items: flex-start;
}

.llb-builder-fields {
	width: 100%;
}

/* "Viewing answers for [member]" banner (Admin/Coach with ?mid=). */
.llb-viewing-member {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #fef9c3;
	border: 1px solid #fde68a;
	color: #854d0e;
	border-radius: 10px;
	padding: 10px 14px;
	margin-bottom: 16px;
	font-size: 0.92rem;
}

.llb-viewing-member strong {
	font-weight: 700;
}
