/*
 * Hörmann Busmanagement — Base Styles
 * Reset + Defaults aufbauend auf tokens.css.
 * Wird in jeder Seite einmal importiert (nach tokens.css).
 */

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

html,
body {
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
  font-family: var(--font-family-base);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  color: var(--color-text-default);
  background: var(--color-surface-alt);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-family-heading);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text-default);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5, h6 { font-size: var(--font-size-md); }

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--color-text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-text-link-hover);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-color: var(--color-border-focus);
}

button {
  font: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font: inherit;
  color: inherit;
}

img,
svg {
  max-width: 100%;
  display: block;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

code,
pre {
  font-family: var(--font-family-mono);
  font-size: 0.95em;
}

/* === Utility-Klassen (sparsam einsetzen) === */
.muted { color: var(--color-text-muted); }
.subtle { color: var(--color-text-subtle); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-bold { font-weight: var(--font-weight-semibold); }
.text-mono { font-family: var(--font-family-mono); }

.hidden,
[hidden] { display: none !important; }
.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;
}

/* === Button === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-brand-primary);
  color: var(--color-brand-primary-on);
}

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

.btn-primary:active {
  background: var(--color-brand-primary-active);
  color: var(--color-brand-primary-on-active);
}

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

.btn-secondary:hover {
  background: var(--color-surface-muted);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-default);
}

.btn-ghost:hover {
  background: var(--color-surface-muted);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* === Card === */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

/* === Badges / Status === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text-default);
}

.badge.ok    { background: var(--color-status-ok-soft);    color: var(--color-status-ok); }
.badge.warn  { background: var(--color-status-warn-soft);  color: var(--color-status-warn); }
.badge.error { background: var(--color-status-error-soft); color: var(--color-status-error); }
.badge.info  { background: var(--color-status-info-soft);  color: var(--color-status-info); }

/* === Dialoge: Sicherheitsnetz gegen Überlauf === */
/* Kein Dialog darf höher werden als der Viewport; läuft der Inhalt über,
   scrollt der Dialog, statt dass Felder unsichtbar unterm Rand verschwinden.
   Dialoge mit eigenem Scroll-Konzept (z. B. .ed-dialog, .off-modal)
   überschreiben das per Klassen-Selektor. */
dialog {
  max-height: calc(100dvh - 32px);
  overflow: auto;
}
