/* Companion Chat – Messenger-Oberfläche
   Farben und Maße über Variablen, damit das Theme sie überschreiben kann. */

.cmp-app {
	--cmp-accent: #c4436e;
	--cmp-accent-dark: #a5335a;
	--cmp-accent-soft: #fde2ea;
	--cmp-text: #1f1b1d;
	--cmp-muted: #7a7075;
	--cmp-border: #e6dfe1;
	--cmp-sidebar-bg: #ffffff;
	--cmp-header-bg: #f7f2f4;
	--cmp-chat-bg: #f2ebe6;
	--cmp-bubble-in: #ffffff;
	--cmp-bubble-out: #fde2ea;
	--cmp-composer-bg: #f7f2f4;
	--cmp-radius: 10px;
	--cmp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--cmp-sidebar-width: 360px;

	font-family: var(--cmp-font);
	font-size: 15px;
	line-height: 1.4;
	color: var(--cmp-text);
	background: var(--cmp-sidebar-bg);
	display: flex;
	height: 100%;
	min-height: 480px;
	overflow: hidden;
	position: relative;
	-webkit-font-smoothing: antialiased;
}
.cmp-app *, .cmp-app *::before, .cmp-app *::after { box-sizing: border-box; }
.cmp-app button { font: inherit; color: inherit; }
.cmp-app a { color: var(--cmp-accent); }

