/**
 * Pulse AI Summary Styles
 *
 * Styling for AI summary container, loading states, and typing animation
 *
 * @package Brandwatch
 * @subpackage Pulse/CSS
 * @since 2025-10-15
 */

/* ===================================================================
   AI Summary Container
   =================================================================== */

.ai-summary-container {
	padding: 0;
	margin: 0;
	background: transparent;
	box-shadow: none;
}

/* Dark mode text color */
.dark-theme .ai-summary-container,
.ai-summary-container[data-theme="dark"] {
	background: transparent;
	color: var(--color-text-white, #ffffff);
}

/* ===================================================================
   Loading State
   =================================================================== */

.ai-summary-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	gap: 1.5rem;
}

.ai-summary-loading .spinner {
	width: 48px;
	height: 48px;
	border: 4px solid rgba(0, 0, 0, 0.1);
	border-left-color: var(--color-primary, #6b4ce6);
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

.ai-summary-loading .loading-text {
	font-size: 1rem;
	color: var(--color-text-grey-7, #666666);
	margin: 0;
}

/* ===================================================================
   AI Summary Content
   =================================================================== */

.ai-summary {
	display: none; /* Hidden by default, shown by JavaScript */
}

.ai-summary-content {
	font-size: 1rem;
	line-height: 1.6;
	color: var(--color-text-grey-9, #333333);
}

/* Dark mode - white text */
.dark-theme .ai-summary-content {
	color: var(--color-text-white, #ffffff);
}

.ai-summary-content p {
	margin-bottom: 1rem;
}

.ai-summary-content p:last-child {
	margin-bottom: 0;
}

/* ===================================================================
   Typing Animation
   =================================================================== */

.ai-summary-content .word {
	display: inline-block;
	/* margin-right: 0.25em; */
}

.ai-summary-content .letter {
	opacity: 0;
	display: inline-block;
	transition: opacity 0.05s ease-in;
}

.ai-summary-content .letter.revealed {
	opacity: 1;
}

/* Bold text styling */
.ai-summary-content .bold-text,
.ai-summary-content span.bold-text {
	font-weight: 700;
	color: var(--color-primary, #6b4ce6);
}

/* Ensure letters inside bold-text inherit the color */
.ai-summary-content .bold-text .letter,
.ai-summary-content span.bold-text .letter {
	color: inherit;
	font-weight: inherit;
}

/* ===================================================================
   Error State
   =================================================================== */

.ai-summary-error {
	text-align: center;
	padding: 2rem;
}

.ai-summary-error .error-icon {
	font-size: 3rem;
	margin-bottom: 1rem;
}

.ai-summary-error .error-message {
	font-size: 1rem;
	color: var(--color-text-grey-7, #666666);
	margin-bottom: 1.5rem;
}

.ai-summary-error .retry-button {
	padding: 0.75rem 1.5rem;
	background: var(--color-primary, #6b4ce6);
	color: white;
	border: none;
	border-radius: 4px;
	font-size: 1rem;
	cursor: pointer;
	transition: background 0.2s ease;
}

.ai-summary-error .retry-button:hover {
	background: var(--color-primary-dark, #5a3dc5);
}

/* ===================================================================
   Lazy-loaded Content (appears after animation)
   =================================================================== */

.lazy-after-ai-summary {
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.5s ease, transform 0.5s ease;
}

.lazy-after-ai-summary.visible {
	opacity: 1;
	transform: translateY(0);
}

/* ===================================================================
   Responsive Design
   =================================================================== */

@media (max-width: 768px) {
	.ai-summary-container {
		padding: 1.5rem;
		margin: 1.5rem 0;
	}

	.ai-summary-content {
		font-size: 1rem;
	}

	.ai-summary-loading {
		min-height: 150px;
	}

	.ai-summary-loading .spinner {
		width: 40px;
		height: 40px;
	}
}

@media (max-width: 480px) {
	.ai-summary-container {
		padding: 1rem;
		margin: 1rem 0;
	}

	.ai-summary-content {
		font-size: 0.938rem;
	}

	.ai-summary-error .error-icon {
		font-size: 2.5rem;
	}
}

/* ===================================================================
   Dark Theme Overrides
   =================================================================== */

[data-theme="dark"] .ai-summary-loading .spinner {
	border-color: rgba(255, 255, 255, 0.1);
	border-left-color: var(--color-primary-light, #8b6cf6);
}

[data-theme="dark"] .ai-summary-loading .loading-text {
	color: var(--color-text-grey-3, #cccccc);
}

[data-theme="dark"] .ai-summary-content {
	color: var(--color-text-grey-2, #e6e6e6);
}

[data-theme="dark"] .ai-summary-content .bold-text {
	color: var(--color-primary-light, #8b6cf6);
}

[data-theme="dark"] .ai-summary-content .bold-text .letter {
	color: inherit;
	font-weight: inherit;
}

[data-theme="dark"] .ai-summary-error .error-message {
	color: var(--color-text-grey-3, #cccccc);
}

/* ===================================================================
   Print Styles
   =================================================================== */

@media print {
	.ai-summary-loading {
		display: none !important;
	}

	.ai-summary {
		display: block !important;
	}

	.ai-summary-content .letter {
		opacity: 1 !important;
	}

	.ai-summary-error .retry-button {
		display: none;
	}
}


.powered-by {
  flex-wrap: wrap;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  margin-top: -20px;
}

.powered-by span {
  top: 4px;
}

.powered-by svg#iris-logo-clean {
  width: 45px;
  height: auto;
}
