.cwa-widget {
	--cwa-primary-color: #1d4ed8;
	--cwa-secondary-color: #ffffff;
	--cwa-user-message-color: var(--cwa-primary-color);
	box-sizing: border-box;
	color: #1f2937;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 15px;
	position: fixed;
	z-index: 99998;
}

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

.cwa-position-bottom-right {
	bottom: 24px;
	right: 24px;
}

.cwa-position-bottom-left {
	bottom: 24px;
	left: 24px;
}

.cwa-position-top-right {
	right: 24px;
	top: 24px;
}

.cwa-position-top-left {
	left: 24px;
	top: 24px;
}

.cwa-launcher {
	align-items: center;
	background: var(--cwa-primary-color);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 12px 30px rgba(15, 23, 42, 0.24);
	color: var(--cwa-secondary-color);
	cursor: pointer;
	display: flex;
	font-size: 26px;
	font-weight: 700;
	height: 58px;
	justify-content: center;
	line-height: 1;
	width: 58px;
}

.cwa-launcher:focus,
.cwa-header button:focus,
.cwa-choice:focus {
	outline: 3px solid rgba(29, 78, 216, 0.35);
	outline-offset: 2px;
}

.cwa-launcher img {
	display: block;
	height: 34px;
	object-fit: contain;
	width: 34px;
}

.cwa-panel {
	background: #ffffff;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	box-shadow: 0 22px 50px rgba(15, 23, 42, 0.22);
	display: none;
	flex-direction: column;
	max-height: calc(100vh - 32px);
	overflow: hidden;
	width: min(360px, calc(100vw - 32px));
}

.cwa-header {
	align-items: center;
	background: var(--cwa-primary-color);
	color: var(--cwa-secondary-color);
	display: flex;
	gap: 12px;
	justify-content: space-between;
	min-height: 52px;
	padding: 10px 12px 10px 16px;
}

.cwa-header strong {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
}

.cwa-header-actions {
	display: flex;
	gap: 6px;
}

.cwa-header button {
	background: rgba(255, 255, 255, 0.16);
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 6px;
	color: var(--cwa-secondary-color);
	cursor: pointer;
	font-size: 12px;
	line-height: 1;
	padding: 7px 8px;
}

.cwa-messages {
	display: grid;
	flex: 1 1 auto;
	gap: 10px;
	max-height: min(420px, calc(100vh - 220px));
	min-height: 0;
	overflow: auto;
	padding: 16px;
}

.cwa-message {
	border-radius: 8px;
	line-height: 1.45;
	padding: 10px 12px;
}

.cwa-message-assistant {
	background: #f3f4f6;
	color: #1f2937;
}

.cwa-message-user {
	background: var(--cwa-user-message-color);
	color: var(--cwa-secondary-color);
	justify-self: end;
	max-width: 88%;
}

.cwa-message-error {
	background: #fef2f2;
	color: #991b1b;
}

.cwa-learndash-result {
	display: grid;
	gap: 6px;
	margin-top: 8px;
}

.cwa-learndash-result p {
	margin: 0;
}

.cwa-learndash-result ul {
	margin: 0 0 0 18px;
	padding: 0;
}

.cwa-learndash-result li {
	margin: 0 0 5px;
}

.cwa-actions {
	display: grid;
	gap: 8px;
	padding: 0 16px 16px;
}

.cwa-choice {
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	color: #1f2937;
	cursor: pointer;
	display: block;
	font: inherit;
	line-height: 1.35;
	padding: 10px 12px;
	text-align: left;
	text-decoration: none;
	width: 100%;
}

.cwa-choice:hover {
	border-color: var(--cwa-primary-color);
	color: var(--cwa-primary-color);
}

.cwa-choice-secondary {
	background: #f8fafc;
	color: #475569;
}

.cwa-choice:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

.cwa-input {
	border-top: 1px solid #e5e7eb;
	display: none;
	flex: 0 0 auto;
	max-height: min(360px, calc(100vh - 180px));
	overflow: auto;
	padding: 12px 16px;
}

.cwa-input form {
	display: flex;
	gap: 8px;
}

.cwa-input .cwa-identity-form {
	display: grid;
	gap: 10px;
}

.cwa-identity-form label {
	color: #1f2937;
	display: grid;
	font-size: 13px;
	font-weight: 700;
	gap: 5px;
	line-height: 1.3;
}

.cwa-input input {
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	flex: 1;
	font: inherit;
	min-width: 0;
	padding: 9px 10px;
}

.cwa-input button {
	background: var(--cwa-primary-color);
	border: 0;
	border-radius: 6px;
	color: var(--cwa-secondary-color);
	cursor: pointer;
	font: inherit;
	padding: 9px 12px;
}

.cwa-survey-form {
	display: grid;
	gap: 12px;
	width: 100%;
}

.cwa-input .cwa-survey-form {
	display: grid !important;
}

.cwa-survey-question {
	border: 0;
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
}

.cwa-survey-question legend {
	color: #1f2937;
	font-weight: 700;
	line-height: 1.35;
	margin-bottom: 2px;
	padding: 0;
}

.cwa-survey-question label {
	align-items: flex-start;
	display: flex;
	gap: 7px;
	line-height: 1.35;
	width: 100%;
}

.cwa-survey-question input[type="radio"] {
	flex: 0 0 auto;
	margin-top: 2px;
}

.cwa-survey-question textarea {
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font: inherit;
	padding: 9px 10px;
	resize: vertical;
	width: 100%;
}

.cwa-rating-options {
	display: grid;
	gap: 6px;
	grid-template-columns: 1fr;
}

.cwa-rating-options label {
	justify-content: flex-start;
}

.cwa-survey-actions {
	display: grid;
	gap: 8px;
	grid-template-columns: 1fr;
}

.cwa-survey-actions button {
	width: 100%;
}

.cwa-input .cwa-survey-skip {
	background: #ffffff;
	border: 1px solid #cbd5e1;
	color: #1f2937;
}

.cwa-widget[data-state="open"] .cwa-panel,
.cwa-widget[data-state="minimized"] .cwa-panel {
	display: flex;
}

.cwa-widget[data-state="open"] .cwa-launcher,
.cwa-widget[data-state="minimized"] .cwa-launcher {
	display: none;
}

.cwa-widget[data-state="icon"] .cwa-panel,
.cwa-widget[data-state="closed"] .cwa-panel {
	display: none;
}

.cwa-widget[data-state="minimized"] .cwa-panel {
	width: min(280px, calc(100vw - 32px));
}

.cwa-widget[data-state="minimized"] .cwa-messages,
.cwa-widget[data-state="minimized"] .cwa-actions,
.cwa-widget[data-state="minimized"] .cwa-input,
.cwa-widget[data-state="open"] [data-cwa-action="open"] {
	display: none;
}

.cwa-widget[data-state="minimized"] [data-cwa-action="minimize"] {
	display: none;
}

@media (max-width: 480px) {
	.cwa-position-bottom-right,
	.cwa-position-bottom-left {
		bottom: 16px;
		left: 16px;
		right: 16px;
	}

	.cwa-position-top-right,
	.cwa-position-top-left {
		left: 16px;
		right: 16px;
		top: 16px;
	}

	.cwa-launcher {
		margin-left: auto;
	}

	.cwa-panel {
		width: 100%;
	}
}
