#swpc-widget {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#swpc-widget.swpc-right { right: 20px; }
#swpc-widget.swpc-left { left: 20px; }
#swpc-widget *,
#swpc-widget *::before,
#swpc-widget *::after { box-sizing: border-box; }

#swpc-bubble {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--swpc-color, #2563eb);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0,0,0,.2);
	border: none;
	font-size: 26px;
	padding: 0;
}
#swpc-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	border: 2px solid #fff;
}

#swpc-window {
	display: none;
	flex-direction: column;
	width: 340px;
	height: 460px;
	max-height: 75vh;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(0,0,0,.25);
	overflow: hidden;
	position: absolute;
	bottom: 74px;
}
#swpc-widget.swpc-right #swpc-window,
#swpc-widget.swpc-right #swpc-toast { right: 0; }
#swpc-widget.swpc-left #swpc-window,
#swpc-widget.swpc-left #swpc-toast { left: 0; }
#swpc-widget.swpc-open #swpc-window { display: flex; }

#swpc-header {
	background: var(--swpc-color, #2563eb);
	color: #fff;
	padding: 12px 14px;
	font-weight: 600;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.swpc-identity {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}
#swpc-title {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.swpc-avatar {
	position: relative;
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #fff;
	color: var(--swpc-color, #2563eb);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.swpc-avatar svg {
	width: 60%;
	height: 60%;
}
.swpc-avatar img {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}
.swpc-avatar.swpc-has-img {
	background: #fff;
}
.swpc-online {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #9ca3af;
	border: 2px solid var(--swpc-color, #2563eb);
}
.swpc-online.is-online { background: #22c55e; }
.swpc-online.is-offline { background: #ef4444; }
.swpc-titles {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.2;
}
#swpc-status {
	font-size: 11px;
	font-weight: 400;
	opacity: .85;
}
#swpc-status:empty { display: none; }
.swpc-msg .swpc-meta {
	text-align: right;
	font-size: 11px;
	line-height: 1;
	margin-top: 3px;
}
.swpc-tick {
	font-weight: 700;
	letter-spacing: -3px;
	color: rgba(255,255,255,.75);
}
.swpc-tick.is-pending { letter-spacing: 0; }
.swpc-tick.is-seen { color: #7dd3fc; }
.swpc-avatar-sm {
	width: 26px;
	height: 26px;
	background: var(--swpc-color, #2563eb);
	color: #fff;
}
.swpc-avatar-xs {
	width: 16px;
	height: 16px;
	background: var(--swpc-color, #2563eb);
	color: #fff;
}
#swpc-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	line-height: 1;
	padding: 4px;
}

#swpc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	background: #f5f6f8;
	display: flex;
	flex-direction: column;
	gap: 8px;
	scrollbar-width: none;
	-ms-overflow-style: none;
}
#swpc-messages::-webkit-scrollbar {
	display: none;
}

.swpc-msg {
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.4;
	word-wrap: break-word;
	white-space: pre-wrap;
}
.swpc-msg.swpc-bot {
	background: #fff;
	border: 1px solid #e3e5e8;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}
.swpc-msg.swpc-user {
	background: var(--swpc-color, #2563eb);
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}
.swpc-msg.swpc-admin {
	background: #fff;
	border: 1px solid #e3e5e8;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}
.swpc-msg-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 600;
	color: var(--swpc-color, #2563eb);
	margin-bottom: 3px;
}

#swpc-toast {
	position: absolute;
	bottom: 74px;
	width: 280px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(0,0,0,.2);
	padding: 12px 14px;
	cursor: pointer;
	font-size: 14px;
	color: #1f2937;
}
#swpc-widget.swpc-open #swpc-toast { display: none !important; }
.swpc-toast-head {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
	font-size: 13px;
}
.swpc-toast-text {
	line-height: 1.4;
}
#swpc-toast-close {
	position: absolute;
	top: 6px;
	right: 8px;
	background: none;
	border: none;
	font-size: 16px;
	color: #9ca3af;
	cursor: pointer;
	padding: 2px;
}

#swpc-loading {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #6b7280;
	font-size: 14px;
}

#swpc-contact-gate {
	padding: 16px;
	background: #fff;
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
#swpc-contact-gate p {
	margin: 0 0 12px;
	font-size: 14px;
	color: #333;
}
#swpc-contact-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
#swpc-widget #swpc-contact-form input {
	width: 100% !important;
	height: 42px !important;
	min-height: 0 !important;
	margin: 0 !important;
	border: 1px solid #d7dadf !important;
	border-radius: 8px !important;
	padding: 10px 12px !important;
	background: #fff !important;
	box-shadow: none !important;
	font-size: 14px !important;
	outline: none;
	box-sizing: border-box !important;
}
#swpc-contact-form button {
	background: var(--swpc-color, #2563eb);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 10px;
	font-size: 14px;
	cursor: pointer;
}
.swpc-error {
	color: #dc2626;
	font-size: 12px;
	min-height: 16px;
}

#swpc-form {
	display: flex;
	align-items: flex-end;
	margin: 0 !important;
	border-top: 1px solid #e3e5e8;
	padding: 8px;
	gap: 6px;
	background: #fff;
}
#swpc-file-preview {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-top: 1px solid #e3e5e8;
	background: #fff;
	font-size: 13px;
	color: #1f2937;
}
#swpc-file-preview img {
	width: 44px;
	height: 44px;
	object-fit: cover;
	border-radius: 8px;
	flex-shrink: 0;
}
.swpc-fp-icon {
	font-size: 26px;
	flex-shrink: 0;
}
.swpc-fp-name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
}
.swpc-fp-size {
	display: block;
	color: #9ca3af;
	font-size: 11px;
	font-weight: 400;
}
#swpc-fp-remove {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: none;
	background: #f3f4f6;
	color: #6b7280;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}
