:root {
	--ai-primary: #075e54;
	--ai-primary-dark: #054840;
	--ai-bubble-out: #e2f7cb;
	--ai-bubble-out-text: #0f172a;
	--ai-bubble-in: #ffffff;
	--ai-bubble-in-text: #1e293b;
	--ai-bg: #f8fafc;
	--ai-border: rgba(0, 0, 0, 0.08);
	--ai-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), 0 3px 10px rgba(0, 0, 0, 0.06);
}

.ai-chat {
	position: fixed;
	bottom: 20px;
	z-index: 100050;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

.ai-chat--right {
	right: 20px;
}

.ai-chat--left {
	left: 20px;
}

/* FAB BUTTON */
.ai-chat__fab {
	position: relative;
	width: 54px;
	height: 54px;
	border: 0;
	border-radius: 50%;
	background: var(--ai-primary, #075e54) !important;
	color: #ffffff !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
	transition: transform 0.2s ease, opacity 0.2s ease;
	will-change: transform;
	outline: none;
}

.ai-chat__fab:hover {
	transform: scale(1.08);
}

.ai-chat__fab:active {
	transform: scale(0.95);
}

.ai-chat__fab-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	background: #ef4444;
	color: #ffffff;
	font-size: 10px;
	font-weight: 700;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #ffffff;
	box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
	animation: aiPulseBadge 2s infinite;
}

@keyframes aiPulseBadge {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.15); }
}

.ai-chat__fab-icon--close {
	display: none;
}

.ai-chat.is-open .ai-chat__fab-icon--open {
	display: none;
}

.ai-chat.is-open .ai-chat__fab-icon--close {
	display: block;
}

/* PROACTIVE TOOLTIP BUBBLE */
.ai-chat__proactive-bubble {
	position: absolute;
	bottom: 68px;
	background: #ffffff;
	color: #0f172a;
	padding: 10px 12px;
	border-radius: 14px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
	width: 240px;
	font-size: 0.84rem;
	line-height: 1.35;
	cursor: pointer;
	border: 1px solid var(--ai-border);
	animation: aiSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	display: flex;
	align-items: flex-start;
	gap: 6px;
	z-index: 100040;
}

.ai-chat--right .ai-chat__proactive-bubble {
	right: 0;
}

.ai-chat--left .ai-chat__proactive-bubble {
	left: 0;
}

.ai-chat__proactive-bubble::after {
	content: '';
	position: absolute;
	bottom: -6px;
	width: 12px;
	height: 12px;
	background: #ffffff;
	border-bottom: 1px solid var(--ai-border);
	border-right: 1px solid var(--ai-border);
	transform: rotate(45deg);
}

.ai-chat--right .ai-chat__proactive-bubble::after {
	right: 20px;
}

.ai-chat--left .ai-chat__proactive-bubble::after {
	left: 20px;
}

.ai-chat__proactive-close {
	position: absolute;
	top: 3px;
	right: 5px;
	border: 0;
	background: transparent;
	font-size: 15px;
	line-height: 1;
	color: #94a3b8;
	cursor: pointer;
	padding: 2px 5px;
}

.ai-chat__proactive-close:hover {
	color: #334155;
}

.ai-chat__proactive-content {
	display: flex;
	align-items: center;
	gap: 6px;
	padding-right: 12px;
}

.ai-chat__proactive-icon {
	font-size: 18px;
	flex-shrink: 0;
}

.ai-chat__proactive-text {
	font-weight: 500;
	color: #1e293b;
}

