@charset 'UTF-8';
/**
 * MW AI Siktir - frontend chat
 * All selectors prefixed with .mwais- to avoid theme conflicts
 * Accent color: --mwais-accent (set from settings)
 */

.mwais-inline,
.mwais-widget {
	--mwais-accent: #2271b1;
	--mwais-bg: #fff;
	--mwais-text: #1d2327;
	--mwais-muted: #646970;
	--mwais-border: #dcdcde;
	--mwais-bubble-bot: #f0f0f1;
	--mwais-radius: 14px;
	--mwais-shadow: 0 10px 40px rgba(0, 0, 0, .18);
}

/* A/B test / chat hours: hidden until chat.js allows it (themes may set display) */
.mwais-inline[hidden],
.mwais-widget[hidden] { display: none !important; }

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

.mwais-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px; height: 1px;
	opacity: 0;
}

/* ------------------------------------------------------------------ */
/* Chat box                                                            */
/* ------------------------------------------------------------------ */
.mwais-chat {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	background: var(--mwais-bg);
	color: var(--mwais-text);
	border: 1px solid var(--mwais-border);
	border-radius: var(--mwais-radius);
	overflow: hidden;
	font-size: 15px;
	line-height: 1.45;
	text-align: left;
}
.mwais-chat *,
.mwais-chat *::before,
.mwais-chat *::after { box-sizing: border-box; }

.mwais-chat--inline {
	height: 520px;
	max-height: 80vh;
	width: 100%;
	max-width: 720px;
}

