/* BD Chat – widget */
#bdchat-root {
	--bdchat-color: #2563eb;
	--bdchat-radius: 14px;
	position: fixed;
	bottom: 20px;
	z-index: 999990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
}
#bdchat-root.bdchat-right { right: 20px; align-items: flex-end; }
#bdchat-root.bdchat-left { left: 20px; align-items: flex-start; }

#bdchat-root * { box-sizing: border-box; }

.bdchat-bubble {
	position: relative;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: 0;
	background: var(--bdchat-color);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .15s ease;
	margin-left: auto;
}
.bdchat-bubble:hover { transform: scale(1.05); }
.bdchat-bubble.is-open { transform: scale(.92); }

.bdchat-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #e11d48;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
}

.bdchat-panel {
	display: none;
	flex-direction: column;
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: var(--bdchat-radius);
	box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
	overflow: hidden;
	margin-bottom: 12px;
	color: #111827;
}

.bdchat-header {
	background: var(--bdchat-color);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}
.bdchat-title { font-weight: 700; font-size: 16px; }
.bdchat-subtitle { display: flex; align-items: center; gap: 6px; font-size: 13px; opacity: .92; margin-top: 2px; }
.bdchat-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; display: inline-block; flex: none; }
.bdchat-dot.is-online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .3); }
.bdchat-dot.is-offline { background: #fbbf24; }
.bdchat-close { background: transparent; border: 0; color: #fff; cursor: pointer; opacity: .85; padding: 4px; border-radius: 6px; }
.bdchat-close:hover { opacity: 1; background: rgba(255, 255, 255, .15); }

.bdchat-body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	background: #f6f7f9;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.bdchat-msg { max-width: 85%; display: flex; flex-direction: column; }
.bdchat-msg-body {
	padding: 9px 13px;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.bdchat-msg-visitor { align-self: flex-end; align-items: flex-end; }
.bdchat-msg-visitor .bdchat-msg-body { background: var(--bdchat-color); color: #fff; border-bottom-right-radius: 4px; }
.bdchat-msg-operator .bdchat-msg-body, .bdchat-msg-bot .bdchat-msg-body { border-bottom-left-radius: 4px; }
.bdchat-msg-time { font-size: 11px; color: #9ca3af; margin-top: 3px; padding: 0 4px; }
.bdchat-link { color: inherit; text-decoration: underline; }

.bdchat-loading { display: flex; gap: 5px; padding: 10px 2px; }
.bdchat-dot-anim {
	width: 7px; height: 7px; border-radius: 50%; background: #c7cbd1;
	animation: bdchat-blink 1.1s infinite ease-in-out;
}
.bdchat-dot-anim:nth-child(2) { animation-delay: .18s; }
.bdchat-dot-anim:nth-child(3) { animation-delay: .36s; }
@keyframes bdchat-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.bdchat-options { display: flex; flex-direction: column; gap: 7px; margin: 4px 0 2px; }
.bdchat-options.is-used { opacity: .55; }
.bdchat-option {
	text-align: left;
	padding: 10px 14px;
	border-radius: 12px;
	border: 1.5px solid var(--bdchat-color);
	background: #fff;
	color: var(--bdchat-color);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	transition: background .12s ease, color .12s ease;
}
.bdchat-option:hover:not(:disabled) { background: var(--bdchat-color); color: #fff; }
.bdchat-option:disabled { cursor: default; }
.bdchat-option-primary { background: var(--bdchat-color); color: #fff; }

.bdchat-products { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.bdchat-product {
	display: flex;
	gap: 10px;
	align-items: center;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 8px;
	text-decoration: none;
	color: inherit;
	transition: border-color .12s ease, box-shadow .12s ease;
}
.bdchat-product:hover { border-color: var(--bdchat-color); box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.bdchat-product-img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; background: #f3f4f6; }
.bdchat-product-info { min-width: 0; }
.bdchat-product-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.bdchat-product-price { font-size: 14px; color: var(--bdchat-color); font-weight: 700; margin-top: 2px; }
.bdchat-product-stock { font-size: 12px; margin-top: 1px; }
.bdchat-product-stock.is-in { color: #16a34a; }
.bdchat-product-stock.is-out { color: #9ca3af; }

.bdchat-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0; }
.bdchat-ghost {
	background: transparent;
	border: 0;
	color: #6b7280;
	font-size: 13px;
	cursor: pointer;
	text-decoration: underline;
	padding: 4px 2px;
	font-family: inherit;
}
.bdchat-cta {
	display: inline-block;
	background: var(--bdchat-color);
	color: #fff;
	text-decoration: none;
	padding: 9px 14px;
	border-radius: 10px;
	font-weight: 600;
	font-size: 14px;
	align-self: flex-start;
}

.bdchat-contact { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px; }
.bdchat-contact-intro { font-size: 13px; color: #4b5563; margin-bottom: 8px; }
.bdchat-contact-form { display: flex; flex-direction: column; gap: 7px; }
.bdchat-field {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid #d1d5db;
	border-radius: 9px;
	font-size: 14px;
	font-family: inherit;
	color: #111827;
	background: #fff;
}
.bdchat-field:focus { outline: 2px solid var(--bdchat-color); outline-offset: -1px; border-color: transparent; }
.bdchat-submit {
	background: var(--bdchat-color);
	color: #fff;
	border: 0;
	border-radius: 9px;
	padding: 10px;
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
	font-family: inherit;
}
.bdchat-submit:disabled { opacity: .6; cursor: default; }
.bdchat-gdpr { font-size: 11px; color: #9ca3af; }
.bdchat-error { font-size: 13px; color: #dc2626; }

.bdchat-footer {
	display: flex;
	gap: 8px;
	padding: 10px;
	background: #fff;
	border-top: 1px solid #e5e7eb;
}
.bdchat-input {
	flex: 1 1 auto;
	border: 1px solid #d1d5db;
	border-radius: 20px;
	padding: 9px 14px;
	font-size: 14px;
	font-family: inherit;
	color: #111827;
	background: #fff;
}
.bdchat-input:focus { outline: 2px solid var(--bdchat-color); outline-offset: -1px; border-color: transparent; }
.bdchat-send {
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 0;
	background: var(--bdchat-color);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

@media (max-width: 480px) {
	#bdchat-root { bottom: 14px; }
	#bdchat-root.bdchat-right { right: 14px; }
	#bdchat-root.bdchat-left { left: 14px; }
	.bdchat-panel { width: calc(100vw - 28px); height: calc(100vh - 110px); }
}

@media (prefers-color-scheme: dark) {
	.bdchat-panel { background: #111827; color: #e5e7eb; }
	.bdchat-body { background: #0f172a; }
	.bdchat-msg-body { background: #1f2937; color: #e5e7eb; box-shadow: none; }
	.bdchat-option { background: #1f2937; }
	.bdchat-product { background: #1f2937; border-color: #374151; }
	.bdchat-contact { background: #1f2937; border-color: #374151; }
	.bdchat-field { background: #111827; border-color: #374151; color: #e5e7eb; }
	.bdchat-footer { background: #111827; border-top-color: #374151; }
	.bdchat-input { background: #0f172a; border-color: #374151; color: #e5e7eb; }
	.bdchat-contact-intro { color: #9ca3af; }
}
