/* HotelAI Asistan - Modern Chat Widget */

.haia-chat-root,
.haia-chat-root *,
.haia-chat-root *::before,
.haia-chat-root *::after {
	box-sizing: border-box;
}

.haia-chat-root {
	--haia-primary: #1a5f4a;
	--haia-primary-dark: #134a3a;
	--haia-primary-soft: rgba(26, 95, 74, 0.12);
	--haia-bg: #ffffff;
	--haia-surface: #f8fafc;
	--haia-text: #0f172a;
	--haia-muted: #64748b;
	--haia-border: #e2e8f0;
	--haia-shadow: 0 8px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
	--haia-shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.2);
	--haia-radius: 20px;
	--haia-radius-sm: 12px;
	--haia-safe-bottom: env(safe-area-inset-bottom, 0px);
	--haia-safe-right: env(safe-area-inset-right, 0px);
	--haia-offset-bottom: 20px;
	--haia-offset-right: 20px;
	position: fixed;
	right: calc(var(--haia-offset-right) + var(--haia-safe-right));
	bottom: calc(var(--haia-offset-bottom) + var(--haia-safe-bottom));
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

/* —— Launcher (teaser + FAB) —— */
.haia-launcher {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	animation: haia-launcher-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

@keyframes haia-launcher-in {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.haia-teaser {
	position: relative;
	max-width: 280px;
	padding: 14px 36px 14px 16px;
	background: #fff;
	border-radius: 16px 16px 4px 16px;
	box-shadow: 0 8px 30px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(15, 23, 42, 0.06);
	animation: haia-teaser-float 3s ease-in-out infinite;
	transform-origin: bottom right;
}

.haia-teaser:not([hidden]) {
	display: block;
}

.haia-teaser[hidden] {
	display: none !important;
}

@keyframes haia-teaser-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-4px); }
}

.haia-teaser-close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 24px;
	height: 24px;
	border: none !important;
	background: #f1f5f9 !important;
	color: #64748b !important;
	border-radius: 50% !important;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	padding: 0 !important;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, color 0.2s;
}

.haia-teaser-close:hover {
	background: #e2e8f0 !important;
	color: #0f172a !important;
}

