/**
 * Erdemed AI – scoped Styles.
 * Feste helle Gestaltung (kein OS-Dark-Mode). Palette: Erdemed-Grün + Slate.
 * Alle Selektoren mit .erdemed-ai-* Präfix.
 */

.erdemed-ai-fab {
	position: fixed;
	right: 20px;
	bottom: 20px;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: #25303c;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 8px 22px rgba( 37, 48, 60, .32 );
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2147483000;
	transition: transform .15s ease, background .15s ease;
}

.erdemed-ai-fab:hover {
	transform: translateY( -2px );
	background: #334352;
}

.erdemed-ai-fab.is-open {
	background: #25303c;
}

.erdemed-ai-panel {
	position: fixed;
	right: 20px;
	bottom: 80px;
	width: 384px;
	max-width: calc( 100vw - 32px );
	height: 600px;
	max-height: calc( 100vh - 108px );
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 18px 50px rgba( 37, 48, 60, .26 );
	display: none;
	flex-direction: column;
	overflow: hidden;
	z-index: 2147483000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #25303c;
}

.erdemed-ai-panel.is-open {
	display: flex;
}

/* Eigene schlanke Scrollbar (überall im Widget) */
.erdemed-ai-messages,
.erdemed-ai-input {
	scrollbar-width: thin;
	scrollbar-color: #c9d5e0 transparent;
}

.erdemed-ai-messages::-webkit-scrollbar,
.erdemed-ai-input::-webkit-scrollbar {
	width: 8px;
}

.erdemed-ai-messages::-webkit-scrollbar-track,
.erdemed-ai-input::-webkit-scrollbar-track {
	background: transparent;
}

.erdemed-ai-messages::-webkit-scrollbar-thumb,
.erdemed-ai-input::-webkit-scrollbar-thumb {
	background: #c9d5e0;
	border-radius: 999px;
	border: 2px solid transparent;
	background-clip: content-box;
}

.erdemed-ai-messages::-webkit-scrollbar-thumb:hover,
.erdemed-ai-input::-webkit-scrollbar-thumb:hover {
	background: #25303c;
	border: 2px solid transparent;
	background-clip: content-box;
}

/* Kopf */
.erdemed-ai-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: #ffffff;
	color: #25303c;
	border-bottom: 1px solid #e8edf2;
}

.erdemed-ai-brand {
	display: flex;
	align-items: center;
	gap: 10px;
}

.erdemed-ai-badge {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #25303c;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	overflow: hidden;
}

.erdemed-ai-badge.has-img {
	background: #fff;
}

.erdemed-ai-badge__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

.erdemed-ai-title {
	font-weight: 700;
	font-size: 15px;
	letter-spacing: .2px;
	color: #25303c;
}

.erdemed-ai-actions {
	display: flex;
	align-items: center;
	gap: 4px;
}

.erdemed-ai-iconbtn {
	background: transparent;
	border: 0;
	color: #7c8896;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.erdemed-ai-iconbtn:hover {
	background: #eef3f8;
	color: #25303c;
}

/* Dropdown-Menü */
.erdemed-ai-menu {
	position: absolute;
	top: 58px;
	right: 14px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba( 37, 48, 60, .20 );
	padding: 6px;
	display: none;
	flex-direction: column;
	min-width: 200px;
	z-index: 5;
}

.erdemed-ai-menu.is-open {
	display: flex;
}

.erdemed-ai-menuitem {
	background: transparent;
	border: 0;
	text-align: left;
	padding: 10px 12px;
	border-radius: 8px;
	font: inherit;
	color: #25303c;
	cursor: pointer;
}

.erdemed-ai-menuitem:hover {
	background: #eef3f8;
}

/* Nachrichten */
.erdemed-ai-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #f5f8fb;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.erdemed-ai-msg {
	display: flex;
}

.erdemed-ai-msg--user {
	justify-content: flex-end;
}

