/* Iva Chatbot — dark/cyan glass UI integrisan sa StartUp Solution temom */

#iva-chatbot {
	--iva-cyan: #00f0ff;
	--iva-cyan-glow: rgba(0, 240, 255, 0.4);
	--iva-cyan-soft: rgba(0, 240, 255, 0.12);
	--iva-cyan-deep: #006970;
	--iva-bg: #0a0a0a;
	--iva-surface: rgba(15, 15, 15, 0.95);
	--iva-card: rgba(23, 23, 23, 0.85);
	--iva-text: #e2e2e2;
	--iva-muted: #737373;
	--iva-border: rgba(38, 38, 38, 1);
	--iva-radius: 16px;
	--iva-blur: 24px;
	font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
	color: var(--iva-text);
	font-size: 14px;
	line-height: 1.55;
	box-sizing: border-box;
}

#iva-chatbot *,
#iva-chatbot *::before,
#iva-chatbot *::after {
	box-sizing: border-box;
}

/* ========== LAUNCHER ========== */

.iva-launcher {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 999999;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: radial-gradient(circle at 30% 30%, rgba(0, 240, 255, 0.22), rgba(13, 13, 13, 0.95) 70%);
	backdrop-filter: blur(var(--iva-blur));
	-webkit-backdrop-filter: blur(var(--iva-blur));
	border: 2px solid rgba(0, 240, 255, 0.5);
	box-shadow:
		0 0 0 1px rgba(0, 240, 255, 0.12),
		0 0 36px rgba(0, 240, 255, 0.45),
		0 12px 32px rgba(0, 0, 0, 0.6);
	color: var(--iva-cyan);
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.35s, box-shadow 0.35s;
}

.iva-launcher:hover {
	transform: scale(1.08);
	border-color: rgba(0, 240, 255, 0.8);
	box-shadow:
		0 0 0 2px rgba(0, 240, 255, 0.2),
		0 0 56px rgba(0, 240, 255, 0.6),
		0 16px 40px rgba(0, 0, 0, 0.7);
}

.iva-launcher-icon {
	width: 30px;
	height: 30px;
	display: flex;
	filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.6));
	animation: iva-spin 9s linear infinite;
}

.iva-launcher-icon svg {
	width: 100%;
	height: 100%;
}

@keyframes iva-spin {
	0%   { transform: rotate(0deg)   scale(1); }
	50%  { transform: rotate(180deg) scale(1.06); }
	100% { transform: rotate(360deg) scale(1); }
}

.iva-launcher-pulse {
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	border: 1px solid rgba(0, 240, 255, 0.3);
	animation: iva-pulse 2.5s ease-out infinite;
	pointer-events: none;
}

@keyframes iva-pulse {
	0%   { transform: scale(1);   opacity: 0.8; }
	100% { transform: scale(1.5); opacity: 0;   }
}

.iva-launcher-tooltip {
	position: absolute;
	right: calc(100% + 14px);
	top: 50%;
	transform: translateY(-50%);
	background: rgba(13, 13, 13, 0.95);
	backdrop-filter: blur(16px);
	color: var(--iva-cyan);
	padding: 0.5rem 1rem;
	border-radius: 9999px;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	white-space: nowrap;
	border: 1px solid rgba(0, 240, 255, 0.3);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
	pointer-events: none;
	animation: iva-bob 3s ease-in-out infinite;
}

@keyframes iva-bob {
	0%, 100% { transform: translateY(-50%); }
	50%      { transform: translateY(calc(-50% - 3px)); }
}

#iva-chatbot[data-iva-open="true"] .iva-launcher-tooltip {
	display: none;
}

#iva-chatbot[data-iva-open="true"] .iva-launcher-pulse {
	display: none;
}

@media (max-width: 600px) {
	.iva-launcher-tooltip { display: none; }
	.iva-launcher { width: 56px; height: 56px; bottom: 16px; right: 16px; }
}

/* ========== PANEL ========== */

.iva-panel {
	position: fixed;
	bottom: 100px;
	right: 24px;
	z-index: 999998;
	width: min(420px, calc(100vw - 32px));
	max-height: min(640px, calc(100vh - 130px));
	display: flex;
	flex-direction: column;
	background: var(--iva-surface);
	backdrop-filter: blur(var(--iva-blur)) saturate(180%);
	-webkit-backdrop-filter: blur(var(--iva-blur)) saturate(180%);
	border: 1px solid rgba(0, 240, 255, 0.2);
	border-radius: 20px;
	box-shadow:
		0 0 40px rgba(0, 240, 255, 0.12),
		0 24px 60px rgba(0, 0, 0, 0.7);
	opacity: 0;
	pointer-events: none;
	transform: translateY(12px) scale(0.96);
	transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	overflow: hidden;
}

