/* Berichtsabgabe — Base & Component Styles
 *
 * Wird zusammen mit tokens.css ausgeliefert. Alle Komponenten-Klassen
 * referenzieren ausschließlich Token-Variablen (keine direkten Hex-Werte),
 * damit Theming + spätere Whitelabel-Varianten ohne CSS-Edit funktionieren.
 */

@import url("./tokens.css");

/* ─── Reset & Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--r-md); }

h1, h2, h3, h4, h5, h6 { font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
small { font-size: var(--fs-sm); color: var(--text-secondary); }

/* ─── Utility ────────────────────────────────────────────────────────── */
.stack > * + * { margin-top: var(--stack-gap, var(--space-4)); }
.row { display: flex; gap: var(--row-gap, var(--space-3)); align-items: center; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.demo-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
}

/* ═══ Button ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--btn-py, var(--space-2)) var(--btn-px, var(--space-4));
  font-size: var(--btn-fs, var(--fs-sm));
  font-weight: var(--fw-medium);
  line-height: 1;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--sm { --btn-py: var(--space-1); --btn-px: var(--space-3); --btn-fs: var(--fs-xs); }
.btn--lg { --btn-py: var(--space-3); --btn-px: var(--space-5); --btn-fs: var(--fs-base); }

.btn--primary { background: var(--bg-primary); color: var(--text-on-primary); }
.btn--primary:hover { background: var(--bg-primary-hover); }

.btn--secondary { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border-default); }
.btn--secondary:hover { background: var(--bg-hover); }

.btn--ghost { background: transparent; color: var(--text-primary); }
.btn--ghost:hover { background: var(--bg-hover); }

.btn--success { background: var(--c-success-600); color: var(--text-on-primary); }
.btn--success:hover { background: var(--c-success-700); }

.btn--danger { background: var(--c-danger-600); color: var(--text-on-primary); }
.btn--danger:hover { background: var(--c-danger-700); }

.btn--link { background: transparent; color: var(--text-link); padding: 0; height: auto; }
.btn--link:hover { text-decoration: underline; }

.btn .ico { width: 1em; height: 1em; flex-shrink: 0; }

/* ═══ Form Field ═══════════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: var(--space-1-5, 0.375rem); }
.field__label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-primary); }
.field__hint  { font-size: var(--fs-xs); color: var(--text-muted); }
.field__error { font-size: var(--fs-xs); color: var(--text-danger); }

.field--required .field__label::after { content: " *"; color: var(--text-danger); }

.input,
.select,
.textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-base);
  line-height: var(--lh-snug);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--c-primary-500); box-shadow: var(--shadow-focus); }
.field--error .input,
.field--error .select,
.field--error .textarea { border-color: var(--c-danger-500); }

.textarea { min-height: 6rem; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 1rem) calc(50% - 2px), calc(100% - 0.625rem) calc(50% - 2px); background-size: 5px 5px; background-repeat: no-repeat; padding-right: var(--space-8); }

.checkbox, .radio {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-sm); cursor: pointer; user-select: none;
}
.checkbox input, .radio input { width: 1rem; height: 1rem; accent-color: var(--bg-primary); }

.toggle { position: relative; display: inline-block; width: 2.5rem; height: 1.5rem; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__track {
  position: absolute; inset: 0; background: var(--c-neutral-300);
  border-radius: var(--r-full); transition: background var(--t-normal) var(--ease);
}
.toggle__track::before {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 1.25rem; height: 1.25rem; background: var(--c-neutral-0);
  border-radius: var(--r-full); transition: transform var(--t-normal) var(--ease);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle__track { background: var(--bg-primary); }
.toggle input:checked + .toggle__track::before { transform: translateX(1rem); }

/* ═══ Card ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: transform var(--t-normal) var(--ease), box-shadow var(--t-normal) var(--ease);
}
.card--interactive { cursor: pointer; }
.card--interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card__title { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.card__symbol { display: flex; align-items: center; justify-content: center; margin-block: var(--space-4); color: var(--text-primary-soft); }
.card__symbol svg { width: 3.5rem; height: 3.5rem; }
.card__number { font-size: var(--fs-4xl); font-weight: var(--fw-bold); line-height: 1; color: var(--text-primary); text-align: center; margin-block: var(--space-4); }
.card__hint { font-size: var(--fs-sm); color: var(--text-secondary); }

/* ═══ Table ════════════════════════════════════════════════════════════ */
.table-wrap { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table thead { background: var(--bg-surface-2); }
.table th {
  text-align: left; padding: var(--space-3) var(--space-4);
  font-weight: var(--fw-semibold); color: var(--text-secondary);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em;
  white-space: nowrap; border-bottom: 1px solid var(--border-subtle);
}
.table th .sort {
  display: inline-flex; align-items: center; gap: var(--space-1);
  color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit;
}
.table th .sort:hover { color: var(--text-primary); }
.table th .sort .ico { width: 0.875em; height: 0.875em; opacity: 0.6; }
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover { background: var(--bg-hover); }
.table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.filter-row td { padding: var(--space-2) var(--space-4); background: var(--bg-surface); }
.table .filter-input { width: 100%; padding: var(--space-1) var(--space-2); font-size: var(--fs-xs); border: 1px solid var(--border-subtle); border-radius: var(--r-sm); background: var(--bg-surface); color: var(--text-primary); }
.table .filter-input:focus { outline: none; border-color: var(--c-primary-500); box-shadow: var(--shadow-focus); }
.table-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-3) var(--space-4); background: var(--bg-surface-2);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-sm); color: var(--text-secondary);
}
.pager { display: inline-flex; gap: var(--space-1); }
.pager .btn { min-width: 2rem; padding: var(--space-1) var(--space-2); }
.pager .btn--active { background: var(--bg-primary); color: var(--text-on-primary); border-color: transparent; }