.haia-teaser-inner {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.haia-teaser-wave {
	font-size: 22px;
	line-height: 1;
	animation: haia-wave 1.8s ease-in-out infinite;
	flex-shrink: 0;
}

@keyframes haia-wave {
	0%, 100% { transform: rotate(0deg); }
	25% { transform: rotate(14deg); }
	75% { transform: rotate(-8deg); }
}

.haia-teaser-text {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.45;
	color: var(--haia-text);
	min-height: 1.45em;
}

.haia-teaser-cursor {
	display: inline-block;
	width: 2px;
	height: 1em;
	background: var(--haia-primary);
	margin-left: 2px;
	vertical-align: text-bottom;
	animation: haia-blink 0.8s step-end infinite;
}

.haia-teaser-cursor.is-hidden {
	display: none;
}

@keyframes haia-blink {
	50% { opacity: 0; }
}

.haia-teaser.is-fading .haia-teaser-text {
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.35s ease, transform 0.35s ease;
}

.haia-teaser:not(.is-fading) .haia-teaser-text {
	opacity: 1;
	transform: translateY(0);
	transition: opacity 0.35s ease, transform 0.35s ease;
}

.haia-fab-wrap {
	position: relative;
	width: 64px;
	height: 64px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.haia-pulse-ring {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid var(--haia-primary);
	opacity: 0;
	animation: haia-pulse 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
	pointer-events: none;
}

.haia-pulse-ring--delay {
	animation-delay: 1.1s;
}

@keyframes haia-pulse {
	0% {
		transform: scale(0.85);
		opacity: 0.6;
	}
	100% {
		transform: scale(1.45);
		opacity: 0;
	}
}

.haia-chat-root.is-open .haia-teaser,
.haia-chat-root.is-open .haia-pulse-ring {
	display: none !important;
}

/* —— Floating action button —— */
.haia-chat-root button.haia-chat-toggle {
	position: relative;
	z-index: 2;
	width: 64px !important;
	height: 64px !important;
	min-width: 64px !important;
	min-height: 64px !important;
	border: none !important;
	outline: none !important;
	border-radius: 50% !important;
	background: linear-gradient(145deg, var(--haia-primary) 0%, var(--haia-primary-dark) 100%) !important;
	color: #fff !important;
	cursor: pointer;
	box-shadow: 0 8px 28px rgba(15, 23, 42, 0.22), 0 0 0 0 rgba(26, 95, 74, 0.4);
	display: flex !important;
	align-items: center;
	justify-content: center;
	transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
	overflow: hidden;
	padding: 0 !important;
	margin: 0 !important;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	animation: haia-fab-glow 2.5s ease-in-out infinite;
}

@keyframes haia-fab-glow {
	0%, 100% { box-shadow: 0 8px 28px rgba(15, 23, 42, 0.22), 0 0 0 0 rgba(26, 95, 74, 0.35); }
	50% { box-shadow: 0 10px 32px rgba(15, 23, 42, 0.26), 0 0 0 10px rgba(26, 95, 74, 0); }
}

.haia-chat-root button.haia-chat-toggle:hover {
	transform: scale(1.08);
	box-shadow: 0 12px 36px rgba(15, 23, 42, 0.28) !important;
	animation: none;
}

.haia-chat-root button.haia-chat-toggle:active {
	transform: scale(0.94);
}

.haia-toggle-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.haia-toggle-inner--icon .haia-icon-chat {
	width: 30px;
	height: 30px;
	display: block;
}

.haia-toggle-inner--icon .haia-icon-close {
	display: none;
	width: 22px;
	height: 22px;
}

.haia-toggle-inner--avatar {
	display: none;
	padding: 3px;
}

.haia-toggle-inner--avatar img,
.haia-toggle-inner--avatar .haia-chat-avatar--fallback {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid rgba(255, 255, 255, 0.9);
}

.haia-has-avatar .haia-toggle-inner--icon {
	display: none;
}

.haia-has-avatar .haia-toggle-inner--avatar {
	display: flex;
}

.haia-chat-root.is-open .haia-chat-toggle {
	background: #fff;
	color: var(--haia-text);
	box-shadow: var(--haia-shadow);
}

.haia-chat-root.is-open.haia-has-avatar .haia-toggle-inner--avatar {
	display: none;
}

.haia-chat-root.is-open .haia-toggle-inner--icon {
	display: flex;
}

.haia-chat-root.is-open .haia-toggle-inner--icon .haia-icon-chat {
	display: none;
}

.haia-chat-root.is-open .haia-toggle-inner--icon .haia-icon-close {
	display: block;
}

/* —— Panel —— */
.haia-chat-panel {
	position: absolute;
	right: 0;
	bottom: calc(74px + var(--haia-safe-bottom));
	width: 400px;
	max-width: calc(100vw - 24px);
	--haia-panel-height-desktop: 560px;
	--haia-panel-height-mobile: 62dvh;
	height: min(var(--haia-panel-height-desktop), calc(100dvh - 110px));
	max-height: min(var(--haia-panel-height-desktop), calc(100dvh - 110px));
	background: var(--haia-bg);
	border-radius: var(--haia-radius);
	box-shadow: var(--haia-shadow-lg);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--haia-border);
	animation: haia-panel-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.haia-chat-panel[hidden] {
	display: none !important;
}

@keyframes haia-panel-in {
	from {
		opacity: 0;
		transform: translateY(16px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* —— Header —— */
.haia-chat-root .haia-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: linear-gradient(135deg, var(--haia-primary) 0%, var(--haia-primary-dark) 100%) !important;
	color: #fff !important;
	flex-shrink: 0;
	border: none !important;
	box-shadow: none !important;
}

.haia-chat-header-info {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.haia-chat-avatar,
.haia-chat-avatar--fallback {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	flex-shrink: 0;
	object-fit: cover;
	border: 2px solid rgba(255, 255, 255, 0.35);
}

.haia-chat-avatar--fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.2);
	font-weight: 700;
	font-size: 18px;
}

.haia-chat-header-text {
	min-width: 0;
}

.haia-chat-root .haia-chat-title {
	display: block;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: #fff !important;
}

.haia-chat-root .haia-chat-status {
	color: rgba(255, 255, 255, 0.92) !important;
}

.haia-chat-status {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	opacity: 0.9;
	margin-top: 2px;
}

.haia-status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
	box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
}

.haia-chat-header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

/* Header aksiyon butonları — tema stillerini ez */
.haia-chat-root .haia-chat-header button.haia-header-btn {
	box-sizing: border-box !important;
	width: 36px !important;
	height: 36px !important;
	min-width: 36px !important;
	min-height: 36px !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	border-radius: 10px !important;
	background: rgba(255, 255, 255, 0.2) !important;
	color: #fff !important;
	cursor: pointer;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	line-height: 1 !important;
	transition: background 0.2s ease, transform 0.15s ease;
	touch-action: manipulation;
	-webkit-appearance: none !important;
	appearance: none !important;
	-webkit-tap-highlight-color: transparent;
}

.haia-chat-root .haia-chat-header button.haia-header-btn:hover {
	background: rgba(255, 255, 255, 0.35) !important;
	transform: scale(1.05);
}

.haia-chat-root .haia-chat-header button.haia-header-btn:active {
	transform: scale(0.94);
}

.haia-chat-root .haia-chat-header button.haia-header-btn:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.85) !important;
	outline-offset: 2px;
}

