/* Interactive Tree Styles for IHP Page */

/* Container styling */
.tree-container {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: 1.1rem;
	max-width: 1180px; 
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;

	position: relative;
	backdrop-filter: blur(4px);
}

.tree-visualization {
	flex: 1 1 55%;
	min-width: 420px; 
	max-width: 660px;
	position: relative;
	background: linear-gradient(180deg, #fffdf9 0%, #f7efde 100%);
	border-radius: 22px;
	padding: 1.1rem 1.1rem 1.4rem;
	box-shadow:
		0 4px 14px -4px rgba(83, 57, 14, 0.28),
		0 2px 3px rgba(0, 0, 0, 0.06);
	border: 2px solid var(--primary-color);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	box-sizing: border-box;
	overflow: hidden;
}

.tree-content {
	flex: 1 1 42%;
	max-width: 470px;
	min-width: 300px;
	padding: 1.85rem 1.65rem 2.1rem;
	background: linear-gradient(180deg, var(--accent) 0%, #5f3699 100%);
	border-radius: 24px;
	box-shadow:
		0 4px 14px -4px rgba(83, 57, 14, 0.3),
		0 2px 3px rgba(0, 0, 0, 0.08);
	border: 2px solid var(--secondary-color);
	color: white;
	box-sizing: border-box;
	position: relative;
	overflow: hidden;
}
#ihp-tree {
	width: 100%;
	height: auto;
	max-width: 600px;
	aspect-ratio: 1 / 1;
}

.tree-visualization.tight {
	padding: 0.6rem 0.6rem 1rem;
}
.tree-visualization.tight #ihp-tree {
	max-width: 640px;
}

.tree-visualization:before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(
		145deg,
		rgba(141, 79, 195, 0.08),
		rgba(83, 57, 14, 0.05)
	);
	pointer-events: none;
	mix-blend-mode: multiply;
}


@media (min-width: 1100px) {
	.tree-content {
		position: sticky;
		top: calc(var(--navbar-offset, 80px) + 1rem);
		max-height: calc(100vh - var(--navbar-offset, 80px) - 2.5rem);
		overflow-y: auto;
	}
	.tree-content::-webkit-scrollbar {
		width: 10px;
	}
	.tree-content::-webkit-scrollbar-track {
		background: rgba(255, 255, 255, 0.08);
		border-radius: 20px;
	}
	.tree-content::-webkit-scrollbar-thumb {
		background: rgba(255, 255, 255, 0.35);
		border-radius: 20px;
		border: 2px solid rgba(255, 255, 255, 0.15);
	}
	.tree-content::-webkit-scrollbar-thumb:hover {
		background: rgba(255, 255, 255, 0.5);
	}
}

.tree-content .content-section h4 {
	font-size: 1.25rem;
	letter-spacing: 0.5px;
}
.tree-content .content-section h5 {
	font-size: 1.05rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}


.tree-content .tree-legend {
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.25);
	backdrop-filter: blur(4px);
}


.progress-indicator {
	background: linear-gradient(135deg, #d4dcb6 0%, #c1d18a 100%);
	border: 2px solid var(--primary-color);
	box-shadow:
		inset 0 1px 4px rgba(0, 0, 0, 0.15),
		0 3px 10px -4px rgba(0, 0, 0, 0.25);
}
.progress-bar {
	background: rgba(255, 255, 255, 0.65);
	height: 14px;
	border-radius: 20px;
}
.progress-fill {
	background: linear-gradient(
		90deg,
		var(--primary-color) 0%,
		var(--accent) 100%
	);
	box-shadow:
		0 0 0 1px rgba(0, 0, 0, 0.06),
		0 1px 2px rgba(0, 0, 0, 0.35);
}
.progress-segments {
	display: flex;
	gap: 6px;
	margin-top: 10px;
	flex-wrap: wrap;
	justify-content: space-between;
}
.progress-segment {
	flex: 1 1 24px;
	max-width: 28px;
	height: 14px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.55);
	border: 2px solid rgba(83, 57, 14, 0.4);
	position: relative;
	overflow: hidden;
	transition: all 0.35s ease;
}
.progress-segment:before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(120deg, var(--primary-color), var(--accent));
	opacity: 0;
	transition: opacity 0.35s ease;
}
.progress-segment.visited {
	border-color: var(--primary-color);
	box-shadow: 0 0 0 2px rgba(141, 79, 195, 0.25);
}
.progress-segment.visited:before {
	opacity: 1;
}

