.wpo-float {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: inherit;
}

.wpo-float-bottom-right {
	right: 20px;
}

.wpo-float-bottom-left {
	left: 20px;
}

.wpo-float-launcher {
	width: var( --wpo-float-size, 60px );
	height: var( --wpo-float-size, 60px );
	border-radius: 50%;
	background: var( --wpo-float-color, #111111 );
	border: none;
	box-shadow: 0 4px 18px rgba( 0, 0, 0, 0.28 );
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	padding: 0;
	transition: transform 0.15s ease;
}

.wpo-float-launcher:hover {
	transform: scale( 1.05 );
}

.wpo-float-launcher svg {
	width: 46%;
	height: 46%;
}

.wpo-float-icon-open {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

/* An uploaded icon (image or animated GIF) is very unlikely to already be a clean circle, so it's
   forced into one here: the wrapper clips to a circle and the image covers it completely, rather
   than trying to make the source file circular ahead of time, uploading a plain square or
   rectangular image is enough. */
.wpo-float-icon-wrap {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	overflow: hidden;
}

.wpo-float-icon-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.wpo-float-icon-close {
	display: none;
}

.wpo-float.wpo-float-open .wpo-float-icon-open {
	display: none;
}

.wpo-float.wpo-float-open .wpo-float-icon-close {
	display: block;
}

/* Button text turns the circular icon-only launcher into a pill: icon on the left, label on the
   right, matching the common "Chat with us" style launcher rather than a bare icon. */
.wpo-float-launcher-with-text {
	width: auto;
	height: auto;
	min-height: var( --wpo-float-size, 60px );
	border-radius: calc( var( --wpo-float-size, 60px ) / 2 );
	padding: 8px 20px 8px 8px;
	gap: 10px;
}

.wpo-float-launcher-with-text .wpo-float-icon-open,
.wpo-float-launcher-with-text .wpo-float-icon-close {
	width: calc( var( --wpo-float-size, 60px ) - 16px );
	height: calc( var( --wpo-float-size, 60px ) - 16px );
	flex-shrink: 0;
}

.wpo-float-text {
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
}

.wpo-float-panel {
	display: none;
	flex-direction: column;
	position: absolute;
	bottom: calc( var( --wpo-float-size, 60px ) + 16px );
	width: min( var( --wpo-width, 380px ), calc( 100vw - 40px ) );
	max-width: 380px;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.22 );
	border-radius: 14px;
	overflow: hidden;
	background: #fff;
	animation: wpo-float-in 0.18s ease;
	transition: width 0.2s ease, max-width 0.2s ease;
}

/* Branded header bar: icon + title + History/Expand/Close actions, replacing the shared widget's
   own plain topbar (hidden below) so the floating panel reads as a proper chat launcher header,
   Tidio/Cloudways-style, rather than a bare card with a heading floating inside it. */
.wpo-float-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 14px;
	background: var( --wpo-float-color, #111111 );
	color: #fff;
	flex-shrink: 0;
}

.wpo-float-header-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	flex-shrink: 0;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.18 );
}

.wpo-float-header-icon svg {
	width: 60%;
	height: 60%;
	color: #fff;
}

