/* Labor Probability Calculator — prefix: lp- */

:root {
	--lp-primary: #8B7BB8;
	--lp-accent: #7BC8B8;
	--lp-text: #3D2F50;
	--lp-text-muted: #695A80;
	--lp-preterm: #e8927c;
	--lp-early: #f0c05a;
	--lp-full: #7BC8B8;
	--lp-late: #b07cc8;
}

/* Personalize section */
.lp-personalize {
	margin-top: 16px;
	border-top: 1px solid rgba(139,123,184,0.10);
	padding-top: 12px;
}
.lp-personalize-toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	background: none;
	border: none;
	font-family: 'Nunito', sans-serif;
	font-size: 16px;
	font-weight: 600;
	color: var(--lp-primary);
	cursor: pointer;
	padding: 4px 0;
	transition: color 0.15s;
}
.lp-personalize-toggle:hover {
	color: var(--lp-text);
}
.lp-personalize-icon {
	font-size: 10px;
	transition: transform 0.2s;
}
.lp-personalize-toggle.open .lp-personalize-icon {
	transform: rotate(180deg);
}
.lp-personalize-body {
	margin-top: 12px;
}
.lp-personalize-note {
	font-size: 16px;
	color: var(--lp-text-muted);
	margin: 0 0 14px;
	line-height: 1.5;
}

/* Detail grid — age, height, weight */
.lp-detail-grid {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 12px;
	margin-bottom: 8px;
}
.lp-detail-field label {
	display: block;
	font-size: 13px;
	font-weight: 700;
	color: var(--lp-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
}
.lp-label-hint {
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
	font-size: 14px;
}
.lp-detail-field input[type="number"] {
	width: 100%;
	padding: 7px 8px;
	border: 1.5px solid rgba(139,123,184,0.18);
	border-radius: 8px;
	font-family: 'Nunito', sans-serif;
	font-size: 16px;
	color: var(--lp-text);
	box-sizing: border-box;
}
.lp-detail-field input[type="number"]:focus {
	border-color: var(--lp-accent);
	outline: none;
}
.lp-compound-input {
	display: flex;
	align-items: center;
	gap: 4px;
}
.lp-compound-input input[type="number"] {
	width: 0;
	flex: 1;
}
.lp-unit {
	font-size: 14px;
	color: var(--lp-text-muted);
}
.lp-unit-switch {
	display: inline-block;
	font-size: 14px;
	color: var(--lp-primary);
	text-decoration: none;
	margin-bottom: 10px;
}
.lp-unit-switch:hover {
	color: var(--lp-text);
}

/* Option rows — Yes/No select dropdowns */
.lp-option-list {
	margin-top: 12px;
	border-top: 1px solid rgba(139,123,184,0.08);
	padding-top: 10px;
}
.lp-option-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 5px 0;
}
.lp-option-row label {
	font-size: 14px;
	color: var(--lp-text);
	text-transform: none;
	letter-spacing: 0;
	font-weight: 400;
	margin-bottom: 0;
}

/* Calculate button */
.lp-calculate-btn {
	display: block;
	width: 100%;
	padding: 14px;
	margin-top: 16px;
	background: linear-gradient(135deg, var(--lp-accent), #5aa898);
	color: #fff;
	border: none;
	border-radius: 10px;
	font-family: 'Nunito', sans-serif;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.15s, box-shadow 0.15s;
}
.lp-calculate-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 16px rgba(90,168,152,0.25);
}

/* Full-width section cards for this page */
.lp-results-card ~ .calc-section-card,
.calc-form-card ~ .calc-section-card {
	max-width: none;
}

/* Results card */
.lp-results-card {
	max-width: 560px;
	margin: -32px auto 24px;
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 8px 32px rgba(61,47,80,0.10);
	padding: 28px 24px 20px;
	text-align: center;
}

/* Gestational age display */
.lp-ga-display {
	margin-bottom: 8px;
}
.lp-ga-label {
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--lp-text-muted);
	font-weight: 700;
}
.lp-ga-value {
	font-size: 26px;
	font-weight: 800;
	color: var(--lp-text);
	margin-top: 4px;
}

