/* AI Live Chat Widget — all visual values are injected by JS as CSS custom properties */
#ailc-widget-root {
	--ailc-primary: #1E7145;
	--ailc-secondary: #0F3D24;
	--ailc-text-on-primary: #FFFFFF;
	--ailc-radius: 16px;
	--ailc-btn-size: 60px;
	--ailc-font: inherit;
	position: fixed;
	z-index: 999999;
	font-family: var(--ailc-font);
	line-height: 1.45;
}

#ailc-widget-root * {
	box-sizing: border-box;
}

/* --- Positioning --- */
.ailc-pos-right { right: 24px; bottom: 24px; }
.ailc-pos-left  { left: 24px; bottom: 24px; }

.ailc-pos-right .ailc-panel { right: 0; }
.ailc-pos-left  .ailc-panel { left: 0; }

/* --- Floating button --- */
.ailc-launcher {
	width: var(--ailc-btn-size) !important;
	height: var(--ailc-btn-size) !important;
	min-width: 0 !important;
	max-width: none !important;
	border-radius: 50% !important;
	background: linear-gradient(155deg, var(--ailc-primary) 0%, var(--ailc-secondary) 100%);
	box-shadow: 0 8px 24px rgba(0,0,0,0.22), 0 2px 6px rgba(0,0,0,0.12);
	border: none !important;
	outline: none !important;
	cursor: pointer;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	position: relative;
	overflow: hidden;
	padding: 0 !important;
	box-sizing: border-box !important;
	transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s ease;
}
.ailc-launcher:hover {
	transform: translateY(-3px) scale(1.04);
	box-shadow: 0 12px 30px rgba(0,0,0,0.28);
}
/* Icons: rendered as background-image (see widget.js header comment for why).
   !important is used deliberately here to survive aggressive theme/page-builder
   resets that sometimes target generic elements inside third-party widgets. */
#ailc-widget-root .ailc-icon {
	display: inline-block !important;
	background-repeat: no-repeat !important;
	background-position: center !important;
	background-size: contain !important;
	flex-shrink: 0;
}
.ailc-launcher .ailc-icon,
.ailc-launcher img {
	width: 46% !important;
	height: 46% !important;
	max-width: 46% !important;
	max-height: 46% !important;
	object-fit: contain !important;
	display: block !important;
	flex-shrink: 0;
}
#ailc-widget-root .ailc-launcher .ailc-close-icon { display: none !important; }
#ailc-widget-root.ailc-open .ailc-launcher .ailc-chat-icon { display: none !important; }
#ailc-widget-root.ailc-open .ailc-launcher .ailc-close-icon { display: inline-block !important; }

.ailc-launcher-dot {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #ff4757;
	border: 2px solid #fff;
}

/* --- Sohbet paneli --- */
.ailc-panel {
	position: absolute;
	bottom: calc(var(--ailc-btn-size) + 16px);
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 140px);
	background: #ffffff;
	border-radius: var(--ailc-radius);
	box-shadow: 0 20px 60px rgba(0,0,0,0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(16px) scale(.97);
	pointer-events: none;
	transition: opacity .22s ease, transform .22s cubic-bezier(.34,1.2,.64,1);
}
#ailc-widget-root.ailc-open .ailc-panel {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.ailc-header {
	background: linear-gradient(155deg, var(--ailc-primary) 0%, var(--ailc-secondary) 100%);
	color: var(--ailc-text-on-primary);
	padding: 18px 20px;
	flex-shrink: 0;
}
.ailc-header-title {
	font-size: 16px;
	font-weight: 700;
	margin: 0 0 2px;
}
.ailc-header-subtitle {
	font-size: 12.5px;
	opacity: .85;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 6px;
}
.ailc-header-subtitle::before {
	content: '';
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
	display: inline-block;
}