.mwais-chat__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: var(--mwais-accent);
	color: #fff;
}
.mwais-chat__logo {
	width: 32px; 
	height: 32px;
	border-radius: 50%;
	background: #fff;
	object-fit: cover;
	flex: none;
	padding: 1px;
}
.mwais-chat__title {
	flex: 1;
	font-weight: 600;
	font-size: 16px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mwais-chat__clear,
.mwais-chat__close {
	flex: none;
	width: 32px; height: 32px;
	padding: 0; margin: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}
.mwais-chat__clear {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.mwais-chat__clear[hidden] { display: none; }
.mwais-chat__clear:disabled { opacity: .5; cursor: default; }
.mwais-chat__clear:hover:not(:disabled),
.mwais-chat__clear:focus-visible,
.mwais-chat__close:hover,
.mwais-chat__close:focus-visible { background: rgba(255, 255, 255, .2); }

.mwais-chat__messages {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overscroll-behavior: contain;
}
.mwais-chat__messages:focus-visible { outline: 2px solid var(--mwais-accent); outline-offset: -2px; }

.mwais-msg {
	max-width: 85%;
	padding: 9px 13px;
	border-radius: var(--mwais-radius);
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.mwais-msg--bot {
	align-self: flex-start;
	background: var(--mwais-bubble-bot);
	border-bottom-left-radius: 4px;
}
.mwais-msg--user {
	align-self: flex-end;
	background: var(--mwais-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.mwais-msg--error {
	align-self: stretch;
	max-width: none;
	background: #fcf0f1;
	color: #8a2424;
	border: 1px solid #f0b8b8;
	font-size: 14px;
}
.mwais-msg--typing .mwais-msg__text {
	color: var(--mwais-muted);
	animation: mwais-pulse 1.2s ease-in-out infinite;
}

/* Message time (date in tooltip) */
.mwais-msg__time {
	display: block;
	margin-top: 3px;
	font-size: 11px;
	line-height: 1.2;
	text-align: right;
	white-space: nowrap;
	opacity: .65;
	cursor: default;
}

/* Phones, emails, web addresses in answers */
.mwais-chat a.mwais-msg__link {
	color: var(--mwais-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
	box-shadow: none;
}
.mwais-chat a.mwais-msg__link[href^="http"],
.mwais-chat a.mwais-msg__link[href^="mailto:"] { white-space: normal; overflow-wrap: anywhere; }
.mwais-chat a.mwais-msg__link:hover { text-decoration-thickness: 2px; }

/* Fallback buttons */
.mwais-msg__links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
	white-space: normal;
}
.mwais-chat a.mwais-msg__btn {
	display: inline-block;
	padding: 5px 12px;
	border: 1px solid var(--mwais-accent);
	border-radius: 999px;
	background: var(--mwais-bg);
	color: var(--mwais-accent);
	font-size: 14px;
	line-height: 1.3;
	text-decoration: none;
	box-shadow: none;
}
.mwais-chat a.mwais-msg__btn:hover,
.mwais-chat a.mwais-msg__btn:focus-visible {
	background: var(--mwais-accent);
	color: #fff;
}

.mwais-chat__form {
	position: relative;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 0;
	padding: 10px;
	border-top: 1px solid var(--mwais-border);
	background: var(--mwais-bg);
}
.mwais-chat__input {
	flex: 1;
	min-height: 42px;
	max-height: 140px;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid var(--mwais-border);
	border-radius: 10px;
	background: #fff;
	color: var(--mwais-text);
	font: inherit;
	resize: none;
	box-shadow: none;
}
.mwais-chat__input:focus {
	outline: none;
	border-color: var(--mwais-accent);
	box-shadow: 0 0 0 1px var(--mwais-accent);
}
.mwais-chat__send {
	position: relative;
	flex: none;
	height: 42px;
	margin: 0;
	padding: 0 16px;
	border: 0;
	border-radius: 10px;
	background: var(--mwais-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.mwais-chat__send:hover { filter: brightness(1.08); }
.mwais-chat__send:focus-visible { outline: 2px solid var(--mwais-text); outline-offset: 2px; }
.mwais-chat__send:disabled { cursor: wait; opacity: .75; }

/* Loading state */
.mwais-spinner {
	display: none;
	position: absolute;
	top: 50%; left: 50%;
	width: 18px; height: 18px;
	margin: -9px 0 0 -9px;
	border: 2px solid rgba(255, 255, 255, .4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: mwais-spin .8s linear infinite;
}
.mwais-chat.is-busy .mwais-spinner { display: block; }
.mwais-chat.is-busy .mwais-chat__send-label { visibility: hidden; }

/* ------------------------------------------------------------------ */
/* Popup widget                                                        */
/* ------------------------------------------------------------------ */
.mwais-widget {
	position: fixed;
	bottom: 20px;
	z-index: 99990;
}
.mwais-widget--right { right: 20px; }
.mwais-widget--left  { left: 20px; }

.mwais-widget__toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px; height: 60px;
	padding: 0; margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--mwais-accent);
	color: #fff;
	box-shadow: var(--mwais-shadow);
	cursor: pointer;
	transition: transform .15s ease;
}
.mwais-widget--left .mwais-widget__toggle { margin-right: auto; }
.mwais-widget--right .mwais-widget__toggle { margin-left: auto; }
.mwais-widget__toggle:hover { transform: scale(1.06); }
.mwais-widget__toggle:focus-visible { outline: 3px solid var(--mwais-text); outline-offset: 3px; }

/* Custom icons (Settings › Chat widget) */
img.mwais-icon-open  { width: 28px; height: 28px; }
img.mwais-icon-close { width: 24px; height: 24px; }
.mwais-widget__toggle img { max-width: none; object-fit: contain; }

.mwais-widget .mwais-icon-close { display: none; }
.mwais-widget.is-open .mwais-icon-close { display: block; }
.mwais-widget.is-open .mwais-icon-open { display: none; }

.mwais-widget__panel {
	position: absolute;
	bottom: 76px;
	width: 380px;
	height: 560px;
	max-height: calc(100vh - 120px);
	animation: mwais-in .18s ease-out;
}
.mwais-widget__panel[hidden] { display: none; }
.mwais-widget--right .mwais-widget__panel { right: 0; }
.mwais-widget--left  .mwais-widget__panel { left: 0; }

.mwais-widget__panel .mwais-chat {
	height: 100%;
	border: 0;
	box-shadow: var(--mwais-shadow);
}

/* Phones: full-width sheet */
@media (max-width: 480px) {
	.mwais-widget { bottom: 14px; }
	.mwais-widget--right { right: 14px; }
	.mwais-widget--left  { left: 14px; }

	.mwais-widget__panel {
		position: fixed;
		left: 8px !important;
		right: 8px !important;
		bottom: 84px;
		width: auto;
		height: auto;
		top: 8px;
		max-height: none;
	}
	.mwais-chat--inline { height: 70vh; }
	.mwais-msg { max-width: 92%; }
}

@keyframes mwais-spin  { to { transform: rotate(360deg); } }
@keyframes mwais-pulse { 50% { opacity: .4; } }
@keyframes mwais-in    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
	.mwais-widget__panel,
	.mwais-widget__toggle,
	.mwais-spinner,
	.mwais-msg--typing .mwais-msg__text { animation: none; transition: none; }
	.mwais-spinner { border-top-color: rgba(255, 255, 255, .4); }
}

@media print {
	.mwais-widget { display: none !important; }
}
