/* Mikratec Chatbot widget */
#mikratec-cb,
#mikratec-cb * {
	box-sizing: border-box;
}

#mikratec-cb {
	--mc-color: #0b5cab;
	--mc-color-dark: #084787;
	--mc-text: #1c2733;
	--mc-bg: #ffffff;
	--mc-muted: #6b7785;
	position: fixed;
	bottom: 22px;
	z-index: 2147483000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
}

#mikratec-cb.mc-right { right: 22px; }
#mikratec-cb.mc-left  { left: 22px; }

/* Launcher bubble */
.mc-launcher {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: var(--mc-color);
	color: #fff;
	box-shadow: 0 6px 22px rgba(11, 92, 171, 0.38);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.mc-launcher:hover { transform: scale(1.06); background: var(--mc-color-dark); }
.mc-launcher svg { width: 30px; height: 30px; }

/* Unread dot */
.mc-launcher .mc-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	width: 16px;
	height: 16px;
	background: #e5484d;
	border: 2px solid #fff;
	border-radius: 50%;
	display: none;
}
.mc-launcher.mc-has-unread .mc-badge { display: block; }

/* Proactive speech bubble */
.mc-proactive {
	position: absolute;
	bottom: 74px;
	max-width: 290px;
	background: var(--mc-bg);
	color: var(--mc-text);
	padding: 14px 16px;
	border-radius: 16px;
	box-shadow: 0 10px 34px rgba(16, 33, 55, 0.18);
	border: 1px solid #eef1f4;
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
}
#mikratec-cb.mc-right .mc-proactive { right: 4px; }
#mikratec-cb.mc-left  .mc-proactive { left: 4px; }
.mc-proactive.mc-show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.mc-proactive .mc-proactive-close {
	position: absolute;
	top: 6px;
	right: 8px;
	border: none;
	background: none;
	color: var(--mc-muted);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}
.mc-proactive p { margin: 2px 20px 0 0; }

/* Chat panel */
.mc-panel {
	position: absolute;
	bottom: 0;
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 60px);
	background: var(--mc-bg);
	border-radius: 18px;
	box-shadow: 0 18px 50px rgba(16, 33, 55, 0.28);
	display: none;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid #e7ebef;
}
#mikratec-cb.mc-right .mc-panel { right: 0; }
#mikratec-cb.mc-left  .mc-panel { left: 0; }
#mikratec-cb.mc-open .mc-panel { display: flex; }
#mikratec-cb.mc-open .mc-launcher { display: none; }

/* Header */
.mc-header {
	background: var(--mc-color);
	color: #fff;
	padding: 15px 16px;
	display: flex;
	align-items: center;
	gap: 11px;
}
.mc-header .mc-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255,255,255,0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	font-weight: 700;
}
.mc-header .mc-title { font-weight: 700; font-size: 15.5px; }
.mc-header .mc-status { font-size: 12px; opacity: 0.9; display: flex; align-items: center; gap: 5px; }
.mc-header .mc-status .mc-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; display: inline-block; }
.mc-header .mc-head-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.mc-lang-toggle {
	background: rgba(255,255,255,0.16);
	color: #fff;
	border: none;
	border-radius: 20px;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
	letter-spacing: 0.4px;
}
.mc-lang-toggle:hover { background: rgba(255,255,255,0.28); }
.mc-close-btn {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	opacity: 0.9;
	padding: 0 2px;
}
.mc-close-btn:hover { opacity: 1; }

/* Messages */
.mc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px 8px;
	background: #f5f7f9;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.mc-msg { max-width: 82%; padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.mc-msg.mc-bot { background: #fff; color: var(--mc-text); align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(16,33,55,0.06); }
.mc-msg.mc-user { background: var(--mc-color); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.mc-msg a { color: inherit; text-decoration: underline; }
.mc-sources { margin-top: 9px; padding-top: 8px; border-top: 1px solid #eef1f4; display: flex; flex-direction: column; gap: 4px; }
.mc-sources-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--mc-muted); }
.mc-source { font-size: 12.5px; color: var(--mc-color) !important; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mc-source::before { content: "↗"; margin-right: 5px; opacity: 0.6; }
.mc-source:hover { text-decoration: underline; }

/* Lead-capture form */
.mc-lead-form { display: flex; flex-direction: column; gap: 11px; padding: 6px 4px 4px; }
.mc-lead-title { margin: 2px 0 4px; font-size: 14.5px; color: var(--mc-text); line-height: 1.4; }
.mc-lead-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--mc-muted); }
.mc-lead-field input { border: 1px solid #d5dbe1; border-radius: 10px; padding: 10px 12px; font-size: 14.5px; font-family: inherit; outline: none; color: var(--mc-text); }
.mc-lead-field input:focus { border-color: var(--mc-color); }
.mc-lead-error { color: #e5484d; font-size: 12.5px; min-height: 1px; }
.mc-lead-submit { background: var(--mc-color); color: #fff; border: none; border-radius: 12px; padding: 11px 14px; font-size: 15px; font-weight: 700; cursor: pointer; }
.mc-lead-submit:hover { background: var(--mc-color-dark); }
.mc-lead-privacy { margin: 2px 0 0; font-size: 11px; color: var(--mc-muted); line-height: 1.4; }

/* Typing indicator */
.mc-typing { display: flex; gap: 4px; align-items: center; padding: 12px 14px; }
.mc-typing span { width: 7px; height: 7px; background: var(--mc-muted); border-radius: 50%; opacity: 0.5; animation: mc-bounce 1.2s infinite; }
.mc-typing span:nth-child(2) { animation-delay: 0.2s; }
.mc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mc-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Suggestion chips */
.mc-suggestions { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 14px 10px; background: #f5f7f9; }
.mc-chip {
	background: #fff;
	border: 1px solid var(--mc-color);
	color: var(--mc-color);
	border-radius: 18px;
	padding: 7px 12px;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}
.mc-chip:hover { background: var(--mc-color); color: #fff; }

/* Composer */
.mc-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid #e7ebef; background: #fff; }
.mc-composer textarea {
	flex: 1;
	resize: none;
	border: 1px solid #d5dbe1;
	border-radius: 14px;
	padding: 9px 12px;
	font-family: inherit;
	font-size: 14.5px;
	max-height: 110px;
	outline: none;
}
.mc-composer textarea:focus { border-color: var(--mc-color); }
.mc-send {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: var(--mc-color);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.mc-send:hover { background: var(--mc-color-dark); }
.mc-send:disabled { opacity: 0.5; cursor: default; }
.mc-send svg { width: 19px; height: 19px; }

.mc-footer { text-align: center; font-size: 11px; color: var(--mc-muted); padding: 6px 0 9px; background: #fff; }

@media (max-width: 480px) {
	#mikratec-cb { bottom: 14px; }
	#mikratec-cb.mc-right { right: 14px; }
	#mikratec-cb.mc-left  { left: 14px; }
	.mc-panel { width: calc(100vw - 20px); height: calc(100vh - 90px); }
}
