/* SY Asistan — site asistanı (0.1.0). Sol altta düğme, üstünde panel. Sağ alt yüzen iletişimle (telefon/WhatsApp) çakışmaz. */

.sy-as {
	--as-lacivert: #021938;
	--as-koyu: #0a2c69;
	--as-altin: #cca668;
	--as-altin-acik: #e0c48a;
	--as-metin: #1f2f4a;
	--as-soluk: #5b6c88;
	--as-cizgi: #e2ecf6;
	--as-balon: #f3f6fb;
	--as-taban: max(16px, env(safe-area-inset-bottom, 0px));
	position: fixed;
	left: max(16px, env(safe-area-inset-left, 0px));
	bottom: var(--as-taban);
	z-index: 1190;
	display: block;
	opacity: 0;
	transform: translateY(12px);
	pointer-events: none;
	transition: opacity .35s ease, transform .45s cubic-bezier(.2, .8, .2, 1);
	font-family: inherit;
	color: var(--as-metin);
}

.sy-as.is-visible {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

/* --- Düğme --- */
.sy-as-dugme {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 52px;
	padding: 0 18px 0 8px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--as-koyu), var(--as-lacivert));
	color: #fff;
	font: inherit;
	font-size: 14.5px;
	font-weight: 700;
	letter-spacing: .01em;
	cursor: pointer;
	box-shadow: 0 10px 28px rgba(2, 25, 56, .22), 0 2px 6px rgba(2, 25, 56, .12), inset 0 1px 0 rgba(255, 255, 255, .08);
	transition: transform .25s ease, box-shadow .25s ease;
	-webkit-tap-highlight-color: transparent;
}

.sy-as-dugme:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 32px rgba(2, 25, 56, .28);
}

.sy-as-dugme:focus-visible {
	outline: 3px solid rgba(204, 166, 104, .5);
	outline-offset: 2px;
}

.sy-as-dugme-ikon {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--as-altin);
	color: var(--as-lacivert);
}

.sy-as-dugme-ikon svg {
	width: 20px;
	height: 20px;
}

.sy-as.is-open .sy-as-dugme {
	box-shadow: 0 4px 12px rgba(2, 25, 56, .18);
}

/* --- Panel --- */
.sy-as-panel {
	position: absolute;
	left: 0;
	bottom: 64px;
	width: min(390px, calc(100vw - 32px));
	max-height: min(660px, calc(100vh - 100px));
	/* 0.1.3: üst menü (--sy-header-offset) ve düğmenin tabanı düşülür; kısa ekranda başlık menünün altında kalmasın. */
	max-height: min(660px, calc(100dvh - var(--sy-header-offset, 84px) - var(--as-taban) - 84px));
	display: flex;
	flex-direction: column;
	border-radius: 22px;
	background: #fff;
	box-shadow: 0 30px 70px -20px rgba(2, 12, 40, .45), 0 2px 8px rgba(2, 12, 40, .08);
	overflow: hidden;
	opacity: 0;
	transform: translateY(14px) scale(.98);
	transform-origin: bottom left;
	transition: opacity .28s ease, transform .32s cubic-bezier(.2, .8, .2, 1);
}

.sy-as-panel[hidden] {
	display: none;
}

.sy-as-panel.is-shown {
	opacity: 1;
	transform: none;
}

.sy-as-bas {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 12px 14px 16px;
	color: #eaf3ff;
	background: linear-gradient(160deg, var(--as-koyu), var(--as-lacivert) 70%);
}

.sy-as-bas-ikon {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .08);
	color: var(--as-altin-acik);
	flex: 0 0 auto;
}

.sy-as-bas-ikon svg {
	width: 20px;
	height: 20px;
}

.sy-as-bas-meta {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	line-height: 1.25;
}

.sy-as-bas-meta strong {
	color: #fff;
	font-size: 15px;
	font-weight: 800;
}

.sy-as-bas-meta span {
	color: rgba(214, 230, 250, .72);
	font-size: 12px;
}

