/*------------------
Frontend related CSS
------------------*/

/* Chat Window Component */
.wp-rag-chat {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 400px;
	height: 500px;
	border: 1px solid #ccc;
	border-radius: 8px;
	background-color: #fff;
	display: flex;
	flex-direction: column;
	z-index: 999999;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.wp-rag-chat * {
	font-size: inherit;
}

/* Chat Header */
.wp-rag-chat__header {
	padding: 10px;
	background-color: #2271b1;
	color: #fff;
	border-top-left-radius: 7px;
	border-top-right-radius: 7px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.wp-rag-chat__title {
	font-weight: bold;
}

.wp-rag-chat__minimize {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wp-rag-chat__minimize:hover {
	opacity: 0.8;
}

.wp-rag-chat__minimize .dashicons {
	width: 20px;
	height: 20px;
	font-size: 20px;
}

/* Chat Content Area */
.wp-rag-chat__content {
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Messages Container */
.wp-rag-chat__messages {
	flex-grow: 1;
	overflow-y: auto;
	padding: 10px;
}

/* Message Components */
.wp-rag-message {
	margin-bottom: 15px;
	animation: fadeIn 0.3s ease-in;
}

.wp-rag-message--user {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	margin-left: 20%;
}

.wp-rag-message__author {
	font-size: var(--wp--preset--font-size--small);
	color: #666;
	margin-bottom: 4px;
	padding-right: 8px;
}

.wp-rag-message__text--user {
	background-color: #2271b1;
	color: #fff;
	padding: 10px 14px;
	border-radius: 18px;
	border-bottom-right-radius: 4px;
	max-width: 100%;
	word-wrap: break-word;
	position: relative;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wp-rag-message--bot {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	margin-right: 20%;
}

.wp-rag-message__author--bot {
	font-size: var(--wp--preset--font-size--small);
	color: #666;
	margin-bottom: 4px;
	padding-left: 8px;
}

.wp-rag-message__text--bot {
	background-color: #f1f1f1;
	color: #333;
	padding: 10px 14px;
	border-radius: 18px;
	border-bottom-left-radius: 4px;
	max-width: 100%;
	word-wrap: break-word;
	position: relative;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	border: 1px solid #e0e0e0;
}

/* Related Information Component */
.wp-rag-related {
	margin-top: 12px;
	padding: 12px;
	background-color: #f8f9fa;
	border-radius: 8px;
	border-left: 3px solid #2271b1;
}

.wp-rag-related__title {
	display: flex;
	align-items: center;
	margin-bottom: 8px;
	font-weight: 600;
	color: #2271b1;
}

.wp-rag-related__icon {
	margin-right: 6px;
}

.wp-rag-related__text {
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.wp-rag-related__links {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.wp-rag-related__link {
	display: flex;
	align-items: center;
	padding: 6px 8px;
	background-color: #ffffff;
	border-radius: 4px;
	text-decoration: none;
	color: #495057;
	transition: all 0.2s ease;
	border: 1px solid #e9ecef;
	position: relative;
	overflow: hidden;
}

.wp-rag-related__link:hover {
	background-color: #e3f2fd;
	border-color: #2271b1;
	color: #2271b1;
	transform: translateX(2px);
}

.wp-rag-related__link:hover::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 3px;
	background-color: #2271b1;
}

.wp-rag-related__link-icon {
	margin-right: 8px;
	opacity: 0.7;
	transition: opacity 0.2s ease;
}

.wp-rag-related__link:hover .wp-rag-related__link-icon {
	opacity: 1;
}

.wp-rag-related__link-text {
	flex: 1;
	line-height: 1.4;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Chat Form */
.wp-rag-chat__form {
	display: flex;
	padding: 10px;
}

.wp-rag-chat__input {
	flex-grow: 1;
	margin-right: 10px;
	padding: 0 calc(.667em + 2px);
}

.wp-rag-chat__submit {
	position: relative;
	padding-right: 30px;
}

.wp-rag-chat__spinner {
	display: none;
	position: absolute;
	right: 18px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	border: 2px solid #ffffff;
	border-radius: 50%;
	border-top-color: transparent;
	animation: wp-rag-chat-spin 1s linear infinite;
}

@keyframes wp-rag-chat-spin {
	100% {
		transform: translateY(-50%) rotate(360deg);
	}
}

.wp-rag-chat__submit--loading .wp-rag-chat__spinner {
	display: block;
}

.wp-rag-chat__submit--loading .wp-rag-chat__submit-text {
	opacity: 0.7;
}

.wp-rag-chat__submit {
	background-color: #2271b1;
	border: none;
	color: #ffffff;
	padding: 8px 15px;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.2s;
}

.wp-rag-chat-submit:hover {
	background-color: #135e96;
}

.wp-rag-chat-submit:disabled {
	background-color: #2271b1;
	cursor: not-allowed;
	opacity: 0.8;
}

@media screen and (max-width: 480px) {
	.wp-rag-chat__submit {
		padding-right: 24px;
	}

	.wp-rag-chat__spinner {
		right: 6px;
		width: 14px;
		height: 14px;
	}
}

/* Chat Launcher */
.wp-rag-chat-launcher {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 50px;
	height: 50px;
	background-color: #2271b1;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 999999;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	transition: transform 0.3s ease;
}

.wp-rag-chat-launcher:hover {
	transform: scale(1.1);
}

.wp-rag-chat-launcher .dashicons {
	color: #fff;
	font-size: 24px;
	width: 24px;
	height: 24px;
}

.wp-rag-chat-launcher__tooltip {
	position: absolute;
	background-color: #333;
	color: #fff;
	padding: 5px 10px;
	border-radius: 4px;
	right: 60px;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wp-rag-chat-launcher:hover .wp-rag-chat-launcher__tooltip {
	opacity: 1;
	visibility: visible;
}

/* Utility Classes */
.wp-rag--hidden {
	display: none !important;
}