/* Tree buttons enhancement */
.tree-btn {
	position: relative;
	overflow: hidden;
}
.tree-btn:after {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(
		circle at 30% 30%,
		rgba(255, 255, 255, 0.35),
		transparent 70%
	);
	opacity: 0;
	transition: opacity 0.4s ease;
}
.tree-btn:hover:after {
	opacity: 1;
}
.tree-btn.secondary {
	background: linear-gradient(135deg, var(--accent) 0%, #7d4fbf 100%);
}
.tree-btn.secondary:hover {
	filter: brightness(1.1);
}


.tree-svg g:focus {
	outline: 3px solid var(--accent) !important;
	outline-offset: 4px;
	filter: drop-shadow(0 0 6px rgba(141, 79, 195, 0.7));
}


.tree-svg g.active {
	animation: pulseSelect 1.6s ease-in-out infinite;
}
@keyframes pulseSelect {
	0%,
	100% {
		filter: drop-shadow(0 0 6px rgba(141, 79, 195, 0.55));
	}
	50% {
		filter: drop-shadow(0 0 14px rgba(141, 79, 195, 0.85));
	}
}

.visited-checklist {
	margin-top: 1.25rem;
	padding: 0.85rem 0.75rem 0.5rem;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 12px;
}
.visited-checklist h5 {
	margin: 0 0 0.5rem 0;
	font-size: 0.9rem;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	opacity: 0.85;
}
.checklist-ul {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 0.4rem 0.75rem;
	margin: 0;
	padding: 0;
}
.check-item {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.75rem;
	letter-spacing: 0.3px;
	background: rgba(255, 255, 255, 0.08);
	padding: 0.35rem 0.5rem;
	border-radius: 6px;
	position: relative;
	transition:
		background 0.3s ease,
		color 0.3s ease;
}
.check-item .status-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.35);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.check-item.done {
	background: linear-gradient(
		135deg,
		var(--primary-color) 0%,
		var(--accent) 100%
	);
	color: #fff;
	font-weight: 600;
}
.check-item.done .status-dot {
	background: #fff;
	box-shadow:
		0 0 0 2px rgba(255, 255, 255, 0.4),
		0 0 0 4px rgba(255, 255, 255, 0.15);
}


.tree-visualization .tree-controls,
.tree-visualization .progress-indicator {
	width: 100%;
}


#ihp-tree {
	width: 100%;
	height: auto;
	max-width: 600px;
	aspect-ratio: 1 / 1;
}


.tree-visualization object {
	display: block;
	max-width: 100%;
	height: auto;
}


.tree-content h3,
.tree-content h4,
.tree-content h5,
.tree-content p,
.tree-content li {
	color: white !important;
}

.tree-content .content-section h4 {
	color: white !important;
	border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.tree-content .content-section h5 {
	color: rgba(255, 255, 255, 0.9) !important;
}

.tree-content .content-section p {
	color: rgba(255, 255, 255, 0.85) !important;
}

.tree-content .content-section li {
	color: rgba(255, 255, 255, 0.85) !important;
}

.tree-content .content-section li::before {
	color: rgba(255, 255, 255, 0.9) !important;
}


.tree-svg {
	width: 100%;
	height: auto;
	max-height: 800px;
	cursor: pointer;
	transition: transform 0.3s ease;
	user-select: none;
	outline: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	align-items: center;
}


.tree-svg g {
	cursor: pointer;
	transition: all 0.3s ease;
	user-select: none;
	outline: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	opacity: 1;
}

.tree-svg g:hover {
	filter: drop-shadow(0 4px 8px rgba(83, 57, 14, 0.3));
}


.tree-svg g.active {
	filter: drop-shadow(0 0 10px rgba(141, 79, 195, 0.6));
}


.tree-svg text {
	transition: all 0.3s ease;
	user-select: none;
	pointer-events: none; 
	outline: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
}


.tree-svg path {
	transition: all 0.3s ease;
	pointer-events: none; 
	outline: none;
	user-select: none;
}


.tree-svg path {
	transition: all 0.3s ease;
}


.tree-svg path:hover {
	stroke: var(--primary-color);
	stroke-width: 3;
	filter: drop-shadow(0 2px 4px rgba(83, 57, 14, 0.3));
}

.tree-section h3 {
	color: var(--primary-color);
	font-size: 1.5rem;
	margin-bottom: 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--secondary-color);
	font-family: "Montserrat", sans-serif;
	font-weight: 700;
}

/* IMPORTANT: Scope content-section visibility rules to the tree only so
   we don't hide all page sections globally. */
