.wpo-oracle {
	box-sizing: border-box;
	width: 100%;
	max-width: var( --wpo-width, 640px );
	margin: 2em auto;
	border: 1px solid #ddd;
	border-radius: 12px;
	padding: 20px;
	font-family: inherit;
	font-size: var( --wpo-font-size, 14px );
	background: #fafafa;
}

.wpo-oracle *,
.wpo-oracle *::before,
.wpo-oracle *::after {
	box-sizing: border-box;
}

.wpo-oracle-topbar {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}

.wpo-oracle-heading {
	margin: 0;
	font-size: 1.2em;
}

.wpo-oracle-menu-toggle {
	display: none;
	border: 1px solid #ccc;
	background: #fff;
	border-radius: 6px;
	width: 32px;
	height: 32px;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	flex-shrink: 0;
}

.wpo-oracle-body {
	display: flex;
	align-items: stretch;
	gap: 0;
	border: 1px solid #ddd;
	border-radius: 10px;
	background: #fff;
	overflow: hidden;
	position: relative;
}

.wpo-oracle-sidebar {
	width: 190px;
	flex: 0 0 190px;
	border-right: 1px solid #e5e5e5;
	background: #f6f6f6;
	padding: 10px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: min( calc( var( --wpo-height, 420px ) + 90px ), 75vh );
	overflow-y: auto;
}

.wpo-oracle-new-chat {
	border: 1px solid #ccc;
	background: #fff;
	border-radius: 6px;
	padding: 8px 10px;
	font-size: calc( var( --wpo-font-size, 14px ) - 1px );
	font-weight: 600;
	cursor: pointer;
	text-align: left;
}