#iva-chatbot[data-iva-open="true"] .iva-panel {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0) scale(1);
}

@media (max-width: 600px) {
	.iva-panel {
		bottom: 0;
		right: 0;
		left: 0;
		top: 0;
		width: 100%;
		max-height: 100svh;
		max-height: 100dvh;
		height: 100svh;
		height: 100dvh;
		border-radius: 0;
		border: none;
	}
	.iva-header {
		flex-shrink: 0;
		position: sticky;
		top: 0;
		z-index: 3;
		padding-top: max(1rem, env(safe-area-inset-top));
		background: linear-gradient(135deg, rgba(0, 240, 255, 0.06), rgba(13, 13, 13, 0.98));
	}
	.iva-input-form {
		flex-shrink: 0;
		position: sticky;
		bottom: 0;
		z-index: 3;
		background: rgba(13, 13, 13, 0.98);
		padding-bottom: max(1rem, env(safe-area-inset-bottom));
		border-top: 1px solid rgba(0, 240, 255, 0.15);
	}
	.iva-messages {
		min-height: 0;
	}
	#iva-chatbot[data-iva-open="true"] .iva-launcher {
		display: none;
	}
	/* Prevent body scroll behind chat */
	body:has(#iva-chatbot[data-iva-open="true"]) {
		overflow: hidden;
	}
}

/* ========== HEADER ========== */

.iva-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem;
	background: linear-gradient(135deg, rgba(0, 240, 255, 0.06), rgba(13, 13, 13, 0.95));
	border-bottom: 1px solid rgba(0, 240, 255, 0.15);
}

.iva-header-left {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.iva-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: radial-gradient(circle at 30% 30%, rgba(0, 240, 255, 0.3), rgba(13, 13, 13, 0.9) 70%);
	border: 1px solid rgba(0, 240, 255, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--iva-cyan);
	box-shadow: 0 0 16px rgba(0, 240, 255, 0.2);
}

.iva-avatar svg {
	width: 20px;
	height: 20px;
}

.iva-title {
	margin: 0;
	font-family: "Space Grotesk", sans-serif;
	font-size: 1rem;
	font-weight: 700;
	color: var(--iva-cyan);
	letter-spacing: -0.01em;
	line-height: 1.1;
}

.iva-subtitle {
	margin: 0.125rem 0 0;
	font-size: 0.6875rem;
	color: var(--iva-muted);
	display: flex;
	align-items: center;
	gap: 0.375rem;
}

.iva-status-dot {
	display: inline-block;
	width: 0.4375rem;
	height: 0.4375rem;
	border-radius: 50%;
	background: #22c55e;
	box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
	animation: iva-blink 2s ease-in-out infinite;
}

@keyframes iva-blink {
	0%, 100% { opacity: 1; }
	50%      { opacity: 0.4; }
}

.iva-header-actions {
	display: flex;
	gap: 0.25rem;
}

.iva-icon-btn {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: transparent;
	border: 1px solid transparent;
	color: var(--iva-muted);
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
}

.iva-icon-btn:hover {
	background: rgba(0, 240, 255, 0.08);
	border-color: rgba(0, 240, 255, 0.25);
	color: var(--iva-cyan);
}

/* ========== WELCOME ========== */

.iva-welcome {
	position: relative;
	margin: 0 0 0.75rem;
	padding: 1.25rem 1.125rem;
	border-radius: 14px;
	background: linear-gradient(180deg, rgba(0, 240, 255, 0.07), rgba(13, 13, 13, 0.5));
	border: 1px solid rgba(0, 240, 255, 0.18);
	overflow: hidden;
	flex-shrink: 0;
}

.iva-welcome[hidden] { display: none; }

.iva-welcome-glow {
	position: absolute;
	top: -40%;
	right: -20%;
	width: 200px;
	height: 200px;
	background: rgba(0, 240, 255, 0.15);
	border-radius: 50%;
	filter: blur(60px);
	pointer-events: none;
}

.iva-welcome-content {
	position: relative;
	z-index: 1;
}

.iva-welcome-title {
	margin: 0 0 0.5rem;
	font-family: "Space Grotesk", sans-serif;
	font-size: 1.125rem;
	font-weight: 600;
	color: #ffffff;
	letter-spacing: -0.01em;
}

.iva-welcome-accent {
	color: var(--iva-cyan);
	text-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.iva-welcome-lead {
	margin: 0 0 1rem;
	font-size: 0.875rem;
	color: var(--iva-text);
	line-height: 1.55;
}

.iva-welcome-list {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.iva-welcome-list li {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	font-size: 0.8125rem;
	color: #cbd5e1;
	line-height: 1.5;
}

.iva-welcome-list li svg {
	flex-shrink: 0;
	color: var(--iva-cyan);
	margin-top: 0.125rem;
}

.iva-welcome-prompt {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--iva-muted);
	font-style: italic;
}

/* ========== MESSAGES ========== */

.iva-messages {
	flex: 1;
	overflow-y: auto;
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	min-height: 200px;
	scroll-behavior: smooth;
}

.iva-messages::-webkit-scrollbar { width: 6px; }
.iva-messages::-webkit-scrollbar-track { background: transparent; }
.iva-messages::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.25); border-radius: 9999px; }

