/**
 * Akıllı Sohbet - Ön Yüz Sohbet Widget'ı Stilleri
 * WhatsApp benzeri modern tasarım, koyu/açık tema desteği, mobil uyumlu.
 */

.as-chat-root {
	--as-primary: #25D366;
	--as-primary-dark: #128C7E;
	--as-bg: #ffffff;
	--as-bg-soft: #f0f2f5;
	--as-text: #111b21;
	--as-text-soft: #667781;
	--as-bubble-in: #ffffff;
	--as-bubble-out: #d9fdd3;
	--as-border: #e9edef;
	--as-shadow: 0 10px 30px rgba(0, 0, 0, .18);

	position: fixed;
	bottom: 24px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.as-chat-root.as-pos-right {
	right: 24px;
}

.as-chat-root.as-pos-left {
	left: 24px;
}

.as-chat-root * {
	box-sizing: border-box;
}

/* Koyu tema */
.as-chat-root.as-theme-dark {
	--as-bg: #111b21;
	--as-bg-soft: #0b141a;
	--as-text: #e9edef;
	--as-text-soft: #8696a0;
	--as-bubble-in: #202c33;
	--as-bubble-out: #005c4b;
	--as-border: #2a3942;
	--as-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

@media (prefers-color-scheme: dark) {
	.as-chat-root.as-theme-auto {
		--as-bg: #111b21;
		--as-bg-soft: #0b141a;
		--as-text: #e9edef;
		--as-text-soft: #8696a0;
		--as-bubble-in: #202c33;
		--as-bubble-out: #005c4b;
		--as-border: #2a3942;
		--as-shadow: 0 10px 30px rgba(0, 0, 0, .5);
	}
}

/* Balon */
.as-chat-bubble {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--as-primary);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--as-shadow);
	color: #fff;
	position: relative;
	transition: transform .15s ease;
}

.as-chat-bubble:hover {
	transform: scale(1.06);
}

.as-bubble-icon {
	width: 30px;
	height: 30px;
}

.as-bubble-logo {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
}

.as-bubble-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	background: #f02849;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	min-width: 18px;
	height: 18px;
	border-radius: 9px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
}

/* Pencere */
.as-chat-window {
	position: absolute;
	bottom: 76px;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 140px);
	background: var(--as-bg);
	border-radius: 12px;
	box-shadow: var(--as-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: as-pop-in .18s ease;
}

.as-pos-right .as-chat-window {
	right: 0;
}

.as-pos-left .as-chat-window {
	left: 0;
}

@keyframes as-pop-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* Başlık */
.as-chat-header {
	background: var(--as-primary-dark);
	color: #fff;
	padding: 12px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.as-chat-header-info {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.as-header-logo {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.as-header-title {
	font-weight: 600;
	font-size: 15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.as-header-status {
	font-size: 12px;
	opacity: .85;
	display: flex;
	align-items: center;
	gap: 5px;
}

.as-status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
	display: inline-block;
}

.as-chat-header-actions {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}

.as-icon-btn {
	background: transparent;
	border: none;
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .12s ease;
}

.as-icon-btn:hover {
	background: rgba(255, 255, 255, .15);
}

.as-icon-btn svg {
	width: 18px;
	height: 18px;
}

/* Mesaj alanı */
.as-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: var(--as-bg-soft);
	display: flex;
	flex-direction: column;
	gap: 8px;
	scroll-behavior: smooth;
}

.as-msg-row {
	display: flex;
	max-width: 85%;
}

.as-msg-row.as-in {
	align-self: flex-start;
}

.as-msg-row.as-out {
	align-self: flex-end;
}

.as-msg-bubble {
	padding: 8px 12px;
	border-radius: 10px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--as-text);
	box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
	word-break: break-word;
	position: relative;
}

.as-in .as-msg-bubble {
	background: var(--as-bubble-in);
	border-top-left-radius: 2px;
}

.as-out .as-msg-bubble {
	background: var(--as-bubble-out);
	border-top-right-radius: 2px;
}

.as-msg-time {
	display: block;
	font-size: 10px;
	color: var(--as-text-soft);
	margin-top: 4px;
	text-align: right;
}

/* Yazıyor animasyonu */
.as-chat-typing {
	padding: 4px 18px 10px;
	background: var(--as-bg-soft);
	display: flex;
	gap: 4px;
	align-items: center;
	flex-shrink: 0;
}

.as-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--as-text-soft);
	animation: as-blink 1.2s infinite ease-in-out;
}

.as-dot:nth-child(2) {
	animation-delay: .2s;
}

.as-dot:nth-child(3) {
	animation-delay: .4s;
}

@keyframes as-blink {
	0%, 80%, 100% {
		opacity: .3;
		transform: translateY(0);
	}
	40% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

/* Giriş satırı */
.as-chat-input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	background: var(--as-bg);
	border-top: 1px solid var(--as-border);
	flex-shrink: 0;
}

.as-chat-input {
	flex: 1;
	resize: none;
	border: 1px solid var(--as-border);
	border-radius: 18px;
	padding: 9px 14px;
	font-size: 14px;
	line-height: 1.3;
	max-height: 90px;
	background: var(--as-bg-soft);
	color: var(--as-text);
	font-family: inherit;
}

.as-chat-input:focus {
	outline: none;
	border-color: var(--as-primary);
}

.as-chat-send {
	background: var(--as-primary);
	border: none;
	color: #fff;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: transform .1s ease;
}

.as-chat-send:hover {
	transform: scale(1.05);
}

.as-chat-send svg {
	width: 18px;
	height: 18px;
}

.as-chat-body::-webkit-scrollbar {
	width: 6px;
}

.as-chat-body::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, .15);
	border-radius: 3px;
}

/* Mobil uyum */
@media (max-width: 480px) {
	.as-chat-root.as-pos-right,
	.as-chat-root.as-pos-left {
		right: 12px;
		left: 12px;
		bottom: 12px;
	}

	.as-chat-window {
		width: auto;
		height: calc(100vh - 100px);
		max-height: none;
		right: 0;
		left: 0;
		bottom: 70px;
	}

	.as-chat-bubble {
		margin-left: auto;
	}
}
