/**
 * OctoRagChat - Produktberater Widget Styles
 *
 * Eigenstaendiges CSS fuer das Inline-Produktberater-Widget.
 * Alle Selektoren unter .ragchat-advisor-widget gekapselt.
 */

/* =========================================================================
   CSS-Variablen
   ========================================================================= */

.ragchat-advisor-widget {
	--ragchat-advisor-primary: #006899;
	--ragchat-advisor-primary-hover: #005577;
	--ragchat-advisor-msg-bot: #f3f4f6;
	--ragchat-advisor-msg-user: var(--ragchat-advisor-primary);
	--ragchat-advisor-msg-user-text: #ffffff;
	--ragchat-advisor-msg-bot-text: #1f2937;
	--ragchat-advisor-bg: #ffffff;
	--ragchat-advisor-border: #e5e7eb;
	--ragchat-advisor-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--ragchat-advisor-radius: 12px;
	--ragchat-advisor-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* =========================================================================
   Reset / Basis
   ========================================================================= */

.ragchat-advisor-widget,
.ragchat-advisor-widget *,
.ragchat-advisor-widget *::before,
.ragchat-advisor-widget *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

.ragchat-advisor-widget {
	font-family: var(--ragchat-advisor-font);
	font-size: 14px;
	line-height: 1.5;
	color: var(--ragchat-advisor-msg-bot-text);
	background: var(--ragchat-advisor-bg);
	border: 1px solid var(--ragchat-advisor-border);
	border-radius: var(--ragchat-advisor-radius);
	box-shadow: var(--ragchat-advisor-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	height: 500px;
	width: 100%;
}

/* =========================================================================
   Header
   ========================================================================= */

.ragchat-advisor-header {
	background: var(--ragchat-advisor-primary);
	color: #ffffff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.ragchat-advisor-avatar {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid rgba(255, 255, 255, 0.6);
	flex-shrink: 0;
	margin-right: 10px;
}

.ragchat-advisor-title {
	font-size: 20px;
	font-weight: 700;
}

/* =========================================================================
   Nachrichten-Bereich
   ========================================================================= */

.ragchat-advisor-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ragchat-advisor-messages::-webkit-scrollbar {
	width: 6px;
}

.ragchat-advisor-messages::-webkit-scrollbar-track {
	background: transparent;
}

.ragchat-advisor-messages::-webkit-scrollbar-thumb {
	background: #d1d5db;
	border-radius: 3px;
}

/* =========================================================================
   Nachrichten-Bubbles
   ========================================================================= */

.ragchat-advisor-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 16px;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.ragchat-advisor-msg-bot {
	background: var(--ragchat-advisor-msg-bot);
	color: var(--ragchat-advisor-msg-bot-text);
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}

.ragchat-advisor-msg-user {
	background: var(--ragchat-advisor-msg-user);
	color: var(--ragchat-advisor-msg-user-text);
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}

.ragchat-advisor-msg-system {
	text-align: center;
	color: #9ca3af;
	font-size: 12px;
	align-self: center;
	max-width: 100%;
	padding: 4px 8px;
}

/* Markdown innerhalb Bot-Nachrichten */
.ragchat-advisor-msg-bot p {
	margin: 0 0 8px 0;
}

.ragchat-advisor-msg-bot p:last-child {
	margin-bottom: 0;
}

.ragchat-advisor-msg-bot ul,
.ragchat-advisor-msg-bot ol {
	margin: 4px 0 8px 0;
	padding-left: 20px;
}

.ragchat-advisor-msg-bot li {
	margin-bottom: 2px;
}

.ragchat-advisor-msg-bot code {
	background: rgba(0, 0, 0, 0.06);
	padding: 1px 4px;
	border-radius: 3px;
	font-size: 13px;
	font-family: "SF Mono", "Fira Code", Consolas, monospace;
}

.ragchat-advisor-msg-bot pre {
	background: #1f2937;
	color: #e5e7eb;
	padding: 10px 12px;
	border-radius: 8px;
	overflow-x: auto;
	margin: 6px 0;
	font-size: 13px;
}

.ragchat-advisor-msg-bot pre code {
	background: none;
	padding: 0;
	color: inherit;
}

.ragchat-advisor-msg-bot a {
	color: var(--ragchat-advisor-primary);
	text-decoration: underline;
}

.ragchat-advisor-msg-bot strong {
	font-weight: 600;
}

.ragchat-advisor-msg-bot em {
	font-style: italic;
}

/* =========================================================================
   Typing-Indicator
   ========================================================================= */

.ragchat-advisor-typing {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 10px 14px;
	background: var(--ragchat-advisor-msg-bot);
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	align-self: flex-start;
	max-width: 85%;
}

.ragchat-advisor-typing-dot {
	width: 8px;
	height: 8px;
	background: #9ca3af;
	border-radius: 50%;
	animation: ragchat-advisor-bounce 1.4s infinite ease-in-out both;
}

.ragchat-advisor-typing-dot:nth-child(1) {
	animation-delay: 0s;
}

.ragchat-advisor-typing-dot:nth-child(2) {
	animation-delay: 0.16s;
}

.ragchat-advisor-typing-dot:nth-child(3) {
	animation-delay: 0.32s;
}

@keyframes ragchat-advisor-bounce {
	0%, 80%, 100% {
		transform: scale(0.6);
		opacity: 0.4;
	}
	40% {
		transform: scale(1);
		opacity: 1;
	}
}

/* =========================================================================
   Feedback-Buttons
   ========================================================================= */

.ragchat-advisor-feedback {
	display: flex;
	gap: 4px;
	margin-top: 4px;
	align-self: flex-start;
}

.ragchat-advisor-feedback-btn {
	background: none;
	border: 1px solid var(--ragchat-advisor-border);
	border-radius: 6px;
	padding: 3px 6px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, border-color 0.2s;
	color: #9ca3af;
}

.ragchat-advisor-feedback-btn:hover {
	background: #f3f4f6;
	border-color: #d1d5db;
	color: #6b7280;
}

.ragchat-advisor-feedback-btn.ragchat-advisor-feedback-sent {
	border-color: var(--ragchat-advisor-primary);
	color: var(--ragchat-advisor-primary);
	pointer-events: none;
}

.ragchat-advisor-feedback-btn svg {
	width: 14px;
	height: 14px;
	fill: currentColor;
}

/* =========================================================================
   Quellen-Anzeige
   ========================================================================= */

.ragchat-advisor-sources {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
	padding: 4px 0;
	font-size: 12px;
	line-height: 1.4;
}

.ragchat-advisor-sources-label {
	color: #6b7280;
	font-weight: 500;
}

.ragchat-advisor-source-link {
	color: var(--ragchat-advisor-primary);
	text-decoration: none;
}

.ragchat-advisor-source-link:hover {
	text-decoration: underline;
}

/* =========================================================================
   Input-Bereich
   ========================================================================= */

.ragchat-advisor-input-area {
	padding: 12px 16px;
	border-top: 1px solid var(--ragchat-advisor-border);
	display: flex;
	align-items: flex-end;
	gap: 8px;
	flex-shrink: 0;
}

.ragchat-advisor-input {
	flex: 1;
	border: 1px solid var(--ragchat-advisor-border);
	border-radius: 8px;
	padding: 8px 12px;
	font-family: var(--ragchat-advisor-font);
	font-size: 14px;
	line-height: 1.4;
	resize: none;
	outline: none;
	max-height: 96px;
	min-height: 36px;
	overflow-y: auto;
	transition: border-color 0.2s;
}

.ragchat-advisor-input:focus {
	border-color: var(--ragchat-advisor-primary);
}

.ragchat-advisor-input::placeholder {
	color: #9ca3af;
}

.ragchat-advisor-send-btn {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: var(--ragchat-advisor-primary);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.2s;
}

.ragchat-advisor-send-btn:hover {
	background: var(--ragchat-advisor-primary-hover);
}

.ragchat-advisor-send-btn:disabled {
	background: #d1d5db;
	cursor: not-allowed;
}

.ragchat-advisor-send-btn svg {
	width: 18px;
	height: 18px;
	fill: #ffffff;
}

/* =========================================================================
   Footer / Disclaimer
   ========================================================================= */

.ragchat-advisor-footer {
	text-align: center;
	padding: 6px 16px 8px;
	font-size: 11px;
	color: #9ca3af;
	flex-shrink: 0;
}

.ragchat-advisor-privacy-link {
	color: #9ca3af;
	text-decoration: underline;
	transition: color 0.2s;
}

.ragchat-advisor-privacy-link:hover {
	color: var(--ragchat-advisor-primary);
}

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

@media (max-width: 640px) {
	.ragchat-advisor-widget {
		height: 400px;
	}
}

/* =========================================================================
   Print: Ausblenden
   ========================================================================= */

@media print {
	.ragchat-advisor-widget {
		display: none !important;
	}
}
