/*
 * Fallback values only. The Connector Lines controls in the Style tab
 * write the real values as inline custom properties on this widget's
 * outer Elementor wrapper (an ancestor of .wpda-oce-chart), which this
 * element then inherits. Do not redeclare these here — a local
 * declaration on .wpda-oce-chart itself would permanently win over the
 * inherited, user-configured value from the wrapper.
 */
.wpda-oce-chart {
	box-sizing: border-box;
	max-width: 100%;
}

.wpda-oce-chart *,
.wpda-oce-chart *::before,
.wpda-oce-chart *::after {
	box-sizing: border-box;
}

.wpda-oce-scroll {
	display: flex;
	width: 100%;
}

.wpda-oce-tree {
	display: inline-block;
	position: relative;
}

.wpda-oce-connectors {
	position: absolute;
	top: 0;
	left: 0;
	overflow: visible;
	pointer-events: none;
	z-index: 0;
}

.wpda-oce-level {
	display: flex;
	justify-content: center;
	list-style: none;
	margin: 0;
	padding: 0;
	position: relative;
	z-index: 1;
}

/* ---------------------------------------------------------------- */
/* Vertical orientation (default): each level stacks top to bottom,  */
/* siblings run left to right. Connector lines are drawn by an SVG   */
/* overlay (see frontend.js) computed from each card's actual        */
/* position, so they stay correct through wrapping, resizing and     */
/* collapsing instead of relying on fixed CSS geometry.               */
/* ---------------------------------------------------------------- */

.wpda-oce-level:not(.wpda-oce-level-1) {
	padding-top: var( --wpda-oce-level-gap, 48px );
}

.wpda-oce-node {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 0 16px;
	text-align: center;
	z-index: 1;
}

.wpda-oce-node-inner {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	z-index: 1;
}

.wpda-oce-node-card {
	position: relative;
	display: inline-flex;
	background-color: #ffffff;
	border: 1px solid #e4e7ec;
	border-radius: 10px;
	padding: 16px 18px;
	transition-property: transform, box-shadow, background-color, border-color;
	transition-duration: 200ms;
	transition-timing-function: ease;
}

.wpda-oce-node-card-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
}

.wpda-oce-node-image {
	width: 64px;
	height: 64px;
	object-fit: cover;
	display: block;
	margin-bottom: 10px;
}

.wpda-oce-shape-circle {
	border-radius: 50%;
}

.wpda-oce-shape-rounded {
	border-radius: 12px;
}

.wpda-oce-shape-square {
	border-radius: 0;
}

.wpda-oce-node-title {
	margin: 0 0 4px;
	line-height: 1.3;
}

.wpda-oce-node-description {
	margin: 0;
	line-height: 1.5;
}

.wpda-oce-node-description > *:first-child {
	margin-top: 0;
}

.wpda-oce-node-description > *:last-child {
	margin-bottom: 0;
}

.wpda-oce-node-link {
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

.wpda-oce-toggle {
	appearance: none;
	-webkit-appearance: none;
	margin-top: 10px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 1px solid #c9cdd6;
	background-color: #ffffff;
	color: #4b5563;
	line-height: 1;
	font-size: 14px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.wpda-oce-toggle:focus-visible {
	outline: 2px solid #4b5563;
	outline-offset: 2px;
}

.wpda-oce-collapsible .wpda-oce-node.wpda-oce-collapsed > .wpda-oce-node-inner > .wpda-oce-level {
	display: none;
}

/* ---------------------------------------------------------------- */
/* Horizontal orientation: levels run left to right, siblings stack  */
/* top to bottom within a level, mirroring the rules above.          */
/* ---------------------------------------------------------------- */

.wpda-oce-orientation-horizontal .wpda-oce-scroll {
	overflow-x: auto;
}

.wpda-oce-orientation-horizontal .wpda-oce-tree {
	display: block;
}

.wpda-oce-orientation-horizontal .wpda-oce-node-inner {
	flex-direction: row;
	align-items: center;
}

.wpda-oce-orientation-horizontal .wpda-oce-level {
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
}

.wpda-oce-orientation-horizontal .wpda-oce-level:not(.wpda-oce-level-1) {
	padding-top: 0;
	padding-left: var( --wpda-oce-level-gap, 48px );
}

.wpda-oce-orientation-horizontal .wpda-oce-node {
	padding: 10px 0;
}

.wpda-oce-orientation-horizontal .wpda-oce-toggle {
	margin-top: 0;
	margin-left: 10px;
}

/* ---------------------------------------------------------------- */
/* Mobile override: a horizontal chart automatically falls back to   */
/* the vertical layout below the mobile breakpoint, since a          */
/* left-to-right tree rarely fits a narrow viewport. Enabling         */
/* "Keep Horizontal Layout on Mobile" in the widget adds the          */
/* .wpda-oce-allow-horizontal-mobile class, which opts back out of   */
/* every rule in this block. frontend.js listens for this breakpoint  */
/* too, so connector lines reroute to match automatically.            */
/* ---------------------------------------------------------------- */

@media (max-width: 767px) {
	.wpda-oce-orientation-horizontal:not(.wpda-oce-allow-horizontal-mobile) .wpda-oce-scroll {
		overflow-x: auto;
	}

	.wpda-oce-orientation-horizontal:not(.wpda-oce-allow-horizontal-mobile) .wpda-oce-node-inner {
		flex-direction: column;
		align-items: center;
	}

	.wpda-oce-orientation-horizontal:not(.wpda-oce-allow-horizontal-mobile) .wpda-oce-level {
		flex-direction: row;
		align-items: flex-start;
		justify-content: center;
	}

	.wpda-oce-orientation-horizontal:not(.wpda-oce-allow-horizontal-mobile) .wpda-oce-level:not(.wpda-oce-level-1) {
		padding-top: var( --wpda-oce-level-gap, 48px );
		padding-left: 0;
	}

	.wpda-oce-orientation-horizontal:not(.wpda-oce-allow-horizontal-mobile) .wpda-oce-node {
		padding: 0 12px;
	}

	.wpda-oce-orientation-horizontal:not(.wpda-oce-allow-horizontal-mobile) .wpda-oce-toggle {
		margin-top: 10px;
		margin-left: 0;
	}
}

/* ---------------------------------------------------------------- */
/* General small-screen safety nets, independent of orientation.     */
/* ---------------------------------------------------------------- */

@media (max-width: 767px) {
	.wpda-oce-chart:not(.wpda-oce-orientation-horizontal) .wpda-oce-scroll {
		overflow-x: auto;
	}
}

.wpda-oce-node-title,
.wpda-oce-node-description {
	overflow-wrap: break-word;
	word-break: break-word;
}

.wpda-oce-placeholder {
	padding: 40px 20px;
	text-align: center;
	border: 1px dashed #c9cdd6;
	border-radius: 8px;
	color: #6b7280;
}