/* Due date reminder */
.lp-due-reminder {
	font-size: 16px;
	color: var(--lp-text-muted);
	margin-bottom: 20px;
}
.lp-due-reminder.lp-overdue {
	color: var(--lp-late);
	font-weight: 600;
}
.lp-due-reminder.lp-dueday {
	color: var(--lp-accent);
	font-weight: 700;
}

/* Stats grid (2x2) */
.lp-stats-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-bottom: 16px;
}
.lp-stat {
	background: rgba(139,123,184,0.06);
	border-radius: 12px;
	padding: 14px 8px;
}
.lp-stat-value {
	font-size: 24px;
	font-weight: 800;
	color: var(--lp-text);
}
.lp-stat-label {
	font-size: 14px;
	color: var(--lp-text-muted);
	margin-top: 2px;
	font-weight: 600;
}

/* Chart */
.lp-chart-container {
	min-height: 140px;
}
.lp-chart-bars {
	display: flex;
	align-items: flex-end;
	gap: 1px;
	height: 140px;
}
.lp-bar-wrap {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	height: 100%;
	position: relative;
	cursor: default;
}
.lp-bar {
	width: 100%;
	min-height: 1px;
	border-radius: 2px 2px 0 0;
	transition: opacity 0.15s;
}
.lp-bar-wrap:hover .lp-bar {
	opacity: 0.75;
}
.lp-bar-wrap::after {
	content: attr(data-tip);
	position: absolute;
	bottom: calc(100% + 4px);
	left: 50%;
	transform: translateX(-50%);
	background: var(--lp-text);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: 5px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.1s;
	z-index: 10;
}
.lp-bar-wrap:hover::after {
	opacity: 1;
}

/* Bar colors */
.lp-bar-preterm { background: var(--lp-preterm); }
.lp-bar-early { background: var(--lp-early); }
.lp-bar-full { background: var(--lp-full); }
.lp-bar-late { background: var(--lp-late); }

/* Past bars (before today) */
.lp-bar-past {
	opacity: 0.25;
}

/* Due date bar highlight */
.lp-bar-due {
	box-shadow: inset 0 0 0 2px var(--lp-text);
}
.lp-bar-today {
	box-shadow: inset 0 0 0 2px var(--lp-accent);
}

/* Bar markers */
.lp-bar-marker {
	position: absolute;
	bottom: -18px;
	font-size: 10px;
	font-weight: 700;
	color: var(--lp-text);
	white-space: nowrap;
}
.lp-bar-marker-today {
	color: var(--lp-accent);
}

/* Chart axis */
.lp-chart-axis {
	display: flex;
	justify-content: space-between;
	margin-top: 22px;
	font-size: 11px;
	color: var(--lp-text-muted);
	font-weight: 600;
}

/* Chart legend */
.lp-chart-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 16px;
	font-size: 15px;
	color: var(--lp-text-muted);
}
.lp-legend-item {
	display: flex;
	align-items: center;
	gap: 5px;
}
.lp-legend-dot {
	width: 10px;
	height: 10px;
	border-radius: 2px;
	display: inline-block;
}
.lp-legend-preterm { background: var(--lp-preterm); }
.lp-legend-early { background: var(--lp-early); }
.lp-legend-full { background: var(--lp-full); }
.lp-legend-late { background: var(--lp-late); }

/* Cumulative probability */
.lp-cumul-intro {
	font-size: 16px;
	color: var(--lp-text-muted);
	margin-bottom: 16px;
}
.lp-cumul-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 10px;
}
.lp-cumul-label {
	flex: 0 0 180px;
	font-size: 16px;
	color: var(--lp-text);
	font-weight: 600;
}
.lp-cumul-date {
	display: block;
	font-size: 14px;
	color: var(--lp-text-muted);
	font-weight: 400;
}
.lp-cumul-bar-track {
	flex: 1;
	height: 12px;
	background: rgba(139,123,184,0.08);
	border-radius: 6px;
	overflow: hidden;
}
.lp-cumul-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--lp-accent), var(--lp-primary));
	border-radius: 6px;
	transition: width 0.4s ease-out;
}
.lp-cumul-pct {
	flex: 0 0 52px;
	text-align: right;
	font-size: 16px;
	font-weight: 700;
	color: var(--lp-text);
}