.tree-content .content-section {
	display: none;
	animation: fadeIn 0.5s ease-in-out;
}

.tree-content .content-section.active {
	display: block;
}

.content-section h4 {
	color: white;
	font-size: 1.3rem;
	margin-bottom: 0.75rem;
	font-weight: 600;
	border-bottom: 2px solid var(--alt-background);
	padding-bottom: 0.5rem;
	font-family: "Montserrat", sans-serif;
}

.content-section h5 {
	color: var(--accent);
	font-size: 1.1rem;
	margin-top: 1.5rem;
	margin-bottom: 0.5rem;
	font-weight: 600;
	font-family: "Montserrat", sans-serif;
}

.content-section p {
	line-height: 1.6;
	margin-bottom: 1rem;
	color: var(--text-muted);
	font-family: "Atkinson Hyperlegible", sans-serif;
}

.content-section ul {
	list-style-type: none;
	padding-left: 0;
	margin-bottom: 1.5rem;
}

.content-section li {
	position: relative;
	padding-left: 1.5rem;
	margin-bottom: 0.5rem;
	color: var(--text-muted);
	font-family: "Atkinson Hyperlegible", sans-serif;
}

.content-section li::before {
	content: "▸";
	position: absolute;
	left: 0;
	color: var(--accent);
	font-weight: bold;
}

.stakeholder-details {
	background: rgba(255, 255, 255, 0.2);
	padding: 1rem;
	border-radius: 12px;
	border: 2px solid var(--accent);
	border-left: 6px solid whitesmoke;
	margin-top: 1.5rem;
	box-shadow: var(--shadow-md);
}

.stakeholder-details h5 {
	color: var(--accent) !important;
	font-weight: 700;
	font-size: 1.1rem;
}

.stakeholder-details p {
	color: var(--primary-color) !important;
	font-weight: 500;
	line-height: 1.5;
}

.tree-legend {
	margin-top: 1.5rem;
	padding: 1rem;
	background: var(--background);
	border-radius: 12px;
	border-left: 4px solid var(--primary-color);
	box-shadow: var(--shadow-sm);
}

.tree-legend h4 {
	color: var(--primary-color);
	margin-bottom: 0.5rem;
	font-size: 1rem;
	font-family: "Montserrat", sans-serif;
	font-weight: 600;
}

.tree-legend p {
	font-size: 0.9rem;
	color: var(--text-muted);
	margin: 0;
	font-family: "Atkinson Hyperlegible", sans-serif;
}

.tree-visualization svg *,
.tree-svg *,
object svg *,
object,
#ihp-tree,
#ihp-tree svg * {
	outline: none !important;
	user-select: none !important;
	-webkit-user-select: none !important;
	-moz-user-select: none !important;
	-ms-user-select: none !important;
	-webkit-tap-highlight-color: transparent !important;
	-webkit-touch-callout: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.tree-svg g:focus,
.tree-svg *:focus,
object:focus {
	outline: none !important;
	box-shadow: none !important;
}

::selection {
	background: transparent !important;
}

::-moz-selection {
	background: transparent !important;
}

.tree-svg .node-highlight {
	fill: var(--accent) !important;
	font-weight: bold;
	filter: drop-shadow(0 4px 8px rgba(141, 79, 195, 0.4));
}

.tree-svg .branch-highlight {
	stroke: var(--primary-color) !important;
	stroke-width: 3 !important;
	filter: drop-shadow(0 2px 4px rgba(83, 57, 14, 0.3));
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes pulse {
	0%,
	100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.05);
	}
}

.tree-svg text.pulse {
	animation: pulse 1.5s infinite;
}

.tree-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 300px;
	color: #6c757d;
	font-style: italic;
}

@media (max-width: 900px) {
	.tree-container {
		flex-direction: column;
		flex-wrap: nowrap;
	}
	.tree-visualization,
	.tree-content {
		min-width: 0;
		max-width: 100%;
		flex: 1 1 auto;
	}
	.tree-visualization {
		padding: 1.25rem 1rem 1.5rem;
	}
	.tree-content {
		padding: 1.25rem 1rem 1.75rem;
	}
}

@media (min-width: 1350px) {
	.tree-visualization {
		flex: 0 0 56%;
		max-width: 700px;
	}
	.tree-content {
		flex: 0 0 40%;
		max-width: 520px;
	}
}

.page-wrapper.with-sidebar .tree-container {
	max-width: 1120px;
}

