/**
 * Presswick Chatbot — Widget stilleri.
 *
 * CSS değişkenleriyle: --pswcb-primary tek yerden değişir (Görünüm
 * sekmesi gelince oradan basılacak). Hafif, tema çakışmasına karşı
 * yüksek özgüllük + kapsül.
 */

.pswcb-popup-root,
/* ── Gömülü (shortcode) sarmalayıcı: hiza ── */
.pswcb-embed-wrap { display: flex; width: 100%; }
.pswcb-embed-align-left { justify-content: flex-start; }
.pswcb-embed-align-center { justify-content: center; }
.pswcb-embed-align-right { justify-content: flex-end; }
.pswcb-embed-wrap .pswcb-embed { width: 100%; } /* max-width inline'dan gelir */

.pswcb-embed {
	--pswcb-primary: #6b4de6;
	--pswcb-primary-dark: #5a3fd0;
	--pswcb-text: #1e1e2e;
	--pswcb-bot-bg: #f2f0fb;
	--pswcb-visitor-bg: #6b4de6;
	--pswcb-on-primary: #ffffff;
	--pswcb-on-visitor: #ffffff;
	--pswcb-on-bot: #1e1e2e;
	--pswcb-radius: 14px;
	--pswcb-shadow: 0 8px 30px rgba(0,0,0,.16);
	box-sizing: border-box;
}
.pswcb-popup-root *,
.pswcb-embed * {
	box-sizing: border-box;
}

/* ── Launcher (balon) ── */
.pswcb-launcher {
	position: fixed;
	right: 22px;
	bottom: 22px;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: none;
	background: var(--pswcb-primary);
	color: var(--pswcb-on-primary, #fff);
	cursor: pointer;
	box-shadow: var(--pswcb-shadow);
	z-index: 999990;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .15s ease, background .15s ease;
}
.pswcb-launcher svg { width: 25px; height: 25px; display: block; }

/* ── Launcher şekli ── */
.pswcb-shape-round .pswcb-launcher { border-radius: 50%; }
.pswcb-shape-rounded .pswcb-launcher { border-radius: 16px; }
.pswcb-shape-pill .pswcb-launcher {
	border-radius: 30px;
	width: auto;
	min-width: 58px;
	padding: 0 20px;
	gap: 8px;
}
/* Pill şekilde metin de göster (varsa) */
.pswcb-shape-pill .pswcb-launcher-text { display: inline; }

/* ── Karşılama balonu (launcher yanında metin) ── */
.pswcb-greeting {
	position: fixed;
	bottom: 30px;
	background: var(--pswcb-primary);
	color: var(--pswcb-on-primary, #fff);
	padding: 10px 14px;
	border-radius: 12px;
	box-shadow: var(--pswcb-shadow);
	font-size: 14px;
	max-width: 240px;
	z-index: 999989;
	cursor: pointer;
	animation: pswcb-greet-in .3s ease;
	display: flex;
	align-items: center;
	gap: 8px;
}
.pswcb-greeting-text { flex: 1 1 auto; }
.pswcb-greeting-close {
	flex: 0 0 auto;
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	outline: none !important;
	color: inherit !important;
	opacity: .7;
	font-size: 18px !important;
	line-height: 1 !important;
	width: auto !important;
	min-width: 0 !important;
	height: auto !important;
	margin: 0 !important;
	padding: 0 2px !important;
	cursor: pointer;
	border-radius: 0 !important;
}
.pswcb-greeting-close:hover { opacity: 1; background: transparent !important; }
.pswcb-pos-right .pswcb-greeting { right: 90px; }
.pswcb-pos-left .pswcb-greeting { left: 90px; }
@keyframes pswcb-greet-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}
.pswcb-greeting.pswcb-hidden { display: none; }

/* Gecikme: başta gizli, süre sonunda JS class'ı kaldırınca belirir */
.pswcb-launcher.pswcb-prehide,
.pswcb-greeting.pswcb-prehide {
	opacity: 0;
	transform: scale(.6);
	pointer-events: none;
}
.pswcb-launcher, .pswcb-greeting {
	transition: opacity .25s ease, transform .25s ease;
}
@media (max-width: 480px) {
	/* Mobilde karşılama launcher'ın ÜSTÜNDE (yan yana sığmıyor) */
	.pswcb-greeting {
		max-width: 200px;
		bottom: 84px; /* launcher'ın üstü: 16px alt + 58px launcher + boşluk */
	}
	.pswcb-pos-right .pswcb-greeting { right: 16px; left: auto; }
	.pswcb-pos-left .pswcb-greeting { left: 16px; right: auto; }
}

/* ── Sol konum ── */
.pswcb-pos-left .pswcb-launcher { right: auto; left: 22px; }
.pswcb-pos-left .pswcb-panel { right: auto; left: 22px; }
@media (max-width: 480px) {
	.pswcb-pos-left .pswcb-launcher { left: 16px; }
}
.pswcb-launcher:hover {
	background: var(--pswcb-primary-dark);
	transform: scale(1.05);
}
.pswcb-launcher.pswcb-hidden {
	display: none;
}

/* ── Panel (sohbet penceresi) ── */
.pswcb-panel {
	position: fixed;
	right: 22px;
	bottom: 22px;
	width: 370px;  /* varsayılan; .pswcb-size-* ezer */
	max-width: calc(100vw - 32px);
	height: 540px; /* varsayılan; .pswcb-size-* ezer */
	max-height: calc(100vh - 48px);
	background: #fff;
	border-radius: var(--pswcb-radius);
	box-shadow: var(--pswcb-shadow);
	z-index: 999991;
	display: none;
	flex-direction: column;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--pswcb-text);
}
.pswcb-panel.pswcb-open {
	display: flex;
}

