#mca-chat-root {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* Posisi kiri bawah (opsional, diatur admin). */
#mca-chat-root.mca-pos-left {
	right: auto;
	left: 20px;
}

/* Reset ringan supaya CSS tema website tidak "menabrak" tombol/elemen
   widget ini (mis. tema yang memberi padding/line-height besar ke semua
   <button>, atau border-box berbeda). */
#mca-chat-root button {
	box-sizing: border-box;
	margin: 0;
	line-height: normal;
	font-family: inherit;
	-webkit-appearance: none;
	appearance: none;
}
#mca-chat-root svg {
	display: block;
	flex-shrink: 0;
}

.mca-bubble {
	position: relative;
	height: var(--mca-bubble-size, 52px);
	min-width: var(--mca-bubble-size, 52px);
	padding: 0 20px 0 16px;
	border-radius: 999px;
	background: var(--mca-color, #2563eb);
	color: #fff;
	border: none;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0,0,0,.2);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: transform .15s ease;
}
.mca-bubble:hover { transform: scale(1.04); }
.mca-bubble svg { width: 22px; height: 22px; flex-shrink: 0; }
.mca-bubble-label {
	font-size: 14.5px;
	font-weight: 600;
	white-space: nowrap;
}

.mca-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	line-height: 1;
	min-width: 20px;
	height: 20px;
	padding: 0 4px;
	border-radius: 999px;
	font-weight: 700;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
}

.mca-window {
	position: absolute;
	bottom: 68px;
	right: 0;
	width: var(--mca-window-width, 360px);
	max-width: calc(100vw - 24px);
	height: var(--mca-window-height, 520px);
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(0,0,0,.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(.98);
	pointer-events: none;
	transition: opacity .18s ease, transform .18s ease;
}
.mca-window.mca-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}
/* Posisi kiri: window dibuka dari sisi kiri bubble, bukan kanan. */
.mca-pos-left .mca-window {
	right: auto;
	left: 0;
}

.mca-theme-ribbon {
	position: absolute;
	bottom: calc(var(--mca-bubble-size, 52px) + 14px);
	right: 0;
	background: #fff;
	color: #1f2937;
	font-size: 11.5px;
	font-weight: 700;
	padding: 6px 12px;
	border-radius: 999px;
	box-shadow: 0 4px 14px rgba(0,0,0,.15);
	white-space: nowrap;
	pointer-events: none;
	animation: mca-ribbon-float 2.4s ease-in-out infinite;
}
.mca-pos-left .mca-theme-ribbon { right: auto; left: 0; }
@keyframes mca-ribbon-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-4px); }
}

