/*
 * HBC Digital Design System V1.0 · Komponenten
 * Voraussetzung: ../08_Design-Tokens/hbc-tokens.css (zuerst einbinden)
 * Prinzipien: ruhig, präzise, großzügig. Keine Verläufe, keine Glanzeffekte.
 */

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--hbc-bg); color: var(--hbc-text);
  font-family: var(--hbc-font); font-size: var(--hbc-text-body); line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--hbc-accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: var(--hbc-focus-width) solid var(--hbc-accent); outline-offset: var(--hbc-focus-offset); border-radius: 4px; }
.hbc-skip { position: absolute; left: var(--hbc-space-4); top: -100px; background: var(--hbc-surface); color: var(--hbc-text); padding: var(--hbc-space-3) var(--hbc-space-4); border-radius: var(--hbc-radius-sm); z-index: var(--hbc-z-toast); }
.hbc-skip:focus { top: var(--hbc-space-4); }
.hbc-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }

/* ---------- Typografie ---------- */
.hbc-display, .hbc-h1, .hbc-h2, .hbc-h3, .hbc-h4 { margin: 0; font-weight: var(--hbc-weight-bold); color: var(--hbc-text); text-wrap: balance; }
.hbc-display { font-size: var(--hbc-text-display); line-height: 1.02; letter-spacing: -0.045em; }
.hbc-h1 { font-size: var(--hbc-text-h1); line-height: 1.08; letter-spacing: -0.035em; }
.hbc-h2 { font-size: var(--hbc-text-h2); line-height: 1.15; letter-spacing: -0.03em; }
.hbc-h3 { font-size: var(--hbc-text-h3); line-height: 1.25; letter-spacing: -0.02em; }
.hbc-h4 { font-size: var(--hbc-text-h4); line-height: 1.3; letter-spacing: -0.01em; font-weight: var(--hbc-weight-semibold); }
.hbc-lead { font-size: var(--hbc-text-body-lg); line-height: 1.6; color: var(--hbc-text-muted); max-width: var(--hbc-measure); }
.hbc-small { font-size: var(--hbc-text-small); line-height: 1.5; }
.hbc-caption { font-size: var(--hbc-text-caption); line-height: 1.45; color: var(--hbc-text-muted); font-weight: var(--hbc-weight-medium); }
.hbc-overline { font-size: var(--hbc-text-overline); line-height: 1.4; letter-spacing: 0.18em; text-transform: uppercase; font-weight: var(--hbc-weight-bold); color: var(--hbc-accent); }
.hbc-accent-text { color: var(--hbc-accent); }
.hbc-prose { max-width: var(--hbc-measure); }
.hbc-prose p { margin: 0 0 1em; }

/* ---------- Layout ---------- */
.hbc-container { width: 100%; max-width: calc(var(--hbc-container) + 2 * var(--hbc-gutter)); margin-inline: auto; padding-inline: var(--hbc-gutter); }
.hbc-container--wide { max-width: calc(var(--hbc-container-wide) + 2 * var(--hbc-gutter)); }
.hbc-section { padding-block: var(--hbc-space-16); }
@media (min-width: 1024px) { .hbc-section { padding-block: var(--hbc-space-24); } }
.hbc-section--alt { background: var(--hbc-surface-alt); }
.hbc-grid { display: grid; gap: var(--hbc-gutter); grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 768px) { .hbc-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .hbc-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); } }
.hbc-auto-grid { display: grid; gap: var(--hbc-space-6); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.hbc-stack { display: flex; flex-direction: column; gap: var(--hbc-space-4); }
.hbc-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--hbc-space-3); }

