/**
 * Akıllı Yem WhatsApp Destek — ön yüz
 * Author: Adem YÜCEYURT
 *
 * Tüm sınıflar "aywa-" önekiyle yalıtılmıştır; tema stilleriyle çakışmaz.
 */

.aywa {
	--aywa-yan: 20px;
	--aywa-alt: 20px;
	--aywa-boyut: 60px;
	--aywa-renk: #25D366;
	--aywa-renk-hover: #1EBE5A;
	--aywa-baslik-renk: #0E5A4A;
	--aywa-zemin: #EDE6DC;
	--aywa-balon: #ffffff;
	--aywa-yazi: #1f2a27;
	--aywa-soluk: #5d6b67;

	position: fixed;
	bottom: calc(var(--aywa-alt) + env(safe-area-inset-bottom, 0px));
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 14px;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	color: var(--aywa-yazi);
	-webkit-font-smoothing: antialiased;
}
.aywa *,
.aywa *::before,
.aywa *::after { box-sizing: border-box; }

.aywa--sag { right: var(--aywa-yan); }
.aywa--sol { left: var(--aywa-yan); align-items: flex-start; }

.aywa--onizleme { position: absolute; }

/* ---------- Tetik butonu ---------- */
.aywa-tetik {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: var(--aywa-boyut);
	height: var(--aywa-boyut);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--aywa-renk);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(14, 60, 50, .28), 0 2px 4px rgba(14, 60, 50, .18);
	transition: transform .18s ease, box-shadow .18s ease;
	-webkit-tap-highlight-color: transparent;
}
.aywa-tetik:hover { transform: translateY(-2px); background: var(--aywa-renk-hover); box-shadow: 0 10px 24px rgba(14, 60, 50, .32), 0 3px 6px rgba(14, 60, 50, .2); }
.aywa-tetik:focus-visible { outline: 3px solid var(--aywa-baslik-renk); outline-offset: 3px; }

.aywa-tetik-simge,
.aywa-tetik-simge svg { display: block; width: calc(var(--aywa-boyut) * .52); height: calc(var(--aywa-boyut) * .52); }
.aywa-tetik-simge { --aywa-simge-ic: var(--aywa-renk); }

.aywa--simge-kare .aywa-tetik { border-radius: calc(var(--aywa-boyut) * .28); }

.aywa--simge-hap .aywa-tetik {
	width: auto;
	padding: 0 calc(var(--aywa-boyut) * .36) 0 calc(var(--aywa-boyut) * .26);
	border-radius: 999px;
}
.aywa--simge-hap .aywa-tetik-simge,
.aywa--simge-hap .aywa-tetik-simge svg { width: calc(var(--aywa-boyut) * .46); height: calc(var(--aywa-boyut) * .46); }
.aywa-tetik-yazi { font-weight: 600; font-size: calc(var(--aywa-boyut) * .27); white-space: nowrap; letter-spacing: .01em; }

.aywa--simge-temsilci .aywa-tetik { background: #fff; padding: 3px; box-shadow: 0 0 0 3px var(--aywa-renk), 0 8px 20px rgba(14, 60, 50, .3); }
.aywa-tetik-foto,
.aywa-tetik-foto img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.aywa-tetik-foto { overflow: hidden; background: #dfe7e4; color: #8aa39b; display: flex; align-items: center; justify-content: center; }
.aywa-tetik-foto .aywa-avatar-bos svg { width: 60%; height: 60%; display: block; margin: auto; }
.aywa-tetik-rozet-simge {
	position: absolute;
	right: -4px;
	bottom: -4px;
	width: calc(var(--aywa-boyut) * .42);
	height: calc(var(--aywa-boyut) * .42);
	padding: 4px;
	border-radius: 50%;
	background: var(--aywa-renk);
	color: #fff;
	box-shadow: 0 0 0 2px #fff;
	--aywa-simge-ic: var(--aywa-renk);
}
.aywa-tetik-rozet-simge svg { display: block; width: 100%; height: 100%; }

.aywa--simge-ozel .aywa-tetik { background: transparent; box-shadow: none; border-radius: 0; }
.aywa-ozel-simge { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .22)); }

.aywa-rozet {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #E5484D;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 0 0 2px #fff;
}
.aywa--sol .aywa-rozet { right: auto; left: -3px; }

/* Dikkat çeken halka — ilk açılışa kadar */
.aywa--nabiz .aywa-tetik::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	box-shadow: 0 0 0 0 var(--aywa-renk);
	animation: aywa-nabiz 2.4s ease-out infinite;
	pointer-events: none;
}
@keyframes aywa-nabiz {
	0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--aywa-renk) 55%, transparent); }
	70%, 100% { box-shadow: 0 0 0 16px color-mix(in srgb, var(--aywa-renk) 0%, transparent); }
}

