/* Rebelcooking – Chat-Agent.
   Reduziert: Typografie und Weißraum tragen, Farbe wird sparsam eingesetzt. */

:root {
	--bg:      #fbfaf9;
	--surface: #ffffff;
	--raised:  #f4f2ef;
	--text:    #1c1b19;
	--muted:   #78746d;
	--line:    #e7e4df;
	--accent:  #b8471f;

	--radius: 16px;
	--stage:  46rem;

	--ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg:      #161513;
		--surface: #201f1c;
		--raised:  #26241f;
		--text:    #eeece7;
		--muted:   #97928a;
		--line:    #302e2a;
		--accent:  #e08256;
	}
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

.sr-only {
	position: absolute; width: 1px; height: 1px;
	padding: 0; margin: -1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ─────────────── Kopfzeile ─────────────── */

.topbar {
	position: sticky; top: 0; z-index: 10;
	display: flex; align-items: center; justify-content: space-between;
	gap: 1rem;
	padding: .85rem 1.5rem;
	background: color-mix(in srgb, var(--bg) 82%, transparent);
	backdrop-filter: blur(12px);
}

.mark {
	display: inline-flex; align-items: center; gap: .55rem;
	text-decoration: none; color: var(--text);
	font-weight: 560; letter-spacing: -.01em;
}

.mark-dot {
	width: 9px; height: 9px; border-radius: 50%;
	background: var(--accent);
}

.topbar-end { display: flex; align-items: center; gap: .9rem; margin: 0; }
.who { color: var(--muted); font-size: .875rem; }

.link-btn {
	background: none; border: 0; padding: .25rem 0;
	font: inherit; font-size: .875rem;
	color: var(--muted); cursor: pointer;
	border-bottom: 1px solid transparent;
	transition: color .15s, border-color .15s;
}
.link-btn:hover { color: var(--text); border-bottom-color: var(--line); }

/* ─────────────── Bühne ─────────────── */

.stage {
	flex: 1;
	width: 100%;
	max-width: var(--stage);
	margin: 0 auto;
	padding: 0 1.5rem 2rem;
	display: flex;
	flex-direction: column;
}

.agent {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 1.5rem;
	padding-block: 2rem;
	transition: justify-content .3s var(--ease);
}

/* Sobald ein Gespräch läuft: Inhalt nach oben, Eingabe unten */
.agent.is-active { justify-content: flex-start; }

/* ─────────────── Leerzustand ─────────────── */

.intro { text-align: center; }

.intro-greeting {
	margin: 0;
	font-size: clamp(1.75rem, 5vw, 2.5rem);
	font-weight: 500;
	letter-spacing: -.03em;
	line-height: 1.15;
}

.intro-sub {
	margin: .5rem 0 0;
	color: var(--muted);
	font-size: 1.0625rem;
}

.agent.is-active .intro { display: none; }

/* ─────────────── Gesprächsverlauf ─────────────── */

.thread {
	display: flex;
	flex-direction: column;
	gap: 1.75rem;
	padding-block: 1rem 2rem;
}

.turn { display: flex; flex-direction: column; gap: .4rem; animation: rise .35s var(--ease) both; }

@keyframes rise {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.turn { animation: none; }
	.agent { transition: none; }
}

/* Nutzer: leicht abgesetzter Block, rechtsbündig */
.turn-user { align-items: flex-end; }

.turn-user .bubble {
	max-width: 85%;
	padding: .7rem 1rem;
	background: var(--raised);
	border-radius: var(--radius) var(--radius) 4px var(--radius);
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

/* Agent: kein Kasten, nur Text mit kleiner Markierung */
.turn-agent { align-items: flex-start; }

.turn-agent .who-mark {
	display: inline-flex; align-items: center; gap: .45rem;
	font-size: .75rem; font-weight: 600;
	letter-spacing: .06em; text-transform: uppercase;
	color: var(--muted);
}

.turn-agent .who-mark::before {
	content: ""; width: 7px; height: 7px; border-radius: 50%;
	background: var(--accent);
}

.turn-agent .body {
	max-width: 92%;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.turn-agent .body em { color: var(--muted); font-style: normal; }

/* Tipp-Anzeige */
.dots { display: inline-flex; gap: 4px; padding: .35rem 0; }
.dots span {
	width: 6px; height: 6px; border-radius: 50%;
	background: var(--muted); opacity: .4;
	animation: pulse 1.2s infinite;
}
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }

@keyframes pulse {
	0%, 60%, 100% { opacity: .25; transform: translateY(0); }
	30%           { opacity: .9;  transform: translateY(-3px); }
}

/* ─────────────── Eingabe ─────────────── */

.composer { position: sticky; bottom: 0; padding-bottom: .5rem; background: linear-gradient(to top, var(--bg) 68%, transparent); }

.composer-box {
	display: flex; align-items: flex-end; gap: .5rem;
	padding: .5rem .5rem .5rem 1.1rem;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	transition: border-color .15s, box-shadow .15s;
}

.composer-box:focus-within {
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
}

.composer-input {
	flex: 1; min-width: 0;
	max-height: 40vh;
	padding: .6rem 0;
	border: 0; outline: 0; resize: none;
	background: none; color: var(--text);
	font: inherit; line-height: 1.55;
}

.composer-input::placeholder { color: var(--muted); }

.composer-send {
	flex: none;
	width: 34px; height: 34px;
	display: grid; place-items: center;
	border: 0; border-radius: 50%;
	background: var(--accent); color: var(--surface);
	cursor: pointer;
	transition: opacity .15s, transform .15s;
}

.composer-send:disabled { opacity: .28; cursor: default; }
.composer-send:not(:disabled):hover { transform: translateY(-1px); }
.composer-send:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.composer-hint {
	margin: .55rem 0 0;
	text-align: center;
	font-size: .78rem;
	color: var(--muted);
	transition: color .2s;
}

.composer-hint.is-flash { color: var(--accent); }

/* ─────────────── Vorschläge ─────────────── */

.chips {
	display: flex; flex-wrap: wrap; gap: .5rem;
	justify-content: center;
}

.agent.is-active .chips { display: none; }

.chip {
	padding: .45rem .9rem;
	background: none;
	border: 1px solid var(--line);
	border-radius: 999px;
	font: inherit; font-size: .875rem;
	color: var(--muted);
	cursor: pointer;
	transition: color .15s, border-color .15s, background .15s;
}

.chip:hover {
	color: var(--text);
	border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
	background: var(--raised);
}

/* ─────────────── Anmeldung ─────────────── */

.stage-bare {
	flex: 1; display: grid; place-items: center;
	padding: 2rem 1.5rem;
}

.login-card { width: 100%; max-width: 21rem; text-align: center; }

.login-logo {
	width: 12px; height: 12px; border-radius: 50%;
	background: var(--accent); margin: 0 auto 1.5rem;
}

.login-title { margin: 0 0 .4rem; font-size: 1.5rem; font-weight: 500; letter-spacing: -.02em; }
.login-sub   { margin: 0 0 2rem; color: var(--muted); font-size: .9375rem; }

.login-form { display: flex; flex-direction: column; gap: .75rem; text-align: left; }
.login-form label { font-size: .8125rem; color: var(--muted); margin-bottom: -.5rem; }

.login-form input {
	padding: .7rem .9rem;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 12px;
	font: inherit; color: var(--text);
	transition: border-color .15s, box-shadow .15s;
}

.login-form input:focus {
	outline: 0;
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
}

.btn {
	padding: .7rem 1rem;
	border: 0; border-radius: 12px;
	font: inherit; font-weight: 550;
	cursor: pointer;
	transition: opacity .15s;
}

.btn-primary { background: var(--accent); color: #fff; margin-top: .5rem; }
.btn-primary:hover { opacity: .9; }

.alert {
	margin: 0 0 1.25rem;
	padding: .65rem .85rem;
	background: color-mix(in srgb, var(--accent) 10%, transparent);
	border-radius: 12px;
	font-size: .875rem;
	color: var(--accent);
}

/* ─────────────── Klein ─────────────── */

@media (max-width: 640px) {
	.topbar { padding: .75rem 1rem; }
	.stage  { padding: 0 1rem 1.5rem; }
	.who    { display: none; }
	.chips  { justify-content: flex-start; }
	.turn-user .bubble { max-width: 92%; }
}
