/* ========================================================================
   LOADING ANIMATIONS
   Modern loading indicators with bouncing dots animation
   ======================================================================== */

/* ========================================
   TYPING INDICATOR - 3 Bouncing Dots
   Positioned as AI message (left-aligned)
   ======================================== */

.typing-indicator {
	display: flex;
	justify-content: flex-start;
	width: 100%;
	margin-top: var(--space-lg, 24px);
	animation: fadeIn 0.3s ease-in-out;
}

.typing-indicator-content {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: var(--space-md, 16px) var(--space-lg, 24px);
	max-width: 80%;
	background: var(--bubble-ai-bg, #F3F4F6);
	color: var(--bubble-ai-text, #1F2937);
	border-radius: 0 var(--radius-xl, 20px) var(--radius-xl, 20px) var(--radius-xl, 20px);
	box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
	border: 1px solid var(--border-light, rgba(0, 0, 0, 0.05));
	transition: all var(--transition-fast, 150ms ease);
}

.typing-indicator-text {
	font-size: 14px;
	color: var(--text-secondary, #6B7280);
	font-weight: 500;
	margin-right: 4px;
	user-select: none;
}

.typing-indicator-dots {
	display: flex;
	gap: 6px;
	align-items: center;
	height: 20px;
}

.typing-indicator-dots span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--accent-primary, #3B82F6);
	display: block;
	animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator-dots span:nth-child(1) {
	animation-delay: 0s;
}

.typing-indicator-dots span:nth-child(2) {
	animation-delay: 0.2s;
}

.typing-indicator-dots span:nth-child(3) {
	animation-delay: 0.4s;
}

/* Bounce Animation - Smooth vertical movement */
@keyframes bounce {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.7;
	}
	30% {
		transform: translateY(-10px);
		opacity: 1;
	}
}

/* Fade In Animation for smooth appearance */
@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ========================================
   FADE OUT ANIMATION - Typing Indicator
   Usato quando l'AI risponde e il typing indicator scompare
   ======================================== */

.typing-indicator.fading-out {
	animation: fadeOutTyping 150ms cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

@keyframes fadeOutTyping {
	from {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
	to {
		opacity: 0;
		transform: translateY(-10px) scale(0.95);
	}
}

/* ========================================
   ALTERNATIVE ANIMATIONS (for future use)
   ======================================== */

/* Scale Animation - Dots grow and shrink */
@keyframes scale {
	0%, 60%, 100% {
		transform: scale(0.8);
		opacity: 0.5;
	}
	30% {
		transform: scale(1.2);
		opacity: 1;
	}
}

/* Pulse Animation - Subtle pulsing effect */
@keyframes pulse {
	0%, 100% {
		transform: scale(1);
		opacity: 0.6;
	}
	50% {
		transform: scale(1.4);
		opacity: 1;
	}
}

/* Wave Animation - Sequential wave motion */
@keyframes wave {
	0%, 60%, 100% {
		transform: translateY(0) scale(1);
	}
	30% {
		transform: translateY(-12px) scale(1.1);
	}
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Mobile - Smaller indicator */
@media (max-width: 576px) {
	.typing-indicator-content {
		padding: 12px 16px;
		gap: 10px;
	}

	.typing-indicator-text {
		font-size: 13px;
	}

	.typing-indicator-dots span {
		width: 7px;
		height: 7px;
	}

	@keyframes bounce {
		0%, 60%, 100% {
			transform: translateY(0);
			opacity: 0.7;
		}
		30% {
			transform: translateY(-8px);
			opacity: 1;
		}
	}
}

/* ========================================
   THEME COMPATIBILITY
   ======================================== */

/* Dark theme adjustments */
[data-theme="dark"] .typing-indicator {
	background: rgba(255, 255, 255, 0.05);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* High contrast mode */
@media (prefers-contrast: high) {
	.typing-indicator-dots span {
		opacity: 1 !important;
	}
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	.typing-indicator {
		animation: none;
	}

	.typing-indicator-dots span {
		animation: none;
		opacity: 1;
	}

	/* Static dots with no animation */
	.typing-indicator-dots span:nth-child(2) {
		opacity: 0.7;
	}

	.typing-indicator-dots span:nth-child(3) {
		opacity: 0.5;
	}
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Alternative color variations */
.typing-indicator.typing-indicator-success .typing-indicator-dots span {
	background: var(--color-success, #10B981);
}

.typing-indicator.typing-indicator-warning .typing-indicator-dots span {
	background: var(--color-warning, #F59E0B);
}

.typing-indicator.typing-indicator-error .typing-indicator-dots span {
	background: var(--color-error, #EF4444);
}

/* Small size variant */
.typing-indicator.typing-indicator-sm {
	padding: 10px 14px;
	margin: 12px 0;
}

.typing-indicator.typing-indicator-sm .typing-indicator-text {
	font-size: 12px;
}

.typing-indicator.typing-indicator-sm .typing-indicator-dots span {
	width: 6px;
	height: 6px;
}

/* Large size variant */
.typing-indicator.typing-indicator-lg {
	padding: 20px 24px;
	margin: 24px 0;
}

.typing-indicator.typing-indicator-lg .typing-indicator-text {
	font-size: 16px;
}

.typing-indicator.typing-indicator-lg .typing-indicator-dots span {
	width: 10px;
	height: 10px;
}