.wpo-float-header-title {
	flex: 1;
	min-width: 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpo-float-header-actions {
	display: flex;
	align-items: center;
	gap: 2px;
	flex-shrink: 0;
}

/* oracle.css's .wpo-oracle-menu-toggle (reused here for the History button, see below) sets a
   fixed 32x32 box sized for an icon-only hamburger; History carries an icon plus a text label, so
   without an explicit override here it gets squeezed into that same 32px box and the two overlap.
   Both selectors below are two classes / class+type, which beats oracle.css's single-class rule
   on specificity regardless of load order, so this reliably wins. */
.wpo-float-header-actions button,
.wpo-float-header-actions .wpo-oracle-menu-toggle {
	display: flex;
	align-items: center;
	width: auto;
	height: auto;
	gap: 4px;
	border: none;
	background: none;
	color: rgba( 255, 255, 255, 0.85 );
	cursor: pointer;
	padding: 6px 8px;
	border-radius: 6px;
	line-height: 1;
	font-size: 12px;
}

.wpo-float-header-actions button:hover {
	background: rgba( 255, 255, 255, 0.15 );
	color: #fff;
}

.wpo-float-header-actions svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.wpo-float-history-label {
	font-size: 12px;
	font-weight: 600;
}

/* The label reads fine next to an icon on a wide-enough panel, but crowds the other two buttons
   on the default 380px width; icon-only there, label reappears once expanded (more room). */
@media ( max-width: 400px ) {
	.wpo-float-history-label {
		display: none;
	}
}

/* The shared widget markup still renders its own topbar (hamburger + heading); the floating
   panel's dedicated header above replaces it, so it's hidden here rather than removed from the
   shared markup, which the inline [podcast_oracle] shortcode still relies on as-is. */
.wpo-float-panel .wpo-oracle-topbar {
	display: none;
}

.wpo-float-panel .wpo-oracle {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	margin: 0;
	border-radius: 0;
	max-width: none;
	box-shadow: none;
}

.wpo-float-bottom-right .wpo-float-panel {
	right: 0;
}

.wpo-float-bottom-left .wpo-float-panel {
	left: 0;
}

.wpo-float.wpo-float-open .wpo-float-panel {
	display: flex;
}

/* The shared widget's own sidebar behavior (a permanent column on desktop, an overlay that
   slides in from the left under 640px) assumes an inline, full-width embed on a page; squeezed
   into a ~380px floating card, both of those looked broken; an overlay narrower than its own
   "78vw" cap rendered stacked oddly, and z-index/transform edge cases could leave it appearing
   to bleed outside the card's rounded corners. Inside the floating panel, "History" instead
   swaps the whole card between two full-width views, the conversation and the sessions list,
   never both trying to occupy the same space at once, so there's nothing to clip or overlap. */
.wpo-float-panel .wpo-oracle-body {
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

.wpo-float-panel .wpo-oracle-sidebar {
	display: none;
	width: 100%;
	max-width: none;
	flex: 1;
	border-right: none;
	border-radius: 0;
	box-shadow: none;
	max-height: min( calc( var( --wpo-height, 420px ) + 90px ), 70vh );
}

.wpo-float-panel .wpo-oracle.wpo-sidebar-open .wpo-oracle-sidebar {
	display: flex;
}

.wpo-float-panel .wpo-oracle.wpo-sidebar-open .wpo-oracle-main {
	display: none;
}

.wpo-float-panel .wpo-oracle-sidebar-close {
	display: inline-flex;
}

.wpo-float-panel .wpo-oracle-sidebar-backdrop {
	display: none !important;
}

/* Expanded state, toggled by the header's expand button (see float.js). Widens the card and
   raises the message area's height cap; the cap comes from the --wpo-height custom property set
   inline on .wpo-oracle from Settings, which an inline style normally wins against, so this needs
   !important to actually override it here. */
.wpo-float.wpo-float-expanded .wpo-float-panel {
	width: min( 480px, calc( 100vw - 40px ) );
	max-width: 480px;
}

.wpo-float.wpo-float-expanded .wpo-oracle {
	--wpo-height: 640px !important;
}

.wpo-float.wpo-float-expanded .wpo-float-history-label {
	display: inline;
}

@keyframes wpo-float-in {
	from {
		opacity: 0;
		transform: translateY( 12px );
	}
	to {
		opacity: 1;
		transform: translateY( 0 );
	}
}

/* Mobile: a floating card is awkward at phone width, so the panel takes over most of the
   screen instead, matching how Tidio and similar widgets behave on small viewports. */
@media ( max-width: 520px ) {
	.wpo-float {
		bottom: 16px;
	}

	.wpo-float-bottom-right,
	.wpo-float-bottom-left {
		right: 16px;
		left: auto;
	}

	.wpo-float-panel {
		position: fixed;
		top: 16px;
		left: 16px;
		right: 16px;
		bottom: calc( var( --wpo-float-size, 60px ) + 28px );
		width: auto;
		max-width: none;
	}

	.wpo-float-panel .wpo-oracle {
		flex: 1;
		min-height: 0;
		display: flex;
		flex-direction: column;
	}

	.wpo-float-panel .wpo-oracle-body {
		flex: 1;
		min-height: 0;
	}

	.wpo-float-panel .wpo-oracle-messages {
		max-height: none;
		flex: 1;
	}
}
