/* Manyrak Gaz Support Chatbot — front-end styles.
   Brand colour is injected as --mgc-brand from plugin settings. */

.mgc-root {
	--mgc-ink: #0e1620;
	--mgc-ink-soft: #5b6875;
	--mgc-line: #e3e8ee;
	--mgc-surface: #ffffff;
	--mgc-canvas: #f5f7fa;
	--mgc-radius: 16px;
	--mgc-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	position: fixed;
	bottom: 24px;
	z-index: 99999;
	font-family: var(--mgc-font);
	font-size: 15px;
	line-height: 1.5;
}

.mgc-root.mgc-right { right: 24px; }
.mgc-root.mgc-left  { left: 24px; }

.mgc-root *,
.mgc-root *::before,
.mgc-root *::after { box-sizing: border-box; }

.mgc-sr,
.mgc-root .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}

/* ---------- Launcher ---------- */

.mgc-launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--mgc-brand);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 10px 26px rgba(9, 24, 45, 0.22);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.mgc-root.mgc-right .mgc-launcher { margin-left: auto; }

.mgc-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 32px rgba(9, 24, 45, 0.28);
}

.mgc-launcher:focus-visible {
	outline: 3px solid var(--mgc-brand-ring);
	outline-offset: 3px;
}

.mgc-launcher__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.16s ease, transform 0.16s ease;
}

.mgc-launcher__icon--close {
	position: absolute;
	opacity: 0;
	transform: rotate(-45deg) scale(0.7);
}

/* Solid white bubble; the three dots are knocked out in the brand colour. */
.mgc-launcher .mgc-bubble-dot {
	fill: var(--mgc-brand);
}

.mgc-root[data-open="true"] .mgc-launcher__icon--chat {
	opacity: 0;
	transform: scale(0.7);
}

.mgc-root[data-open="true"] .mgc-launcher__icon--close {
	opacity: 1;
	transform: rotate(0) scale(1);
}

/* Uploaded logo fills the launcher circle */
.mgc-launcher__logo {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

.mgc-has-logo .mgc-launcher__icon--chat {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	overflow: hidden;
}

.mgc-has-logo .mgc-launcher__icon--close {
	background: var(--mgc-brand);
	border-radius: 50%;
	width: 100%;
	height: 100%;
}

/* Attention pulse, once, on the ring only */
.mgc-launcher__pulse {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid var(--mgc-brand);
	animation: mgc-pulse 2.4s ease-out 3;
	pointer-events: none;
}

.mgc-root[data-open="true"] .mgc-launcher__pulse { display: none; }

@keyframes mgc-pulse {
	0%   { transform: scale(1);    opacity: 0.55; }
	70%  { transform: scale(1.55); opacity: 0; }
	100% { transform: scale(1.55); opacity: 0; }
}

/* Unread badge */
.mgc-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #e5484d;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 0 0 2px #fff;
}

/* ---------- Panel ---------- */

.mgc-panel {
	position: absolute;
	bottom: 76px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 120px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--mgc-surface);
	border: 1px solid var(--mgc-line);
	border-radius: var(--mgc-radius);
	box-shadow: 0 24px 60px rgba(9, 24, 45, 0.24);
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.mgc-root.mgc-right .mgc-panel { right: 0; }
.mgc-root.mgc-left  .mgc-panel { left: 0; }

.mgc-panel[hidden] { display: none; }

.mgc-root[data-open="true"] .mgc-panel {
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* ---------- Header ---------- */

.mgc-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 14px 14px 16px;
	background: linear-gradient(135deg, var(--mgc-brand) 0%, var(--mgc-brand-dark) 100%);
	color: #fff;
}

.mgc-header__mark {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex: 0 0 40px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	overflow: hidden;
}

.mgc-header__logo {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.mgc-header__text { flex: 1 1 auto; min-width: 0; }

.mgc-header__title {
	margin: 0;
	padding: 0;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.01em;
	color: #fff;
	line-height: 1.25;
}

.mgc-header__status {
	margin: 2px 0 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.82);
}

.mgc-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #3ddc84;
	flex: 0 0 7px;
}

.mgc-header__actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.mgc-lang {
	display: flex;
	padding: 2px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.16);
}

.mgc-lang__btn {
	border: 0;
	background: transparent;
	color: rgba(255, 255, 255, 0.8);
	font: inherit;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	padding: 4px 8px;
	border-radius: 999px;
	cursor: pointer;
}

.mgc-lang__btn[aria-pressed="true"] {
	background: #fff;
	color: var(--mgc-brand);
}

.mgc-icon-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: rgba(255, 255, 255, 0.85);
	cursor: pointer;
}

.mgc-icon-btn:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* ---------- Message log ---------- */

.mgc-log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 18px 16px 8px;
	background: var(--mgc-canvas);
	scroll-behavior: smooth;
}

.mgc-msg {
	display: flex;
	margin-bottom: 10px;
	animation: mgc-in 0.22s ease-out both;
}