/* ---------- Pencere ---------- */
.aywa-pencere {
	width: 340px;
	max-width: calc(100vw - 2 * var(--aywa-yan));
	max-height: min(560px, calc(100vh - var(--aywa-boyut) - var(--aywa-alt) - 40px));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 16px;
	background: var(--aywa-zemin);
	box-shadow: 0 18px 50px rgba(10, 40, 34, .28), 0 4px 12px rgba(10, 40, 34, .14);
	transform-origin: bottom right;
	animation: aywa-acil .2s cubic-bezier(.2, .8, .3, 1);
}
.aywa--sol .aywa-pencere { transform-origin: bottom left; }
.aywa-pencere[hidden] { display: none; }

@keyframes aywa-acil {
	from { opacity: 0; transform: translateY(10px) scale(.96); }
	to { opacity: 1; transform: none; }
}

.aywa-ust {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 12px 14px 16px;
	background: var(--aywa-baslik-renk);
	color: #fff;
}
.aywa-avatar {
	position: relative;
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	color: rgba(255, 255, 255, .85);
	display: flex;
	align-items: center;
	justify-content: center;
}
.aywa-avatar img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: block; }
.aywa-avatar .aywa-avatar-bos svg { width: 26px; height: 26px; display: block; }
.aywa-cevrimici {
	position: absolute;
	right: 0;
	bottom: 1px;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: #4ADE80;
	box-shadow: 0 0 0 2px var(--aywa-baslik-renk);
}
.aywa-ust-metin { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.aywa-baslik { font-size: 16px; font-weight: 700; line-height: 1.25; color: #fff; overflow-wrap: anywhere; }
.aywa-alt-baslik { font-size: 12.5px; opacity: .82; line-height: 1.35; margin-top: 2px; }
.aywa-kapat {
	flex: 0 0 36px;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 8px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
	opacity: .85;
}
.aywa-kapat:hover { background: rgba(255, 255, 255, .14); opacity: 1; }
.aywa-kapat:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.aywa-kapat svg { display: block; width: 20px; height: 20px; }

.aywa-govde {
	flex: 1 1 auto;
	min-height: 120px;
	overflow-y: auto;
	padding: 18px 16px 12px;
	background-color: var(--aywa-zemin);
	background-image: radial-gradient(rgba(14, 90, 74, .07) 1px, transparent 1.2px);
	background-size: 14px 14px;
}

.aywa-balonlar { display: flex; flex-direction: column; gap: 6px; }
.aywa-balon {
	align-self: flex-start;
	max-width: 88%;
	padding: 8px 12px;
	border-radius: 4px 12px 12px 12px;
	background: var(--aywa-balon);
	box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
	white-space: pre-line;
	overflow-wrap: anywhere;
	font-size: 14.5px;
}
.aywa-balon + .aywa-balon { border-radius: 12px; }
.aywa-balon--ilk { position: relative; }
.aywa-balon--ilk::before {
	content: "";
	position: absolute;
	top: 0;
	left: -7px;
	border-top: 9px solid var(--aywa-balon);
	border-left: 8px solid transparent;
}

/* "Yazıyor…" → mesajlar: pencerenin tek hareketli anı */
.aywa-yaziyor {
	display: inline-flex;
	gap: 4px;
	padding: 12px 14px;
	border-radius: 4px 12px 12px 12px;
	background: var(--aywa-balon);
	box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}
.aywa-yaziyor span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9aa9a4;
	animation: aywa-nokta 1s infinite ease-in-out;
}
.aywa-yaziyor span:nth-child(2) { animation-delay: .15s; }
.aywa-yaziyor span:nth-child(3) { animation-delay: .3s; }
@keyframes aywa-nokta {
	0%, 60%, 100% { transform: translateY(0); opacity: .55; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.aywa .aywa-balonlar { display: none; }
.aywa--gosterildi .aywa-yaziyor { display: none; }
.aywa--gosterildi .aywa-balonlar { display: flex; }
.aywa--gosterildi .aywa-balon { animation: aywa-balon .24s ease-out both; animation-delay: calc(var(--aywa-sira, 0) * 110ms); }
@keyframes aywa-balon {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

/* ---------- Mesaj formu ---------- */
.aywa-form {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
	padding: 10px 12px 12px;
	background: #F6F2EC;
	border-top: 1px solid rgba(14, 60, 50, .08);
}
.aywa .aywa-isim,
.aywa .aywa-mesaj {
	display: block;
	width: 100%;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid rgba(14, 60, 50, .16);
	border-radius: 10px;
	background: #fff;
	color: var(--aywa-yazi);
	font: inherit;
	font-size: 15px;
	line-height: 1.4;
	box-shadow: none;
	resize: none;
}
.aywa .aywa-mesaj { min-height: 44px; max-height: 140px; }
.aywa .aywa-isim:focus,
.aywa .aywa-mesaj:focus { outline: none; border-color: var(--aywa-baslik-renk); box-shadow: 0 0 0 3px color-mix(in srgb, var(--aywa-baslik-renk) 18%, transparent); }
.aywa .aywa-isim::placeholder,
.aywa .aywa-mesaj::placeholder { color: #8b9793; opacity: 1; }

/* Dil bazlı klavye dönüşümü: sağdan sola yazılan alfabeler (Arapça, Farsça)
   için yazı kutuları sağa hizalanır ve yön "rtl" olur; gönder butonu ve
   diğer arayüz öğeleri değişmeden kalır. */
.aywa .aywa-isim[dir="rtl"],
.aywa .aywa-mesaj[dir="rtl"] { text-align: right; }

.aywa-gonder {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 10px 14px;
	border: 0 !important;
	border-radius: 10px;
	background: var(--aywa-renk) !important;
	color: var(--aywa-buton-yazi, #fff) !important;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}
.aywa-gonder:hover:not(:disabled) {
	background: var(--aywa-renk-hover) !important;
	color: var(--aywa-buton-yazi-hover, #fff) !important;
}
.aywa-gonder:focus-visible { outline: 3px solid var(--aywa-baslik-renk); outline-offset: 2px; }
.aywa-gonder:disabled { opacity: .5; cursor: not-allowed; }
.aywa-gonder-simge,
.aywa-gonder-simge svg { display: block; width: 18px; height: 18px; }

/* ---------- Slayt üzerinde gizlenme / belirme ---------- */
.aywa { --aywa-anim-sure: 450ms; --aywa-yon: 1; }
.aywa--sol { --aywa-yon: -1; }

.aywa--gizli { visibility: hidden; opacity: 0; pointer-events: none; }
.aywa--gizleniyor { pointer-events: none; }
.aywa--gizleniyor,
.aywa--beliriyor { animation-duration: var(--aywa-anim-sure); animation-fill-mode: both; }

/* Kaybolma */
.aywa--cik-solma { animation-name: aywa-cik-solma; animation-timing-function: ease-in; }
.aywa--cik-asagi { animation-name: aywa-cik-asagi; animation-timing-function: cubic-bezier(.5, 0, .9, .4); }
.aywa--cik-yana { animation-name: aywa-cik-yana; animation-timing-function: cubic-bezier(.5, 0, .9, .4); }
.aywa--cik-kucul { animation-name: aywa-cik-kucul; animation-timing-function: ease-in; }
.aywa--cik-don { animation-name: aywa-cik-don; animation-timing-function: ease-in; }
@keyframes aywa-cik-solma { to { opacity: 0; } }
@keyframes aywa-cik-asagi { to { opacity: 0; transform: translateY(calc(100% + var(--aywa-alt) + 20px)); } }
@keyframes aywa-cik-yana { to { opacity: .4; transform: translateX(calc(var(--aywa-yon) * (100% + var(--aywa-yan) + 20px))); } }
@keyframes aywa-cik-kucul { to { opacity: 0; transform: scale(.15); } }
@keyframes aywa-cik-don { to { opacity: 0; transform: rotate(200deg) scale(.15); } }

/* Belirme */
.aywa--gel-solma { animation-name: aywa-gel-solma; animation-timing-function: ease-out; }
.aywa--gel-yukari { animation-name: aywa-gel-yukari; animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
.aywa--gel-yandan { animation-name: aywa-gel-yandan; animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
.aywa--gel-buyu { animation-name: aywa-gel-buyu; animation-timing-function: cubic-bezier(.3, 1.4, .5, 1); }
.aywa--gel-zipla { animation-name: aywa-gel-zipla; animation-timing-function: ease-out; }
.aywa--gel-don { animation-name: aywa-gel-don; animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
@keyframes aywa-gel-solma { from { opacity: 0; } }
@keyframes aywa-gel-yukari { from { opacity: 0; transform: translateY(48px); } }
@keyframes aywa-gel-yandan { from { opacity: .4; transform: translateX(calc(var(--aywa-yon) * (100% + var(--aywa-yan) + 20px))); } }
@keyframes aywa-gel-buyu { from { opacity: 0; transform: scale(.3); } }
@keyframes aywa-gel-zipla {
	0% { opacity: 0; transform: translateY(90px); }
	55% { opacity: 1; transform: translateY(-14px); }
	75% { transform: translateY(5px); }
	90% { transform: translateY(-3px); }
	100% { transform: none; }
}
@keyframes aywa-gel-don { from { opacity: 0; transform: rotate(-200deg) scale(.3); } }

/* ---------- Görünürlük ---------- */
@media (max-width: 767px) {
	.aywa--mobil-gizli:not(.aywa--onizleme) { display: none !important; }
	.aywa-pencere { width: calc(100vw - 2 * var(--aywa-yan)); }
}
@media (min-width: 768px) {
	.aywa--masaustu-gizli:not(.aywa--onizleme) { display: none !important; }
}

/* ---------- Hareket azaltma ---------- */
@media (prefers-reduced-motion: reduce) {
	.aywa *,
	.aywa *::before,
	.aywa *::after { animation: none !important; transition: none !important; }
}
.aywa--sakin *,
.aywa--sakin *::before,
.aywa--sakin *::after { animation: none !important; }

/* Yazdırırken gizle */
@media print { .aywa { display: none !important; } }
