/*
  Shared Design System – gemeinsames Stylesheet für alle Tools unter /tools/.
  Ablage: /tools/shared.css
  Setzt tokens.css voraus (Farben, Schrift, Radius, Abstände, Übergänge) –
  MUSS im HTML nach tokens.css und vor dem tool-eigenen style.css geladen werden:

    <link rel="stylesheet" href="../tokens.css">
    <link rel="stylesheet" href="../shared.css">
    <link rel="stylesheet" href="style.css">

  Enthält: Grund-Layout, Buttons, generische Formularfelder, Footer und
  Leerzustand. Tool-spezifische Bauteile (z. B. spezielle Badges,
  Zeilen-Layouts, Toggles) gehören NICHT hierher, sondern in ein eigenes
  style.css im jeweiligen Tool-Ordner. Rohwerte (Farben, Schriftgrößen,
  Radius, ...) gehören NICHT hierher, sondern in tokens.css.
*/

*{ box-sizing: border-box; }

body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  padding: 24px 16px 60px;
}

/* Für tabellarische/technische Zahlenwerte (Initiative, AC, TP, ...) */
.num{
  font-family: var(--font-mono);
}

/* Zentrierter Seiten-Container, den jedes Tool nutzen kann */
.wrap{
  max-width: 980px;
  margin: 0 auto;
}

/* Bare <header> (ohne .page-header): einfache h1 + Status-Text Zeile,
   z. B. für die Live-Vorschau im Design-Token-Editor. Echte Tool-Seiten
   nutzen stattdessen .page-header weiter unten. */
header{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

header h1{
  font-size: var(--fs-xl);
  letter-spacing: 0.04em;
  margin: 0;
  font-weight: 600;
}
header h1 span{
  color: var(--accent);
}

.status-text{
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Vereinheitlichter Seiten-Header für alle echten Tool-Seiten:
   Home – H1 (mittig) – Alle Tools, darunter Trennlinie, darunter
   Status-Text, darunter der Rest der Seite.

   Markup:
     <header class="page-header">
       <div class="page-header-top">
         <a href="/"><span class="icon">⌂</span><span>Home</span></a>
         <h1>Titel<span>-Zusatz</span></h1>
         <button type="button" data-alle-tools><span class="icon">↩</span><span>Alle Tools</span></button>
       </div>
       <div class="status-text">Status …</div>
     </header>

   .page-header überschreibt bewusst die Flex/Border-Regeln des bloßen
   header{} oben – die Trennlinie sitzt jetzt auf .page-header-top. */
.page-header{
  display: block;
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 20px;
}
.page-header-top{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "home title alle";
  align-items: center;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.page-header-top a,
.page-header-top button{
  display:flex;
  align-items:center;
  gap: 5px;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-md);
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition-fast);
  white-space: nowrap;
}
.page-header-top a:hover,
.page-header-top button:hover{ color: var(--accent); }
.page-header-top .icon{ font-size: 1.25em; line-height: 1; }
.page-header-top a{ grid-area: home; justify-self: start; }
.page-header-top button{ grid-area: alle; justify-self: end; }
.page-header-top h1{
  grid-area: title;
  justify-self: center;
  text-align: center;
}
.page-header .status-text{
  display: block;
  margin-top: 10px;
  text-align: right;
}

@media (max-width: 560px){
  .page-header-top{
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "home alle"
      "title title";
    row-gap: 10px;
  }
}

.toolbar{
  display:flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: 18px;
}

button{
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 14px;
  font-size: var(--fs-sm);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
button:hover{ background: var(--surface-2); border-color: #3a3f4b; }
button:active{ transform: translateY(1px); }

.btn-primary{
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.btn-primary:hover{ background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger{
  color: var(--danger);
  border-color: rgba(179,71,71,0.4);
}
.btn-danger:hover{
  background: rgba(179,71,71,0.12);
  border-color: var(--danger);
}

.spacer{ flex: 1; }

/* Generische Formularfelder */
input[type="text"], .field-num{
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 8px;
  font: inherit;
  font-size: var(--fs-md);
}
.field-num{
  text-align: center;
  -moz-appearance: textfield;
}
.field-num::-webkit-outer-spin-button,
.field-num::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }
input:focus{ outline: 1.5px solid var(--accent); border-color: var(--accent); }
input::placeholder{ color: #565a64; }

/* Leerzustand-Hinweis, z. B. "noch keine Einträge" */
.empty{
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
}

footer{
  max-width: 980px;
  margin: var(--space-xl) auto 0;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  text-align: center;
}

/* Off-Canvas „Alle Tools" – fährt von oben ein, gefüllt von tools-nav.js.
   Struktur/Klassennamen sind Vertrag mit dieser Datei: nicht ohne tools-nav.js ändern. */
.tools-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
  z-index: 100;
}
.tools-overlay.open{
  opacity: 1;
  pointer-events: auto;
}
.tools-panel{
  width: 100%;
  max-width: 640px;
  max-height: min(78vh, 640px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(-100%);
  transition: transform var(--transition-med);
  overflow: hidden;
}
.tools-overlay.open .tools-panel{
  transform: translateY(0);
}
.tools-panel-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md) var(--space-sm);
  border-bottom: 1px solid var(--border);
}
.tools-panel-head h2{
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tools-panel-close{
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.tools-panel-close:hover{ background: var(--surface-2); color: var(--text); }

.tools-list{
  overflow-y: auto;
  padding: var(--space-sm);
}
.tools-list-item{
  display:flex;
  align-items:center;
  gap: var(--space-sm);
  padding: 10px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
}
.tools-list-item:hover,
.tools-list-item:focus-visible{
  background: var(--surface-2);
}
.tools-list-icon{
  flex: none;
  display:flex;
  align-items:center;
  justify-content:center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border);
}
.tools-list-icon svg{ width: 22px; height: 22px; }
.tools-list-meta{ display:flex; flex-direction: column; gap: 2px; min-width: 0; }
.tools-list-title{ font-weight: 600; color: var(--accent); font-size: var(--fs-md); }
.tools-list-desc{
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

body.tools-nav-lock{ overflow: hidden; }

@media (max-width: 480px){
  .tools-panel{ max-height: 85vh; border-radius: 0 0 var(--radius-md) var(--radius-md); }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; }
}