/* Custom date query */
.lp-query {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.lp-query label {
	font-size: 16px;
	font-weight: 400;
	color: var(--lp-text);
}
.lp-query input[type="date"] {
	padding: 8px 12px;
	border: 1.5px solid rgba(139,123,184,0.18);
	border-radius: 8px;
	font-family: 'Nunito', sans-serif;
	font-size: 16px;
	color: var(--lp-text);
}
.lp-query-btn {
	padding: 8px 20px;
	background: var(--lp-accent);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-family: 'Nunito', sans-serif;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.15s;
}
.lp-query-btn:hover {
	background: #5aa898;
}
.lp-query-result {
	margin-top: 14px;
	padding: 14px 18px;
	background: rgba(123,200,184,0.08);
	border-radius: 10px;
	font-size: 16px;
	color: var(--lp-text);
	line-height: 1.5;
}

/* Percentile table */
.lp-percentile-intro {
	font-size: 16px;
	color: var(--lp-text-muted);
	margin-bottom: 16px;
}
.lp-ptable {
	border: 1.5px solid rgba(139,123,184,0.10);
	border-radius: 10px;
	overflow: hidden;
}
.lp-ptable-header {
	display: flex;
	background: rgba(139,123,184,0.06);
	padding: 10px 16px;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-weight: 700;
	color: var(--lp-text-muted);
}
.lp-ptable-header span:first-child { flex: 0 0 120px; }
.lp-ptable-header span:nth-child(2) { flex: 1; }
.lp-ptable-header span:last-child { flex: 0 0 80px; text-align: right; }
.lp-ptable-row {
	display: flex;
	padding: 10px 16px;
	font-size: 16px;
	color: var(--lp-text);
	border-top: 1px solid rgba(139,123,184,0.06);
}
.lp-ptable-row span:first-child { flex: 0 0 120px; font-weight: 600; }
.lp-ptable-row span:nth-child(2) { flex: 1; }
.lp-ptable-row span:last-child { flex: 0 0 80px; text-align: right; color: var(--lp-text-muted); }
.lp-ptable-median {
	background: rgba(123,200,184,0.08);
	font-weight: 700;
}

/* Sources */
.lp-sources ul {
	margin: 0;
	padding: 0 0 0 18px;
	font-size: 16px;
	color: var(--lp-text-muted);
	line-height: 1.7;
}
.lp-sources li {
	margin-bottom: 6px;
}
.lp-sources em {
	font-style: italic;
}

/* Disclaimer */
.lp-disclaimer {
	margin: 16px 0;
	padding: 16px 20px;
	background: rgba(232,146,124,0.06);
	border: 1.5px solid rgba(232,146,124,0.15);
	border-radius: 10px;
	font-size: 15px;
	color: var(--lp-text-muted);
	text-align: center;
	line-height: 1.5;
}

/* FAQ */
.lp-faq {
	margin-bottom: 16px;
}
.lp-faq:last-child {
	margin-bottom: 0;
}
.lp-faq h3 {
	font-size: 15px;
	font-weight: 700;
	color: var(--lp-text);
	margin: 0 0 4px;
}
.lp-faq p {
	font-size: 16px;
	color: var(--lp-text-muted);
	margin: 0;
	line-height: 1.6;
}

/* Mobile */
@media (max-width: 600px) {
	.lp-ga-value {
		font-size: 22px;
	}
	.lp-stat-value {
		font-size: 20px;
	}
	.lp-cumul-row {
		flex-wrap: wrap;
	}
	.lp-cumul-label {
		flex: 0 0 100%;
	}
	.lp-cumul-bar-track {
		flex: 1;
	}
	.lp-cumul-pct {
		flex: 0 0 48px;
	}
	.lp-chart-axis {
		font-size: 10px;
	}
	.lp-ptable-header span:first-child,
	.lp-ptable-row span:first-child {
		flex: 0 0 80px;
	}
	.lp-ptable-row span:last-child,
	.lp-ptable-header span:last-child {
		flex: 0 0 60px;
	}
	.lp-query {
		flex-direction: column;
		align-items: stretch;
	}
	.lp-detail-grid {
		grid-template-columns: 1fr;
	}
}