/* --- Message area --- */
.ailc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #F7F8FA;
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.ailc-messages::-webkit-scrollbar { width: 6px; }
.ailc-messages::-webkit-scrollbar-thumb { background: #d5d9de; border-radius: 4px; }

.ailc-msg-row { display: flex; gap: 8px; max-width: 88%; }
.ailc-msg-row.ailc-from-user { align-self: flex-end; flex-direction: row-reverse; }
.ailc-msg-row.ailc-from-assistant { align-self: flex-start; }

.ailc-avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--ailc-primary);
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	font-size: 13px;
	color: #fff;
}
.ailc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ailc-avatar .ailc-icon { width: 15px; height: 15px; }

.ailc-bubble {
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 13.5px;
	white-space: pre-wrap;
	word-break: break-word;
}
.ailc-from-assistant .ailc-bubble {
	background: #fff;
	border: 1px solid #eaecef;
	border-top-left-radius: 4px;
	color: #22262b;
}
.ailc-from-user .ailc-bubble {
	background: var(--ailc-primary);
	color: var(--ailc-text-on-primary);
	border-top-right-radius: 4px;
}

.ailc-typing {
	display: inline-flex;
	gap: 3px;
	padding: 4px 2px;
}
.ailc-typing span {
	width: 6px; height: 6px; border-radius: 50%;
	background: #b7bcc3;
	animation: ailc-bounce 1.2s infinite ease-in-out;
}
.ailc-typing span:nth-child(2) { animation-delay: .15s; }
.ailc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ailc-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: .5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* --- Product cards --- */
.ailc-products {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 8px;
}
.ailc-product-card {
	display: flex;
	gap: 10px;
	background: #fff;
	border: 1px solid #eaecef;
	border-radius: 12px;
	padding: 8px;
	text-decoration: none;
	color: inherit;
	transition: border-color .15s ease, transform .15s ease;
}
.ailc-product-card:hover {
	border-color: var(--ailc-primary);
	transform: translateY(-1px);
}
.ailc-product-card img {
	width: 52px;
	height: 52px;
	border-radius: 8px;
	object-fit: cover;
	background: #f1f2f4;
	flex-shrink: 0;
}
.ailc-product-info { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.ailc-product-name {
	font-size: 12.5px;
	font-weight: 600;
	color: #22262b;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ailc-product-price {
	font-size: 12.5px;
	color: var(--ailc-primary);
	font-weight: 700;
	margin-top: 2px;
}

/* --- WhatsApp CTA --- */
.ailc-whatsapp-cta {
	margin-top: 8px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: #25D366;
	color: #fff;
	text-decoration: none;
	padding: 9px 14px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
	box-shadow: 0 4px 12px rgba(37,211,102,0.35);
	transition: transform .15s ease;
}
.ailc-whatsapp-cta:hover { transform: translateY(-1px); color: #fff; }
.ailc-whatsapp-cta .ailc-icon { width: 16px; height: 16px; }

/* --- Input area --- */
.ailc-input-bar {
	flex-shrink: 0;
	border-top: 1px solid #eaecef;
	padding: 10px 12px;
	display: flex;
	gap: 8px;
	align-items: flex-end;
	background: #fff;
}
.ailc-input-bar textarea {
	flex: 1;
	resize: none;
	border: 1px solid #e1e4e8;
	border-radius: 12px;
	padding: 9px 12px;
	font-size: 13.5px;
	font-family: inherit;
	max-height: 90px;
	outline: none;
}
.ailc-input-bar textarea:focus { border-color: var(--ailc-primary); }
.ailc-send-btn {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	background: var(--ailc-primary);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background .15s ease, transform .1s ease;
}
.ailc-send-btn:hover { background: var(--ailc-secondary); }
.ailc-send-btn:active { transform: scale(.92); }
.ailc-send-btn:disabled { opacity: .5; cursor: default; }
.ailc-send-btn .ailc-icon { width: 16px; height: 16px; }

.ailc-footer-note {
	text-align: center;
	font-size: 10.5px;
	color: #9aa1a9;
	padding: 4px 0 8px;
	background: #fff;
}

@media (max-width: 480px) {
	.ailc-panel {
		width: calc(100vw - 24px);
		height: calc(100vh - 110px);
	}
}