.iva-msg {
	max-width: 85%;
	padding: 0.625rem 0.875rem;
	border-radius: var(--iva-radius);
	font-size: 0.875rem;
	line-height: 1.55;
	word-wrap: break-word;
	white-space: pre-wrap;
	animation: iva-msg-in 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes iva-msg-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

.iva-msg-iva {
	align-self: flex-start;
	background: var(--iva-card);
	border: 1px solid rgba(255, 255, 255, 0.06);
	color: var(--iva-text);
	border-bottom-left-radius: 4px;
}

.iva-msg-user {
	align-self: flex-end;
	background: rgba(0, 240, 255, 0.12);
	border: 1px solid rgba(0, 240, 255, 0.25);
	color: #ffffff;
	border-bottom-right-radius: 4px;
}

.iva-msg-error {
	align-self: stretch;
	background: rgba(239, 68, 68, 0.08);
	border: 1px solid rgba(239, 68, 68, 0.3);
	color: #fca5a5;
	font-size: 0.8125rem;
	max-width: 100%;
	text-align: center;
}

.iva-lead-success {
	align-self: stretch;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	border-radius: 12px;
	background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(0, 240, 255, 0.08));
	border: 1px solid rgba(34, 197, 94, 0.35);
	color: #86efac;
	font-size: 0.8125rem;
	font-weight: 600;
	max-width: 100%;
	animation: iva-msg-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.iva-lead-success svg {
	color: #22c55e;
	flex-shrink: 0;
}

.iva-typing {
	align-self: flex-start;
	background: var(--iva-card);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: var(--iva-radius);
	border-bottom-left-radius: 4px;
	padding: 0.875rem 1rem;
	display: inline-flex;
	gap: 4px;
}

.iva-typing-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--iva-cyan);
	opacity: 0.5;
	animation: iva-typing 1.4s ease-in-out infinite;
}

.iva-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.iva-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes iva-typing {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30%           { transform: translateY(-6px); opacity: 1; }
}

/* ========== SUGGESTIONS ========== */

.iva-suggestions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding: 0 1.25rem 0.75rem;
}

.iva-suggestions[hidden] { display: none; }

.iva-suggestion {
	background: rgba(0, 240, 255, 0.06);
	border: 1px solid rgba(0, 240, 255, 0.2);
	color: var(--iva-cyan);
	padding: 0.4375rem 0.875rem;
	border-radius: 9999px;
	font-family: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s;
}

.iva-suggestion:hover {
	background: rgba(0, 240, 255, 0.15);
	border-color: rgba(0, 240, 255, 0.4);
	color: #ffffff;
	transform: translateY(-1px);
}

/* ========== INPUT ========== */

.iva-input-form {
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	padding: 0.875rem 1.25rem 1rem;
	background: rgba(13, 13, 13, 0.6);
}

.iva-input-wrap {
	display: flex;
	align-items: flex-end;
	gap: 0.5rem;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 14px;
	padding: 0.5rem 0.5rem 0.5rem 0.875rem;
	transition: border-color 0.2s;
}

.iva-input-wrap:focus-within {
	border-color: rgba(0, 240, 255, 0.5);
	box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}

.iva-input {
	flex: 1;
	background: transparent;
	border: none;
	color: #ffffff;
	font-family: inherit;
	font-size: 0.9375rem;
	line-height: 1.45;
	resize: none;
	outline: none;
	max-height: 120px;
	min-height: 24px;
	padding: 0.25rem 0;
}

.iva-input::placeholder {
	color: var(--iva-muted);
}

.iva-send-btn {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--iva-cyan) 0%, var(--iva-cyan-deep) 100%);
	color: #000;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
}

.iva-send-btn:hover:not(:disabled) {
	box-shadow: 0 0 16px rgba(0, 240, 255, 0.5);
	transform: translateY(-1px);
}

.iva-send-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.iva-disclaimer {
	margin: 0.625rem 0 0;
	font-size: 0.6875rem;
	color: var(--iva-muted);
	text-align: center;
	line-height: 1.4;
}

.iva-disclaimer a {
	color: var(--iva-cyan);
	text-decoration: none;
}

.iva-disclaimer a:hover {
	text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
	#iva-chatbot *,
	#iva-chatbot *::before,
	#iva-chatbot *::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}
