/* KI-Sommelier: Knopf am Rand, Chatfenster, Weinkarten. Farben aus --ws-accent (Weingut → Einstellungen). */

.ws-somm {
	--somm-akzent: var(--ws-accent, #8c7a4b);
	--somm-akzent-text: var(--ws-accent-fg, #fff);
	--somm-grund: #fff;
	--somm-text: #1d1d1b;
	--somm-leise: #6b6b66;
	--somm-linie: rgba(0, 0, 0, .1);
	--somm-flaeche: #f5f4f0;
	--somm-radius: 14px;
	font-size: 15px;
	line-height: 1.45;
	color: var(--somm-text);
	box-sizing: border-box;
}
.ws-somm *,
.ws-somm *::before,
.ws-somm *::after {
	box-sizing: inherit;
}
.ws-somm svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
	flex: none;
}

/* Knopf am Rand */
.ws-somm--rand {
	position: fixed;
	bottom: 20px;
	z-index: 99990;
}
.ws-somm--rand:not(.is-offen) {
	bottom: var(--somm-unten, 20px);
}
.ws-somm--rechts { right: 20px; }
.ws-somm--links { left: 20px; }

.ws-somm-knopf {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 12px 18px 12px 14px;
	border: 0;
	border-radius: 999px;
	background: var(--somm-akzent);
	color: var(--somm-akzent-text);
	font: inherit;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
	transition: transform .15s ease, box-shadow .15s ease;
}
.ws-somm-knopf:hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}
.ws-somm-knopf:focus-visible,
.ws-somm button:focus-visible,
.ws-somm a:focus-visible {
	outline: 2px solid var(--somm-akzent);
	outline-offset: 2px;
}
.ws-somm-foto {
	flex: none;
	display: block;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border-radius: 50%;
	object-fit: cover;
	box-shadow: none;
}
.ws-somm-knopf--foto {
	padding: 6px 18px 6px 6px;
}
.ws-somm-knopf .ws-somm-foto {
	width: 32px;
	height: 32px;
	border: 2px solid var(--somm-akzent-text);
}
.ws-somm--rand.is-offen .ws-somm-knopf {
	display: none;
}

/* Fenster */
.ws-somm-panel {
	display: flex;
	flex-direction: column;
	background: var(--somm-grund);
	border: 1px solid var(--somm-linie);
	border-radius: var(--somm-radius);
	overflow: hidden;
}
.ws-somm-panel[hidden] {
	display: none;
}
.ws-somm--rand .ws-somm-panel {
	width: min(400px, calc(100vw - 40px));
	height: min(640px, calc(100vh - 40px));
	height: min(640px, calc(100dvh - 40px));
	box-shadow: 0 18px 48px rgba(0, 0, 0, .2);
}
.ws-somm--eingebettet .ws-somm-panel {
	height: 600px;
	max-width: 720px;
	margin: 0 auto;
}

.ws-somm-kopf {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 12px 12px 18px;
	border-bottom: 1px solid var(--somm-linie);
}
.ws-somm-titelblock {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}
.ws-somm-person {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.3;
	color: var(--somm-leise);
}
.ws-somm-titel {
	flex: 1;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-weight: 600;
	font-size: 16px;
}
.ws-somm-ki {
	display: inline-block;
	margin-left: 4px;
	padding: 1px 6px;
	border: 1px solid currentColor;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 600;
	color: var(--somm-leise);
	vertical-align: 2px;
}
.ws-somm-neu,
.ws-somm-zu {
	margin: 0;
	padding: 6px 10px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--somm-leise);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}
.ws-somm-zu {
	padding: 6px;
	display: inline-flex;
}
.ws-somm-neu:hover,
.ws-somm-zu:hover {
	background: var(--somm-flaeche);
	color: var(--somm-text);
}

/* Verlauf */
.ws-somm-verlauf {
	position: relative;
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px 16px 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scroll-behavior: smooth;
}
.ws-somm-blase {
	max-width: 88%;
	padding: 10px 14px;
	border-radius: 16px;
}
.ws-somm-blase p {
	margin: 0;
	padding: 0;
}
.ws-somm-blase p + p {
	margin-top: 8px;
}
.ws-somm-blase--sommelier {
	align-self: flex-start;
	background: var(--somm-flaeche);
	border-bottom-left-radius: 4px;
}
.ws-somm-blase--kunde {
	align-self: flex-end;
	background: var(--somm-akzent);
	color: var(--somm-akzent-text);
	border-bottom-right-radius: 4px;
}

