/*
 * Datastead AI Chat: widget styles. Brand red #990000, aligned with the MkDocs sites.
 *
 * The launcher declarations are defensive on purpose. WordPress themes commonly
 * style every <button> on the page with high specificity or !important, which
 * turned the bubble into a pale grey square. Every visual property that a theme
 * is likely to touch is therefore locked down here.
 */

.dsc-root {
	--dsc-brand: #990000;
	--dsc-brand-dark: #7a0000;
	--dsc-border: #e2e2e2;
	--dsc-bg: #ffffff;
	--dsc-user-bg: #f4f4f5;
	--dsc-text: #1f2124;
	--dsc-muted: #6b7076;
	--dsc-code-bg: #1e2126;
	--dsc-inline-height: 520px;
	--dsc-panel-width: 720px;
	--dsc-panel-height: 760px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--dsc-text);
	box-sizing: border-box;
}

.dsc-root *,
.dsc-root *::before,
.dsc-root *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------- launcher */

.dsc-root[data-mode="floating"] {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 999999;
}

.dsc-root[data-mode="floating"] .dsc-launcher {
	position: relative;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 10px;
	height: 58px;
	min-height: 58px;
	width: auto;
	padding: 0 22px !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 29px !important;
	background: var(--dsc-brand) !important;
	background-image: none !important;
	color: #fff !important;
	font-family: inherit !important;
	font-size: 15px !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-decoration: none !important;
	text-shadow: none !important;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .3) !important;
	transition: transform .15s ease, background-color .15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.dsc-root[data-mode="floating"] .dsc-launcher:hover,
.dsc-root[data-mode="floating"] .dsc-launcher:focus {
	background: var(--dsc-brand-dark) !important;
	color: #fff !important;
	transform: translateY(-2px);
	outline: none;
}

/* Round bubble when no label is configured. */
.dsc-root[data-mode="floating"] .dsc-launcher.dsc-icon-only {
	width: 58px;
	padding: 0 !important;
	border-radius: 50% !important;
}

.dsc-launcher svg {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	fill: #fff;
	display: block;
}

.dsc-launcher-label {
	white-space: nowrap;
	color: #fff;
}

/* Attention ring, disabled once the panel has been opened. */
.dsc-launcher::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	border: 2px solid var(--dsc-brand);
	animation: dsc-pulse 2.4s ease-out infinite;
	pointer-events: none;
}

.dsc-root.dsc-seen .dsc-launcher::after {
	display: none;
}

@keyframes dsc-pulse {
	0% {
		opacity: .7;
		transform: scale(1);
	}
	70% {
		opacity: 0;
		transform: scale(1.28);
	}
	100% {
		opacity: 0;
		transform: scale(1.28);
	}
}

@media (prefers-reduced-motion: reduce) {
	.dsc-launcher::after {
		animation: none;
		display: none;
	}
}

/* --------------------------------------------------------------- panel */

.dsc-panel {
	display: flex;
	flex-direction: column;
	background: var(--dsc-bg);
	border: 1px solid var(--dsc-border);
	border-radius: 10px;
	overflow: hidden;
}

.dsc-panel[hidden] {
	display: none;
}

.dsc-root[data-mode="floating"] .dsc-panel {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: var(--dsc-panel-width);
	max-width: calc(100vw - 32px);
	height: var(--dsc-panel-height);
	max-height: calc(100vh - 130px);
	box-shadow: 0 16px 48px rgba(0, 0, 0, .28);
}

/* Full screen mode, toggled from the header. */
.dsc-root[data-mode="floating"] .dsc-panel.dsc-expanded {
	position: fixed;
	right: 24px;
	bottom: 24px;
	width: calc(100vw - 48px);
	max-width: 1280px;
	height: calc(100vh - 48px);
	max-height: calc(100vh - 48px);
}

.dsc-root[data-mode="inline"] .dsc-panel {
	height: var(--dsc-inline-height);
	width: 100%;
}

.dsc-head {
	background: var(--dsc-brand);
	color: #fff;
	padding: 12px 14px;
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	flex: 0 0 auto;
}

.dsc-title {
	flex: 1 1 auto;
}

.dsc-head button {
	background: none !important;
	border: 0 !important;
	color: #fff !important;
	cursor: pointer;
	padding: 2px 6px !important;
	margin: 0 !important;
	line-height: 1 !important;
	border-radius: 4px !important;
	box-shadow: none !important;
	opacity: .85;
	display: inline-flex;
	align-items: center;
}

.dsc-head button:hover {
	opacity: 1;
	background: rgba(255, 255, 255, .15) !important;
}

.dsc-close {
	font-size: 24px !important;
}

.dsc-expand svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
	display: block;
}

.dsc-log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	background: #fbfbfc;
}