.haia-header-btn-icon {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 20px;
	height: 20px;
	pointer-events: none;
}

.haia-header-btn-icon svg {
	display: block !important;
	width: 20px !important;
	height: 20px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	background: none !important;
	flex-shrink: 0;
}

/* —— Messages —— */
.haia-chat-messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	background: var(--haia-surface);
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.haia-message-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	max-width: 100%;
}

.haia-message-row--user {
	flex-direction: row-reverse;
}

.haia-message-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	border: 1px solid var(--haia-border);
}

.haia-message-avatar--initials {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--haia-primary-soft);
	color: var(--haia-primary);
	font-size: 13px;
	font-weight: 700;
}

.haia-message-row--user .haia-message-avatar {
	display: none;
}

.haia-message {
	max-width: min(85%, calc(100% - 44px));
	padding: 11px 14px;
	border-radius: 18px;
	font-size: 15px;
	line-height: 1.5;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.haia-message--bot {
	background: var(--haia-bg);
	color: var(--haia-text);
	border: 1px solid var(--haia-border);
	border-bottom-left-radius: 6px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.haia-message--bot .haia-message-link {
	color: var(--haia-primary);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
	word-break: break-word;
}

.haia-message--bot .haia-message-link:hover {
	color: var(--haia-primary-dark);
}

.haia-message--user .haia-message-link {
	color: #fff;
	text-decoration: underline;
}

.haia-message--user {
	background: linear-gradient(135deg, var(--haia-primary), var(--haia-primary-dark));
	color: #fff;
	border-bottom-right-radius: 6px;
}

.haia-message-meta {
	font-size: 11px;
	font-weight: 600;
	margin-bottom: 4px;
	color: var(--haia-primary);
}

.haia-message-image {
	display: block;
	margin-top: 10px;
	max-width: 100%;
}

.haia-chat-root button.haia-message-image-trigger {
	position: relative;
	display: block !important;
	width: 100%;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	background: none !important;
	box-shadow: none !important;
	cursor: zoom-in;
	line-height: 0;
	border-radius: 12px;
	overflow: hidden;
}

.haia-message-image-preview {
	display: block;
	max-width: 100%;
	max-height: 220px;
	width: 100%;
	height: auto;
	border-radius: 12px;
	border: 1px solid var(--haia-border);
	object-fit: cover;
	background: #f1f5f9;
	transition: opacity 0.2s ease;
}

.haia-message-image-zoom {
	position: absolute;
	right: 8px;
	bottom: 8px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(15, 23, 42, 0.55);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.haia-message-image-trigger:hover .haia-message-image-preview {
	opacity: 0.92;
}

.haia-message-image-trigger:hover .haia-message-image-zoom {
	opacity: 1;
}

/* Lightbox */
.haia-lightbox {
	position: fixed;
	inset: 0;
	z-index: 10000000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.haia-lightbox[hidden] {
	display: none !important;
}

.haia-lightbox-backdrop {
	position: absolute;
	inset: 0;
	border: none !important;
	padding: 0 !important;
	margin: 0 !important;
	background: rgba(15, 23, 42, 0.82) !important;
	cursor: zoom-out;
}

.haia-lightbox-content {
	position: relative;
	z-index: 2;
	max-width: min(96vw, 960px);
	max-height: 90vh;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: haia-lightbox-in 0.25s ease;
}

@keyframes haia-lightbox-in {
	from {
		opacity: 0;
		transform: scale(0.94);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.haia-lightbox-img {
	display: block;
	max-width: 100%;
	max-height: 90vh;
	width: auto;
	height: auto;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
	object-fit: contain;
	background: #fff;
}

.haia-lightbox-close {
	position: absolute !important;
	top: -14px;
	right: -14px;
	z-index: 3;
	background: rgba(255, 255, 255, 0.95) !important;
	color: #0f172a !important;
}

body.haia-lightbox-open {
	overflow: hidden;
}

.haia-typing-wrap {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.haia-typing {
	display: flex;
	gap: 5px;
	padding: 14px 16px;
	background: var(--haia-bg);
	border: 1px solid var(--haia-border);
	border-radius: 18px;
	border-bottom-left-radius: 6px;
}

.haia-typing span {
	width: 7px;
	height: 7px;
	background: var(--haia-muted);
	border-radius: 50%;
	animation: haia-bounce 1.2s infinite ease-in-out;
}

.haia-typing span:nth-child(2) { animation-delay: 0.15s; }
.haia-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes haia-bounce {
	0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
	40% { transform: translateY(-5px); opacity: 1; }
}

/* —— Input —— */
.haia-chat-form {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	padding: 12px 14px calc(12px + var(--haia-safe-bottom));
	border-top: 1px solid var(--haia-border);
	background: var(--haia-bg);
	flex-shrink: 0;
}

.haia-chat-input {
	flex: 1;
	resize: none;
	border: 1px solid var(--haia-border);
	border-radius: var(--haia-radius-sm);
	padding: 12px 14px;
	font-size: 16px;
	font-family: inherit;
	line-height: 1.4;
	max-height: 120px;
	min-height: 46px;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
	background: var(--haia-surface);
	-webkit-appearance: none;
	appearance: none;
}

.haia-chat-input:focus {
	border-color: var(--haia-primary);
	box-shadow: 0 0 0 3px var(--haia-primary-soft);
}

.haia-chat-root button.haia-chat-send {
	width: 46px !important;
	height: 46px !important;
	min-width: 46px !important;
	min-height: 46px !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	border-radius: var(--haia-radius-sm) !important;
	background: linear-gradient(135deg, var(--haia-primary), var(--haia-primary-dark)) !important;
	color: #fff !important;
	cursor: pointer;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-shrink: 0;
	line-height: 1 !important;
	transition: transform 0.15s, opacity 0.2s;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.haia-chat-send .haia-send-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.haia-chat-send .haia-send-icon svg {
	display: block;
	width: 20px;
	height: 20px;
	margin: 0;
	flex-shrink: 0;
}

.haia-chat-root button.haia-chat-send:hover:not(:disabled) {
	transform: scale(1.04);
}

.haia-chat-root button.haia-chat-send:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

body.haia-chat-open {
	overflow: hidden;
}

/* —— Tablet & mobile —— */
@media (max-width: 768px) {
	.haia-chat-root {
		right: calc(var(--haia-offset-right) + var(--haia-safe-right));
		bottom: calc(var(--haia-offset-bottom) + var(--haia-safe-bottom));
	}

	.haia-teaser {
		max-width: calc(100vw - 100px);
	}

	.haia-fab-wrap {
		width: 58px;
		height: 58px;
	}

	.haia-chat-root button.haia-chat-toggle {
		width: 58px !important;
		height: 58px !important;
		min-width: 58px !important;
		min-height: 58px !important;
	}

	.haia-chat-panel {
		position: fixed;
		right: calc(max(10px, var(--haia-offset-right)) + var(--haia-safe-right));
		left: auto;
		bottom: calc(max(72px, var(--haia-offset-bottom)) + var(--haia-safe-bottom));
		width: min(calc(100vw - 20px), 380px);
		max-width: calc(100vw - 20px);
		height: min(
			var(--haia-panel-height-mobile),
			calc(100dvh - 100px - var(--haia-offset-bottom) - var(--haia-safe-bottom))
		);
		max-height: min(
			var(--haia-panel-height-mobile),
			calc(100dvh - 100px - var(--haia-offset-bottom) - var(--haia-safe-bottom))
		);
		border-radius: var(--haia-radius);
	}

	.haia-chat-root.is-open .haia-chat-toggle {
		display: none;
	}

	.haia-chat-header {
		padding: 12px 14px;
		min-height: 64px;
	}

	.haia-chat-title {
		font-size: 15px;
	}

	.haia-message {
		font-size: 15px;
		max-width: 88%;
	}

	.haia-chat-input {
		font-size: 16px;
		min-height: 44px;
	}

	.haia-chat-root button.haia-chat-send {
		width: 44px !important;
		height: 44px !important;
		min-width: 44px !important;
		min-height: 44px !important;
		border-radius: 12px !important;
	}

	.haia-chat-send .haia-send-icon svg {
		width: 18px;
		height: 18px;
	}
}

/* —— Small phones —— */
@media (max-width: 380px) {
	.haia-chat-header {
		padding: 12px;
	}

	.haia-chat-messages {
		padding: 12px;
	}
}