@keyframes aiSlideUp {
	from {
		opacity: 0;
		transform: translateY(10px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* CHAT PANEL (KOMPAKT & ŞIK) */
.ai-chat__panel {
	position: absolute;
	bottom: 68px;
	width: 340px;
	max-width: calc(100vw - 24px);
	height: 460px;
	max-height: min(460px, calc(100vh - 120px));
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: var(--ai-shadow);
	border: 1px solid var(--ai-border);
	animation: aiPanelOpen 0.25s cubic-bezier(0.16, 1, 0.3, 1);
	z-index: 100060;
}

.ai-chat--right .ai-chat__panel {
	right: 0;
	transform-origin: bottom right;
}

.ai-chat--left .ai-chat__panel {
	left: 0;
	transform-origin: bottom left;
}

.ai-chat__panel[hidden] {
	display: none !important;
}

@keyframes aiPanelOpen {
	from {
		opacity: 0;
		transform: scale(0.92) translateY(12px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

/* HEADER - BELİRGİN & TEMADAN ETKİLENMEYEN */
.ai-chat__header {
	flex: 0 0 auto;
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	padding: 11px 13px !important;
	background: var(--ai-primary, #075e54) !important;
	color: #ffffff !important;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.ai-chat__header-info {
	display: flex;
	align-items: center;
	gap: 9px;
	min-width: 0;
}

.ai-chat__avatar-wrap {
	position: relative;
	flex-shrink: 0;
}

.ai-chat__avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #ffffff;
	color: #1e293b;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.ai-chat__status-dot {
	position: absolute;
	bottom: -1px;
	right: -1px;
	width: 10px;
	height: 10px;
	background: #22c55e;
	border-radius: 50%;
	border: 2px solid #ffffff;
}

.ai-chat__header-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ai-chat__title {
	font-size: 0.90rem !important;
	font-weight: 700 !important;
	color: #ffffff !important;
	letter-spacing: -0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.25;
}

.ai-chat__subtitle {
	font-size: 0.72rem !important;
	color: rgba(255, 255, 255, 0.88) !important;
	display: flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
	margin-top: 1px;
}

.ai-chat__live-indicator {
	width: 5px;
	height: 5px;
	background: #22c55e;
	border-radius: 50%;
	display: inline-block;
	animation: aiLiveGlow 1.8s infinite;
}

@keyframes aiLiveGlow {
	0%, 100% { opacity: 0.6; transform: scale(1); }
	50% { opacity: 1; transform: scale(1.3); }
}

.ai-chat__header-actions {
	display: flex;
	align-items: center;
	gap: 2px;
}

.ai-chat__btn-icon {
	border: 0;
	background: transparent;
	color: #ffffff !important;
	padding: 5px;
	border-radius: 6px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, opacity 0.15s ease;
	line-height: 0;
	opacity: 0.9;
}

.ai-chat__btn-icon:hover {
	background: rgba(255, 255, 255, 0.2);
	opacity: 1;
}

/* QUICK ACTION CHIPS */
.ai-chat__chips {
	flex: 0 0 auto;
	display: flex;
	gap: 6px;
	padding: 8px 10px;
	background: #f1f5f9;
	border-bottom: 1px solid var(--ai-border);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	cursor: grab;
	user-select: none;
	scrollbar-width: thin;
	scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

.ai-chat__chips.is-dragging {
	cursor: grabbing;
	scroll-behavior: auto;
}

.ai-chat__chips::-webkit-scrollbar {
	height: 4px;
}

.ai-chat__chips::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.18);
	border-radius: 4px;
}

.ai-chat__chips::-webkit-scrollbar-track {
	background: transparent;
}

.ai-chat__chip {
	flex: 0 0 auto;
	border: 1px solid rgba(0, 0, 0, 0.08);
	background: #ffffff;
	color: #334155;
	padding: 5px 11px;
	border-radius: 100px;
	font-size: 0.75rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s ease;
	white-space: nowrap;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ai-chat__chip:hover {
	background: #e2e8f0;
	color: #0f172a;
	border-color: rgba(0, 0, 0, 0.15);
	transform: translateY(-1px);
}

/* MESSAGES CONTAINER */
.ai-chat__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 12px;
	background-color: var(--ai-bg);
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ai-chat__row {
	display: flex;
	width: 100%;
}

.ai-chat__row--in {
	justify-content: flex-start;
}

.ai-chat__row--out {
	justify-content: flex-end;
}

.ai-chat__bubble {
	max-width: 88%;
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 0.86rem;
	line-height: 1.45;
	word-break: break-word;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ai-chat__row--in .ai-chat__bubble {
	background: var(--ai-bubble-in);
	color: var(--ai-bubble-in-text);
	border: 1px solid var(--ai-border);
	border-top-left-radius: 3px;
}

.ai-chat__row--out .ai-chat__bubble {
	background: var(--ai-bubble-out);
	color: var(--ai-bubble-out-text);
	border-top-right-radius: 3px;
}

/* MARKDOWN LINKS & STYLES */
.ai-chat__link {
	color: var(--ai-primary, #075e54);
	font-weight: 600;
	text-decoration: underline;
	transition: opacity 0.15s ease;
}

.ai-chat__link:hover {
	opacity: 0.85;
}

.ai-chat__bubble strong {
	font-weight: 600;
}

/* TYPING INDICATOR DOTS */
.ai-chat__bubble--typing {
	padding: 10px 14px;
	background: #ffffff;
}

.ai-chat__dots {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.ai-chat__dots span {
	width: 6px;
	height: 6px;
	background: #94a3b8;
	border-radius: 50%;
	display: inline-block;
	animation: aiBounce 1.3s infinite ease-in-out;
}

.ai-chat__dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-chat__dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes aiBounce {
	0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
	40% { transform: translateY(-5px); opacity: 1; background: var(--ai-primary, #075e54); }
}

/* COMPOSER */
.ai-chat__composer {
	flex: 0 0 auto;
	display: flex;
	gap: 6px;
	align-items: center;
	padding: 8px 10px 6px;
	background: #ffffff;
	border-top: 1px solid var(--ai-border);
}

.ai-chat__input-wrapper {
	flex: 1 1 auto;
	position: relative;
}

.ai-chat__input {
	width: 100%;
	border: 1px solid #e2e8f0;
	border-radius: 20px;
	padding: 8px 14px;
	font-size: 0.86rem;
	background: #f8fafc;
	color: #0f172a;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.ai-chat__input:focus {
	background: #ffffff;
	border-color: var(--ai-primary, #075e54);
	box-shadow: 0 0 0 2px rgba(7, 94, 84, 0.14);
}

.ai-chat__send {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: var(--ai-primary, #075e54) !important;
	color: #ffffff !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform 0.15s ease, opacity 0.15s ease;
	outline: none;
}

.ai-chat__send:hover {
	transform: scale(1.05);
	opacity: 0.95;
}

.ai-chat__send:active {
	transform: scale(0.95);
}

.ai-chat__send:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	transform: none;
}

.ai-chat__footer-note {
	text-align: center;
	padding: 1px 0 5px;
	font-size: 0.65rem;
	color: #94a3b8;
	background: #ffffff;
	user-select: none;
}

/* RESPONSIVE MOBILE */
@media (max-width: 575.98px) {
	.ai-chat--right,
	.ai-chat--left {
		right: 14px;
		bottom: 14px;
		left: auto;
	}

	.ai-chat__panel {
		position: fixed;
		bottom: 74px;
		right: 10px;
		left: 10px;
		width: auto;
		max-width: none;
		height: calc(100dvh - 110px);
		max-height: 520px;
		border-radius: 16px;
	}

	.ai-chat__fab {
		width: 50px;
		height: 50px;
	}

	.ai-chat__proactive-bubble {
		width: calc(100vw - 40px);
		max-width: 260px;
		right: 0;
	}
}