.dsc-msg {
	margin: 0 0 14px;
	padding: 11px 14px;
	border-radius: 8px;
	max-width: 88%;
	overflow-wrap: break-word;
	word-break: break-word;
}

.dsc-msg p {
	margin: 0 0 8px;
}

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

.dsc-msg ul {
	margin: 4px 0 8px;
	padding-left: 20px;
}

.dsc-user {
	background: var(--dsc-user-bg);
	margin-left: auto;
	border: 1px solid var(--dsc-border);
}

.dsc-assistant {
	background: #fff;
	border: 1px solid var(--dsc-border);
}

.dsc-pending {
	color: var(--dsc-muted);
	font-style: italic;
}

.dsc-error {
	border-color: #e0b4b4;
	background: #fdf5f5;
	color: #8a2b2b;
}

.dsc-msg a {
	color: var(--dsc-brand);
}

.dsc-msg code {
	background: #f0f0f2;
	padding: 1px 4px;
	border-radius: 3px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
}

.dsc-tools {
	margin-top: 8px;
	font-size: 11px;
	color: var(--dsc-muted);
	border-top: 1px dashed var(--dsc-border);
	padding-top: 6px;
}

/* ----------------------------------------------------------- code block */

.dsc-code {
	margin: 8px 0;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid #2c3037;
}

.dsc-code-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #2c3037;
	color: #c9ccd1;
	font-size: 11px;
	padding: 4px 8px;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.dsc-copy {
	background: none !important;
	border: 1px solid #4a4f57 !important;
	color: #c9ccd1 !important;
	border-radius: 4px !important;
	font-size: 11px !important;
	padding: 2px 8px !important;
	line-height: 1.6 !important;
	cursor: pointer;
	box-shadow: none !important;
	text-transform: none !important;
}

.dsc-copy:hover {
	background: #3a3f47 !important;
}

.dsc-code pre {
	margin: 0;
	padding: 10px 12px;
	background: var(--dsc-code-bg);
	color: #e6e6e6;
	overflow-x: auto;
	border: 0;
	border-radius: 0;
}

.dsc-code code {
	background: none;
	padding: 0;
	color: inherit;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12.5px;
	line-height: 1.45;
	white-space: pre;
}

/* --------------------------------------------------------------- footer */

.dsc-foot {
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid var(--dsc-border);
	background: #fff;
	align-items: flex-end;
}

.dsc-input {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid var(--dsc-border) !important;
	border-radius: 6px !important;
	padding: 10px 12px !important;
	margin: 0 !important;
	font-family: inherit !important;
	font-size: 14px !important;
	line-height: 1.45 !important;
	max-height: 160px;
	background: #fff !important;
	color: var(--dsc-text) !important;
	outline: none;
	box-shadow: none !important;
}

.dsc-input:focus {
	border-color: var(--dsc-brand) !important;
}

.dsc-send {
	background: var(--dsc-brand) !important;
	background-image: none !important;
	color: #fff !important;
	border: 0 !important;
	border-radius: 6px !important;
	padding: 11px 20px !important;
	margin: 0 !important;
	font-family: inherit !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.45 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-shadow: none !important;
	box-shadow: none !important;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.dsc-send:hover:not(:disabled) {
	background: var(--dsc-brand-dark) !important;
}

.dsc-send:disabled,
.dsc-input:disabled {
	opacity: .55;
	cursor: not-allowed;
}

/* The honeypot must stay reachable for bots but invisible for humans. */
.dsc-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
}

@media (max-width: 782px) {
	.dsc-root[data-mode="floating"] .dsc-panel,
	.dsc-root[data-mode="floating"] .dsc-panel.dsc-expanded {
		position: fixed;
		right: 10px;
		left: 10px;
		bottom: 10px;
		width: auto;
		max-width: none;
		height: calc(100vh - 20px);
		max-height: calc(100vh - 20px);
	}

	.dsc-msg {
		max-width: 96%;
	}

	.dsc-expand {
		display: none !important;
	}
}

/* ------------------------------------------------------- Turnstile challenge */

.dsc-verify {
	flex: 0 0 auto;
	padding: 10px 12px 0;
	background: #fff;
	border-top: 1px solid var(--dsc-border);
}

.dsc-verify[hidden] {
	display: none;
}

.dsc-verify-note {
	margin: 0 0 8px;
	font-size: 12.5px;
	color: var(--dsc-muted);
}

.dsc-turnstile {
	min-height: 65px;
}

.dsc-verify + .dsc-foot {
	border-top: 0;
}

/* --------------------------------------------------------------- privacy note */

.dsc-notice {
	flex: 0 0 auto;
	margin: 0;
	padding: 0 12px 9px;
	background: #fff;
	font-size: 11.5px;
	line-height: 1.4;
	color: var(--dsc-muted);
}
