/* CamerBuy — chat en direct (bulle du site). Couleurs du thème, avec repli. */
.cbc-chat {
	--c-ink: var(--ink, #0F1412);
	--c-green: var(--green, #0E6B4E);
	--c-gold: var(--gold, #E3B23C);
	--c-line: var(--line, #E7E3DA);
	--c-ground: var(--ground, #F7F5F0);
	--c-muted: var(--muted, #4C5450);
	position: fixed; z-index: 90; right: 16px;
	bottom: calc(var(--tabbar, 0px) + env(safe-area-inset-bottom, 0px) + 16px);
	font-family: var(--font, Inter, system-ui, sans-serif);
}
.single-product .cbc-chat { bottom: calc(var(--tabbar, 0px) + env(safe-area-inset-bottom, 0px) + 84px); }
.single-product .cbc-chat__panel { height: min(560px, calc(100vh - 220px)); }
.cbc-chat[hidden] { display: none; }

.cbc-chat__fab {
	position: relative; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
	background: var(--c-ink); color: var(--c-gold); display: grid; place-items: center;
	box-shadow: 0 10px 28px rgba(15, 20, 18, .28); transition: transform .15s ease;
}
.cbc-chat__fab:hover { transform: translateY(-2px); }
.cbc-chat__fab::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 12px; height: 12px; border-radius: 50%; background: #9AA29E; border: 2px solid var(--c-ink); }
.cbc-chat.is-online .cbc-chat__fab::after { background: #2FBF71; }
.cbc-chat.is-open .cbc-chat__fab { display: none; }
.cbc-chat__badge { position: absolute; top: -2px; right: -2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--red, #C8372D); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.cbc-chat__badge[hidden] { display: none; }

.cbc-chat__panel {
	width: min(370px, calc(100vw - 32px)); height: min(560px, calc(100vh - 150px));
	background: #fff; border: 1px solid var(--c-line); border-radius: 16px; overflow: hidden;
	box-shadow: 0 24px 60px rgba(15, 20, 18, .22); display: flex; flex-direction: column;
}
.cbc-chat__panel[hidden] { display: none; }
.cbc-chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: var(--c-ink); color: #fff; }
.cbc-chat__avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--c-gold); color: var(--c-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.cbc-chat__who { flex: 1; min-width: 0; display: grid; }
.cbc-chat__who strong { font-size: 15px; }
.cbc-chat__status { font-size: 12px; color: #B9C2BE; display: flex; align-items: center; gap: 6px; }
.cbc-chat__status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9AA29E; flex-shrink: 0; }
.cbc-chat.is-online .cbc-chat__status::before { background: #2FBF71; }
.cbc-chat__close { background: transparent; border: 0; color: #fff; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.cbc-chat__close:hover { background: rgba(255, 255, 255, .08); }

.cbc-chat__body { flex: 1; overflow-y: auto; padding: 16px; background: var(--c-ground); display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.cbc-chat__msg { max-width: 82%; padding: 9px 12px 6px; border-radius: 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.cbc-chat__msg time { display: block; text-align: right; font-size: 11px; opacity: .6; margin-top: 2px; }
.cbc-chat__msg.is-agent { align-self: flex-start; background: #fff; border: 1px solid var(--c-line); border-bottom-left-radius: 4px; color: #111614; }
.cbc-chat__msg.is-client { align-self: flex-end; background: var(--c-green); color: #fff; border-bottom-right-radius: 4px; }
.cbc-chat__hello { padding-bottom: 9px; }

.cbc-chat__chips { display: flex; gap: 6px; padding: 8px 12px 0; background: #fff; overflow-x: auto; scrollbar-width: none; }
.cbc-chat__chips[hidden] { display: none; }
.cbc-chat__chips button { flex-shrink: 0; border: 1px solid var(--c-line); background: #fff; border-radius: 20px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: #111614; }
.cbc-chat__chips button:hover { border-color: var(--c-green); color: var(--c-green); }

.cbc-chat__form { padding: 10px 12px 12px; background: #fff; border-top: 1px solid var(--c-line); display: grid; gap: 8px; }
.cbc-chat__id { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cbc-chat__id[hidden] { display: none; }
.cbc-chat__form input, .cbc-chat__form textarea { width: 100%; border: 1px solid #D9D4C9; border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 14px; background: #fff; color: #111614; }
.cbc-chat__form input:focus, .cbc-chat__form textarea:focus { outline: 0; border-color: var(--c-green); box-shadow: 0 0 0 3px rgba(14, 107, 78, .14); }
.cbc-chat__trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.cbc-chat__compose { display: flex; gap: 8px; align-items: flex-end; }
.cbc-chat__compose textarea { resize: none; max-height: 120px; line-height: 1.4; }
.cbc-chat__send { width: 42px; height: 42px; flex-shrink: 0; border: 0; border-radius: 10px; background: var(--c-green); color: #fff; display: grid; place-items: center; cursor: pointer; }
.cbc-chat__send:hover { background: var(--green-dark, #0A4F3A); }
.cbc-chat__form.is-busy .cbc-chat__send { opacity: .5; }
.cbc-chat__note { margin: 0; font-size: 12px; color: var(--c-muted); }
.cbc-chat__note[hidden] { display: none; }

@media (max-width: 640px) {
	/* Plein écran calé sur la partie visible (clavier ouvert compris), mesurée par chat.js. */
	.cbc-chat.is-open { left: 0; right: 0; bottom: auto; top: var(--cbc-top, 0px); height: var(--cbc-h, 100dvh); z-index: 100000; }
	.cbc-chat.is-open .cbc-chat__panel { width: 100%; height: 100%; border-radius: 0; border: 0; }
	.cbc-chat__form input, .cbc-chat__form textarea { font-size: 16px; }
	.cbc-chat__fab { width: 54px; height: 54px; }
	html.cbc-chat-lock, html.cbc-chat-lock body { overflow: hidden; }
}
@media print { .cbc-chat { display: none; } }

/* Pièces jointes */
.cbc-chat__attach { position: relative; width: 42px; height: 42px; flex-shrink: 0; border-radius: 10px; border: 1px solid #D9D4C9; color: var(--c-muted); display: grid; place-items: center; cursor: pointer; }
.cbc-chat__attach:hover { border-color: var(--c-green); color: var(--c-green); }
.cbc-chat__attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; font-size: 0; }
.cbc-chat__form.is-busy .cbc-chat__attach { opacity: .5; pointer-events: none; }
.cbc-chat__msg.has-file { padding: 4px 4px 6px; }
.cbc-chat__msg.has-file > span { display: block; padding: 6px 8px 0; }
.cbc-chat__msg.has-file time { padding-right: 6px; }
.cbc-chat__img { display: block; }
.cbc-chat__img img, .cbc-chat__video { display: block; max-width: 100%; width: 240px; max-height: 280px; object-fit: cover; border-radius: 11px; background: #E7E3DA; }
.cbc-chat__video { object-fit: contain; background: #000; }
.cbc-chat__doc { display: block; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .14); color: inherit; text-decoration: none; font-weight: 500; word-break: break-word; }
.is-agent .cbc-chat__doc { background: var(--c-ground); color: #111614; }
.cbc-chat__msg.is-sending { opacity: .7; font-style: italic; }