.sy-as-ikon-dugme {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: rgba(234, 243, 255, .85);
	cursor: pointer;
	transition: background .2s ease;
}

.sy-as-ikon-dugme:hover {
	background: rgba(255, 255, 255, .1);
}

.sy-as-ikon-dugme svg {
	width: 18px;
	height: 18px;
}

/* --- Gövde --- */
.sy-as-govde {
	flex: 1 1 auto;
	min-height: 120px; /* 0.2.1: kısa ekranda alt alanlar taşmasın, sohbet alanı küçülsün */
	overflow-y: auto;
	padding: 16px 14px 6px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scroll-behavior: smooth;
	overscroll-behavior: contain;
}

.sy-as-mesaj {
	max-width: 88%;
	padding: 10px 13px;
	border-radius: 16px;
	font-size: 14.5px;
	line-height: 1.55;
	word-wrap: break-word;
	animation: sy-as-gir .25s ease;
}

.sy-as-mesaj.is-kullanici {
	align-self: flex-end;
	background: var(--as-koyu);
	color: #fff;
	border-bottom-right-radius: 6px;
}

.sy-as-mesaj.is-asistan {
	align-self: flex-start;
	background: var(--as-balon);
	color: var(--as-metin);
	border-bottom-left-radius: 6px;
}

.sy-as-mesaj.is-hata {
	background: #fff4f0;
	color: #8a3a2a;
}

.sy-as-mesaj p {
	margin: 0 0 8px;
}

.sy-as-mesaj p:last-child,
.sy-as-mesaj ul:last-child {
	margin-bottom: 0;
}

.sy-as-mesaj ul {
	margin: 0 0 8px;
	padding-left: 18px;
}

.sy-as-mesaj li {
	margin: 0 0 4px;
}

.sy-as-mesaj a {
	color: var(--as-koyu);
	font-weight: 700;
	text-decoration: underline;
	text-decoration-color: rgba(204, 166, 104, .7);
	text-underline-offset: 2px;
}

.sy-as-mesaj.is-kullanici a {
	color: #fff;
}

@keyframes sy-as-gir {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

/* Bağlantı kartları */
.sy-as-kartlar {
	align-self: flex-start;
	display: flex;
	flex-direction: column;
	gap: 6px;
	width: 88%;
}

.sy-as-kart {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 12px;
	border: 1px solid var(--as-cizgi);
	border-left: 3px solid var(--as-altin);
	border-radius: 12px;
	background: #fff;
	color: var(--as-metin);
	font-size: 13.5px;
	font-weight: 700;
	text-decoration: none !important;
	transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.sy-as-kart:hover {
	transform: translateX(2px);
	border-color: #cfdcea;
	box-shadow: 0 8px 20px -12px rgba(2, 25, 56, .3);
}

.sy-as-kart span {
	flex: 1 1 auto;
	min-width: 0;
}

.sy-as-kart small {
	color: var(--as-soluk);
	font-size: 11.5px;
	font-weight: 700;
	white-space: nowrap;
}

/* Eylem düğmeleri */
.sy-as-eylemler {
	align-self: flex-start;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.sy-as-eylem {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 13px;
	border-radius: 999px;
	border: 1px solid var(--as-koyu);
	background: #fff;
	color: var(--as-koyu) !important;
	font-size: 13px;
	font-weight: 800;
	text-decoration: none !important;
	transition: background .2s ease, color .2s ease;
}

.sy-as-eylem:hover {
	background: var(--as-koyu);
	color: #fff !important;
}

.sy-as-eylem.is-wa {
	border-color: #1fad57;
	color: #148a42 !important;
}

.sy-as-eylem.is-wa:hover {
	background: #1fad57;
	color: #fff !important;
}

.sy-as-eylem svg {
	width: 15px;
	height: 15px;
}

/* Yazıyor */
.sy-as-yaziyor {
	align-self: flex-start;
	display: inline-flex;
	gap: 5px;
	padding: 12px 14px;
	border-radius: 16px;
	border-bottom-left-radius: 6px;
	background: var(--as-balon);
}

.sy-as-yaziyor i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--as-soluk);
	animation: sy-as-nokta 1.1s infinite ease-in-out;
}

.sy-as-yaziyor i:nth-child(2) { animation-delay: .15s; }
.sy-as-yaziyor i:nth-child(3) { animation-delay: .3s; }

@keyframes sy-as-nokta {
	0%, 80%, 100% { transform: translateY(0); opacity: .5; }
	40% { transform: translateY(-4px); opacity: 1; }
}

/* Öneriler */
.sy-as-oneriler {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 4px 14px 8px;
}

.sy-as-oneriler:empty {
	display: none;
}

.sy-as-oneri {
	padding: 7px 12px;
	border: 1px solid #cfdcea;
	border-radius: 999px;
	background: #fff;
	color: var(--as-koyu);
	font: inherit;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
	transition: border-color .2s ease, background .2s ease;
}

.sy-as-oneri:hover {
	border-color: var(--as-altin);
	background: #fbf7ef;
}

/* Giriş */
.sy-as-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 8px 10px 8px 14px;
	border-top: 1px solid var(--as-cizgi);
}

