<script lang="ts">
	export let title = '';
	export let backHref = '';
</script>

<header class="app-header">
	<div class="header-inner">
		<div class="header-left">
			{#if backHref}
				<a href={backHref} class="back-btn" aria-label="Zurück">←</a>
			{/if}
		</div>

		<div class="header-center">
			{#if title}
				<span class="page-title">{title}</span>
			{/if}
		</div>

		<div class="header-right">
			<a href="/" class="brand-link">
				<span class="brand-name">Qaffee</span>
				<span class="brand-text"> by&nbsp;&nbsp;</span>
			</a>
			<a href="https://www.aquantico.de" class="brand-link">
				<img src="/aquantico-logo.png" alt="Aquantico" class="brand-logo" />
			</a>
		</div>
	</div>
</header>

<style>
	.app-header {
		background: var(--color-navy);
		border-bottom: 2px solid var(--color-teal);
		padding: 0 20px;
		height: 64px;
		display: flex;
		align-items: center;
		position: sticky;
		top: 0;
		z-index: 50;
	}

	.header-inner {
		width: 100%;
		display: grid;
		grid-template-columns: 1fr auto 1fr;
		align-items: center;
	}

	.header-left {
		display: flex;
		align-items: center;
	}

	.header-center {
		display: flex;
		justify-content: center;
	}

	.header-right {
		display: flex;
		justify-content: flex-end;
	}

	.back-btn {
		font-size: 1.5rem;
		color: var(--color-text);
		text-decoration: none;
		padding: 8px 12px;
		border-radius: var(--radius-sm);
		line-height: 1;
		touch-action: manipulation;
	}

	.back-btn:active {
		background: rgba(255,255,255,0.1);
	}

	.page-title {
		font-size: 1.2rem;
		font-weight: 600;
		color: var(--color-text);
	}

	.brand-link {
		display: flex;
		align-items: center;
		gap: 8px;
		text-decoration: none;
	}

	.brand-logo {
		height: 28px;
		width: auto;
		background-color: white;
		border-radius: 4px;
		--filter: brightness(0) invert(1);
	}

	.brand-text {
		font-size: 1rem;
		color: var(--color-text);
		letter-spacing: 0.05em;
	}

	.brand-name {
		font-size: 1rem;
		font-weight: 700;
		color: var(--color-warning);
		letter-spacing: 0.05em;
	}
</style>