/* Embed mod: akışta, sabit değil */
.pswcb-embed .pswcb-panel {
	position: relative;
	right: auto;
	bottom: auto;
	display: flex;
	width: 100%;
	max-width: 100%;
	height: 480px;
}

/* ── Başlık ── */
.pswcb-header {
	background: var(--pswcb-primary);
	color: var(--pswcb-on-primary, #fff);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 0 0 auto;
}
.pswcb-header-name {
	font-weight: 600;
	font-size: 15px;
	flex: 1 1 auto;
}
/* Avatar (başlıkta) */
.pswcb-avatar {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255,255,255,.2);
}
.pswcb-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.pswcb-avatar-letter {
	font-weight: 700;
	font-size: 15px;
	color: var(--pswcb-on-primary, #fff);
	background: rgba(255,255,255,.25);
}
.pswcb-close {
	background: transparent;
	border: none;
	color: var(--pswcb-on-primary, #fff);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	opacity: .85;
	padding: 0 4px;
}
.pswcb-close:hover { opacity: 1; }
.pswcb-embed .pswcb-close { display: none; }

/* ── Boyut (masaüstü; mobilde hepsi tam ekran) ── */
/* Yüksek özgüllük: root + size + panel → base .pswcb-panel'i kesin ezer */
.pswcb-popup-root.pswcb-size-small .pswcb-panel { width: 300px; height: 420px; }
.pswcb-popup-root.pswcb-size-medium .pswcb-panel { width: 370px; height: 540px; }
.pswcb-popup-root.pswcb-size-large .pswcb-panel { width: 420px; height: 620px; }
/* Embed'de genişlik sarmalayıcıdan gelir; boyut sadece yüksekliği ayarlar */
.pswcb-embed.pswcb-size-small .pswcb-panel { width: 100%; height: 420px; }
.pswcb-embed.pswcb-size-medium .pswcb-panel { width: 100%; height: 540px; }
.pswcb-embed.pswcb-size-large .pswcb-panel { width: 100%; height: 620px; }

/* ── Mesaj alanı ── */
.pswcb-messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafafa;
}
.pswcb-msg {
	max-width: 82%;
	padding: 9px 13px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
}
.pswcb-msg-bot {
	align-self: flex-start;
	background: var(--pswcb-bot-bg);
	color: var(--pswcb-on-bot, #1e1e2e);
	border-bottom-left-radius: 4px;
}
.pswcb-msg-visitor {
	align-self: flex-end;
	background: var(--pswcb-visitor-bg);
	color: var(--pswcb-on-visitor, #fff);
	border-bottom-right-radius: 4px;
}
.pswcb-msg-system {
	align-self: center;
	background: #fff4e5;
	color: #8a5a00;
	font-size: 12.5px;
	max-width: 92%;
	text-align: center;
}

/* ── "yazıyor…" ── */
.pswcb-typing {
	align-self: flex-start;
	display: inline-flex;
	gap: 4px;
	padding: 11px 14px;
	background: var(--pswcb-bot-bg);
	border-radius: 12px;
	border-bottom-left-radius: 4px;
}
.pswcb-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b3a9e0;
	animation: pswcb-bounce 1.2s infinite ease-in-out;
}
.pswcb-typing span:nth-child(2) { animation-delay: .15s; }
.pswcb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes pswcb-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: .6; }
	30% { transform: translateY(-5px); opacity: 1; }
}