.mca-header {
	background: var(--mca-color, #2563eb);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.mca-header-title { font-weight: 600; font-size: 15px; }
.mca-header-sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.mca-close-btn {
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	padding: 4px;
}

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

.mca-msg-wrap { display: flex; flex-direction: column; max-width: 82%; }
.mca-msg-wrap-user { align-self: flex-end; align-items: flex-end; }
.mca-msg-wrap-assistant { align-self: flex-start; align-items: flex-start; }
.mca-msg-wrap-system { align-self: center; align-items: center; }
.mca-msg-label {
	font-size: 10.5px;
	font-weight: 600;
	color: #9ca3af;
	text-transform: uppercase;
	letter-spacing: .03em;
	margin: 0 2px 3px;
}

.mca-msg {
	max-width: 100%;
	padding: 9px 12px;
	border-radius: 12px;
	font-size: 13.5px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
}
.mca-msg div { white-space: pre-wrap; }
.mca-msg ul { margin: 4px 0; padding-left: 18px; }
.mca-msg li { margin-bottom: 2px; }
.mca-msg strong { font-weight: 700; }
.mca-msg em { font-style: italic; opacity: .85; }
.mca-msg-assistant {
	background: #fff;
	color: #1f2937;
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.mca-msg-user {
	background: var(--mca-color, #2563eb);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.mca-msg-system {
	background: transparent;
	color: #9ca3af;
	font-size: 12px;
}

.mca-products {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: flex-start;
	max-width: 82%;
	margin-top: -4px;
}
.mca-product-card {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #fff;
	border-radius: 12px;
	padding: 8px;
	box-shadow: 0 1px 2px rgba(0,0,0,.06);
	text-decoration: none;
	border: 1px solid #eee;
}
.mca-product-card:hover { border-color: var(--mca-color, #2563eb); }
.mca-product-card img {
	width: 52px;
	height: 52px;
	border-radius: 8px;
	object-fit: cover;
	flex-shrink: 0;
	background: #f4f5f7;
}
.mca-product-info { min-width: 0; }
.mca-product-title {
	font-size: 12.5px;
	font-weight: 600;
	color: #1f2937;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mca-product-price {
	font-size: 12px;
	color: var(--mca-color, #2563eb);
	font-weight: 600;
	margin-top: 2px;
}

.mca-related-label {
	font-size: 11px;
	font-weight: 600;
	color: #9ca3af;
	align-self: flex-start;
	margin: 2px 0 -2px;
}

.mca-cta-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	align-self: stretch;
	background: var(--mca-color, #2563eb);
	color: #fff;
	text-decoration: none;
	text-align: center;
	padding: 12px 14px;
	border-radius: 12px;
	box-shadow: 0 3px 10px rgba(37,99,235,.35);
	margin: 2px 0;
}
.mca-cta-btn:hover { filter: brightness(1.08); }
.mca-cta-label { font-size: 13.5px; font-weight: 700; }
.mca-cta-price { font-size: 12px; opacity: .9; }

.mca-quickreplies {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-self: flex-start;
	max-width: 100%;
	margin-top: -2px;
}
.mca-chip {
	background: #fff;
	border: 1px solid var(--mca-color, #2563eb);
	color: var(--mca-color, #2563eb);
	font-size: 12.5px;
	font-weight: 600;
	padding: 7px 12px;
	border-radius: 999px;
	cursor: pointer;
	white-space: nowrap;
}
.mca-chip:hover { background: var(--mca-color, #2563eb); color: #fff; }

.mca-office-banner {
	background: #fef3c7;
	color: #92400e;
	font-size: 12px;
	line-height: 1.4;
	padding: 9px 30px 9px 12px;
	margin: 10px 10px 0;
	border-radius: 10px;
	text-align: center;
	position: relative;
}
.mca-office-banner-text { display: block; }
.mca-office-banner-close {
	position: absolute;
	top: 4px;
	right: 6px;
	background: transparent;
	border: none;
	color: #92400e;
	opacity: .6;
	font-size: 16px;
	line-height: 1;
	padding: 4px;
	cursor: pointer;
}
.mca-office-banner-close:hover { opacity: 1; }

.mca-wa-bar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 9px;
	margin: 8px 10px;
	background: #e9fbf1;
	color: #128c4a;
	border-radius: 10px;
	font-size: 12.5px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	flex-shrink: 0;
}
.mca-wa-bar:hover { background: #d7f7e6; }
.mca-wa-bar svg { width: 16px; height: 16px; }

.mca-email-bar {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 9px;
	margin: 0 10px 8px;
	background: #f3f4f6;
	color: #4b5563;
	border-radius: 10px;
	font-size: 12.5px;
	font-weight: 600;
	flex-shrink: 0;
}
.mca-email-bar a {
	display: flex;
	align-items: center;
	gap: 7px;
	color: inherit;
	text-decoration: none;
	width: 100%;
}
.mca-email-bar:has(a):hover { background: #e5e7eb; }
.mca-email-bar svg { width: 16px; height: 16px; flex-shrink: 0; }
.mca-email-bar input[type="email"] {
	flex: 1;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	padding: 6px 8px;
	font-size: 12.5px;
	min-width: 0;
}
.mca-email-bar button {
	background: var(--mca-color, #2563eb);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 6px 12px;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	flex-shrink: 0;
}

.mca-survey-row {
	align-self: center;
	max-width: 90%;
	background: #fff;
	border: 1px solid #eee;
	border-radius: 12px;
	padding: 10px 12px;
	box-shadow: 0 1px 2px rgba(0,0,0,.06);
	text-align: center;
}
.mca-survey-question {
	font-size: 12.5px;
	color: #374151;
	margin-bottom: 8px;
}
.mca-survey-buttons {
	display: flex;
	gap: 8px;
	justify-content: center;
}
.mca-survey-thanks {
	font-size: 12.5px;
	color: #6b7280;
}

.mca-rate-row {
	display: flex;
	gap: 4px;
	margin-top: 3px;
}
.mca-rate-btn {
	background: transparent;
	border: none;
	cursor: pointer;
	font-size: 13px;
	padding: 2px 5px;
	border-radius: 6px;
	opacity: .45;
	line-height: 1;
}
.mca-rate-btn:hover { opacity: .8; background: rgba(0,0,0,.04); }
.mca-rate-btn.mca-rate-active { opacity: 1; background: rgba(37,99,235,.1); }

.mca-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 10px 12px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.mca-typing span {
	width: 6px; height: 6px; border-radius: 50%;
	background: #9ca3af;
	animation: mca-bounce 1.2s infinite ease-in-out;
}
.mca-typing span:nth-child(2) { animation-delay: .15s; }
.mca-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes mca-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: .5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.mca-inputbar {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #eee;
	background: #fff;
}
.mca-inputbar textarea {
	flex: 1;
	resize: none;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 9px 10px;
	font-size: 13.5px;
	font-family: inherit;
	max-height: 90px;
	outline: none;
}
.mca-inputbar textarea:focus { border-color: var(--mca-color, #2563eb); }
.mca-send-btn {
	background: var(--mca-color, #2563eb);
	color: #fff;
	border: none;
	border-radius: 10px;
	width: 40px;
	height: 40px;
	padding: 0;
	flex-shrink: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.mca-send-btn:disabled { opacity: .5; cursor: default; }
.mca-send-btn svg { width: 19px; height: 19px; }

.mca-icon-btn {
	background: #f3f4f6;
	color: #555;
	border: none;
	border-radius: 10px;
	width: 40px;
	height: 40px;
	padding: 0;
	flex-shrink: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.mca-icon-btn:hover { background: #e5e7eb; }
.mca-icon-btn:disabled { opacity: .5; cursor: default; }
.mca-icon-btn svg { width: 18px; height: 18px; }
.mca-icon-btn.mca-mic-active {
	background: #fee2e2;
	color: #dc2626;
	animation: mca-mic-pulse 1.2s infinite ease-in-out;
}
@keyframes mca-mic-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.4); }
	50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

.mca-img-msg {
	max-width: 200px;
	max-height: 200px;
	border-radius: 12px;
	display: block;
	object-fit: cover;
	box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.mca-msg-wrap.mca-uploading .mca-img-msg { opacity: .55; }
.mca-msg-wrap.mca-uploading { position: relative; }
.mca-msg-wrap.mca-uploading::after {
	content: '';
	position: absolute;
	top: 50%; left: 50%;
	width: 22px; height: 22px;
	margin: -11px 0 0 -11px;
	border: 3px solid rgba(0,0,0,.15);
	border-top-color: var(--mca-color, #2563eb);
	border-radius: 50%;
	animation: mca-spin .7s linear infinite;
}
@keyframes mca-spin { to { transform: rotate(360deg); } }

.mca-namegate {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fff;
	flex: 1;
	justify-content: center;
}
.mca-namegate input {
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 9px 10px;
	font-size: 13.5px;
}
.mca-namegate button {
	background: var(--mca-color, #2563eb);
	color: #fff;
	border: none;
	border-radius: 10px;
	padding: 10px;
	font-size: 13.5px;
	cursor: pointer;
	font-weight: 600;
}

@media (max-width: 420px) {
	#mca-chat-root { right: 12px; bottom: 12px; }
	#mca-chat-root.mca-pos-left { left: 12px; right: auto; }
	.mca-window { width: calc(100vw - 24px); right: -8px; }
	.mca-pos-left .mca-window { left: -8px; right: auto; }
}
