/* SaglamWhatsapp — ön yüz stilleri.
   Tüm seçiciler #sagwa-widget ile güçlendirilmiştir; tema/builder
   buton stillerinin widget'a sızmasını engellemek için buton ve
   bağlantı öğeleri açıkça sıfırlanır. */

#sagwa-widget,
#sagwa-widget * {
	box-sizing: border-box;
}

/* Tema sızmalarına karşı sıfırlama */
#sagwa-widget button,
#sagwa-widget a {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	font-family: inherit;
	-webkit-tap-highlight-color: transparent;
}

#sagwa-widget {
	position: fixed;
	z-index: var(--sagwa-z, 99999);
	bottom: calc(var(--sagwa-y, 20px) + env(safe-area-inset-bottom, 0px));
	display: flex;
	flex-direction: column;
	gap: 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	opacity: 0;
	transform: translateY(14px);
	pointer-events: none;
	transition: opacity 0.35s ease, transform 0.35s ease;
}

#sagwa-widget.sagwa--right {
	right: calc(var(--sagwa-x, 20px) + env(safe-area-inset-right, 0px));
	align-items: flex-end;
}

#sagwa-widget.sagwa--left {
	left: calc(var(--sagwa-x, 20px) + env(safe-area-inset-left, 0px));
	align-items: flex-start;
}

/* Mobilde ayrı alt boşluk — altta sabit menüsü olan temalar için */
@media (max-width: 768px) {
	#sagwa-widget {
		bottom: calc(var(--sagwa-y-mobile, var(--sagwa-y, 20px)) + env(safe-area-inset-bottom, 0px));
	}
}

#sagwa-widget.sagwa-visible {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

#sagwa-widget.sagwa-hidden-off {
	display: none !important;
}

/* ---------------- Butonlar ---------------- */

#sagwa-widget .sagwa-buttons {
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: center;
}

#sagwa-widget .sagwa-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--sagwa-size, 60px);
	height: var(--sagwa-size, 60px);
	border-radius: 50%;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
	position: relative;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#sagwa-widget .sagwa-btn:hover,
#sagwa-widget .sagwa-btn:focus-visible {
	transform: scale(1.07);
	box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
}

#sagwa-widget .sagwa-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

#sagwa-widget .sagwa-btn svg {
	width: 54%;
	height: 54%;
	fill: #fff;
	display: block;
	pointer-events: none;
}

#sagwa-widget .sagwa-btn-wa {
	background: var(--sagwa-color, #25d366);
}

#sagwa-widget .sagwa-btn-phone {
	background: var(--sagwa-phone, #2563eb);
}

/* Telefon butonu yalnızca mobilde (ayara bağlı) */
@media (hover: hover) and (pointer: fine) {
	#sagwa-widget.sagwa-phone-mobile-only .sagwa-btn-phone {
		display: none;
	}
}

/* Durum noktası */

#sagwa-widget .sagwa-dot {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #9ca3af;
	border: 2px solid #fff;
	box-sizing: content-box;
}

#sagwa-widget.sagwa-online .sagwa-dot {
	background: #22c55e;
}

/* Pulse — aralıklı, 7 sn'de bir tek vuruş */

#sagwa-widget.sagwa-pulse.sagwa-online .sagwa-btn-wa::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	animation: sagwa-pulse 7s ease-out infinite;
	pointer-events: none;
}

@keyframes sagwa-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
	}
	12% {
		box-shadow: 0 0 0 18px rgba(37, 211, 102, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
	}
}

/* ---------------- WhatsApp sohbet balonu ---------------- */

#sagwa-widget .sagwa-bubble {
	width: min(340px, calc(100vw - 40px));
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
	overflow: hidden;
	opacity: 0;
	transform: translateY(10px) scale(0.97);
	transition: opacity 0.28s ease, transform 0.28s ease;
}

#sagwa-widget .sagwa-bubble-in {
	opacity: 1;
	transform: none;
}

/* Başlık — WhatsApp yeşili */

#sagwa-widget .sagwa-chat-header {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #008069;
	padding: 12px 14px;
}

#sagwa-widget .sagwa-avatar {
	position: relative;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
}

#sagwa-widget .sagwa-avatar img,
#sagwa-widget .sagwa-avatar-initial {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #25d366;
	color: #fff;
	font-weight: 700;
	font-size: 17px;
}

