/* ── CSS-Variablen & Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --imi-dark:   #05263d;
  --imi-navy:   #0b3c5d;
  --imi-navy-h: #1565a0;
  --imi-teal:   #00bfae;
  --imi-teal-d: #00897b;
  --imi-bg:     #f8fafc;
  --imi-border: #d1dce6;
  --imi-muted:  #5a7080;
  --imi-light:  #e3f2fd;
}

/* ── Base & Layout ───────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--imi-bg);
  color: #1a2634;
  line-height: 1.6;
  font-size: 15px;
}
.container {
  max-width: 1060px;
  margin: 30px auto;
  padding: 0 20px;
}
/* GEÄNDERT v2.0: hidden-Klasse ersetzt inline style="display:none" */
.hidden { display: none !important; }

/* GEÄNDERT v2.0: Screenreader-only Utility für visually-hidden Labels (WCAG 1.3.1) */
.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;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: linear-gradient(90deg, var(--imi-dark) 0%, var(--imi-navy) 100%);
  padding: 15px 25px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.sitename {
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.sitename img { height: 32px; width: auto; }

/* ── Navigation / Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb { margin-top: 8px; font-size: 12px; color: #cbd5e1; }
.breadcrumb a { color: #fff; text-decoration: none; }
.breadcrumb a:hover { color: var(--imi-teal); }
.back-link {
  display: inline-block;
  margin-bottom: 15px;
  text-decoration: none;
  color: var(--imi-navy);
  font-size: 14px;
  font-weight: 700;
}
.back-link:hover { color: var(--imi-teal-d); }

/* ── Intro-Box ───────────────────────────────────────────────────────────── */
.imi-intro {
  background: linear-gradient(105deg, var(--imi-light) 0%, rgba(0,191,174,.06) 100%);
  border: 1px solid rgba(21,101,160,.18);
  border-left: 4px solid var(--imi-navy-h);
  border-radius: 8px;
  padding: 24px 28px;
  margin-bottom: 22px;
}
.imi-intro h2 { margin: 0 0 10px; color: var(--imi-navy); font-size: 20px; font-weight: 700; }
.imi-intro p  { font-size: 15px; color: var(--imi-muted); margin: 0; }

/* ── Content-Box ─────────────────────────────────────────────────────────── */
.content-box {
  background: #fff;
  border: 1px solid var(--imi-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
  margin-bottom: 22px;
}
.box-header {
  background: linear-gradient(90deg, var(--imi-navy) 0%, #1a5a85 45%, #2272a0 100%);
  color: #fff;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  position: relative;
}
.box-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--imi-teal) 0%, rgba(0,191,174,.3) 55%, transparent 100%);
}
.box-body { padding: 24px 28px; }
/* GEÄNDERT v2.0: ehemals inline style="font-size:14px;color:#444" → eigene Klasse */
.box-body--text { font-size: 14px; color: #444; }
.box-body--text p { margin-top: 0; }
.box-body--text p + p { margin-top: 10px; }
/* GEÄNDERT v2.0: ehemals inline style="overflow-x:auto" */
.box-body--overflow { padding: 24px 28px; overflow-x: auto; }

/* ── Formular-Elemente ───────────────────────────────────────────────────── */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--imi-muted);
  margin-bottom: 5px;
  margin-top: 14px;
}
label:first-of-type { margin-top: 0; }
textarea,
select,
input[type="text"],
input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--imi-border);
  border-radius: 6px;
  font-size: 13px;
  color: #1a2634;
  background: #fff;
  transition: border-color .2s;
  font-family: 'Cascadia Code', 'Consolas', monospace;
}
/* GEÄNDERT v2.0: Suchfeld und Eingabefeld: Segoe UI für normalen Text */
#searchBox { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
textarea { resize: vertical; }
textarea:focus,
select:focus,
input:focus {
  outline: none;
  border-color: var(--imi-teal);
  box-shadow: 0 0 0 3px rgba(0,191,174,.15);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all .2s;
  font-family: inherit;
  /* GEÄNDERT v2.0: min-height 44px für WCAG 2.5.5 Touchziel */
  min-height: 44px;
}
/* GEÄNDERT v2.0: focus-visible Indikator ergänzt (WCAG 2.4.7) */
.btn:focus-visible {
  outline: 3px solid var(--imi-teal);
  outline-offset: 2px;
}
.btn-primary   { background: var(--imi-navy);  color: #fff; }
.btn-primary:hover   { background: var(--imi-navy-h); }
.btn-secondary { background: var(--imi-teal);  color: #fff; }
.btn-secondary:hover { background: var(--imi-teal-d); }
.btn-outline   { background: #fff; color: var(--imi-navy); border: 1px solid var(--imi-navy); }
.btn-outline:hover   { background: var(--imi-light); }
.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
/* GEÄNDERT v2.0: ehemals inline style="margin-top:10px" */
.btn-row--top { margin-top: 10px; }

/* ── Fehleranzeige ───────────────────────────────────────────────────────── */
.error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px;
  color: #dc2626;
  margin-top: 12px;
  display: none;
}

/* ── Tool-spezifische Styles: Segment-Cards ─────────────────────────────── */
.seg-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}
.seg-card {
  border: 1px solid var(--imi-border);
  border-radius: 8px;
  overflow: hidden;
}
.seg-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--imi-bg);
  transition: background .15s;
}
.seg-header:hover { background: var(--imi-light); }
/* GEÄNDERT v2.0: focus-visible für Tastaturnavigation (WCAG 2.4.7) */
.seg-header:focus-visible {
  outline: 3px solid var(--imi-teal);
  outline-offset: -3px;
}
.seg-id {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: var(--imi-navy);
  padding: 4px 12px;
  border-radius: 4px;
  min-width: 52px;
  text-align: center;
  letter-spacing: .04em;
}
.seg-name    { font-size: 14px; font-weight: 600; color: var(--imi-navy); }
.seg-raw {
  font-size: 11px;
  color: var(--imi-muted);
  font-family: 'Cascadia Code', 'Consolas', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.seg-toggle {
  font-size: 18px;
  color: var(--imi-muted);
  margin-left: auto;
  flex-shrink: 0;
  transition: transform .2s;
}
.seg-card.open .seg-toggle { transform: rotate(180deg); }
.seg-body { display: none; border-top: 1px solid var(--imi-border); overflow-x: auto; }
.seg-card.open .seg-body { display: block; }

/* ── Tool-spezifische Styles: Feldtabelle ───────────────────────────────── */
.field-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.field-table th {
  background: #4a5c6a;
  color: rgba(255,255,255,.92);
  padding: 7px 14px;
  text-align: left;
  font-size: 11px;
  letter-spacing: .04em;
  font-weight: 600;
  white-space: nowrap;
}
.field-table td { border-bottom: 1px solid rgba(209,220,230,.5); padding: 7px 14px; vertical-align: top; }
.field-table tr:nth-child(even) td { background: #f7fafd; }
.field-table tr:last-child td { border-bottom: none; }
.field-idx  { color: #94a3b8; font-family: monospace; font-size: 11px; white-space: nowrap; }
.field-val  { font-family: 'Cascadia Code', 'Consolas', monospace; word-break: break-all; }
.field-val.empty { color: #c0c0c0; font-style: italic; }
.field-desc { color: var(--imi-muted); font-size: 12px; }
.badge-known {
  background: rgba(0,191,174,.1);
  border: 1px solid rgba(0,191,174,.3);
  color: var(--imi-teal-d);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.badge-unk {
  background: #f1f5f9;
  border: 1px solid var(--imi-border);
  color: #94a3b8;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ── Tool-spezifische Styles: Separatoren (inline via JS, Farb-Klassen) ─── */
.sep-comp { color: var(--imi-teal);    margin: 0 2px; font-weight: 600; }
.sep-sub  { color: #b0609a;            margin: 0 2px; font-weight: 600; }
.sep-rep  { color: #d97706;            margin: 0 4px; font-weight: 700; }
.rep-count { font-size: 11px; color: #d97706; }
.comp-info  { font-size: 11px; color: #94a3b8; }

/* ── Tool-spezifische Styles: Summary Strip ─────────────────────────────── */
.summary-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.sum-tile {
  background: #f0f4f8;
  border: 1px solid var(--imi-border);
  border-radius: 8px;
  padding: 10px 16px;
  text-align: center;
  min-width: 100px;
}
.sum-tile strong { display: block; font-size: 22px; font-weight: 800; color: var(--imi-navy); }
.sum-tile span   { font-size: 12px; color: var(--imi-muted); }

/* ── Tool-spezifische Styles: Message-Info-Tabelle ──────────────────────── */
.msg-info-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 6px; }
.msg-info-table td { padding: 5px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.msg-info-table td:first-child {
  font-weight: 600;
  color: var(--imi-muted);
  width: 200px;
  white-space: nowrap;
}
/* GEÄNDERT v2.0: ehemals inline style; GEÄNDERT v2.1: Styling via CSS-Selektor (kein Klassenname im JS) */
.msg-info-table td:last-child { font-family: monospace; font-size: 13px; }

/* ── Tool-spezifische Styles: Suchzeile ─────────────────────────────────── */
.search-row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.search-row input { flex: 1; }

/* ── Tool-spezifische Styles: Referenztabelle ───────────────────────────── */
/* GEÄNDERT v2.0: ehemals komplett inline styles → eigene Klassen */
.ref-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
  border: 1px solid var(--imi-border);
}
.ref-table th {
  background: #4a5c6a;
  color: rgba(255,255,255,.92);
  padding: 8px 14px;
  text-align: left;
  font-size: 11px;
  letter-spacing: .04em;
}
.ref-table td { padding: 8px 14px; border-bottom: 1px solid rgba(209,220,230,.5); }
.ref-table tbody tr:nth-child(even) td { background: #f7fafd; }
.ref-table tbody tr:last-child td { border-bottom: none; }
.ref-table .ref-seg-id { font-family: monospace; font-weight: 700; color: var(--imi-navy); }
.ref-table .ref-seg-name { font-weight: 600; }
.ref-table .ref-seg-msg { font-size: 12px; color: var(--imi-muted); white-space: nowrap; }
.ref-links { margin-top: 14px; font-size: 14px; color: var(--imi-muted); }
.ref-links a { color: var(--imi-navy); font-weight: 600; text-decoration: none; }
.ref-links a:hover { color: var(--imi-teal-d); }

/* ── Tool-spezifische Styles: Info-Liste in Datenschutz-Box ─────────────── */
/* GEÄNDERT v2.0: ehemals inline style="margin:12px 0 0 20px;line-height:2" */
.info-list { margin: 12px 0 0 20px; line-height: 2; }

/* ── Highlight / Suchergebnis ────────────────────────────────────────────── */
.hl { background: #fff59d; border-radius: 2px; padding: 0 2px; }

/* ── Copy-Flash-Notification ─────────────────────────────────────────────── */
.copy-flash {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--imi-teal-d);
  color: #fff;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  z-index: 999;
}
.copy-flash.show { opacity: 1; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer { text-align: center; font-size: 13px; color: #64748b; margin-top: 40px; padding-bottom: 30px; }
footer a { color: var(--imi-navy); text-decoration: none; margin: 0 10px; }
footer a:hover { color: var(--imi-teal-d); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .box-body, .box-body--text, .box-body--overflow { padding: 16px; }
  .msg-info-table td:first-child { width: auto; white-space: normal; }
  .seg-raw { display: none; } /* Rohtext auf Mobile ausblenden – zu wenig Platz */
  .btn { padding: 10px 14px; font-size: 13px; }
}
