/**
 * BWD Support Copilot — popup chat panel styles.
 *
 * Host-agnostic; the accent colour arrives as the --bwdsc-accent custom
 * property set inline on .bwdsc-root by the host's config.
 */

.bwdsc-root {
	--bwdsc-accent: #1b3a6b;
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Launcher button */
.bwdsc-launcher {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--bwdsc-accent);
	color: #fff;
	border: none;
	border-radius: 50px;
	padding: 10px 18px 10px 14px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	transition: filter 0.15s;
}

.bwdsc-launcher:hover {
	filter: brightness(1.15);
}

.bwdsc-launcher__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border: 2px solid #ffffffaa;
	border-radius: 50%;
	font-size: 13px;
	line-height: 1;
}

/* Panel */
.bwdsc-panel {
	position: absolute;
	bottom: 56px;
	right: 0;
	width: 380px;
	max-width: calc(100vw - 48px);
	height: 520px;
	max-height: calc(100vh - 120px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
	overflow: hidden;
}

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

.bwdsc-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	background: var(--bwdsc-accent);
	color: #fff;
	padding: 12px 14px;
}

.bwdsc-panel__header strong {
	display: block;
	font-size: 14px;
}

.bwdsc-panel__subtitle {
	display: block;
	font-size: 11px;
	opacity: 0.8;
}

.bwdsc-panel__header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.bwdsc-newchat {
	background: transparent;
	border: 1px solid #ffffff44;
	border-radius: 3px;
	color: #fff;
	font-size: 11px;
	padding: 3px 8px;
	cursor: pointer;
}

.bwdsc-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 20px;
	line-height: 1;
	padding: 0 4px;
	cursor: pointer;
}

/* Consent view */
.bwdsc-consent {
	padding: 18px;
	overflow-y: auto;
}

.bwdsc-consent[hidden] {
	display: none;
}

.bwdsc-consent h3 {
	margin: 0 0 8px;
	font-size: 14px;
}

.bwdsc-consent p {
	font-size: 12px;
	line-height: 1.55;
	color: #3c434a;
}

.bwdsc-consent__error {
	color: #b32d2e;
	font-weight: 600;
}

/* Onboarding view (unauthorised state) */
.bwdsc-onboard {
	padding: 18px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.bwdsc-onboard[hidden] {
	display: none;
}

.bwdsc-onboard h3 {
	margin: 0;
	font-size: 14px;
}

.bwdsc-onboard__card {
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 12px 14px;
	background: #f6f7f7;
}

.bwdsc-onboard__card p {
	margin: 0 0 10px;
	font-size: 12px;
	line-height: 1.55;
	color: #3c434a;
}

.bwdsc-onboard__cta {
	text-decoration: none;
}

/* BYOK nudge line inside the chat view */
.bwdsc-byokhint {
	border-bottom: 1px solid #dcdcde;
	padding: 6px 14px;
	font-size: 11px;
	background: #f6f7f7;
}

.bwdsc-byokhint a {
	color: #646970;
	text-decoration: underline;
}

/* Chat view */
.bwdsc-chat {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
}

.bwdsc-chat[hidden] {
	display: none;
}

.bwdsc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f6f7f7;
}

.bwdsc-msg {
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 10px;
	font-size: 13px;
	line-height: 1.5;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.bwdsc-msg--user {
	align-self: flex-end;
	background: var(--bwdsc-accent);
	color: #fff;
	border-bottom-right-radius: 2px;
}

.bwdsc-msg--assistant {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #dcdcde;
	color: #1d2327;
	border-bottom-left-radius: 2px;
}

.bwdsc-msg--system {
	align-self: center;
	background: #fcf9e8;
	border: 1px solid #dba617;
	color: #646970;
	font-size: 12px;
}

.bwdsc-msg--thinking {
	color: #646970;
	font-style: italic;
}

.bwdsc-msg__badge {
	display: block;
	margin-top: 6px;
	font-size: 10px;
	color: #646970;
	border-top: 1px dashed #dcdcde;
	padding-top: 4px;
	cursor: help;
}

/* Status line (free-tier allowance) */
.bwdsc-status {
	border-top: 1px solid #dcdcde;
	padding: 6px 14px;
	font-size: 11px;
	color: #646970;
	background: #fcf9e8;
}

.bwdsc-status[hidden] {
	display: none;
}

/* Follow-up strip (escalation / soft gate) */
.bwdsc-followup {
	border-top: 1px solid #dcdcde;
	padding: 8px 14px;
	font-size: 12px;
	color: #646970;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	background: #fff;
}

.bwdsc-followup[hidden] {
	display: none;
}

.bwdsc-followup__softgate {
	flex: 1 1 100%;
}

.bwdsc-followup__anyway {
	font-size: 11px;
	color: #646970;
	text-decoration: underline;
}

.bwdsc-escalate__label {
	flex: 1 1 100%;
	font-weight: 600;
	color: #1d2327;
}

.bwdsc-escalate__email {
	flex: 1 1 100%;
	padding: 4px 8px;
}

.bwdsc-escalate__hint {
	flex: 1 1 100%;
	margin: 2px 0 0;
	font-size: 11px;
}

/* Input row */
.bwdsc-inputrow {
	display: flex;
	gap: 8px;
	padding: 10px 14px;
	border-top: 1px solid #dcdcde;
	background: #fff;
}

.bwdsc-input {
	flex: 1;
	resize: none;
	font-size: 13px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	padding: 6px 8px;
}
