/* ═══════════════════════════════════════════════════════════════════════════════
   ViCORE — BASISSCHICHT (Element-Defaults)
   ───────────────────────────────────────────────────────────────────────────────
   ACHTUNG — diese Datei definiert KEINE Design-Tokens mehr.

   Bis 16.08.2026 war sie ein zweites, vollständiges Designsystem: sie definierte
   230 Custom Properties, davon 149 mit denselben Namen wie `public/css/design-system.css`
   und teilweise anderen Werten. Welcher Wert galt, entschied allein die Ladereihenfolge —
   das ist keine Single Source of Truth, sondern ein Zufall mit Dokumentation.

   SEITDEM:
   • ALLE Tokens stehen ausschließlich in `public/css/design-system.css`.
     Die 81 Tokens, die es nur hier gab, sind dorthin umgezogen (Block „ÜBERNOMMEN AUS").
   • Diese Datei enthält nur noch **Element-Defaults** für nackte HTML-Elemente
     (`body`, `h1`–`h6`, `input`, `table`, `button`) und einige Hilfsklassen, die es
     sonst nirgends gibt (`.badge-*`, `.empty-state`, `.spinner`, `.tooltip`, Utilities).
     Sie liest ausschließlich Tokens — sie setzt keine.
   • Sie lädt bewusst FRÜH (vor style.css), damit spätere Schichten sie überschreiben
     können. Neue Regeln gehören NICHT hierher, sondern in die kanonische Datei
     bzw. in die zuständige Komponentendatei.

   Guardrail: `npm run check:design` schlägt an, wenn hier wieder ein `--token:`
   auftaucht.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ===== GLOBAL STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== TYPOGRAPHY STYLES ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin: 0;
}

h1 {
  font-size: var(--font-size-5xl);
  letter-spacing: var(--letter-spacing-tight);
}

h2 {
  font-size: var(--font-size-4xl);
  letter-spacing: var(--letter-spacing-tight);
}

h3 {
  font-size: var(--font-size-3xl);
}

h4 {
  font-size: var(--font-size-2xl);
}

h5 {
  font-size: var(--font-size-xl);
}

h6 {
  font-size: var(--font-size-lg);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

p {
  margin: 0;
  line-height: var(--line-height-relaxed);
}

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

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

label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  display: block;
  margin-bottom: var(--space-2);
}
/* Ein `display` in der Element-Vorgabe schlägt das `display: none`, das der Browser für
   `[hidden]` mitbringt (UA-Regel, niedrigste Stufe). Ohne diese Zeile steht eine
   ausgeblendete Beschriftung sichtbar im Formular — gefunden 10.09.2026 an der
   eingeklappten Maßnahmen-Anmerkung des Anlage-Assistenten. */
label[hidden] { display: none; }

small, .text-small {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* ===== BUTTON SYSTEM ===== */
button, .btn {
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
  user-select: none;
  outline: none;
}

button:disabled, .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Button Variants */
.btn-primary {
  background: var(--color-primary-600);
  color: white;
  height: var(--btn-height-md);
  padding: 0 var(--btn-padding-x-md);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-700);
  box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
  background: var(--color-primary-800);
}

.btn-primary:focus:not(:disabled) {
  outline: 2px solid var(--color-primary-300);
  outline-offset: 2px;
}

.btn-secondary {
  background: var(--color-slate-200);
  color: var(--text-primary);
  height: var(--btn-height-md);
  padding: 0 var(--btn-padding-x-md);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-slate-300);
}

.btn-secondary:active:not(:disabled) {
  background: var(--color-slate-400);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary-600);
  height: var(--btn-height-md);
  padding: 0 var(--btn-padding-x-md);
  border: 1px solid var(--border-light);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-default);
}

.btn-ghost:active:not(:disabled) {
  background: var(--bg-active);
}

.btn-danger {
  background: var(--color-red-600);
  color: white;
  height: var(--btn-height-md);
  padding: 0 var(--btn-padding-x-md);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger-ink);
}

