/* ==========================================================================
   Hospice Screening Tool - Main Stylesheet
   ========================================================================== */

:root {
	--hst-primary: var(--e-global-color-primary, #006d77);
	--hst-accent: var(--e-global-color-accent, #83c5be);
	--hst-bg-light: #edf6f9;
	--hst-text-dark: var(--e-global-color-text, #222222);
	--hst-text-medium: var(--e-global-color-text, #555555);
	--hst-text-light: var(--e-global-color-text, #888888);
	--hst-border: #e0e6e8;
	--hst-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Card Container */
.hst-card-container {
	font-family: inherit;
	color: var(--hst-text-dark);
	background-color: #ffffff;
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(0, 109, 119, 0.06);
	border: 1px solid var(--hst-border);
	overflow: hidden;
	margin: 20px auto;
	max-width: 1000px;
	width: 100%;
	box-sizing: border-box;
	position: relative;
	transition: box-shadow 0.3s ease;
}

.hst-card-container * {
	box-sizing: border-box;
}

/* Header */
.hst-card-header {
	background-color: var(--hst-primary);
	padding: 24px 32px;
	border-bottom: 3px solid var(--hst-accent);
}

.hst-header-title {
	color: #ffffff;
	margin: 0;
	font-size: 28px;
	font-weight: 800;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	text-align: left;
}

/* Body Content */
.hst-card-body {
	padding: 32px;
	background-color: #ffffff;
}

/* Two-Column Grid */
.hst-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 40px;
}

.hst-col {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* Section Styling */
.hst-section {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.hst-section-title {
	font-size: 20px;
	font-weight: 700;
	color: var(--hst-primary);
	margin: 0;
	border-bottom: 2px solid var(--hst-bg-light);
	padding-bottom: 8px;
}

.hst-section-subtitle {
	font-size: 13px;
	font-weight: 500;
	color: var(--hst-text-medium);
	font-style: italic;
	margin-top: -8px;
	margin-bottom: 4px;
}

/* Option Items (Checkboxes) */
.hst-options-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.hst-option-item {
	position: relative;
	display: flex;
	align-items: flex-start;
	background-color: #ffffff;
	border: 1px solid var(--hst-border);
	border-radius: 8px;
	padding: 12px 16px;
	transition: var(--hst-transition);
	cursor: pointer;
}

.hst-option-item:hover {
	border-color: var(--hst-accent);
	background-color: var(--hst-bg-light);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 109, 119, 0.03);
}

.hst-option-item.hst-checked {
	border-color: var(--hst-accent);
	background-color: rgba(131, 197, 190, 0.1);
}

.hst-checkbox {
	position: absolute;
	opacity: 0;
	cursor: pointer;
	height: 0;
	width: 0;
}

/* Accessibility: Focus visible outline on the custom checkbox and focus-within highlight on parent card */
.hst-checkbox:focus-visible + .hst-checkbox-label::before {
	outline: 2px solid var(--hst-primary);
	outline-offset: 2px;
	box-shadow: 0 0 0 4px rgba(0, 109, 119, 0.2);
}

.hst-option-item:focus-within {
	border-color: var(--hst-primary) !important;
	box-shadow: 0 4px 12px rgba(0, 109, 119, 0.08) !important;
}

/* Custom Checkbox Label & Box */
.hst-checkbox-label {
	display: flex;
	align-items: flex-start;
	width: 100%;
	font-size: 15px;
	line-height: 1.4;
	font-weight: 500;
	color: var(--hst-text-dark);
	cursor: pointer;
	padding-left: 28px;
	position: relative;
	user-select: none;
}

/* Checkbox Indicator Square */
.hst-checkbox-label::before {
	content: '';
	position: absolute;
	left: 0;
	top: 2px;
	height: 20px;
	width: 20px;
	background-color: #ffffff;
	border: 2px solid var(--hst-border);
	border-radius: 4px;
	transition: var(--hst-transition);
}

/* Checked State of Box */
.hst-checkbox:checked + .hst-checkbox-label::before {
	background-color: var(--hst-primary);
	border-color: var(--hst-primary);
}

/* Checkmark SVG Icon */
.hst-checkbox-label::after {
	content: '';
	position: absolute;
	left: 7px;
	top: 5px;
	width: 6px;
	height: 11px;
	border: solid white;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) scale(0);
	transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hst-checkbox:checked + .hst-checkbox-label::after {
	transform: rotate(45deg) scale(1);
}

.hst-alpha-prefix {
	font-weight: 700;
	color: var(--hst-primary);
	margin-right: 4px;
}

.hst-label-desc {
	font-weight: 400;
	color: var(--hst-text-medium);
	font-size: 14px;
}

/* Section Helper Notes */
.hst-score-helper {
	font-size: 12px;
	font-weight: 700;
	font-style: italic;
	margin-top: 4px;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

.hst-score-helper-two {
	color: var(--hst-primary);
}

.hst-score-helper-one {
	color: #0081a7;
}

/* Dividers */
.hst-divider {
	height: 1px;
	background-color: var(--hst-border);
	margin: 8px 0;
}

/* Radio Cards (Functional Status) */
.hst-radio-list {
	gap: 12px;
}

.hst-radio-card {
	position: relative;
	background-color: #ffffff;
	border: 1px solid var(--hst-border);
	border-radius: 8px;
	transition: var(--hst-transition);
}

.hst-radio-card:hover {
	border-color: var(--hst-accent);
	background-color: var(--hst-bg-light);
}

.hst-radio-card.hst-selected {
	border-color: var(--hst-primary);
	background-color: rgba(0, 109, 119, 0.04);
	box-shadow: 0 4px 12px rgba(0, 109, 119, 0.04);
}

.hst-radio-input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.hst-radio-label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	cursor: pointer;
	width: 100%;
	font-size: 14px;
	line-height: 1.4;
	font-weight: 500;
	padding-left: 36px;
	position: relative;
	user-select: none;
}

/* Radio Indicator Outer Circle */
.hst-radio-label::before {
	content: '';
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	height: 18px;
	width: 18px;
	border-radius: 50%;
	border: 2px solid var(--hst-border);
	background-color: #ffffff;
	transition: var(--hst-transition);
}

.hst-radio-input:checked + .hst-radio-label::before {
	border-color: var(--hst-primary);
}

/* Radio Indicator Inner Dot */
.hst-radio-label::after {
	content: '';
	position: absolute;
	left: 17px;
	top: 50%;
	transform: translateY(-50%) scale(0);
	height: 8px;
	width: 8px;
	border-radius: 50%;
	background-color: var(--hst-primary);
	transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hst-radio-input:checked + .hst-radio-label::after {
	transform: translateY(-50%) scale(1);
}

.hst-radio-text {
	flex-grow: 1;
	padding-right: 12px;
	text-align: left;
}

.hst-radio-badge {
	font-size: 11px;
	font-weight: 700;
	background-color: var(--hst-bg-light);
	color: var(--hst-primary);
	padding: 4px 8px;
	border-radius: 12px;
	white-space: nowrap;
	transition: var(--hst-transition);
}

.hst-radio-input:checked + .hst-radio-label .hst-radio-badge {
	background-color: var(--hst-primary);
	color: #ffffff;
}

/* ==========================================================================
   Dashboard & Live Score Panel
   ========================================================================== */

.hst-dashboard-panel {
	margin-top: 40px;
	background: linear-gradient(135deg, var(--hst-bg-light) 0%, rgba(237, 246, 249, 0.4) 100%);
	border-radius: 12px;
	padding: 24px;
	border: 1px dashed var(--hst-accent);
}

.hst-card-container .hst-dashboard-inner {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	align-items: center !important;
	justify-content: flex-start !important;
	gap: 32px !important;
}

.hst-card-container .hst-score-visualization {
	flex-shrink: 0 !important;
}

.hst-score-ring-container {
	position: relative;
	width: 110px;
	height: 110px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hst-score-ring {
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
}

.hst-score-ring-bg {
	fill: none;
	stroke: rgba(0, 109, 119, 0.08);
	stroke-width: 8;
}

.hst-score-ring-fill {
	fill: none;
	stroke: var(--hst-primary);
	stroke-width: 8;
	stroke-linecap: round;
	transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hst-score-text-container {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.hst-score-value {
	font-size: 36px;
	font-weight: 800;
	color: var(--hst-primary);
	line-height: 1;
	transition: transform 0.15s ease-out;
}

.hst-score-value.hst-pop {
	transform: scale(1.2);
}

.hst-score-lbl {
	font-size: 11px;
	font-weight: 700;
	color: var(--hst-text-medium);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-top: 2px;
}

/* Print-only score display (hidden in screen layout) */
.hst-print-score-display {
	display: none;
}

/* Recommendations Panel */
.hst-card-container .hst-recommendation-panel {
	flex-grow: 1 !important;
}

/* Neutral Message */
.hst-neutral-message {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	background-color: #ffffff;
	border-radius: 8px;
	border: 1px solid var(--hst-border);
	transition: var(--hst-transition);
}

.hst-neutral-icon {
	color: var(--hst-primary);
	display: flex;
}

.hst-neutral-text {
	font-size: 13.5px;
	line-height: 1.4;
	color: var(--hst-text-medium);
	text-align: left;
}

/* Active Recommendations layout */
.hst-recom-container {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

/* Recommendation Box (Dimmed by default) */
.hst-recom-box {
	background-color: #ffffff;
	border: 1px solid var(--hst-border);
	border-radius: 8px;
	padding: 16px;
	text-align: center;
	opacity: 0.35;
	filter: grayscale(1);
	transform: scale(0.98);
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 90px;
}

.hst-recom-header {
	margin-bottom: 6px;
}

.hst-recom-score-rule {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--hst-text-light);
	transition: var(--hst-transition);
}

.hst-recom-action {
	font-size: 16px;
	font-weight: 700;
	color: var(--hst-text-dark);
	transition: var(--hst-transition);
}

/* ACTIVE STATE: Transitions (Score 2-3) */
.hst-recom-box.hst-active-transition {
	opacity: 1;
	filter: none;
	transform: scale(1.03);
	border-color: #ffb703;
	background: linear-gradient(135deg, #ffffff 0%, rgba(255, 183, 3, 0.05) 100%);
	box-shadow: 0 6px 20px rgba(255, 183, 3, 0.12);
}

.hst-recom-box.hst-active-transition .hst-recom-score-rule {
	color: #805300;
}

.hst-recom-box.hst-active-transition .hst-recom-action {
	color: #b27300;
}

/* ACTIVE STATE: Hospice (Score > 3) */
.hst-recom-box.hst-active-hospice {
	opacity: 1;
	filter: none;
	transform: scale(1.03);
	border-color: var(--hst-primary);
	background: linear-gradient(135deg, var(--hst-primary) 0%, rgba(0, 109, 119, 0.85) 100%);
	box-shadow: 0 6px 20px rgba(0, 109, 119, 0.2);
	animation: hst-pulse 2s infinite;
}

.hst-recom-box.hst-active-hospice .hst-recom-score-rule {
	color: #e0f2f1;
}

.hst-recom-box.hst-active-hospice .hst-recom-action {
	color: #ffffff;
}

/* Recommendation Pulse Animation */
@keyframes hst-pulse {
	0% {
		box-shadow: 0 6px 20px rgba(0, 109, 119, 0.2);
	}
	50% {
		box-shadow: 0 6px 24px rgba(0, 109, 119, 0.4);
	}
	100% {
		box-shadow: 0 6px 20px rgba(0, 109, 119, 0.2);
	}
}

/* ==========================================================================
   Action Buttons Panel
   ========================================================================== */

.hst-actions-panel {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 16px;
	margin-top: 32px;
}

.hst-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 700;
	padding: 12px 20px;
	border-radius: 8px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: var(--hst-transition);
	outline: none;
	user-select: none;
}

.hst-btn-icon {
	flex-shrink: 0;
}

.hst-btn-primary {
	background-color: var(--hst-primary);
	color: #ffffff;
}

.hst-btn-primary:hover {
	background-color: #005259;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 109, 119, 0.15);
}

.hst-btn-secondary {
	background-color: #ffffff;
	border-color: var(--hst-primary);
	color: var(--hst-primary);
}

.hst-btn-secondary:hover {
	background-color: var(--hst-bg-light);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 109, 119, 0.05);
}

.hst-btn-link {
	background: none;
	border: none;
	color: var(--hst-text-light);
	font-size: 13px;
	font-weight: 500;
	padding: 8px;
	text-decoration: underline;
}

.hst-btn-link:hover {
	color: var(--hst-text-dark);
}

/* Helper classes */
.hst-hidden {
	display: none !important;
}

/* Clipboard Toast */
.hst-toast {
	position: absolute;
	bottom: 32px;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	background-color: #333333;
	color: #ffffff;
	padding: 10px 20px;
	border-radius: 30px;
	font-size: 13px;
	font-weight: 600;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	z-index: 100;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.hst-toast.hst-show {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

.hst-print-footer {
	display: none;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 768px) {
	.hst-card-header {
		padding: 20px 24px;
	}

	.hst-header-title {
		font-size: 22px;
	}

	.hst-card-body {
		padding: 20px;
	}

	.hst-grid {
		grid-template-columns: 1fr;
		gap: 24px;
	}

	.hst-card-container .hst-dashboard-inner {
		flex-direction: column !important;
		gap: 20px !important;
		align-items: center !important;
	}

	.hst-card-container .hst-score-visualization {
		display: flex !important;
		justify-content: center !important;
		flex-shrink: 0 !important;
	}

	.hst-card-container .hst-recommendation-panel {
		width: 100% !important;
	}

	.hst-card-container .hst-recom-container {
		grid-template-columns: 1fr !important;
		gap: 12px !important;
		width: 100% !important;
	}

	.hst-actions-panel {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}

	.hst-btn {
		width: 100%;
	}

	.hst-btn-link {
		text-align: center;
	}
}

/* ==========================================================================
   Clinical Print Optimization Sheet
   ========================================================================== */

@media print {
	/* Ensure page body is formatted for physical paper/PDF printing */
	html, body {
		background: #ffffff !important;
		color: #000000 !important;
		font-size: 12pt !important;
		height: auto !important;
		overflow: visible !important;
		position: static !important;
	}

	/* Reset standard theme wrappers to prevent print clipping and height issues */
	html, body,
	#page, #content, #primary, #main, 
	.site, .site-content, .site-container,
	.elementor, .elementor-inner, .elementor-section-wrap, .elementor-widget-container,
	main {
		display: block !important;
		position: static !important;
		float: none !important;
		width: 100% !important;
		height: auto !important;
		min-height: 0 !important;
		overflow: visible !important;
		opacity: 1 !important;
		visibility: visible !important;
		box-shadow: none !important;
		background: transparent !important;
	}

	/* Reset all ancestors of the widget container to prevent collapsed heights, 
	   overflow clippings, position issues, or entrance animations from hiding the widget */
	:has(.hst-card-container) {
		display: block !important;
		position: static !important;
		float: none !important;
		width: 100% !important;
		height: auto !important;
		min-height: 0 !important;
		overflow: visible !important;
		opacity: 1 !important;
		visibility: visible !important;
		box-shadow: none !important;
		transform: none !important;
		animation: none !important;
		background: transparent !important;
	}

	/* Hide standard non-essential site elements (unless they contain the widget) */
	header:not(:has(.hst-card-container)),
	footer:not(:has(.hst-card-container)),
	nav:not(:has(.hst-card-container)),
	aside:not(:has(.hst-card-container)),
	sidebar,
	.admin-bar, 
	.hst-actions-panel, 
	.hst-neutral-message, 
	.hst-toast,
	.hst-btn, 
	.hst-score-visualization, 
	.hst-score-helper {
		display: none !important;
	}

	/* Force full visibility of the widget */
	.hst-card-container {
		display: block !important;
		visibility: visible !important;
		opacity: 1 !important;
		border: 1px solid #000000 !important;
		box-shadow: none !important;
		max-width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
		border-radius: 0 !important;
		width: 100% !important;
		overflow: visible !important;
	}

	.hst-card-header {
		background-color: #ffffff !important;
		border-bottom: 2px solid #000000 !important;
		padding: 10px 0 !important;
	}

	.hst-header-title {
		color: #000000 !important;
		font-size: 20pt !important;
		text-align: center !important;
	}

	.hst-card-body {
		padding: 15px 0 !important;
	}

	/* Print Layout: Two Column Grid */
	.hst-grid {
		display: grid !important;
		grid-template-columns: 1.1fr 0.9fr !important;
		gap: 20px !important;
	}

	.hst-section-title {
		font-size: 13pt !important;
		color: #000000 !important;
		border-bottom: 1px solid #000000 !important;
		padding-bottom: 3px !important;
	}

	.hst-section-subtitle {
		font-size: 9.5pt !important;
		color: #555555 !important;
		margin-top: -12px !important;
		margin-bottom: 4px !important;
	}

	/* Reformat unchecked items and keep checked items prominent */
	.hst-option-item {
		border: none !important;
		padding: 2px 0 !important;
		background: none !important;
		margin-bottom: 4px !important;
		transform: none !important;
		box-shadow: none !important;
	}

	.hst-checkbox-label {
		font-size: 10.5pt !important;
		padding-left: 22px !important;
		color: #000000 !important;
	}

	/* Show standard checkboxes in print */
	.hst-checkbox-label::before {
		border: 1px solid #000000 !important;
		background: #ffffff !important;
		border-radius: 0 !important;
		height: 14px !important;
		width: 14px !important;
		top: 1px !important;
	}

	/* Print Checkmark indicator (uses black border checkmark for printing without background graphics) */
	.hst-checkbox:checked + .hst-checkbox-label::before {
		background-color: #ffffff !important;
		border: 1px solid #000000 !important;
	}

	.hst-checkbox:checked + .hst-checkbox-label::after {
		border-color: #000000 !important;
		left: 4px !important;
		top: 3px !important;
		width: 4px !important;
		height: 7px !important;
		transform: rotate(45deg) scale(1) !important;
	}

	/* Radio Button formatting in Print */
	.hst-radio-card {
		border: none !important;
		background: none !important;
		margin-bottom: 4px !important;
	}

	.hst-radio-label {
		font-size: 10.5pt !important;
		padding: 2px 0 2px 22px !important;
		color: #000000 !important;
	}

	.hst-radio-label::before {
		border: 1px solid #000000 !important;
		background: #ffffff !important;
		height: 14px !important;
		width: 14px !important;
		left: 0 !important;
	}

	.hst-radio-input:checked + .hst-radio-label::after {
		background-color: #000000 !important;
		height: 8px !important;
		width: 8px !important;
		left: 3px !important;
	}

	.hst-radio-badge {
		border: 1px solid #000000 !important;
		background: none !important;
		color: #000000 !important;
		font-size: 9pt !important;
		padding: 1px 4px !important;
	}

	/* Dividers */
	.hst-divider {
		border-top: 1px dashed #000000 !important;
		background: none !important;
		margin: 10px 0 !important;
	}

	/* Dashboard Panel reformat in Print */
	.hst-dashboard-panel {
		margin-top: 20px !important;
		background: #ffffff !important;
		border: 1px solid #000000 !important;
		padding: 12px !important;
		border-radius: 0 !important;
	}

	.hst-dashboard-inner {
		flex-direction: row !important;
		justify-content: space-between !important;
		align-items: center !important;
	}

	.hst-print-score-display {
		display: block !important;
		font-size: 13pt !important;
		font-weight: 800 !important;
		color: #000000 !important;
		margin-right: 15px !important;
		white-space: nowrap !important;
	}

	/* Build a simple text-based printed score display */
	.hst-dashboard-inner::before {
		content: "CLINICAL ASSESSMENT RESULT";
		font-weight: 800;
		font-size: 14pt;
		color: #000000;
	}

	/* Clean representation of active recommendations */
	.hst-recom-container {
		grid-template-columns: 1fr !important;
		gap: 8px !important;
		width: 100% !important;
	}

	.hst-recom-box {
		opacity: 0.2 !important;
		filter: grayscale(1) !important;
		border: 1px solid #cccccc !important;
		background: #ffffff !important;
		color: #555555 !important;
		padding: 8px !important;
		min-height: auto !important;
		transform: none !important;
		box-shadow: none !important;
	}

	.hst-recom-box.hst-active-transition,
	.hst-recom-box.hst-active-hospice {
		opacity: 1 !important;
		filter: none !important;
		border: 2px solid #000000 !important;
		background: #f0f0f0 !important;
		color: #000000 !important;
		font-weight: 800 !important;
		transform: none !important;
		animation: none !important;
	}

	.hst-recom-box.hst-active-transition .hst-recom-score-rule,
	.hst-recom-box.hst-active-hospice .hst-recom-score-rule {
		color: #000000 !important;
		font-size: 10pt !important;
	}

	.hst-recom-box.hst-active-transition .hst-recom-action,
	.hst-recom-box.hst-active-hospice .hst-recom-action {
		color: #000000 !important;
		font-size: 13pt !important;
		text-transform: uppercase !important;
	}

	/* Show print footer and signature block */
	.hst-print-footer {
		display: block !important;
		margin-top: 30px !important;
		border-top: 1px solid #000000 !important;
		padding-top: 15px !important;
	}

	.hst-print-meta {
		font-size: 10pt !important;
	}

	.hst-meta-row {
		display: flex !important;
		justify-content: space-between !important;
	}
}
