/* KDA Yardım Botu Stilleri */
.vma-chatbot-wrapper {
	position: fixed;
	bottom: 30px;
	right: calc(var(--vma-right-width, 280px) + 30px);
	z-index: 99999;
	font-family: var(--vma-font-body, system-ui, -apple-system, sans-serif);
}

.vma-chatbot-wrapper.is-dismissed {
	display: none;
}

.vma-chatbot-toggle {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--vma-color-primary, #b91c1c);
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 20px rgba(185, 28, 28, 0.4);
	cursor: grab;
	position: relative;
	touch-action: none;
	transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
}

.vma-chatbot-toggle::after {
	content: "";
	position: absolute;
	inset: -8px;
	border: 2px solid rgba(185, 28, 28, 0.34);
	border-radius: inherit;
	opacity: 0;
	pointer-events: none;
}

.vma-chatbot-wrapper.is-dragging .vma-chatbot-toggle {
	cursor: grabbing;
}

.vma-chatbot-toggle:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 25px rgba(185, 28, 28, 0.5);
}

.vma-chatbot-wrapper.is-dragging .vma-chatbot-toggle {
	transform: none;
}

.vma-chatbot-toggle svg {
	width: 30px;
	height: 30px;
	fill: none;
	stroke: currentColor;
}

.vma-chatbot-toggle .vma-close-icon {
	display: none;
}