#swpc-fp-remove:hover {
	background: #fee2e2;
	color: #b91c1c;
}

#swpc-attach {
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	margin: 0 !important;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #6b7280;
	cursor: pointer;
}
#swpc-attach:hover {
	background: #f3f4f6;
	color: var(--swpc-color, #2563eb);
}
#swpc-attach svg {
	width: 20px;
	height: 20px;
}
.swpc-att-img img {
	display: block;
	max-width: 200px;
	max-height: 200px;
	border-radius: 10px;
	margin: 2px 0;
}
.swpc-att-file {
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
	word-break: break-all;
}
.swpc-msg.swpc-pending {
	opacity: .6;
}
.swpc-msg.swpc-note {
	align-self: center;
	max-width: 95%;
	background: #fef2f2;
	color: #b91c1c;
	font-size: 12px;
	text-align: center;
}

/* Themes (e.g. WoodMart) style every textarea/button on the site; these ID rules + !important keep the composer compact. */
#swpc-widget #swpc-input {
	flex: 1 1 auto !important;
	width: auto !important;
	min-width: 0 !important;
	height: 38px;
	min-height: 38px !important;
	max-height: 120px !important;
	margin: 0 !important;
	padding: 9px 14px !important;
	border: 1px solid #d7dadf !important;
	border-radius: 19px !important;
	background: #fff !important;
	box-shadow: none !important;
	color: #1f2937 !important;
	font-family: inherit !important;
	font-size: 14px !important;
	line-height: 18px !important;
	outline: none !important;
	resize: none !important;
	overflow-y: auto;
	scrollbar-width: none;
	box-sizing: border-box !important;
}
#swpc-widget #swpc-input:focus {
	border-color: var(--swpc-color, #2563eb) !important;
}
#swpc-widget #swpc-input::-webkit-scrollbar { display: none; }
#swpc-widget #swpc-send {
	flex-shrink: 0;
	height: 38px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 18px !important;
	background: var(--swpc-color, #2563eb) !important;
	color: #fff !important;
	border: none !important;
	border-radius: 19px !important;
	box-shadow: none !important;
	cursor: pointer;
	font-size: 14px !important;
	font-weight: 600;
	line-height: 38px !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

@media (max-width: 420px) {
	#swpc-window { width: calc(100vw - 40px); }
}

/* Phones: the open chat takes the whole screen. */
@media (max-width: 480px) {
	#swpc-widget.swpc-open #swpc-window {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 100%;
		height: 100dvh;
		max-height: none;
		border-radius: 0;
	}
	#swpc-widget.swpc-open #swpc-bubble { display: none; }
	#swpc-header { padding: 14px 16px; }
	#swpc-close { font-size: 26px; }
	#swpc-widget #swpc-input,
	#swpc-widget #swpc-contact-form input { font-size: 16px !important; }
	#swpc-toast { width: calc(100vw - 40px); }
	.swpc-msg { max-width: 88%; }
}
