/* Scoped under #wtaisc-root — minimal impact on themes */
.wtaisc-widget {
	position: fixed;
	z-index: 999999;
	bottom: 20px;
	inset-inline-end: 20px;
	font-family: inherit;
}

.wtaisc-widget--rtl {
	direction: rtl;
}

.wtaisc-fab {
	width: 56px;
	height: 56px;
	border-radius: 999px;
	border: 0;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	background: #1d4ed8;
	color: #fff;
	font-size: 22px;
	line-height: 1;
}

.wtaisc-panel {
	position: absolute;
	bottom: 72px;
	inset-inline-end: 0;
	width: min(380px, calc(100vw - 40px));
	max-height: min(520px, 70vh);
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-height: 250px;
}

.wtaisc-panel[hidden] {
	display: none !important;
}

.wtaisc-panel-loader {
	position: absolute;
	inset: 0;
	z-index: 30;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 20px;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(2px);
}

.wtaisc-panel-loader[hidden] {
	display: none !important;
}

.wtaisc-panel-loader-spinner {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 3px solid #e5e7eb;
	border-top-color: #1d4ed8;
	animation: wtaisc-spin 0.75s linear infinite;
}

@keyframes wtaisc-spin {
	to {
		transform: rotate(360deg);
	}
}

.wtaisc-panel-loader-text {
	margin: 0;
	font-size: 14px;
	color: #4b5563;
	text-align: center;
}

.wtaisc-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.wtaisc-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 8px 10px;
	border-bottom: 1px solid #e5e7eb;
	background: #f3f4f6;
	flex-shrink: 0;
}

.wtaisc-toolbar[hidden] {
	display: none !important;
}

.wtaisc-toolbar-btn {
	flex: 1 1 auto;
	min-width: 0;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 6px 8px;
	background: #fff;
	color: #111827;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	line-height: 1.3;
}

.wtaisc-toolbar-btn:hover,
.wtaisc-toolbar-btn:focus {
	border-color: #9ca3af;
	background: #111827;
	color: #fff;
}

.wtaisc-toolbar-hint {
	flex: 1 1 100%;
	margin: 0;
	padding: 4px 2px;
	font-size: 13px;
	line-height: 1.45;
	color: #374151;
}

.wtaisc-toolbar-hint[hidden] {
	display: none !important;
}

.wtaisc-toolbar-notice {
	flex: 1 1 100%;
	margin: 0;
	padding: 2px 2px 4px;
	font-size: 12px;
	line-height: 1.4;
	color: #b91c1c;
}

.wtaisc-toolbar-notice[hidden] {
	display: none !important;
}

.wtaisc-threads {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 10px 12px;
	background: #fff;
	min-height: 200px;
}

.wtaisc-threads[hidden] {
	display: none !important;
}

.wtaisc-threads-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wtaisc-threads-empty {
	margin: 0;
	font-size: 14px;
	color: #6b7280;
}

.wtaisc-thread-row {
	width: 100%;
	text-align: start;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 10px 12px;
	background: #f9fafb;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	color: #111827;
}

.wtaisc-thread-row:hover,
.wtaisc-thread-row:focus {
	border-color: #93c5fd;
	background: #111827;
	color: #fff;
}