.btn-danger:active:not(:disabled) {
  background: var(--color-danger-ink);
}

.btn-sm {
  height: var(--btn-height-sm);
  padding: 0 var(--btn-padding-x-sm);
  font-size: var(--font-size-xs);
}

.btn-icon {
  width: var(--btn-height-md);
  height: var(--btn-height-md);
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon.sm {
  width: var(--btn-height-sm);
  height: var(--btn-height-sm);
}

.btn-icon.lg {
  width: var(--btn-height-lg);
  height: var(--btn-height-lg);
}

/* ===== FORM ELEMENTS =====
   `:where()` haelt diese Grundeinstellungen bei Spezifitaet 0. Sie gelten damit
   weiterhin fuer nackte Felder, treten aber niemals gegen eine Komponentenregel
   an (z. B. `.meta-menu-search`, das eigenen Innenabstand fuer sein Lupensymbol
   braucht). Die feinere Feldregel in style.css steht spaeter im Dokument und
   gewinnt bei Gleichstand unveraendert. */
:where(input, select, textarea) {
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--input-padding-y) var(--input-padding-x);
  transition: all var(--transition-base);
}

:where(input, select) {
  height: var(--input-height);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary-500);
  background: var(--color-white);
  box-shadow: 0 0 0 3px var(--color-primary-100);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--bg-disabled);
  color: var(--text-muted);
  cursor: not-allowed;
}

input::placeholder {
  color: var(--text-subtle);
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: var(--line-height-relaxed);
}

/* Select styling */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23857F73' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
  appearance: none;
}

/* ===== CARD / PANEL =====
   ENTFERNT am 16.08.2026. Diese Basisschicht definierte `.card`/`.card-header`/
   `.card-body`/`.card-footer` ein zweites Mal — mit anderer Polsterung, anderem
   Rahmen und Hover-Schatten. Welche der beiden Definitionen galt, hing je Eigenschaft
   von der Ladereihenfolge ab.
   Kanonisch ist jetzt ausschließlich: `.card` in style.css (Fläche + Rahmen + Radius),
   harmonisiert über alle Modul-Kartenklassen in vi-canonical.css §15.
   `.panel` erbt dieselbe Optik dort — hier wird nichts mehr gesetzt. */

/* ===== TABLE STYLES ===== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

thead {
  background: var(--bg-tertiary);
}

thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background-color var(--transition-fast);
}

tbody tr:hover {
  background-color: var(--bg-hover);
}

tbody td {
  padding: var(--space-3) var(--space-4);
  vertical-align: middle;
}

/* ===== BADGE / STATUS STYLES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.badge-primary {
  background: var(--color-primary-100);
  color: var(--color-primary-700);
}

.badge-success {
  background: var(--color-green-100);
  color: var(--color-green-700);
}

.badge-warning {
  background: var(--vi-warning-soft);
  color: var(--color-warning-ink);
}

.badge-danger {
  background: var(--vi-error-soft);
  color: var(--color-red-700);
}

.badge-info {
  background: var(--vi-info-soft);
  color: var(--vi-info);
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

/* ===== MODAL / DIALOG STYLES ===== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-bg);
  animation: fadeIn var(--transition-base);
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp var(--transition-base);
  z-index: var(--z-modal);
}

.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
}

.modal-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.modal-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== TOOLTIP / POPOVER STYLES ===== */
.tooltip {
  position: absolute;
  background: var(--color-slate-900);
  color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  white-space: nowrap;
  pointer-events: none;
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-lg);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: var(--font-size-6xl);
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-message {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  max-width: 400px;
}

/* ===== LOADING STATE ===== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--color-primary-600);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

.border { border: 1px solid var(--border-light); }
.border-top { border-top: 1px solid var(--border-light); }
.border-bottom { border-bottom: 1px solid var(--border-light); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

.flex { display: flex; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