.page-wrapper.with-sidebar .container-wrapper .tree-visualization {
	flex: 1 1 560px;
	min-width: 380px;
	max-width: 640px;
}

.page-wrapper.with-sidebar .container-wrapper .tree-content {
	flex: 0 1 340px;
	min-width: 260px;
}


.page-wrapper.without-sidebar .container-wrapper .tree-visualization {
	flex: 1 1 720px;
	min-width: 480px;
	max-width: 720px;
}

.page-wrapper.without-sidebar .container-wrapper .tree-content {
	flex: 0 1 400px;
	min-width: 300px;
}

@media (max-width: 768px) {
	.tree-container {
		padding: 1rem;
		gap: 1rem;
	}

	.tree-visualization,
	.tree-content {
		padding: 1rem;
	}

	.tree-svg {
		max-height: 400px;
	}

	.tree-section h3 {
		font-size: 1.3rem;
	}
}

.tree-tooltip {
	position: absolute;
	background: var(--primary-color);
	color: var(--background);
	padding: 0.5rem 0.75rem;
	border-radius: 8px;
	font-size: 0.875rem;
	white-space: nowrap;
	z-index: 1000;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.3s ease;
	box-shadow: var(--shadow-md);
	font-family: "Poppins", sans-serif;
	font-weight: 500;
}

.tree-tooltip.show {
	opacity: 1;
}

.progress-indicator {
	margin-top: 1.5rem;
	padding: 1rem;
	background: var(--alt-background);
	border-radius: 12px;
	border: 2px solid var(--primary-color);
	box-shadow: var(--shadow-sm);
}

.progress-indicator p {
	color: white !important;
	font-weight: bold !important;
	font-family: "Montserrat", sans-serif !important;
	font-size: 0.95rem;
	margin: 0 0 0.5rem 0;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.progress-bar {
	width: 100%;
	height: 12px;
	background: white;
	border-radius: 6px;
	overflow: hidden;
	margin-top: 0.5rem;
	border: 2px solid var(--primary-color);
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-fill {
	height: 100%;
	background: var(--primary-color);
	border-radius: 4px;
	transition: width 0.3s ease;
	width: 0%;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tree-controls {
	display: flex;
	gap: 0.5rem;
	margin-top: 1rem;
	flex-wrap: wrap;
}

.tree-btn {
	padding: 0.5rem 1rem;
	background: var(--primary-color);
	color: whitesmoke;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	font-size: 0.875rem;
	transition: all 0.3s ease;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	font-family: "Poppins", sans-serif;
	font-weight: 500;
	box-shadow: var(--shadow-sm);
}

.tree-btn:hover {
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
}

.tree-btn.secondary {
	background: var(--accent);
	color: whitesmoke;
}

.tree-btn.secondary:hover {
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
}

.expandable-section {
	border: 2px solid var(--secondary-color);
	border-radius: 12px;
	margin-bottom: 1rem;
	overflow: hidden;
	box-shadow: var(--shadow-sm);
}

.section-header {
	background: var(--alt-background);
	padding: 1rem;
	cursor: pointer;
	display: flex;
	justify-content: between;
	align-items: center;
	transition: background-color 0.3s ease;
	font-family: "Montserrat", sans-serif;
	font-weight: 500;
	color: var(--text-main);
}

.section-header:hover {
	background: var(--background);
}

.section-content {
	padding: 1rem;
	display: none;
}

.section-content.expanded {
	display: block;
	animation: fadeIn 0.3s ease;
}

.expand-icon {
	transition: transform 0.3s ease;
}

.expand-icon.rotated {
	transform: rotate(90deg);
}

object[data*=".svg"],
object[data*="svg"] {
	pointer-events: auto !important;
	-webkit-user-select: none !important;
	-moz-user-select: none !important;
	-ms-user-select: none !important;
	user-select: none !important;
	outline: none !important;
	border: none !important;
	box-shadow: none !important;
}


* {
	-webkit-tap-highlight-color: transparent !important;
	-webkit-touch-callout: none !important;
}

*::selection {
	background: transparent !important;
	color: inherit !important;
}

*::-moz-selection {
	background: transparent !important;
	color: inherit !important;
}


.tree-visualization,
.tree-svg,
#ihp-tree {
	-webkit-user-drag: none !important;
	-khtml-user-drag: none !important;
	-moz-user-drag: none !important;
	-o-user-drag: none !important;
	-webkit-user-select: none !important;
	-khtml-user-select: none !important;
	-moz-user-select: none !important;
	-o-user-select: none !important;
	user-select: none !important;
}