.wtaisc-chat {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

.wtaisc-chat[hidden] {
	display: none !important;
}

.wtaisc-closed-thread-footer {
	flex-shrink: 0;
	padding: 10px 12px;
	border-top: 1px solid #e5e7eb;
	background: #eff6ff;
}

.wtaisc-closed-thread-footer[hidden] {
	display: none !important;
}

.wtaisc-closed-thread-footer__text {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: #1e3a8a;
	white-space: pre-line;
}

.wtaisc-chat-actions {
	flex-shrink: 0;
	padding: 8px 10px;
	border-top: 1px solid #e5e7eb;
	background: #f3f4f6;
}

.wtaisc-chat-actions[hidden] {
	display: none !important;
}

.wtaisc-end-chat {
	width: 100%;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 8px 10px;
	background: #fff;
	color: #991b1b;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	line-height: 1.3;
}

.wtaisc-end-chat:hover,
.wtaisc-end-chat:focus {
	background: #fef2f2;
	border-color: #fca5a5;
	color: #7f1d1d;
}

.wtaisc-log {
	padding: 12px;
	overflow: auto;
	flex: 1;
	min-height: 0;
	background: #f9fafb;
}

.wtaisc-msg {
	margin: 8px 0;
	padding: 10px 12px;
	border-radius: 10px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-break: break-word;
}

.wtaisc-msg--user {
	background: #dbeafe;
	margin-inline-start: 24px;
}

.wtaisc-msg--bot {
	background: #fff;
	border: 1px solid #e5e7eb;
	margin-inline-end: 24px;
}

.wtaisc-msg--bot a {
	color: #1d4ed8;
	text-decoration: underline;
	word-break: break-all;
}

.wtaisc-msg--bot a:hover,
.wtaisc-msg--bot a:focus {
	color: #1e40af;
}

.wtaisc-form {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: flex-end;
	padding: 10px;
	border-top: 1px solid #e5e7eb;
	background: #fff;
}

.wtaisc-prechat {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #e5e7eb;
	background: #fff;
}

.wtaisc-prechat[hidden],
.wtaisc-form[hidden] {
	display: none !important;
}

.wtaisc-prechat-input {
	flex: 1 1 100%;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 10px 12px;
	font: inherit;
}

.wtaisc-prechat-status {
	flex: 1 1 100%;
	font-size: 13px;
	color: #b91c1c;
}

.wtaisc-prechat-status[hidden] {
	display: none !important;
}

.wtaisc-recaptcha {
	flex: 1 1 100%;
	min-height: 78px;
}

.wtaisc-input {
	flex: 1;
	resize: none;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 8px;
	font: inherit;
}

.wtaisc-send {
	border: 0;
	border-radius: 8px;
	padding: 8px 12px;
	background: #111827;
	color: #fff;
	cursor: pointer;
	font: inherit;
}

.wtaisc-log .wtaisc-rating-slot {
	margin-top: 12px;
	padding: 14px 12px;
	border-top: 1px solid #e5e7eb;
	border-radius: 0 0 10px 10px;
	background: #f3f4f6;
	box-sizing: border-box;
}

.wtaisc-rating-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wtaisc-rating-summary {
	font-size: 14px;
	line-height: 1.45;
	color: #111827;
}

.wtaisc-rating-summary-title {
	margin: 0 0 6px;
	font-weight: 600;
}

.wtaisc-rating-summary-stars {
	margin: 0 0 8px;
	color: #f59e0b;
	letter-spacing: 2px;
}

.wtaisc-rating-summary-label {
	margin: 8px 0 4px;
	font-size: 13px;
	font-weight: 600;
	color: #374151;
}

.wtaisc-rating-summary-comment {
	margin: 0;
	white-space: pre-wrap;
	word-break: break-word;
	color: #1f2937;
}

.wtaisc-rating-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #111827;
	text-align: center;
}

.wtaisc-rating-hint {
	margin: 0;
	font-size: 13px;
	color: #6b7280;
	text-align: center;
}

.wtaisc-rating-stars {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	justify-content: center;
	align-items: center;
}

.wtaisc-rating-star {
	border: 0;
	background: transparent;
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 4px;
	color: #f59e0b;
}

.wtaisc-rating-star:hover,
.wtaisc-rating-star:focus {
	color: #d97706;
	outline: none;
}

.wtaisc-rating-star[aria-pressed='false'] {
	color: #d1d5db;
}

.wtaisc-rating-comment {
	width: 100%;
	min-height: 72px;
	box-sizing: border-box;
	resize: vertical;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 8px;
	font: inherit;
	font-size: 14px;
}

.wtaisc-rating-err {
	min-height: 1.25em;
	font-size: 13px;
	color: #b91c1c;
	text-align: center;
}

.wtaisc-rating-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

.wtaisc-rating-skip {
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 8px 14px;
	background: #fff;
	color: #374151;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.wtaisc-rating-skip:hover,
.wtaisc-rating-skip:focus {
	background: #f9fafb;
	border-color: #9ca3af;
}

@media (max-width: 480px) {
	.wtaisc-widget {
		inset-inline-end: 12px;
		bottom: 12px;
	}
}