.ws-somm-tippt {
	display: inline-flex;
	gap: 4px;
	padding: 14px 16px;
}
.ws-somm-tippt span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--somm-leise);
	animation: ws-somm-punkt 1.2s infinite ease-in-out;
}
.ws-somm-tippt span:nth-child(2) { animation-delay: .15s; }
.ws-somm-tippt span:nth-child(3) { animation-delay: .3s; }
@keyframes ws-somm-punkt {
	0%, 80%, 100% { opacity: .25; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

/* Weinkarten */
.ws-somm-weine {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.ws-somm-wein {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin: 0;
	padding: 10px 10px 10px 8px;
	border: 1px solid var(--somm-linie);
	border-radius: 12px;
	background: var(--somm-grund);
}
.ws-somm-wein-bild {
	flex: none;
	width: 52px;
	height: 84px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.ws-somm-wein-bild img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 0;
	box-shadow: none;
}
.ws-somm-wein-text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.ws-somm-wein-name {
	font-weight: 600;
	color: var(--somm-text);
	text-decoration: none;
}
.ws-somm-wein-name:hover {
	text-decoration: underline;
}
.ws-somm-wein-fakten,
.ws-somm-wein-recht {
	font-size: 12px;
	color: var(--somm-leise);
}
.ws-somm-wein-recht {
	display: block;
}
.ws-somm-wein-recht > span + span::before {
	content: " · ";
}
.ws-somm-wein-recht a {
	color: inherit;
}
.ws-somm-wein-grund {
	font-size: 13px;
}
.ws-somm-wein-preis {
	margin-top: 4px;
	font-weight: 600;
}
.ws-somm-wein-preis del {
	font-weight: 400;
	color: var(--somm-leise);
	margin-right: 4px;
}
.ws-somm-wein-preis ins {
	text-decoration: none;
}
.ws-somm-wein-korb {
	flex: none;
	align-self: center;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--somm-akzent);
	border-radius: 50%;
	background: var(--somm-grund);
	color: var(--somm-akzent);
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}
.ws-somm-wein-korb:hover,
.ws-somm-wein-korb.is-drin {
	background: var(--somm-akzent);
	color: var(--somm-akzent-text);
}
.ws-somm-wein-korb.is-laedt {
	opacity: .5;
	cursor: progress;
}

/* Vorschläge */
.ws-somm-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 2px;
}
.ws-somm-chip {
	margin: 0;
	padding: 7px 12px;
	border: 1px solid var(--somm-linie);
	border-radius: 999px;
	background: var(--somm-grund);
	color: var(--somm-text);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}
.ws-somm-chip:hover {
	border-color: var(--somm-akzent);
	color: var(--somm-akzent);
}

/* Eingabe */
.ws-somm-eingabe {
	display: flex;
	gap: 8px;
	margin: 0;
	padding: 10px 12px 6px;
	border-top: 1px solid var(--somm-linie);
}
/* Höhere Spezifität: Themes (z. B. Divi) setzen input[type="text"] sonst auf 2px Innenabstand. */
.ws-somm .ws-somm-eingabe input[type="text"] {
	flex: 1;
	min-width: 0;
	margin: 0;
	padding: 11px 14px;
	border: 1px solid var(--somm-linie);
	border-radius: 999px;
	background: var(--somm-grund);
	color: var(--somm-text);
	font: inherit;
	font-size: 16px; /* kein Zoom auf dem iPhone */
	line-height: 1.3;
	height: auto;
	box-shadow: none;
}
.ws-somm .ws-somm-eingabe input[type="text"]:focus {
	outline: none;
	border-color: var(--somm-akzent);
	box-shadow: 0 0 0 1px var(--somm-akzent);
}
.ws-somm-eingabe button {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--somm-akzent);
	color: var(--somm-akzent-text);
	cursor: pointer;
}
.ws-somm-eingabe[aria-busy="true"] button {
	opacity: .5;
	cursor: progress;
}
/* Höhere Spezifität: Themes setzen p { padding } zurück (Divi, Landing-Vorlagen). Links bündig mit dem Text im Fragefeld. */
.ws-somm .ws-somm-panel .ws-somm-hinweis {
	margin: 0;
	padding: 4px 26px 12px;
	font-size: 11px;
	line-height: 1.4;
	color: var(--somm-leise);
}
.ws-somm-hinweis a {
	color: inherit;
}

.ws-somm .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* Handy: Fenster über die ganze Breite, Knopf etwas kleiner */
@media (max-width: 599px) {
	/* Auf dem Handy nur ein runder Knopf (Foto oder Glas), damit nichts am unteren Rand überdeckt wird. */
	.ws-somm .ws-somm-knopf {
		width: 56px;
		height: 56px;
		padding: 0;
		justify-content: center;
		gap: 0;
	}
	.ws-somm .ws-somm-knopf > span {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(1px, 1px, 1px, 1px);
		white-space: nowrap;
	}
	.ws-somm .ws-somm-knopf svg {
		width: 24px;
		height: 24px;
	}
	.ws-somm .ws-somm-knopf .ws-somm-foto {
		width: 50px;
		height: 50px;
	}
	.ws-somm--rand,
	.ws-somm--rand:not(.is-offen) {
		bottom: var(--somm-unten, 12px);
	}
	.ws-somm--rechts { right: 12px; }
	.ws-somm--links { left: 12px; }
	.ws-somm--rand.is-offen {
		left: 8px;
		right: 8px;
		bottom: 8px;
	}
	.ws-somm--rand .ws-somm-panel {
		width: 100%;
		height: calc(100vh - 16px);
		height: calc(100dvh - 16px);
	}
	.ws-somm--eingebettet .ws-somm-panel {
		height: 70vh;
		height: 70dvh;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ws-somm-verlauf { scroll-behavior: auto; }
	.ws-somm-tippt span { animation: none; opacity: .6; }
	.ws-somm-knopf { transition: none; }
}

/* Seitenwarenkorb geöffnet: Knopf nicht darüber */
html.ws-sc-offen .ws-somm--rand {
	z-index: 1;
}