@keyframes mgc-in {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.mgc-root *,
	.mgc-root *::before,
	.mgc-root *::after {
		animation: none !important;
		transition: none !important;
	}
}

.mgc-msg--bot  { justify-content: flex-start; }
.mgc-msg--user { justify-content: flex-end; }

.mgc-bubble {
	max-width: 84%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.55;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.mgc-msg--bot .mgc-bubble {
	background: var(--mgc-surface);
	color: var(--mgc-ink);
	border: 1px solid var(--mgc-line);
	border-bottom-left-radius: 4px;
}

.mgc-msg--user .mgc-bubble {
	background: var(--mgc-brand);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.mgc-bubble a { color: inherit; text-decoration: underline; }
.mgc-msg--bot .mgc-bubble a { color: var(--mgc-brand); font-weight: 600; }

.mgc-bubble strong { font-weight: 600; }

/* Typing indicator */
.mgc-typing {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	padding: 12px 14px;
}

.mgc-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #b6c0cb;
	animation: mgc-bounce 1.1s infinite ease-in-out;
}

.mgc-typing span:nth-child(2) { animation-delay: 0.15s; }
.mgc-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes mgc-bounce {
	0%, 60%, 100% { transform: translateY(0);   opacity: 0.5; }
	30%           { transform: translateY(-4px); opacity: 1; }
}

/* Quick replies / chips */
.mgc-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 12px 0;
	padding: 0;
}

.mgc-chip {
	border: 1px solid var(--mgc-brand);
	background: var(--mgc-brand-soft);
	color: var(--mgc-brand-dark);
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	padding: 7px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.mgc-chip:hover {
	background: var(--mgc-brand);
	color: #fff;
}

.mgc-chip:focus-visible {
	outline: 2px solid var(--mgc-brand);
	outline-offset: 2px;
}

/* Inline lead form */
.mgc-form {
	background: var(--mgc-surface);
	border: 1px solid var(--mgc-line);
	border-radius: 14px;
	padding: 14px;
	margin-bottom: 12px;
}

.mgc-form h3 {
	margin: 0 0 4px;
	font-size: 14px;
	font-weight: 600;
	color: var(--mgc-ink);
}

.mgc-form p.mgc-form__intro {
	margin: 0 0 10px;
	font-size: 12.5px;
	color: var(--mgc-ink-soft);
}

.mgc-form label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--mgc-ink-soft);
	margin-bottom: 4px;
}

.mgc-form input,
.mgc-form textarea {
	width: 100%;
	padding: 9px 11px;
	margin-bottom: 9px;
	font: inherit;
	font-size: 14px;
	color: var(--mgc-ink);
	background: #fff;
	border: 1px solid var(--mgc-line);
	border-radius: 9px;
}

.mgc-form input:focus,
.mgc-form textarea:focus {
	outline: none;
	border-color: var(--mgc-brand);
	box-shadow: 0 0 0 3px var(--mgc-brand-ring);
}

.mgc-form textarea { resize: vertical; min-height: 66px; }

.mgc-form__submit {
	width: 100%;
	padding: 10px 14px;
	border: 0;
	border-radius: 9px;
	background: var(--mgc-brand);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.mgc-form__submit:hover { background: var(--mgc-brand-dark); }
.mgc-form__submit[disabled] { opacity: 0.6; cursor: default; }

.mgc-form__error {
	margin: 0 0 8px;
	font-size: 12.5px;
	color: #b32d2e;
}

/* ---------- Composer ---------- */

.mgc-composer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: var(--mgc-surface);
	border-top: 1px solid var(--mgc-line);
}

.mgc-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 11px 14px;
	font: inherit;
	font-size: 14px;
	color: var(--mgc-ink);
	background: var(--mgc-canvas);
	border: 1px solid var(--mgc-line);
	border-radius: 999px;
}

.mgc-input:focus {
	outline: none;
	border-color: var(--mgc-brand);
	box-shadow: 0 0 0 3px var(--mgc-brand-ring);
	background: #fff;
}

.mgc-send {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	border: 0;
	border-radius: 50%;
	background: var(--mgc-brand);
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease;
}

.mgc-send:hover { background: var(--mgc-brand-dark); }
.mgc-send:focus-visible { outline: 3px solid var(--mgc-brand-ring); outline-offset: 2px; }

.mgc-foot {
	margin: 0;
	padding: 7px 12px 9px;
	background: var(--mgc-surface);
	border-top: 1px solid var(--mgc-line);
	font-size: 11px;
	color: var(--mgc-ink-soft);
	text-align: center;
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
	.mgc-root { bottom: 16px; }
	.mgc-root.mgc-right { right: 16px; }
	.mgc-root.mgc-left  { left: 16px; }

	.mgc-panel {
		position: fixed;
		inset: 0;
		width: 100vw;
		max-width: 100vw;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
		border: 0;
	}

	.mgc-root[data-open="true"] .mgc-launcher { display: none; }
}
