/* WA Chat Bridge — front-end widget */
#wacb-root, #wacb-root * { box-sizing: border-box; }
#wacb-root {
	--wacb-color: #25D366;
	--wacb-ink: #0b141a;
	--wacb-muted: #667781;
	--wacb-bg: #efeae2;
	--wacb-bubble-in: #ffffff;
	--wacb-bubble-out: #d9fdd3;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Launcher button */
.wacb-launcher {
	position: fixed; bottom: 22px; z-index: 2147483000;
	width: 60px; height: 60px; border-radius: 50%;
	background: var(--wacb-color); color: #fff; border: 0; cursor: pointer;
	box-shadow: 0 6px 22px rgba(0,0,0,.28);
	display: flex; align-items: center; justify-content: center;
	transition: transform .18s ease, box-shadow .18s ease;
}
.wacb-launcher:hover { transform: scale(1.06); box-shadow: 0 10px 28px rgba(0,0,0,.32); }
.wacb-launcher svg { width: 32px; height: 32px; }
.wacb--right .wacb-launcher, .wacb--right .wacb-panel { right: 22px; }
.wacb--left  .wacb-launcher, .wacb--left  .wacb-panel { left: 22px; }
.wacb-badge {
	position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px;
	background: #ff3b30; color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700;
	display: none; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid #fff;
}
.wacb-badge.is-show { display: flex; }

/* Panel */
.wacb-panel {
	position: fixed; bottom: 96px; z-index: 2147483000;
	width: 360px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 130px);
	background: var(--wacb-bg); border-radius: 16px; overflow: hidden;
	box-shadow: 0 18px 60px rgba(0,0,0,.3);
	display: none; flex-direction: column;
	opacity: 0; transform: translateY(12px); transition: opacity .2s ease, transform .2s ease;
}
.wacb-panel.is-open { display: flex; opacity: 1; transform: translateY(0); }

.wacb-head { background: var(--wacb-color); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.wacb-head__avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.wacb-head__avatar svg { width: 24px; height: 24px; }
.wacb-head__meta { line-height: 1.25; flex: 1; min-width: 0; }
.wacb-head__title { font-weight: 700; font-size: 15px; }
.wacb-head__sub { font-size: 12px; opacity: .9; }
.wacb-head__close { background: none; border: 0; color: #fff; cursor: pointer; padding: 6px; opacity: .9; }
.wacb-head__close:hover { opacity: 1; }
.wacb-head__close svg { width: 20px; height: 20px; }

.wacb-body {
	flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 8px;
	background-image: linear-gradient(rgba(229,221,213,.6), rgba(229,221,213,.6));
}
.wacb-msg { max-width: 80%; padding: 8px 11px; border-radius: 10px; font-size: 14px; line-height: 1.4; color: var(--wacb-ink); box-shadow: 0 1px 1px rgba(0,0,0,.08); word-wrap: break-word; white-space: pre-wrap; position: relative; }
.wacb-msg time { display: block; font-size: 10px; color: var(--wacb-muted); text-align: right; margin-top: 2px; }
.wacb-msg--in  { align-self: flex-start; background: var(--wacb-bubble-in); border-top-left-radius: 2px; }
.wacb-msg--out { align-self: flex-end; background: var(--wacb-bubble-out); border-top-right-radius: 2px; }
.wacb-note { align-self: center; font-size: 11px; color: var(--wacb-muted); background: rgba(255,255,255,.7); padding: 4px 10px; border-radius: 999px; }

/* Name gate */
.wacb-gate { padding: 22px 18px; text-align: center; }
.wacb-gate p { color: var(--wacb-ink); font-size: 14px; margin: 0 0 14px; }
.wacb-gate input { width: 100%; padding: 11px 13px; border: 1px solid #d5d5d5; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.wacb-gate button { width: 100%; padding: 11px; background: var(--wacb-color); color: #fff; border: 0; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }

/* Composer */
.wacb-foot { padding: 10px; background: #f0f2f5; display: flex; gap: 8px; align-items: flex-end; }
.wacb-foot textarea {
	flex: 1; resize: none; border: 0; border-radius: 20px; padding: 10px 14px; font-size: 14px;
	max-height: 110px; line-height: 1.4; font-family: inherit; background: #fff; outline: none;
}
.wacb-foot button {
	flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
	background: var(--wacb-color); color: #fff; display: flex; align-items: center; justify-content: center;
}
.wacb-foot button:disabled { opacity: .5; cursor: default; }
.wacb-foot button svg { width: 20px; height: 20px; }

.wacb-powered { text-align: center; font-size: 10px; color: var(--wacb-muted); padding: 4px 0 8px; background: #f0f2f5; }

@media (max-width: 480px) {
	.wacb-panel { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; bottom: 0; border-radius: 0; }
	.wacb--right .wacb-panel, .wacb--left .wacb-panel { right: 0; left: 0; }
}