/* ── Giriş alanı ── */
.pswcb-input-row {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #eee;
	background: #fff;
}
.pswcb-input {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid #ddd;
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 14px;
	font-family: inherit;
	max-height: 72px;
	outline: none;
}
.pswcb-input:focus { border-color: var(--pswcb-primary); }
.pswcb-send {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	background: var(--pswcb-primary);
	color: var(--pswcb-on-primary, #fff);
	border: none;
	border-radius: 10px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}
.pswcb-send svg { width: 20px; height: 20px; display: block; }
.pswcb-send:hover { background: var(--pswcb-primary-dark); }
.pswcb-send:disabled { opacity: .5; cursor: default; }
/* Metin/ikon+metin modu: sabit kare değil, içeriğe göre genişler */
.pswcb-send-wide {
	width: auto;
	min-width: 42px;
	padding: 0 16px;
	font-size: 14px;
	font-weight: 600;
}

/* ── Alt bilgi (rıza + imza) ── */
.pswcb-foot {
	flex: 0 0 auto;
	padding: 6px 12px 10px;
	font-size: 11px;
	color: #999;
	text-align: center;
	background: #fff;
}
/* İmza satırı (varsayılan görünüm) */
.pswcb-sig { font-size: 11px; color: #999; }
/* KVKK/GDPR bilgilendirmesi — imzanın altında, daha küçük ve silik */
.pswcb-consent {
	font-size: 10px;
	color: #b5b5b5;
	margin-top: 2px;
	line-height: 1.35;
}

/* ── Mobil ── */
@media (max-width: 480px) {
	/* Boyut class'ları (.pswcb-size-*) özgüllük olarak daha güçlü olduğu için
	   mobilde tam ekranı eziyordu. Aynı özgüllükle hedefleyip sonda geldiğimiz
	   için kazanıyoruz — !important'a gerek yok. Mobilde boyut ayarı geçersiz:
	   her boyutta panel tam ekran açılır. */
	.pswcb-panel,
	.pswcb-pos-left .pswcb-panel,
	.pswcb-popup-root.pswcb-size-small .pswcb-panel,
	.pswcb-popup-root.pswcb-size-medium .pswcb-panel,
	.pswcb-popup-root.pswcb-size-large .pswcb-panel {
		right: 0;
		bottom: 0;
		left: 0;
		top: 0;
		width: 100%;
		max-width: 100%;
		/* dvh: mobil tarayıcı çubuğu + klavyeyi doğru hesaplar (100vh taşıyordu) */
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		border-radius: 0;
	}
	/* Başlık sabit üstte, küçülmez */
	.pswcb-header {
		flex: 0 0 auto;
	}
	/* Mesaj alanı esner ve KENDİ İÇİNDE kayar — taşma buradaydı */
	.pswcb-messages {
		flex: 1 1 auto;
		min-height: 0; /* kritik: flex çocuğun taşmasını önler */
		-webkit-overflow-scrolling: touch;
	}
	/* Giriş satırı sabit altta — klavye açılınca görünür kalır */
	.pswcb-input-row {
		flex: 0 0 auto;
	}
	.pswcb-foot {
		flex: 0 0 auto;
	}
	.pswcb-launcher {
		right: 16px;
		bottom: 16px;
	}
	/* Embed modu mobilde tam ekran değil, akışta kalır */
	.pswcb-embed .pswcb-panel {
		position: relative;
		height: 70vh;
		top: auto;
		left: auto;
	}
}