/**
 * Sievitalot Chatbot — self-contained widget styles.
 *
 * Everything is prefixed .stcb and sets its own box-sizing/typography so the
 * widget can't be reshaped by (or reshape) the surrounding theme.
 */

.stcb {
	--stcb-accent: #1d4e3f;
	--stcb-accent-text: #fff;
	--stcb-bg: #fff;
	--stcb-text: #23282d;
	--stcb-muted: #667;
	--stcb-border: #e0e0e0;
	--stcb-bot-bubble: #F3F0EE;
	--stcb-radius: 12px;
}

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

/* Floating variant */
.stcb:not(.stcb--inline) {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-size: 15px;
	line-height: 1.5;
	color: var(--stcb-text);
}

.stcb__launcher {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px;
	border: 0;
	border-radius: 999px;
	background: var(--stcb-accent);
	color: var(--stcb-accent-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.stcb__launcher:hover,
.stcb__launcher:focus-visible {
	filter: brightness(1.1);
}

.stcb__launcher-icon {
	display: inline-flex;
}

.stcb__panel {
	display: flex;
	flex-direction: column;
	width: min(360px, calc(100vw - 40px));
	height: min(520px, calc(100vh - 140px));
	overflow: hidden;
	border: 1px solid var(--stcb-border);
	border-radius: var(--stcb-radius);
	background: var(--stcb-bg);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.stcb__panel[hidden] {
	display: none;
}

/* Inline variant — sits in page flow instead of floating. */
.stcb--inline {
	font-size: 15px;
	line-height: 1.5;
	color: var(--stcb-text);
}

.stcb--inline .stcb__panel {
	width: 100%;
	height: 460px;
	box-shadow: none;
}

.stcb__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: var(--stcb-accent);
	color: var(--stcb-accent-text);
}

.stcb__title {
	font-weight: 600;
}

.stcb__close {
	border: 0;
	background: none;
	color: inherit;
	font-size: 24px;
	line-height: 1;
	padding: 0 4px;
	cursor: pointer;
}

/* Back to menu — sits left of the title, mirroring the close button. */
.stcb__back {
	border: 0;
	background: none;
	color: inherit;
	font-size: 20px;
	line-height: 1;
	padding: 0 6px 0 0;
	margin-right: -4px;
	cursor: pointer;
}

.stcb__back[hidden] {
	display: none;
}

.stcb__back:hover,
.stcb__back:focus-visible {
	opacity: 0.75;
}

.stcb__header .stcb__title {
	flex: 1;
}

.stcb__log {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.stcb__msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: var(--stcb-radius);
	overflow-wrap: break-word;
}

.stcb__msg p {
	margin: 0 0 8px;
}

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

.stcb__msg a {
	color: inherit;
}

.stcb__msg--bot {
	align-self: flex-start;
	background: var(--stcb-bot-bubble);
	border-bottom-left-radius: 4px;
}

.stcb__msg--user {
	align-self: flex-end;
	background: var(--stcb-accent);
	color: var(--stcb-accent-text);
	border-bottom-right-radius: 4px;
}

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

.stcb__choices {
	align-self: flex-start;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 6px;
	max-width: 90%;
}

.stcb__choices-label {
	flex-basis: 100%;
	color: var(--stcb-muted);
	font-size: 13px;
}

.stcb__suggestion {
	padding: 7px 12px;
	border: 1px solid var(--stcb-accent);
	border-radius: 999px;
	background: transparent;
	color: var(--stcb-accent);
	font: inherit;
	font-size: 14px;
	text-align: left;
	cursor: pointer;
}

.stcb__suggestion:hover,
.stcb__suggestion:focus-visible {
	background: var(--stcb-accent);
	color: var(--stcb-accent-text);
}

/* Skip reads as secondary — it shouldn't compete with a real answer. */
.stcb__skip {
	border-color: var(--stcb-border);
	color: var(--stcb-muted);
}

.stcb__skip:hover,
.stcb__skip:focus-visible {
	background: var(--stcb-muted);
	color: #fff;
}

/* Dropdown steps (sales territory) */
.stcb__choices--select {
	align-self: stretch;
	flex-wrap: nowrap;
	gap: 8px;
}

.stcb__select {
	flex: 1;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid var(--stcb-border);
	border-radius: 8px;
	background: #fff;
	color: var(--stcb-text);
	font: inherit;
}

.stcb__select:focus {
	outline: 2px solid var(--stcb-accent);
	outline-offset: -1px;
}

/* Consent */
.stcb__consent {
	align-self: flex-start;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	max-width: 90%;
	padding: 10px 14px;
	border: 1px solid var(--stcb-border);
	border-radius: var(--stcb-radius);
}

.stcb__consent-label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-weight: 600;
}



/* Download links — buttons in the log, not in the composer row. */
.stcb__downloads {
	align-self: stretch;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.stcb__download {
	display: block;
	text-align: center;
	padding: 12px 20px;
	border: 1px solid #507f41;
	border-radius: 28px;
	background-color: #507f41;
	color: #f3f0ee;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
	text-decoration: none;
	transition: all ease-in-out 300ms;
}

.stcb__download:hover,
.stcb__download:focus-visible {
	background-color: #37592c;
	color: #f3f0ee;
}

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.stcb__hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.stcb__form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--stcb-border);
	background: var(--stcb-bg);
}

.stcb__input {
	flex: 1;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid var(--stcb-border);
	border-radius: 8px;
	font: inherit;
	color: var(--stcb-text);
	background: #fff;
}

.stcb__input:focus {
	outline: 2px solid var(--stcb-accent);
	outline-offset: -1px;
}

/* Matches the theme's .button.green (see themes/sievitalot/src/sass/theme/
   _typography.scss). Written out rather than inherited because a plugin
   stylesheet cannot reach the theme's variables — if the theme button changes,
   this and the three other form buttons change with it. Note the accent
   variable above is a different green (#1d4e3f) and stays for the chat's own
   chrome; only the button is unified. */
.stcb__send {
	padding: 12px 20px;
	border: 1px solid #507f41;
	border-radius: 28px;
	background-color: #507f41;
	color: #f3f0ee;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
	cursor: pointer;
	transition: all ease-in-out 300ms;
}

.stcb__send:hover,
.stcb__send:focus-visible {
	background-color: #37592c;
	color: #f3f0ee;
}

.stcb__send[disabled] {
	opacity: 0.6;
	cursor: default;
}

.stcb__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 480px) {
	.stcb:not(.stcb--inline) {
		right: 12px;
		bottom: 12px;
	}

	.stcb:not(.stcb--inline) .stcb__panel {
		width: calc(100vw - 24px);
		height: min(70vh, 480px);
	}
}

/* File step */
.stcb__choices--file {
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
}

.stcb__file {
	width: 100%;
	padding: 9px 12px;
	border: 1px dashed var(--stcb-border);
	border-radius: 8px;
	background: #fff;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.stcb__file:disabled { opacity: 0.6; cursor: default; }

.stcb__file-status {
	margin: 0;
	color: var(--stcb-muted);
	font-size: 13px;
}
.stcb__file-status:empty { display: none; }