/* ---------- Buttons ---------- */
.hbc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--hbc-space-2);
  min-height: 48px; padding: 0 var(--hbc-space-6); border-radius: var(--hbc-radius-pill);
  font: var(--hbc-weight-bold) 1rem/1 var(--hbc-font); text-decoration: none; cursor: pointer;
  border: 1.5px solid transparent; transition: background-color var(--hbc-duration-base) var(--hbc-ease), color var(--hbc-duration-base) var(--hbc-ease), border-color var(--hbc-duration-base) var(--hbc-ease);
}
.hbc-btn--primary { background: var(--hbc-accent-fill); color: var(--hbc-on-accent); }
.hbc-btn--primary:hover { background: var(--hbc-accent-fill-hover); color: var(--hbc-on-accent-hover); }
.hbc-btn--secondary { background: transparent; color: var(--hbc-text); border-color: var(--hbc-text); }
.hbc-btn--secondary:hover { background: var(--hbc-text); color: var(--hbc-bg); }
.hbc-btn--ghost { background: transparent; color: var(--hbc-text); padding-inline: var(--hbc-space-3); }
.hbc-btn--ghost:hover { background: var(--hbc-border); }
.hbc-btn--sm { min-height: 40px; padding-inline: var(--hbc-space-4); font-size: 0.9375rem; }
.hbc-btn--lg { min-height: 56px; padding-inline: var(--hbc-space-8); font-size: 1.0625rem; }
.hbc-btn:focus-visible { outline-offset: 3px; border-radius: var(--hbc-radius-pill); }
.hbc-btn[disabled], .hbc-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.hbc-btn[aria-busy="true"]::before { content: ""; width: 1em; height: 1em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: hbc-spin 0.8s linear infinite; }
@keyframes hbc-spin { to { transform: rotate(360deg); } }