.sy-as-form textarea {
	flex: 1 1 auto;
	min-height: 40px;
	max-height: 120px;
	padding: 10px 0;
	border: 0;
	background: transparent;
	color: var(--as-metin);
	font: inherit;
	font-size: 14.5px;
	line-height: 1.4;
	resize: none;
	outline: none;
}

.sy-as-form textarea::placeholder {
	color: #8a9ab3;
}

.sy-as-gonder {
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, #cca668, #b8924f);
	color: var(--as-lacivert);
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.sy-as-gonder:hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 20px rgba(184, 146, 79, .3);
}

.sy-as-gonder:disabled {
	opacity: .5;
	cursor: default;
	transform: none;
	box-shadow: none;
}

.sy-as-gonder svg {
	width: 18px;
	height: 18px;
}

.sy-as-uyari {
	margin: 0;
	padding: 0 14px 10px;
	color: #8a9ab3;
	font-size: 11px;
	line-height: 1.4;
}

/* --- Tablet/mobil: tema içindekiler pili de sol altta (≤1100px); pil olan sayfalarda düğme onun üstüne çıkar. --- */
@media (max-width: 1100px) {
	body:has(.sy-toc-pill) .sy-as {
		--as-taban: calc(max(16px, env(safe-area-inset-bottom, 0px)) + 56px);
	}
}

/* --- Mobil --- */
@media (max-width: 640px) {
	.sy-as-dugme {
		height: 48px;
		padding-right: 14px;
		font-size: 13.5px;
	}

	.sy-as-panel {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		max-height: 88vh;
		max-height: 88dvh;
		border-radius: 22px 22px 0 0;
		transform-origin: bottom center;
	}

	.sy-as.is-open .sy-as-dugme {
		opacity: 0;
		pointer-events: none;
	}

	/* Panel açıkken alt köşedeki diğer yüzen öğeler (telefon/WhatsApp, içindekiler pili) gizlenir; panel en üstte. */
	.sy-as.is-open {
		z-index: 1300;
	}

	body.sy-as-acik .sy-float,
	body.sy-as-acik .sy-toc-pill {
		opacity: 0 !important;
		pointer-events: none !important;
	}

	.sy-as-mesaj,
	.sy-as-kartlar {
		max-width: 92%;
		width: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sy-as,
	.sy-as-panel,
	.sy-as-mesaj,
	.sy-as-dugme {
		transition: none !important;
		animation: none !important;
	}
}

/* 0.2.1: panelde yalnız sohbet alanı küçülür; öneriler, form ve uyarı sıkışmaz (EN/DE önerileri daha uzun). */
.sy-as-oneriler,
.sy-as-form,
.sy-as-uyari,
.sy-as-bas {
	flex-shrink: 0;
}