.erdemed-ai-bubble {
	max-width: 84%;
	padding: 10px 14px;
	border-radius: 14px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.erdemed-ai-msg--bot .erdemed-ai-bubble {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-bottom-left-radius: 5px;
	color: #25303c;
}

.erdemed-ai-msg--user .erdemed-ai-bubble {
	background: #25303c;
	color: #fff;
	border-bottom-right-radius: 5px;
}

.erdemed-ai-bubble a {
	color: #25303c;
	text-decoration: underline;
}

.erdemed-ai-msg--user .erdemed-ai-bubble a {
	color: #fff;
}

/* Vorschlag-Chips */
.erdemed-ai-suggests {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 2px;
}

.erdemed-ai-suggest {
	background: #fff;
	border: 1px solid #cfd6de;
	color: #25303c;
	border-radius: 999px;
	padding: 8px 14px;
	font: inherit;
	font-size: 13px;
	line-height: 1.3;
	cursor: pointer;
	transition: background .12s ease, border-color .12s ease;
}

.erdemed-ai-suggest:hover {
	background: #eef1f5;
	border-color: #25303c;
}

/* Fundstellen: Kategorie-Überschrift + Listenzeilen */
.erdemed-ai-sources {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-top: 2px;
}

.erdemed-ai-srcgroup {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	overflow: hidden;
}

.erdemed-ai-srcgroup__title {
	font-size: 13.5px;
	font-weight: 600;
	color: #334352;
	padding: 11px 14px 7px;
}

.erdemed-ai-srcrow {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 14px;
	border-top: 1px solid #eef1f5;
	text-decoration: none;
	color: #25303c;
	transition: background .12s ease;
}

.erdemed-ai-srcrow:hover {
	background: #f4f7fb;
}

.erdemed-ai-srcrow__txt {
	font-size: 13.5px;
	line-height: 1.35;
}

.erdemed-ai-srcrow__arw {
	color: #9aa7b4;
	flex: 0 0 auto;
}

/* Letzte Chats */
.erdemed-ai-recent {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.erdemed-ai-recent__item {
	text-align: left;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	padding: 10px 12px;
	cursor: pointer;
	font: inherit;
	color: #25303c;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.erdemed-ai-recent__item:hover {
	background: #f4f7fb;
}

.erdemed-ai-recent__item span {
	font-size: 11px;
	color: #647483;
}

/* Footer */
.erdemed-ai-footer {
	text-align: center;
	font-size: 11px;
	color: #9aa7b4;
	padding: 6px 0 2px;
}

/* Eingabe */
.erdemed-ai-form {
	display: flex;
	align-items: stretch;
	gap: 8px;
	padding: 10px 12px 14px;
	background: #fff;
	border-top: 1px solid #eef1f5;
}

/* Mic oben, Send unten – spart horizontale Breite */
.erdemed-ai-btncol {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 6px;
}

.erdemed-ai-input {
	flex: 1;
	resize: none;
	box-sizing: border-box;
	border: 1px solid #d3dbe4;
	border-radius: 8px;
	padding: 10px 14px;
	font: inherit;
	color: #25303c;
	min-height: 74px;
	max-height: 140px;
	outline: none;
	background: #fff;
}

.erdemed-ai-input:focus {
	border-color: #25303c;
	box-shadow: 0 0 0 3px rgba( 37, 48, 60, .16 );
}

.erdemed-ai-mic {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: #f1f4f8;
	color: #647483;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.erdemed-ai-mic:hover {
	background: #eef3f8;
	color: #25303c;
}

.erdemed-ai-send {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: #25303c;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .12s ease;
}

.erdemed-ai-send:hover {
	background: #334352;
}

.erdemed-ai-send:disabled {
	opacity: .45;
	cursor: default;
}

/* Tippen-Animation */
.erdemed-ai-typing .erdemed-ai-bubble {
	display: inline-flex;
	gap: 4px;
	background: #fff;
	border: 1px solid #e2e8f0;
}

.erdemed-ai-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9aa7b4;
	animation: erdemed-ai-blink 1.2s infinite both;
}

.erdemed-ai-typing span:nth-child( 2 ) { animation-delay: .2s; }
.erdemed-ai-typing span:nth-child( 3 ) { animation-delay: .4s; }

@keyframes erdemed-ai-blink {
	0%, 80%, 100% { opacity: .3; }
	40% { opacity: 1; }
}

@media ( max-width: 480px ) {
	.erdemed-ai-panel {
		right: 8px;
		bottom: 8px;
		width: calc( 100vw - 16px );
		height: calc( 100vh - 16px );
		max-height: calc( 100vh - 16px );
	}
}