/* ---------- Header und Navigation ---------- */
.hbc-header { position: sticky; top: 0; z-index: var(--hbc-z-header); background: var(--hbc-bg); border-bottom: 1px solid var(--hbc-border); }
.hbc-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--hbc-space-6); min-height: var(--hbc-header-height); }
.hbc-header__logo { display: inline-flex; flex-shrink: 0; }
.hbc-header__logo svg { height: 28px; width: auto; }
@media (min-width: 1024px) { .hbc-header__logo svg { height: 34px; } }
.hbc-nav { display: none; }
.hbc-nav__list { display: flex; align-items: center; gap: var(--hbc-space-8); list-style: none; margin: 0; padding: 0; }
.hbc-nav__link { color: var(--hbc-text); text-decoration: none; font-weight: var(--hbc-weight-medium); padding-block: var(--hbc-space-2); border-bottom: 2px solid transparent; }
.hbc-nav__link:hover { border-bottom-color: var(--hbc-border-strong); }
.hbc-nav__link[aria-current="page"] { border-bottom-color: var(--hbc-accent); }
.hbc-nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: 0; background: transparent; color: var(--hbc-text); border-radius: var(--hbc-radius-sm); cursor: pointer; }
.hbc-mobile-nav { display: none; border-top: 1px solid var(--hbc-border); padding: var(--hbc-space-4) 0 var(--hbc-space-6); }
.hbc-mobile-nav[data-open="true"] { display: block; }
.hbc-mobile-nav a { display: block; padding: var(--hbc-space-3) 0; color: var(--hbc-text); text-decoration: none; font-weight: var(--hbc-weight-semibold); font-size: 1.125rem; border-bottom: 1px solid var(--hbc-border); }
@media (min-width: 1024px) { .hbc-nav { display: block; } .hbc-nav-toggle, .hbc-mobile-nav, .hbc-mobile-nav[data-open="true"] { display: none; } }
.hbc-tabs { display: flex; gap: var(--hbc-space-1); border-bottom: 1px solid var(--hbc-border); overflow-x: auto; }
.hbc-tab { padding: var(--hbc-space-3) var(--hbc-space-4); border: 0; background: none; color: var(--hbc-text-muted); font: var(--hbc-weight-semibold) 0.9375rem var(--hbc-font); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.hbc-tab[aria-selected="true"] { color: var(--hbc-text); border-bottom-color: var(--hbc-accent); }
.hbc-breadcrumb { display: flex; flex-wrap: wrap; gap: var(--hbc-space-2); list-style: none; padding: 0; margin: 0; font-size: var(--hbc-text-small); color: var(--hbc-text-muted); }
.hbc-breadcrumb li + li::before { content: "/"; margin-right: var(--hbc-space-2); opacity: 0.6; }

/* ---------- Karten und Produktmodule ---------- */
.hbc-card { background: var(--hbc-surface); border: 1px solid var(--hbc-border); border-radius: var(--hbc-radius-lg); padding: var(--hbc-space-6); display: flex; flex-direction: column; gap: var(--hbc-space-3); }
.hbc-card--flat { border: 0; background: var(--hbc-surface-alt); }
.hbc-card__title { margin: 0; font-size: 1.25rem; line-height: 1.3; font-weight: var(--hbc-weight-bold); letter-spacing: -0.01em; }
.hbc-card__text { margin: 0; color: var(--hbc-text-muted); }
a.hbc-card { color: inherit; text-decoration: none; transition: border-color var(--hbc-duration-base) var(--hbc-ease), box-shadow var(--hbc-duration-base) var(--hbc-ease); }
a.hbc-card:hover { border-color: var(--hbc-border-strong); box-shadow: var(--hbc-shadow-md); }
.hbc-module { display: flex; align-items: center; gap: var(--hbc-space-4); }
.hbc-module__tile { width: 48px; height: 48px; flex-shrink: 0; }
.hbc-module__name { font-weight: var(--hbc-weight-bold); font-size: 1.1875rem; line-height: 1; color: var(--hbc-text); }
.hbc-module__name .hbc-ai { color: var(--hbc-petrol-on-light); font-weight: var(--hbc-weight-semibold); }
[data-theme="dark"] .hbc-module__name .hbc-ai { color: var(--hbc-petrol-on-dark); }
.hbc-module__sub { margin-top: 4px; font-size: 0.75rem; font-weight: var(--hbc-weight-semibold); letter-spacing: 0.04em; color: var(--hbc-petrol-on-light); }
[data-theme="dark"] .hbc-module__sub { color: var(--hbc-petrol-on-dark); }
.hbc-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--hbc-radius-pill); font-size: var(--hbc-text-caption); font-weight: var(--hbc-weight-semibold); background: var(--hbc-surface-alt); color: var(--hbc-text); }
.hbc-badge__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.hbc-rule { height: 3px; width: 64px; border-radius: 3px; background: var(--hbc-accent); border: 0; margin: 0; }

/* ---------- Formulare ---------- */
.hbc-field { display: flex; flex-direction: column; gap: var(--hbc-space-2); }
.hbc-label { font-weight: var(--hbc-weight-semibold); font-size: var(--hbc-text-small); }
.hbc-input, .hbc-select, .hbc-textarea {
  width: 100%; min-height: 48px; padding: 12px 16px; font: 400 1rem/1.4 var(--hbc-font); color: var(--hbc-text);
  background: var(--hbc-surface); border: 1.5px solid var(--hbc-border-strong); border-radius: var(--hbc-radius-sm);
  transition: border-color var(--hbc-duration-fast) var(--hbc-ease);
}
[data-theme="dark"] .hbc-input, [data-theme="dark"] .hbc-select, [data-theme="dark"] .hbc-textarea { background: var(--hbc-surface-alt); }
.hbc-textarea { min-height: 128px; resize: vertical; }
.hbc-input::placeholder, .hbc-textarea::placeholder { color: var(--hbc-text-muted); }
.hbc-input:hover, .hbc-select:hover, .hbc-textarea:hover { border-color: var(--hbc-text); }
.hbc-input:focus-visible, .hbc-select:focus-visible, .hbc-textarea:focus-visible { outline: var(--hbc-focus-width) solid var(--hbc-accent); outline-offset: 1px; border-color: var(--hbc-accent); border-radius: var(--hbc-radius-sm); }
.hbc-help { font-size: var(--hbc-text-caption); color: var(--hbc-text-muted); }
.hbc-field--error .hbc-input, .hbc-field--error .hbc-textarea { border-color: var(--hbc-error); }
.hbc-error { display: flex; align-items: center; gap: 6px; font-size: var(--hbc-text-caption); font-weight: var(--hbc-weight-semibold); color: var(--hbc-error); }
.hbc-check { display: flex; align-items: flex-start; gap: var(--hbc-space-3); cursor: pointer; }
.hbc-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--hbc-dunkelblau); flex-shrink: 0; }
[data-theme="dark"] .hbc-check input { accent-color: var(--hbc-beige); }