/* ═══ Theme-Switcher (Showcase-Only) ═══════════════════════════════════ */
.demo-page {
  min-height: 100vh; padding: var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-8);
}
.demo-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-4); }
.demo-header h1 { font-size: var(--fs-2xl); }
.demo-header .brand { display: flex; align-items: center; gap: var(--space-3); }
.demo-header .brand-dot { width: 2rem; height: 2rem; border-radius: var(--r-md); background: linear-gradient(135deg, var(--c-primary-500), var(--c-success-500)); }
.demo-section { display: flex; flex-direction: column; gap: var(--space-4); }
.demo-section h2 { font-size: var(--fs-xl); color: var(--text-primary); }
.demo-section .demo-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* ═══ Modal ════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgb(15 23 42 / 0.4);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  z-index: 1000;
  animation: backdrop-in var(--t-slow) var(--ease);
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: var(--modal-w, 32rem);
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--space-8));
  animation: modal-in var(--t-slow) var(--ease-out);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal__head {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
}
.modal__head h3 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.modal__close { width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-md); color: var(--text-muted); transition: background var(--t-fast) var(--ease); }
.modal__close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal__body { padding: var(--space-5) var(--space-6); overflow-y: auto; flex: 1; color: var(--text-secondary); }
.modal__foot {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex; justify-content: flex-end; gap: var(--space-3);
  background: var(--bg-surface-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
.modal--danger .modal__head { color: var(--text-danger); }
.modal__icon { width: 2.5rem; height: 2.5rem; border-radius: var(--r-full); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal__icon--danger { background: var(--bg-danger-soft); color: var(--text-danger); }
.modal__icon--warning { background: var(--bg-warning-soft); color: var(--text-warning); }
.modal__icon--success { background: var(--bg-success-soft); color: var(--text-success); }
.modal__consequences { list-style: none; padding: 0; margin: 0; }
.modal__consequences li { display: flex; gap: var(--space-2); padding: var(--space-2) 0; color: var(--text-primary); border-bottom: 1px dashed var(--border-subtle); }
.modal__consequences li::before { content: "→"; color: var(--text-warning); font-weight: var(--fw-bold); flex-shrink: 0; }
.modal__consequences li:last-child { border-bottom: 0; }

/* ═══ Chip / Tag ═══════════════════════════════════════════════════════ */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--chip-py, var(--space-1)) var(--chip-px, var(--space-2));
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  background: var(--bg-surface-2); color: var(--text-primary);
  border-radius: var(--r-full);
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip__remove {
  width: 1rem; height: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
  margin-left: var(--space-1); margin-right: calc(-1 * var(--space-1));
  color: var(--text-muted); transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.chip__remove:hover { background: rgb(15 23 42 / 0.08); color: var(--text-primary); }
:root[data-theme="dark"] .chip__remove:hover { background: rgb(255 255 255 / 0.1); }
.chip__remove .ico { width: 0.625rem; height: 0.625rem; }

.chip--primary { background: var(--bg-primary-soft); color: var(--text-primary-soft); }
.chip--success { background: var(--bg-success-soft); color: var(--text-success); }
.chip--warning { background: var(--bg-warning-soft); color: var(--text-warning); }
.chip--danger  { background: var(--bg-danger-soft); color: var(--text-danger); }
.chip--lg { --chip-py: var(--space-2); --chip-px: var(--space-3); font-size: var(--fs-sm); }

.chip-input {
  display: flex; flex-wrap: wrap; gap: var(--space-1-5, 0.375rem);
  padding: var(--space-2);
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--r-md); min-height: 2.5rem;
  cursor: text;
}
.chip-input:focus-within { border-color: var(--c-primary-500); box-shadow: var(--shadow-focus); }
.chip-input input { flex: 1; min-width: 6rem; border: 0; outline: none; background: transparent; color: var(--text-primary); font-size: var(--fs-sm); }

/* ═══ Progress (detailliert) ═══════════════════════════════════════════ */
.progress-bar { height: 0.5rem; background: var(--c-neutral-200); border-radius: var(--r-full); overflow: hidden; }
:root[data-theme="dark"] .progress-bar { background: var(--c-neutral-800); }
.progress-bar__fill { height: 100%; background: linear-gradient(90deg, var(--c-primary-500), var(--c-success-500)); border-radius: var(--r-full); transition: width var(--t-slow) var(--ease); }
.progress-block { display: flex; flex-direction: column; gap: var(--space-2); }
.progress-block__head { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-sm); }
.progress-block__head strong { color: var(--text-primary); }
.progress-block__head .pct { font-family: var(--font-mono); color: var(--text-secondary); }

.donut { --size: 7rem; --thickness: 0.625rem; width: var(--size); height: var(--size); position: relative; display: inline-block; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut__track { fill: none; stroke: var(--c-neutral-200); stroke-width: var(--thickness); }
:root[data-theme="dark"] .donut__track { stroke: var(--c-neutral-800); }
.donut__fill { fill: none; stroke: url(#donut-gradient); stroke-width: var(--thickness); stroke-linecap: round; transition: stroke-dashoffset var(--t-slow) var(--ease); }
.donut__label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut__label .num { font-size: var(--fs-2xl); font-weight: var(--fw-bold); font-family: var(--font-mono); color: var(--text-primary); line-height: 1; }
.donut__label .lbl { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.steps { display: flex; align-items: center; gap: var(--space-2); }
.step { display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--fs-sm); }
.step__dot { width: 1.75rem; height: 1.75rem; border-radius: var(--r-full); display: inline-flex; align-items: center; justify-content: center; background: var(--bg-surface-2); color: var(--text-muted); font-weight: var(--fw-semibold); font-size: var(--fs-sm); border: 2px solid transparent; flex-shrink: 0; }
.step--done .step__dot { background: var(--c-success-500); color: var(--text-on-primary); }
.step--current { color: var(--text-primary); font-weight: var(--fw-semibold); }
.step--current .step__dot { background: var(--bg-primary); color: var(--text-on-primary); box-shadow: 0 0 0 4px var(--bg-primary-soft); }
.step__line { flex: 1; height: 2px; background: var(--border-subtle); border-radius: var(--r-full); min-width: 1.5rem; }
.step__line--done { background: var(--c-success-500); }

/* ═══ Empty / Loading / Error State ════════════════════════════════════ */
.state {
  padding: var(--space-12) var(--space-6);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-4);
  background: var(--bg-surface); border: 1px dashed var(--border-default); border-radius: var(--r-lg);
}
.state__art { width: 5rem; height: 5rem; border-radius: var(--r-full); background: var(--bg-primary-soft); color: var(--text-primary-soft); display: inline-flex; align-items: center; justify-content: center; }
.state__art svg { width: 2.25rem; height: 2.25rem; }
.state h3 { font-size: var(--fs-lg); }
.state p { color: var(--text-secondary); max-width: 28rem; }

.skeleton { background: linear-gradient(90deg, var(--bg-surface-2) 0%, var(--bg-hover) 50%, var(--bg-surface-2) 100%); background-size: 200% 100%; border-radius: var(--r-sm); animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; }
.skeleton--avatar { width: 2rem; height: 2rem; border-radius: var(--r-full); flex-shrink: 0; }
.skeleton--line { height: 0.75rem; flex: 1; }
.skeleton--short { width: 30%; }

/* ═══ Toast / Notification ═════════════════════════════════════════════ */
.toast-stack { position: fixed; top: var(--space-4); right: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); z-index: 1100; max-width: calc(100vw - var(--space-8)); }
.toast {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--toast-accent, var(--bg-primary));
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 18rem; max-width: 24rem;
  animation: toast-in var(--t-slow) var(--ease-out);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.toast__icon { width: 1.25rem; height: 1.25rem; color: var(--toast-accent, var(--bg-primary)); flex-shrink: 0; margin-top: 0.125rem; }
.toast__body { flex: 1; font-size: var(--fs-sm); color: var(--text-primary); }
.toast__body small { display: block; color: var(--text-secondary); margin-top: var(--space-1); }
.toast__close { color: var(--text-muted); }
.toast--success { --toast-accent: var(--c-success-500); }
.toast--warning { --toast-accent: var(--c-warning-500); }
.toast--danger  { --toast-accent: var(--c-danger-500); }
.toast--info    { --toast-accent: var(--c-primary-500); }