.wpo-oracle-sessions {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.wpo-session-row {
	display: flex;
	align-items: center;
	gap: 4px;
}

.wpo-session-item {
	flex: 1;
	min-width: 0;
	text-align: left;
	background: none;
	border: none;
	border-radius: 5px;
	padding: 7px 8px;
	font-size: calc( var( --wpo-font-size, 14px ) - 1px );
	color: #333;
	cursor: pointer;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wpo-session-item:hover,
.wpo-session-item.wpo-session-active {
	background: #e8e8e8;
}

.wpo-session-item.wpo-session-active {
	font-weight: 600;
}

.wpo-session-rename {
	flex-shrink: 0;
	background: none;
	border: none;
	cursor: pointer;
	opacity: 0.5;
	padding: 4px;
	font-size: 12px;
}

.wpo-session-rename:hover {
	opacity: 1;
}

.wpo-sessions-empty {
	font-size: 12px;
	color: #888;
	padding: 6px 8px;
}

.wpo-oracle-main {
	flex: 1;
	min-width: 0;
	padding: 16px;
}

.wpo-oracle-sidebar-backdrop {
	display: none;
}

/* Mobile: sidebar becomes an off-canvas panel toggled by the menu button, rather than a
   permanent column that would otherwise eat most of a phone screen's width. */
@media ( max-width: 640px ) {
	.wpo-oracle-menu-toggle {
		display: block;
	}

	.wpo-oracle-body {
		position: relative;
		overflow: visible;
	}

	.wpo-oracle-sidebar {
		position: absolute;
		top: 0;
		left: 0;
		bottom: 0;
		z-index: 3;
		width: 78vw;
		max-width: 260px;
		max-height: none;
		border-radius: 10px 0 0 10px;
		box-shadow: 2px 0 12px rgba( 0, 0, 0, 0.15 );
		transform: translateX( -100% );
		transition: transform 0.2s ease;
	}

	.wpo-oracle.wpo-sidebar-open .wpo-oracle-sidebar {
		transform: translateX( 0 );
	}

	.wpo-oracle-sidebar-backdrop {
		display: none;
		position: absolute;
		inset: 0;
		background: rgba( 0, 0, 0, 0.25 );
		z-index: 2;
	}

	.wpo-oracle.wpo-sidebar-open .wpo-oracle-sidebar-backdrop {
		display: block;
	}

	.wpo-oracle-main {
		padding: 14px;
	}
}

/* Tablet: dimensions still come from Settings, but capped so the widget never dominates a
   mid-size screen regardless of what desktop value is configured. */
@media ( max-width: 768px ) {
	.wpo-oracle {
		padding: 16px;
	}
}

/* Mobile: same idea, tighter cap, and less padding to leave more room for the conversation. */
@media ( max-width: 480px ) {
	.wpo-oracle {
		padding: 12px;
		border-radius: 8px;
	}
	.wpo-oracle-heading {
		font-size: 1.05em;
	}
}

.wpo-oracle .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.wpo-oracle-messages {
	max-height: min( var( --wpo-height, 420px ), 70vh );
	overflow-y: auto;
	margin-bottom: 14px;
}

@media ( max-width: 768px ) {
	.wpo-oracle-messages {
		max-height: min( var( --wpo-height, 420px ), 340px, 60vh );
	}
}

@media ( max-width: 480px ) {
	.wpo-oracle-messages {
		max-height: min( var( --wpo-height, 420px ), 280px, 50vh );
	}
}

.wpo-msg {
	padding: 10px 14px;
	border-radius: 10px;
	margin-bottom: 10px;
	line-height: 1.5;
	max-width: 88%;
}

.wpo-msg p {
	margin: 0 0 10px;
}

.wpo-msg p:last-child {
	margin-bottom: 0;
}

.wpo-msg ul {
	margin: 0 0 10px;
	padding-left: 1.3em;
}

.wpo-msg ul:last-child {
	margin-bottom: 0;
}

.wpo-msg li {
	margin-bottom: 4px;
}

.wpo-msg li:last-child {
	margin-bottom: 0;
}

.wpo-msg-user {
	background: var( --wpo-user-bg, #2a2a2a );
	color: var( --wpo-user-text, #ffffff );
	margin-left: auto;
	text-align: right;
}

.wpo-msg-assistant {
	background: var( --wpo-assistant-bg, #ffffff );
	border: 1px solid #e0e0e0;
	color: var( --wpo-assistant-text, #222222 );
}

.wpo-msg a {
	word-break: break-word;
}

/* Fully configurable under Settings → Link Style. Defaults (bold, underlined, near-black, no
   background) match Wow Digital's own site, which uses no color accent at all, only stark black
   CTA buttons; a generic blue link reads as off-brand there, not just understated. Scoped to
   assistant messages only: a user-chosen colour could have poor contrast against the dark user
   bubble, so that side keeps a fixed white/underlined style regardless of this setting. */
.wpo-msg-assistant a {
	color: var( --wpo-link-color, #111111 );
	background: var( --wpo-link-bg, transparent );
	border: var( --wpo-link-border-width, 0px ) solid var( --wpo-link-border-color, transparent );
	border-radius: var( --wpo-link-radius, 0px );
	padding: var( --wpo-link-padding, 0px );
	font-weight: var( --wpo-link-weight, 700 );
	text-decoration: var( --wpo-link-decoration, underline );
	text-decoration-thickness: 2px;
	text-underline-offset: 2px;
	box-decoration-break: clone;
	-webkit-box-decoration-break: clone;
}

.wpo-msg-assistant a:hover {
	opacity: 0.75;
}

.wpo-msg-user a {
	color: #fff;
	font-weight: 700;
	text-decoration: underline;
	text-decoration-color: #fff;
	text-decoration-thickness: 2px;
	text-underline-offset: 2px;
}

.wpo-msg-user a:hover {
	text-decoration-color: rgba( 255, 255, 255, 0.6 );
}

.wpo-msg-thinking {
	opacity: 0.6;
	font-style: italic;
}

.wpo-msg-error {
	background: #fdeaea;
	border: 1px solid #f3b8b8;
	color: #a12b2b;
}

.wpo-msg-rating {
	margin-top: 8px;
	display: flex;
	gap: 4px;
}

.wpo-rate-btn {
	background: none;
	border: 1px solid transparent;
	border-radius: 5px;
	padding: 2px 6px;
	font-size: calc( var( --wpo-font-size, 14px ) - 1px );
	cursor: pointer;
	opacity: 0.5;
	line-height: 1.4;
}

.wpo-rate-btn:hover {
	opacity: 0.85;
}

.wpo-rate-btn.wpo-rate-active {
	opacity: 1;
	border-color: #ccc;
	background: #f0f0f0;
}

.wpo-oracle-form {
	display: flex;
	gap: 8px;
}

.wpo-oracle-input {
	flex: 1;
	resize: vertical;
	padding: 10px 12px;
	border: 1px solid #ccc;
	border-radius: 8px;
	font-family: inherit;
	font-size: var( --wpo-font-size, 14px );
}

.wpo-oracle-submit {
	padding: 0 20px;
	border: none;
	border-radius: 8px;
	background: #111;
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

.wpo-oracle-submit:disabled {
	opacity: 0.5;
	cursor: default;
}

.wpo-oracle-verify {
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 14px;
	background: #fff;
}

.wpo-verify-intro {
	margin: 0 0 10px;
	font-size: calc( var( --wpo-font-size, 14px ) - 1px );
	color: #444;
}

.wpo-oracle-verify input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	margin-bottom: 8px;
	border: 1px solid #ccc;
	border-radius: 6px;
	font-family: inherit;
	font-size: var( --wpo-font-size, 14px );
}

.wpo-verify-send,
.wpo-verify-confirm {
	padding: 8px 18px;
	border: none;
	border-radius: 6px;
	background: #111;
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

.wpo-verify-send:disabled,
.wpo-verify-confirm:disabled {
	opacity: 0.5;
	cursor: default;
}

.wpo-verify-resend {
	background: none;
	border: none;
	color: #555;
	text-decoration: underline;
	cursor: pointer;
	padding: 8px 10px;
	font-size: calc( var( --wpo-font-size, 14px ) - 1px );
}

.wpo-verify-error {
	margin-top: 8px;
	color: #a12b2b;
	font-size: calc( var( --wpo-font-size, 14px ) - 1px );
	min-height: 1em;
}

@media ( max-width: 480px ) {
	.wpo-oracle-form {
		flex-direction: column;
	}
	.wpo-oracle-submit {
		padding: 10px 20px;
	}
}

.wpo-oracle-powered-by {
	margin-top: 12px;
	text-align: center;
	font-size: 11px;
	color: #999;
}

.wpo-oracle-powered-by a {
	color: inherit;
	text-decoration: underline;
}