/* ---------- Dialoge und Benachrichtigungen ---------- */
.hbc-dialog { border: 0; padding: 0; border-radius: var(--hbc-radius-xl); background: var(--hbc-surface); color: var(--hbc-text); width: min(560px, calc(100vw - 32px)); box-shadow: var(--hbc-shadow-lg); }
.hbc-dialog::backdrop { background: var(--hbc-overlay); }
.hbc-dialog__body { padding: var(--hbc-space-8); display: flex; flex-direction: column; gap: var(--hbc-space-4); }
.hbc-dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--hbc-space-3); margin-top: var(--hbc-space-4); }
.hbc-alert { display: flex; gap: var(--hbc-space-3); padding: var(--hbc-space-4) var(--hbc-space-5); border-radius: var(--hbc-radius-md); background: var(--hbc-surface); border: 1px solid var(--hbc-border); border-left-width: 1px; }
.hbc-alert__icon { flex-shrink: 0; width: 24px; height: 24px; }
.hbc-alert__title { margin: 0; font-weight: var(--hbc-weight-bold); }
.hbc-alert__text { margin: 2px 0 0; color: var(--hbc-text-muted); font-size: var(--hbc-text-small); }
.hbc-alert--error .hbc-alert__icon { color: var(--hbc-error); }
.hbc-alert--warning .hbc-alert__icon { color: var(--hbc-warning); }
.hbc-alert--success .hbc-alert__icon { color: var(--hbc-success); }
.hbc-alert--info .hbc-alert__icon { color: var(--hbc-info); }
.hbc-toast-region { position: fixed; right: var(--hbc-space-4); bottom: var(--hbc-space-4); z-index: var(--hbc-z-toast); display: flex; flex-direction: column; gap: var(--hbc-space-2); }
.hbc-toast { display: flex; align-items: center; gap: var(--hbc-space-3); min-width: 280px; max-width: 420px; padding: var(--hbc-space-4) var(--hbc-space-5); border-radius: var(--hbc-radius-md); background: var(--hbc-dunkelblau); color: var(--hbc-beige); box-shadow: var(--hbc-shadow-md); font-weight: var(--hbc-weight-medium); }
[data-theme="dark"] .hbc-toast { background: var(--hbc-beige); color: var(--hbc-dunkelblau); }

/* ---------- Icons ---------- */
.hbc-icon { width: 24px; height: 24px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.hbc-icon--sm { width: 20px; height: 20px; }
.hbc-icon--lg { width: 32px; height: 32px; stroke-width: 1.5; }

/* ---------- Hintergrundflächen ---------- */
.hbc-surface-light { background: var(--hbc-beige); color: var(--hbc-dunkelblau); }
.hbc-surface-clay { background: var(--hbc-soft-clay); color: var(--hbc-dunkelblau); }
.hbc-surface-dark { background: var(--hbc-dunkelblau); color: var(--hbc-beige); }
.hbc-surface-deep { background: var(--hbc-abendgrau); color: var(--hbc-beige); }
.hbc-horizon { height: 3px; border: 0; margin: 0; background: var(--hbc-accent); border-radius: 3px; }