#sagwa-widget .sagwa-dot--avatar {
	top: auto;
	bottom: 0;
	right: 0;
	width: 10px;
	height: 10px;
	border-color: #008069;
}

#sagwa-widget .sagwa-agent {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1 1 auto;
}

#sagwa-widget .sagwa-agent strong {
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#sagwa-widget .sagwa-status {
	color: rgba(255, 255, 255, 0.85);
	font-size: 12px;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#sagwa-widget .sagwa-bubble-close {
	flex: 0 0 auto;
	color: rgba(255, 255, 255, 0.85);
	font-size: 22px;
	line-height: 1;
	padding: 4px 6px;
	border-radius: 6px;
}

#sagwa-widget .sagwa-bubble-close:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.12);
}

/* Gövde — WhatsApp duvar kağıdı */

#sagwa-widget .sagwa-chat-body {
	background: #e5ddd5;
	background-image: linear-gradient(rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.03));
	padding: 16px 14px 18px;
	min-height: 84px;
}

#sagwa-widget .sagwa-chat-tag {
	display: inline-block;
	background: rgba(255, 255, 255, 0.85);
	color: #54656f;
	font-size: 11px;
	border-radius: 6px;
	padding: 3px 8px;
	margin-bottom: 10px;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

/* Gelen mesaj balonu (kuyruklu) */

#sagwa-widget .sagwa-msg {
	position: relative;
	background: #fff;
	color: #111b21;
	border-radius: 8px;
	border-top-left-radius: 0;
	padding: 8px 10px 6px;
	max-width: 88%;
	width: fit-content;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
	font-size: 14px;
}

#sagwa-widget .sagwa-msg::before {
	content: "";
	position: absolute;
	top: 0;
	left: -8px;
	width: 0;
	height: 0;
	border-right: 8px solid #fff;
	border-bottom: 10px solid transparent;
}

#sagwa-widget .sagwa-msg-text {
	display: block;
	white-space: pre-line;
	word-wrap: break-word;
	padding-right: 4px;
}

#sagwa-widget .sagwa-msg-time {
	display: block;
	text-align: right;
	font-size: 11px;
	color: #8696a0;
	margin-top: 2px;
	line-height: 1;
}

/* Alt bar — mesaj kutusu + gönder butonu */

#sagwa-widget .sagwa-chat-footer {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	background: #f0f2f5;
	padding: 8px 10px;
}

#sagwa-widget .sagwa-input {
	all: unset;
	box-sizing: border-box;
	flex: 1 1 auto;
	min-width: 0;
	background: #fff;
	color: #111b21;
	font-family: inherit;
	font-size: 16px; /* iOS'in odakta zoom yapmaması için ≥16px */
	line-height: 1.4;
	border-radius: 999px;
	padding: 9px 14px;
	text-align: left;
	cursor: text;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

#sagwa-widget .sagwa-input::placeholder {
	color: #8696a0;
	opacity: 1;
}

#sagwa-widget .sagwa-input:focus-visible {
	outline: 2px solid #00a884;
}

@media (hover: hover) and (pointer: fine) {
	#sagwa-widget .sagwa-input {
		font-size: 14px;
	}
}

#sagwa-widget .sagwa-send-btn {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #00a884;
	transition: filter 0.15s ease, transform 0.15s ease;
}

#sagwa-widget .sagwa-send-btn:hover,
#sagwa-widget .sagwa-send-btn:focus-visible {
	filter: brightness(1.08);
	transform: scale(1.05);
}

#sagwa-widget .sagwa-send-btn:focus-visible {
	outline: 2px solid #00a884;
	outline-offset: 2px;
}

#sagwa-widget .sagwa-send-btn svg {
	width: 18px;
	height: 18px;
	fill: #fff;
	display: block;
	margin-left: 2px;
}

/* ---------------- Erişilebilirlik ve yazdırma ---------------- */

@media (prefers-reduced-motion: reduce) {
	#sagwa-widget,
	#sagwa-widget .sagwa-bubble {
		transition: none;
	}

	#sagwa-widget.sagwa-pulse.sagwa-online .sagwa-btn-wa::after {
		animation: none;
	}
}

@media print {
	#sagwa-widget {
		display: none !important;
	}
}
