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

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

/* ── Base & Layout ───────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--imi-bg);
  color: #333;
  line-height: 1.6;
  font-size: 15px;
}
.container {
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
}

/* ── 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(90deg, var(--imi-light), #f4faff);
  border-left: 5px solid var(--imi-navy);
  padding: 24px 28px;
  border-radius: 4px;
  margin-bottom: 22px;
}
.imi-intro h2 { margin-bottom: 10px; color: var(--imi-navy); font-size: 20px; }
.imi-intro p  { font-size: 15px; color: #444; }

/* ── 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: var(--imi-navy);
  color: #fff;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.box-body { padding: 24px 28px; }

/* ── Formular-Elemente ───────────────────────────────────────────────────── */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--imi-muted);
  margin-bottom: 4px;
  margin-top: 14px;
}
label:first-of-type { margin-top: 0; }
input[type=text],
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--imi-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #333;
  transition: border .2s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--imi-navy);
  box-shadow: 0 0 0 3px rgba(11,60,93,.12);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all .2s;
  font-family: inherit;
  min-height: 44px;
}
.btn:focus-visible { outline: 3px solid var(--imi-teal); outline-offset: 2px; }
.btn-primary  { background: var(--imi-navy);  color: #fff; }
.btn-primary:hover  { background: #1565a0; }
.btn-accent   { background: var(--imi-teal);  color: #fff; }
.btn-accent:hover   { background: var(--imi-teal-d); }
.btn-outline  { background: #fff; color: var(--imi-navy); border: 2px solid var(--imi-navy); }
.btn-outline:hover  { background: var(--imi-navy); color: #fff; }
.btn-danger   { background: #ef5350; color: #fff; border: none; }
.btn-danger:hover   { background: #c62828; }
.btn-sm  { padding: 6px 12px; font-size: 12px; min-height: 32px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ── Grid-Helpers ────────────────────────────────────────────────────────── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Tool-spezifische Styles ─────────────────────────────────────────────── */

/* Toolbar */
.toolbar-right { display: flex; gap: 8px; align-items: center; }
.toolbar-body {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  align-items: center;
  padding: 14px 20px;
}
.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tool-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--imi-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.hint-text {
  font-size: 12px;
  color: var(--imi-muted);
  font-style: italic;
}
.mode-btn.active {
  background: var(--imi-navy);
  color: #fff;
  border-color: var(--imi-navy);
}

/* Color swatches */
.color-swatches { display: flex; gap: 6px; align-items: center; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  padding: 0;
  min-height: unset;
}
.swatch:hover { transform: scale(1.2); }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 2px #333; }

/* Export group */
.export-group {
  display: flex;
  align-items: center;
  gap: 0;
}
.export-group .btn { border-radius: 6px 0 0 6px; border-right: none; }
.export-select {
  height: 32px;
  padding: 0 6px;
  border: 2px solid var(--imi-navy);
  border-left: none;
  border-radius: 0 6px 6px 0;
  font-size: 11px;
  font-family: inherit;
  background: #fff;
  color: var(--imi-navy);
  cursor: pointer;
  font-weight: 600;
  width: auto;
}
.export-select:focus { outline: none; }

/* Zoom display */
.size-display {
  font-size: 12px;
  font-weight: 700;
  color: var(--imi-navy);
  min-width: 42px;
  text-align: center;
  display: inline-block;
}

/* Grid toggle */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--imi-muted);
  cursor: pointer;
  user-select: none;
}
.toggle-label input[type=checkbox] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--imi-navy);
}

/* Canvas area */
.canvas-box { overflow: hidden; }
.canvas-body {
  padding: 0;
  position: relative;
  /* Gitter wird auf Canvas gezeichnet, CSS-bg als Fallback */
  background: #f0f4f8;
  height: 560px;
  overflow: hidden;
  cursor: default;
}
#mindmap-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#node-label-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* Inline-Edit input on canvas */
.node-inline-edit {
  position: absolute;
  border: 2px solid var(--imi-teal);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #333;
  outline: none;
  z-index: 10;
  pointer-events: all;
  min-width: 80px;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

/* ── 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) {
  .grid2 { grid-template-columns: 1fr; }
  .box-body { padding: 16px; }
  .toolbar-body { padding: 12px 14px; gap: 12px; }
  .canvas-body { height: 380px; }
  .toolbar-right { flex-wrap: wrap; }
}