.vma-chatbot-toggle-label {
	position: absolute;
	top: 50%;
	right: 72px;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	min-height: 30px;
	padding: 6px 10px;
	border-radius: 999px;
	background: #ffffff;
	color: var(--vma-color-primary, #b91c1c);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0;
	box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
	white-space: nowrap;
	pointer-events: none;
}

.vma-chatbot-tooltip {
	position: absolute;
	right: 72px;
	bottom: calc(100% + 10px);
	padding: 8px 12px;
	border-radius: 8px;
	background: #111827;
	color: #ffffff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
	box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
	opacity: 0;
	pointer-events: none;
	transform: translateY(6px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.vma-chatbot-wrapper.is-glimpsing .vma-chatbot-toggle {
	animation: vma-chatbot-glimpse 3s ease-out both;
}

.vma-chatbot-wrapper.is-glimpsing .vma-chatbot-toggle::after {
	animation: vma-chatbot-pulse-ring 3s ease-out both;
}

.vma-chatbot-wrapper.is-glimpsing .vma-chatbot-toggle-label {
	animation: vma-chatbot-label-glimpse 3s ease-out both;
}

.vma-chatbot-wrapper.is-glimpsing .vma-chatbot-tooltip {
	opacity: 1;
	transform: translateY(0);
	animation: vma-chatbot-tooltip-glimpse 3s ease-out both;
}

.vma-chatbot-toggle:hover .vma-chatbot-tooltip,
.vma-chatbot-toggle:focus-visible .vma-chatbot-tooltip {
	opacity: 1;
	transform: translateY(0);
}

.vma-chatbot-wrapper.is-open .vma-chatbot-toggle {
	background: #333;
	box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.vma-chatbot-wrapper.is-open .vma-chatbot-toggle .vma-chat-icon {
	display: none;
}

.vma-chatbot-wrapper.is-open .vma-chatbot-toggle .vma-close-icon {
	display: block;
}

.vma-chatbot-wrapper.is-open .vma-chatbot-toggle-label {
	display: none;
}

.vma-chatbot-window {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 360px;
	max-height: 600px;
	height: calc(100vh - 120px);
	background: #ffffff;
	border-radius: 20px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
	transform: translateY(20px) scale(0.95);
	transform-origin: bottom right;
	transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.vma-chatbot-dismiss {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 22px;
	height: 22px;
	border: 2px solid #ffffff;
	border-radius: 50%;
	background: #111827;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	font-size: 0;
	font-weight: 700;
	line-height: 0;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
	cursor: pointer;
	z-index: 2;
}

.vma-chatbot-dismiss::before,
.vma-chatbot-dismiss::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 2px;
	border-radius: 999px;
	background: currentColor;
	transform-origin: center;
}

.vma-chatbot-dismiss::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.vma-chatbot-dismiss::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.vma-chatbot-dismiss:hover {
	background: #000000;
}

@keyframes vma-chatbot-glimpse {
	0% { transform: translateY(10px) scale(0.86); box-shadow: 0 4px 20px rgba(185, 28, 28, 0.26); }
	16% { transform: translateY(0) scale(1.08); box-shadow: 0 10px 30px rgba(185, 28, 28, 0.48); }
	31% { transform: translateY(0) scale(0.98); }
	44% { transform: translateY(0) scale(1.03); }
	100% { transform: translateY(0) scale(1); box-shadow: 0 4px 20px rgba(185, 28, 28, 0.4); }
}

@keyframes vma-chatbot-pulse-ring {
	0% { opacity: 0; transform: scale(0.82); }
	14% { opacity: 0.68; transform: scale(1); }
	100% { opacity: 0; transform: scale(1.42); }
}

@keyframes vma-chatbot-label-glimpse {
	0% { opacity: 0; transform: translate(10px, -50%); }
	14% { opacity: 1; transform: translate(0, -50%); }
	88% { opacity: 1; transform: translate(0, -50%); }
	100% { opacity: 1; transform: translateY(-50%); }
}

@keyframes vma-chatbot-tooltip-glimpse {
	0% { opacity: 0; transform: translateY(6px); }
	10% { opacity: 0; transform: translateY(6px); }
	20% { opacity: 1; transform: translateY(0); }
	82% { opacity: 1; transform: translateY(0); }
	100% { opacity: 0; transform: translateY(6px); }
}

.vma-chatbot-wrapper.is-open .vma-chatbot-window {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0) scale(1);
}

.vma-chatbot-header {
	background: var(--vma-color-primary, #b91c1c);
	color: white;
	padding: 20px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.vma-chatbot-header-icon {
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.vma-chatbot-header-text h3 {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 700;
	color: white;
}

.vma-chatbot-header-text span {
	font-size: 0.8rem;
	opacity: 0.8;
}

.vma-chatbot-body {
	flex: 1;
	padding: 20px;
	overflow-y: auto;
	background: #f9fafb;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.vma-chatbot-message {
	max-width: 85%;
	padding: 12px 16px;
	border-radius: 16px;
	font-size: 0.95rem;
	line-height: 1.5;
	position: relative;
	word-wrap: break-word;
}

.vma-chatbot-message.is-bot {
	background: #ffffff;
	color: #1f2937;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
	box-shadow: 0 2px 5px rgba(0,0,0,0.05);
	border: 1px solid #e5e7eb;
}

.vma-chatbot-message.is-bot.is-error {
	color: #991b1b;
	background: #fef2f2;
	border-color: #fecaca;
}

.vma-chatbot-message.is-user {
	background: var(--vma-color-primary, #b91c1c);
	color: white;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
	box-shadow: 0 2px 5px rgba(185, 28, 28, 0.2);
}

.vma-chatbot-message p:last-child {
	margin-bottom: 0;
}
.vma-chatbot-message p:first-child {
	margin-top: 0;
}

.vma-chatbot-sources {
	margin-top: 10px;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	background: #f8fafc;
	overflow: hidden;
}

.vma-chatbot-sources summary {
	cursor: pointer;
	padding: 8px 10px;
	color: #475569;
	font-size: 0.78rem;
	font-weight: 700;
	list-style-position: inside;
}

.vma-chatbot-sources-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 10px 10px;
}

.vma-chatbot-source {
	padding: 6px 8px;
	border-radius: 999px;
	background: #ffffff;
	border: 1px solid #e2e8f0;
}

.vma-chatbot-source strong {
	color: #1f2937;
	font-size: 0.78rem;
	line-height: 1.25;
	font-weight: 700;
}

.vma-chatbot-safe-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.vma-chatbot-safe-action {
	appearance: none;
	border: 1px solid #fecaca;
	border-radius: 999px;
	background: #fff7f7;
	color: var(--vma-color-primary, #b91c1c);
	cursor: pointer;
	font-size: 0.78rem;
	font-weight: 800;
	line-height: 1;
	padding: 8px 10px;
}

.vma-chatbot-safe-action:hover {
	background: #fee2e2;
	border-color: #fca5a5;
}

.vma-chatbot-feedback {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #e5e7eb;
	font-size: 0.85rem;
	color: #6b7280;
}

.vma-chatbot-feedback button {
	background: none;
	border: none;
	color: var(--vma-color-primary, #b91c1c);
	padding: 0;
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
}

.vma-chatbot-feedback button:hover {
	color: #991b1b;
}

.vma-chatbot-typing {
	display: none;
	align-items: center;
	gap: 4px;
	padding: 12px 16px;
	background: #ffffff;
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	align-self: flex-start;
	border: 1px solid #e5e7eb;
}
.vma-chatbot-wrapper.is-typing .vma-chatbot-typing {
	display: flex;
}
.vma-chatbot-typing span {
	width: 6px;
	height: 6px;
	background: #9ca3af;
	border-radius: 50%;
	animation: vma-typing 1.4s infinite ease-in-out both;
}
.vma-chatbot-typing span:nth-child(1) { animation-delay: -0.32s; }
.vma-chatbot-typing span:nth-child(2) { animation-delay: -0.16s; }
@keyframes vma-typing {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}

.vma-chatbot-footer {
	padding: 16px;
	background: #ffffff;
	border-top: 1px solid #e5e7eb;
}

.vma-chatbot-input-group {
	display: flex;
	gap: 8px;
}

.vma-chatbot-input-group input {
	flex: 1;
	padding: 12px 16px;
	border: 1px solid #d1d5db;
	border-radius: 20px;
	font-size: 0.95rem;
	outline: none;
	transition: border-color 0.3s;
	font-family: inherit;
}

.vma-chatbot-input-group input:focus {
	border-color: var(--vma-color-primary, #b91c1c);
}

.vma-chatbot-input-group button {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--vma-color-primary, #b91c1c);
	color: white;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.3s;
}

.vma-chatbot-input-group button:hover {
	background: #991b1b;
}

.vma-chatbot-input-group button svg {
	width: 20px;
	height: 20px;
	transform: translateX(-1px);
}

/* Fallback Contact Form (shown in body) */
.vma-chatbot-contact-form {
	background: white;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 16px;
	margin-top: 8px;
	box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.vma-chatbot-contact-form h4 {
	margin: 0 0 12px 0;
	font-size: 0.95rem;
	color: #111827;
}
.vma-chatbot-contact-form input,
.vma-chatbot-contact-form textarea {
	width: 100%;
	padding: 10px;
	margin-bottom: 10px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: 0.9rem;
	font-family: inherit;
	box-sizing: border-box;
}
.vma-chatbot-contact-form button {
	width: 100%;
	padding: 10px;
	background: #111827;
	color: white;
	border: none;
	border-radius: 8px;
	font-weight: 600;
	cursor: pointer;
}
.vma-chatbot-contact-form button:hover {
	background: #000;
}

@media (max-width: 480px) {
	.vma-chatbot-window {
		width: calc(100vw - 40px);
		right: -10px;
		bottom: 70px;
	}

	.vma-chatbot-tooltip {
		right: 68px;
	}
}

@media (max-width: 860px) {
	.vma-chatbot-wrapper {
		right: 24px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vma-chatbot-wrapper.is-glimpsing .vma-chatbot-toggle,
	.vma-chatbot-wrapper.is-glimpsing .vma-chatbot-toggle::after,
	.vma-chatbot-wrapper.is-glimpsing .vma-chatbot-toggle-label,
	.vma-chatbot-wrapper.is-glimpsing .vma-chatbot-tooltip {
		animation: none;
	}

	.vma-chatbot-wrapper.is-glimpsing .vma-chatbot-tooltip {
		opacity: 0;
		transform: translateY(6px);
	}
}

.vma-chatbot-quick-actions {
	display: flex;
	gap: 7px;
	padding: 9px 14px;
	overflow-x: auto;
	white-space: nowrap;
	border-top: 1px solid #f1f5f9;
	background: #ffffff;
	scrollbar-width: thin;
}

.vma-chatbot-quick-actions::-webkit-scrollbar {
	height: 4px;
}

.vma-chatbot-quick-actions::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 4px;
}

.vma-quick-action-btn {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	color: #475569;
	min-height: 32px;
	padding: 6px 11px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.15;
	cursor: pointer;
	flex-shrink: 0;
	transition: all 0.2s ease;
}

.vma-quick-action-btn:hover {
	background: var(--vma-color-primary, #b91c1c);
	color: #ffffff;
	border-color: var(--vma-color-primary, #b91c1c);
}

@media (max-width: 520px) {
	.vma-chatbot-quick-actions {
		gap: 6px;
		padding: 8px 12px;
	}
	.vma-quick-action-btn {
		max-width: 148px;
		min-height: 31px;
		padding: 6px 10px;
		font-size: 11.5px;
		overflow: hidden;
		text-overflow: ellipsis;
	}
}

/* Panel sayfalarında KD.AI içerik başlığı hizasında, sağ üstte durur. */
.vma-chatbot-wrapper--panel,
body.vma-panel-page .vma-chatbot-wrapper,
body.vma-admin-panel-body .vma-chatbot-wrapper {
	top: 140px;
	right: clamp(28px, 3.2vw, 64px);
	bottom: auto;
	left: auto;
}

.vma-chatbot-wrapper--panel .vma-chatbot-window,
body.vma-panel-page .vma-chatbot-wrapper .vma-chatbot-window,
body.vma-admin-panel-body .vma-chatbot-wrapper .vma-chatbot-window {
	top: 78px;
	right: 0;
	bottom: auto;
	height: clamp(320px, calc(100vh - 240px), 560px);
	max-height: calc(100vh - 180px);
	transform-origin: top right;
}

body.admin-bar .vma-chatbot-wrapper--panel,
body.admin-bar.vma-panel-page .vma-chatbot-wrapper,
body.admin-bar.vma-admin-panel-body .vma-chatbot-wrapper {
	top: 172px;
}

@media (max-width: 860px) {
	.vma-chatbot-wrapper--panel,
	body.vma-panel-page .vma-chatbot-wrapper,
	body.vma-admin-panel-body .vma-chatbot-wrapper {
		top: 88px;
		right: 18px;
	}

	body.admin-bar .vma-chatbot-wrapper--panel,
	body.admin-bar.vma-panel-page .vma-chatbot-wrapper,
	body.admin-bar.vma-admin-panel-body .vma-chatbot-wrapper {
		top: 120px;
	}

	.vma-chatbot-wrapper--panel .vma-chatbot-window,
		body.vma-panel-page .vma-chatbot-wrapper .vma-chatbot-window,
		body.vma-admin-panel-body .vma-chatbot-wrapper .vma-chatbot-window {
		top: 72px;
		height: clamp(300px, calc(100vh - 174px), 560px);
		max-height: calc(100vh - 128px);
	}
}

@media (max-width: 480px) {
	.vma-chatbot-wrapper--panel .vma-chatbot-window,
	body.vma-panel-page .vma-chatbot-wrapper .vma-chatbot-window,
	body.vma-admin-panel-body .vma-chatbot-wrapper .vma-chatbot-window {
		right: -8px;
		bottom: auto;
		width: calc(100vw - 34px);
	}
}
