/* ============================================================
   MCK Webchat Widget
   Sleek dark design. Brand color injected via --mck-accent CSS var.
   ============================================================ */

:root {
	--mck-accent: #1E40AF;
	--mck-accent-dark: color-mix(in srgb, var(--mck-accent) 80%, #000);
	--mck-bg: #16181d;
	--mck-bg2: #1e2028;
	--mck-bg3: #25272f;
	--mck-border: rgba(255,255,255,0.06);
	--mck-text: #f1f2f5;
	--mck-text-muted: rgba(255,255,255,0.45);
	--mck-radius: 18px;
	--mck-font: inherit;
}

.mck-chat-wrapper {
	font-family: var(--mck-font);
	z-index: 9999;
	--mck-accent-dark: color-mix(in srgb, var(--mck-accent) 80%, #000 20%);
}

/* ── Positions ────────────────────────────────────────────── */
.mck-chat-bottom-right {
	position: fixed;
	bottom: 24px;
	right: 24px;
}
.mck-chat-bottom-left {
	position: fixed;
	bottom: 24px;
	left: 24px;
}
.mck-chat-inline {
	position: relative;
	width: 100%;
}

@media (max-width: 640px) {
	.mck-chat-hide-mobile { display: none !important; }
	.mck-chat-bottom-right .mck-chat-window,
	.mck-chat-bottom-left .mck-chat-window {
		width: calc(100vw - 24px);
		right: 12px;
		left: 12px;
		bottom: 76px;
	}
}

/* ── Bubble ───────────────────────────────────────────────── */
.mck-chat-bubble {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background-color: var(--mck-accent);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 0 0 var(--mck-accent);
	transition: transform 0.2s, box-shadow 0.2s;
	position: relative;
}
.mck-chat-bubble:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 28px rgba(0,0,0,0.35);
}
.mck-chat-bubble-icon {
	width: 24px;
	height: 24px;
	color: #fff;
}
.mck-chat-unread {
	position: absolute;
	top: -3px;
	right: -3px;
	background: #ef4444;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	min-width: 18px;
	height: 18px;
	border-radius: 9px;
	padding: 0 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
	line-height: 1;
}

/* ── Chat Window ──────────────────────────────────────────── */
.mck-chat-bottom-right .mck-chat-window,
.mck-chat-bottom-left .mck-chat-window {
	position: absolute;
	bottom: 64px;
	right: 0;
	width: 360px;
}
.mck-chat-bottom-left .mck-chat-window {
	right: auto;
	left: 0;
}
.mck-chat-window {
	background: var(--mck-bg);
	border-radius: var(--mck-radius);
	box-shadow: 0 12px 48px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.07);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	max-height: 540px;
	min-height: 320px;
}
.mck-chat-window.mck-chat-inline {
	position: relative;
	bottom: auto;
	right: auto;
	width: 100%;
	max-height: 600px;
}

/* Transitions */
.mck-chat-enter { transition: opacity 0.2s ease, transform 0.2s ease; }
.mck-chat-enter-start { opacity: 0; transform: translateY(10px) scale(0.97); }
.mck-chat-enter-end   { opacity: 1; transform: translateY(0) scale(1); }

/* ── Header ───────────────────────────────────────────────── */
.mck-chat-header {
	background: var(--mck-accent);
	padding: 14px 16px 13px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	position: relative;
}
.mck-chat-header::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 1px;
	background: rgba(0,0,0,0.12);
}
.mck-chat-header-info {
	display: flex;
	align-items: center;
	gap: 10px;
}
.mck-chat-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(255,255,255,0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.mck-chat-avatar svg {
	width: 17px;
	height: 17px;
	color: #fff;
}
.mck-chat-header-title {
	color: #fff;
	font-size: 13.5px;
	font-weight: 600;
	margin: 0;
	line-height: 1.3;
	letter-spacing: -0.01em;
}
.mck-chat-header-sub {
	color: rgba(255,255,255,0.75);
	font-size: 11px;
	margin: 1px 0 0;
	display: flex;
	align-items: center;
	gap: 5px;
	line-height: 1;
}
.mck-chat-status-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #4ade80;
	display: inline-block;
	box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.3);
}
.mck-chat-close {
	background: rgba(255,255,255,0.12);
	border: none;
	cursor: pointer;
	color: rgba(255,255,255,0.9);
	padding: 5px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s;
}
.mck-chat-close:hover { background: rgba(255,255,255,0.22); }
.mck-chat-close svg { width: 16px; height: 16px; }

/* ── Messages area ────────────────────────────────────────── */
.mck-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	scroll-behavior: smooth;
	background: var(--mck-bg);
}
.mck-chat-messages::-webkit-scrollbar { width: 3px; }
.mck-chat-messages::-webkit-scrollbar-track { background: transparent; }
.mck-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* Message rows */
.mck-chat-msg {
	display: flex;
	max-width: 84%;
}
.mck-chat-msg-visitor {
	align-self: flex-end;
	flex-direction: row-reverse;
}
.mck-chat-msg-ai {
	align-self: flex-start;
}

/* Bubbles */
.mck-chat-bubble-msg {
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 13.5px;
	line-height: 1.55;
	word-break: break-word;
	letter-spacing: -0.01em;
}
.mck-chat-msg-visitor .mck-chat-bubble-msg {
	background: var(--mck-accent);
	color: #fff;
	border-bottom-right-radius: 5px;
}
.mck-chat-msg-ai .mck-chat-bubble-msg {
	background: var(--mck-bg3);
	color: var(--mck-text);
	border-bottom-left-radius: 5px;
}

/* Typing dots */
.mck-chat-typing {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 11px 15px;
	background: var(--mck-bg3);
	border-radius: 16px;
	border-bottom-left-radius: 5px;
}
.mck-chat-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--mck-text-muted);
	animation: mck-bounce 1.2s infinite;
}
.mck-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.mck-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mck-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
	30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Input area ───────────────────────────────────────────── */
.mck-chat-input-area {
	border-top: 1px solid var(--mck-border);
	padding: 10px 12px 8px;
	flex-shrink: 0;
	background: var(--mck-bg2);
}
.mck-chat-form {
	display: flex;
	gap: 8px;
	align-items: flex-end;
}
.mck-chat-input {
	flex: 1;
	border: 1px solid rgba(255,255,255,0.1);
	border-radius: 12px;
	padding: 9px 13px;
	font-size: 13.5px;
	outline: none;
	transition: border-color 0.15s, background 0.15s;
	background: var(--mck-bg3);
	color: var(--mck-text);
	resize: none;
	max-height: 80px;
	line-height: 1.45;
	font-family: var(--mck-font);
}
.mck-chat-input::placeholder { color: var(--mck-text-muted); }
.mck-chat-input:focus {
	border-color: var(--mck-accent);
	background: var(--mck-bg3);
}
.mck-chat-input:disabled { opacity: 0.5; cursor: not-allowed; }

.mck-chat-send {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: var(--mck-accent);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: opacity 0.15s, transform 0.1s;
}
.mck-chat-send:hover { opacity: 0.88; }
.mck-chat-send:active { transform: scale(0.93); }
.mck-chat-send:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
.mck-chat-send svg { width: 16px; height: 16px; color: #fff; }

.mck-chat-footer {
	text-align: center;
	font-size: 10px;
	color: var(--mck-text-muted);
	margin: 6px 0 0;
	letter-spacing: 0.01em;
}