/* Vollbild-Template */
body.cmp-fullscreen { margin: 0; height: 100dvh; overflow: hidden; background: var(--cmp-chat-bg, #f2ebe6); }
body.cmp-fullscreen .cmp-app { height: 100dvh; }

/* Einbettung per Shortcode */
.cmp-embed { height: min(80vh, 820px); border: 1px solid #e6dfe1; border-radius: 12px; overflow: hidden; }

.cmp-boot, .cmp-notice-full {
	margin: auto;
	padding: 24px;
	color: var(--cmp-muted);
	text-align: center;
	max-width: 380px;
}
.cmp-notice-full h2 { margin: 0 0 8px; color: var(--cmp-text); font-size: 20px; }
.cmp-notice-full .cmp-btn { margin-top: 14px; }
.cmp-notice-alt { margin-top: 16px; font-size: 14px; }

/* ---------- Buttons ---------- */
.cmp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 16px;
	border-radius: 999px;
	border: 0;
	background: var(--cmp-accent);
	color: #fff;
	cursor: pointer;
	text-decoration: none;
	font-weight: 600;
}
.cmp-btn:hover { background: var(--cmp-accent-dark); }
.cmp-btn--ghost { background: transparent; color: var(--cmp-accent); border: 1px solid var(--cmp-border); }
.cmp-btn--ghost:hover { background: var(--cmp-accent-soft); }
.cmp-icon-btn {
	width: 40px; height: 40px;
	border: 0; border-radius: 50%;
	background: transparent;
	color: var(--cmp-muted);
	cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	flex: 0 0 auto;
}
.cmp-icon-btn:hover { background: rgba(0,0,0,.06); color: var(--cmp-text); }
.cmp-icon-btn svg { width: 22px; height: 22px; }
.cmp-app :focus-visible { outline: 2px solid var(--cmp-accent); outline-offset: 2px; }

/* ---------- Sidebar ---------- */
.cmp-sidebar {
	width: var(--cmp-sidebar-width);
	flex: 0 0 var(--cmp-sidebar-width);
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--cmp-border);
	background: var(--cmp-sidebar-bg);
	min-width: 0;
}
.cmp-sidebar-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px 10px 16px;
	background: var(--cmp-header-bg);
	min-height: 60px;
}
.cmp-brand { font-weight: 700; font-size: 17px; flex: 1 1 auto; min-width: 0; }
.cmp-brand small { display: block; font-weight: 400; font-size: 12px; color: var(--cmp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-list { flex: 1 1 auto; overflow-y: auto; }
.cmp-list-empty { padding: 32px 20px; color: var(--cmp-muted); text-align: center; }
.cmp-contact {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 10px 14px;
	border: 0;
	border-bottom: 1px solid var(--cmp-border);
	background: transparent;
	text-align: left;
	cursor: pointer;
}
.cmp-contact:hover, .cmp-contact.is-active { background: var(--cmp-header-bg); }
.cmp-avatar {
	width: 50px; height: 50px;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 auto;
	background: var(--cmp-accent-soft);
}
.cmp-contact-body { flex: 1 1 auto; min-width: 0; }
.cmp-contact-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cmp-contact-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-contact-time { font-size: 12px; color: var(--cmp-muted); flex: 0 0 auto; }
.cmp-contact-snippet { font-size: 13.5px; color: var(--cmp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.cmp-sidebar-foot {
	padding: 8px 12px;
	border-top: 1px solid var(--cmp-border);
	font-size: 12.5px;
	color: var(--cmp-muted);
	display: flex;
	justify-content: space-between;
	gap: 8px;
	align-items: center;
}
.cmp-sidebar-foot a { text-decoration: none; }

/* ---------- Chat ---------- */
.cmp-chat {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--cmp-chat-bg);
	position: relative;
}
.cmp-chat-empty {
	margin: auto;
	text-align: center;
	color: var(--cmp-muted);
	padding: 24px;
	max-width: 360px;
}
.cmp-chat-empty h2 { color: var(--cmp-text); font-weight: 600; font-size: 20px; margin: 0 0 6px; }
.cmp-chat-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px 8px 12px;
	background: var(--cmp-header-bg);
	border-bottom: 1px solid var(--cmp-border);
	min-height: 60px;
}
.cmp-chat-head .cmp-avatar { width: 40px; height: 40px; }
.cmp-chat-head-body { flex: 1 1 auto; min-width: 0; }
.cmp-chat-head-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-chat-head-status { font-size: 12.5px; color: var(--cmp-muted); }
.cmp-chat-head-status.is-typing { color: var(--cmp-accent); }
.cmp-back { display: none; }

.cmp-messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 14px 8% 8px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { .cmp-messages { scroll-behavior: auto; } }

.cmp-day {
	align-self: center;
	font-size: 12px;
	color: var(--cmp-muted);
	background: rgba(255,255,255,.75);
	padding: 4px 10px;
	border-radius: 8px;
	margin: 8px 0 6px;
}
.cmp-msg {
	max-width: min(72%, 560px);
	padding: 7px 10px 6px;
	border-radius: var(--cmp-radius);
	background: var(--cmp-bubble-in);
	box-shadow: 0 1px 0 rgba(0,0,0,.06);
	position: relative;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
	animation: cmp-pop .14s ease-out;
}
@media (prefers-reduced-motion: reduce) { .cmp-msg { animation: none; } }
@keyframes cmp-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.cmp-msg--in { align-self: flex-start; border-top-left-radius: 2px; }
.cmp-msg--out { align-self: flex-end; background: var(--cmp-bubble-out); border-top-right-radius: 2px; }
.cmp-msg--system {
	align-self: center;
	background: #fff7e6;
	color: #6b5321;
	font-size: 13.5px;
	max-width: 80%;
	text-align: center;
	white-space: normal;
}
.cmp-msg--system a { color: inherit; font-weight: 600; }
.cmp-msg--gift { align-self: flex-end; background: #fff2cc; }
.cmp-msg-time {
	display: inline-block;
	font-size: 11px;
	color: var(--cmp-muted);
	float: right;
	margin: 6px 0 -2px 10px;
	white-space: nowrap;
}
.cmp-msg.is-streaming .cmp-msg-time { visibility: hidden; }
.cmp-msg-text::after { content: ""; display: inline-block; width: 0; }

.cmp-typing {
	align-self: flex-start;
	background: var(--cmp-bubble-in);
	border-radius: var(--cmp-radius);
	border-top-left-radius: 2px;
	padding: 12px 14px;
	display: inline-flex;
	gap: 4px;
	box-shadow: 0 1px 0 rgba(0,0,0,.06);
}
.cmp-typing i {
	width: 7px; height: 7px;
	border-radius: 50%;
	background: var(--cmp-muted);
	opacity: .4;
	animation: cmp-blink 1.2s infinite;
}
.cmp-typing i:nth-child(2) { animation-delay: .2s; }
.cmp-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes cmp-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.cmp-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 8px 10px;
	background: var(--cmp-composer-bg);
	border-top: 1px solid var(--cmp-border);
}
.cmp-input {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid var(--cmp-border);
	border-radius: 20px;
	padding: 10px 14px;
	font: inherit;
	line-height: 1.35;
	max-height: 140px;
	min-height: 42px;
	background: #fff;
	color: var(--cmp-text);
}
.cmp-input:focus { outline: none; border-color: var(--cmp-accent); }
.cmp-send {
	width: 44px; height: 44px;
	border-radius: 50%;
	border: 0;
	background: var(--cmp-accent);
	color: #fff;
	cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	flex: 0 0 auto;
}
.cmp-send:hover { background: var(--cmp-accent-dark); }
.cmp-send:disabled { opacity: .45; cursor: default; }
.cmp-send svg { width: 22px; height: 22px; margin-left: 2px; }
.cmp-hint {
	font-size: 12px;
	color: var(--cmp-muted);
	padding: 0 14px 6px;
	background: var(--cmp-composer-bg);
	text-align: center;
	min-height: 18px;
}
.cmp-hint a { text-decoration: none; font-weight: 600; }

@media (min-width: 900px) {
	.cmp-hint { display: none; } /* Desktop: Hinweis steht schon in der Seitenleiste */
}

/* ---------- Menü ---------- */
.cmp-menu-wrap { position: relative; }
.cmp-menu {
	position: absolute;
	right: 0; top: 44px;
	background: #fff;
	border: 1px solid var(--cmp-border);
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0,0,0,.12);
	min-width: 200px;
	padding: 6px 0;
	z-index: 20;
	display: none;
}
.cmp-menu.is-open { display: block; }
.cmp-menu button, .cmp-menu a {
	display: block;
	width: 100%;
	padding: 9px 14px;
	border: 0;
	background: transparent;
	text-align: left;
	cursor: pointer;
	color: var(--cmp-text);
	text-decoration: none;
	font: inherit;
}
.cmp-menu button:hover, .cmp-menu a:hover { background: var(--cmp-header-bg); }
.cmp-menu .is-danger { color: #b3261e; }

/* ---------- Sheet (Presets) ---------- */
.cmp-sheet-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 12, 15, .45);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	z-index: 30;
}
.cmp-sheet {
	background: #fff;
	width: 100%;
	max-width: 520px;
	max-height: 90%;
	overflow-y: auto;
	border-radius: 16px 16px 0 0;
	padding: 18px 20px 20px;
}
@media (min-width: 900px) {
	.cmp-sheet-backdrop { align-items: center; }
	.cmp-sheet { border-radius: 16px; }
}
.cmp-sheet h3 { margin: 0 0 4px; font-size: 18px; }
.cmp-sheet p.cmp-sheet-intro { margin: 0 0 16px; color: var(--cmp-muted); font-size: 14px; }
.cmp-field { margin-bottom: 16px; }
.cmp-field label, .cmp-field .cmp-field-label { display: block; font-weight: 600; margin-bottom: 8px; }
.cmp-field input[type="text"] {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--cmp-border);
	border-radius: 8px;
	font: inherit;
}
.cmp-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-pill {
	padding: 7px 14px;
	border-radius: 999px;
	border: 1px solid var(--cmp-border);
	background: #fff;
	cursor: pointer;
}
.cmp-pill.is-selected { background: var(--cmp-accent); border-color: var(--cmp-accent); color: #fff; }
.cmp-sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- Toast ---------- */
.cmp-toast {
	position: absolute;
	left: 50%;
	bottom: 90px;
	transform: translateX(-50%);
	background: #2b2326;
	color: #fff;
	padding: 10px 16px;
	border-radius: 8px;
	font-size: 14px;
	z-index: 40;
	max-width: 90%;
	box-shadow: 0 6px 20px rgba(0,0,0,.2);
}

/* ---------- Mobil ---------- */
@media (max-width: 899px) {
	.cmp-app { --cmp-sidebar-width: 100%; }
	.cmp-sidebar { border-right: 0; }
	.cmp-chat { display: none; }
	.cmp-app.is-chat-open .cmp-sidebar { display: none; }
	.cmp-app.is-chat-open .cmp-chat { display: flex; }
	.cmp-back { display: inline-flex; }
	.cmp-messages { padding-left: 10px; padding-right: 10px; }
	.cmp-msg { max-width: 84%; }
	.cmp-embed { height: 78vh; }
}

/* ---------- Geschenke ---------- */
.cmp-gift-btn { color: var(--cmp-accent); }
.cmp-msg--gift {
	background: #fff4d6;
	display: flex; align-items: center; gap: 10px;
	padding: 8px 12px 8px 10px;
	white-space: normal;
}
.cmp-msg--gift .cmp-msg-text { display: flex; align-items: center; gap: 10px; }
.cmp-msg--gift .cmp-gift-icon { font-size: 30px; line-height: 1; }
.cmp-msg--gift .cmp-gift-icon img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: block; }
.cmp-msg--gift .cmp-gift-name { font-weight: 600; }
.cmp-msg--gift .cmp-gift-credits { font-size: 12px; color: var(--cmp-muted); margin-left: 4px; }
.cmp-msg--gift .cmp-msg-time { float: none; margin: 0 0 0 6px; }

.cmp-gift-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
	gap: 10px;
	margin-bottom: 8px;
}
.cmp-gift {
	display: flex; flex-direction: column; align-items: center; gap: 4px;
	padding: 12px 8px 10px;
	border: 1px solid var(--cmp-border);
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
	text-align: center;
}
.cmp-gift:hover { border-color: var(--cmp-accent); background: var(--cmp-accent-soft); }
.cmp-gift.is-disabled { opacity: .45; cursor: default; }
.cmp-gift .cmp-gift-icon { font-size: 34px; line-height: 1.1; }
.cmp-gift .cmp-gift-icon img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; display: block; }
.cmp-gift .cmp-gift-name { font-size: 13.5px; font-weight: 600; }
.cmp-gift .cmp-gift-credits { font-size: 12px; color: var(--cmp-muted); }
