/* =====================================================================
   atelier.css — Designsystem fürs Backend von mueller-brodmann.de
   Übernimmt Tokens und Stil-Vokabular aus dem Frontend (filigrane
   1px-Borders, Cover-Rahmen-Eckwinkel, Cormorant-Garamond für Akzente,
   Inter für UI-Text, Mono für Caps-Labels).
   ===================================================================== */

:root {
  --ink-0: #050505;
  --ink-1: #0c0c0d;
  --ink-2: #15151a;
  --ink-3: #1f1f25;
  --ink-4: #2a2a32;
  --grey-1: #4a4a52;
  --grey-2: #7a7a82;
  --grey-3: #a8a8b0;
  --grey-4: #d2d2d8;
  --paper: #ededea;
  --paper-soft: #c8c8c4;

  --line: rgba(237, 237, 234, 0.14);
  --line-strong: rgba(237, 237, 234, 0.32);
  --line-bright: rgba(237, 237, 234, 0.55);

  --serif: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --t-fast: 0.18s ease;
  --t-slow: 0.45s cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--ink-0);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
::selection { background: var(--paper); color: var(--ink-0); }
a { color: inherit; text-decoration: none; }

/* ------------ Typografie ------------ */

.eyebrow {
  display: inline-flex; align-items: center; gap: 14px;
  color: var(--grey-3);
  font-family: var(--sans);
  font-size: 10.5px; letter-spacing: 0.4em; text-transform: uppercase;
}
.eyebrow::before {
  content: ""; width: 36px; height: 1px; background: var(--paper);
}

.headline-serif {
  font-family: var(--serif);
  font-weight: 300;
  letter-spacing: -0.012em;
  line-height: 1.04;
}
.headline-serif em { font-style: italic; color: var(--grey-3); }

.label-mono {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--grey-2);
}
.label-mono b { color: var(--paper); font-weight: 400; }

/* ------------ Frame-Komponente (Cover-Rahmen-Eckwinkel) ------------
   Setzt 1px-Outline + filigrane Eckwinkel an die vier Ecken.
   Verwendung: <div class="frame">…<span class="frame-corners"></span>…</div>
   oder <div class="frame frame-glow">…</div>                          */

.frame {
  position: relative;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.18);
}
.frame-corners {
  position: absolute; inset: 0; pointer-events: none;
}
.frame-corners::before, .frame-corners::after,
.frame-corners > i::before, .frame-corners > i::after {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--paper);
}
.frame-corners::before { top: -1px; left: -1px;  border-right: 0; border-bottom: 0; }
.frame-corners::after  { top: -1px; right: -1px; border-left: 0;  border-bottom: 0; }
.frame-corners > i::before { bottom: -1px; left: -1px;  border-right: 0; border-top: 0; }
.frame-corners > i::after  { bottom: -1px; right: -1px; border-left: 0;  border-top: 0; }

/* ------------ Buttons (Cover-Rahmen-Stil) ------------ */

.btn-frame {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  padding: 14px 28px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), gap var(--t-fast);
}
/* Eckwinkel — wie der filigrane Rahmen um den Cover-Bereich, nur in
   Button-Größe. Im Ruhezustand schon sichtbar (nur etwas leiser),
   beim Hover voll und einen Hauch größer. */
.btn-frame::before, .btn-frame::after,
.btn-frame > .corners::before, .btn-frame > .corners::after {
  content: ""; position: absolute; width: 6px; height: 6px;
  border: 1px solid var(--paper);
  opacity: 0.6;
  transition: opacity var(--t-slow), width var(--t-slow), height var(--t-slow);
}
.btn-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.btn-frame::after  { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.btn-frame > .corners { position: absolute; inset: 0; pointer-events: none; }
.btn-frame > .corners::before { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.btn-frame > .corners::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.btn-frame:hover {
  border-color: var(--paper);
  gap: 22px;
}
.btn-frame:hover::before, .btn-frame:hover::after,
.btn-frame:hover > .corners::before, .btn-frame:hover > .corners::after {
  opacity: 1;
  width: 8px;
  height: 8px;
}
.btn-frame:disabled, .btn-frame.is-loading {
  opacity: 0.5; cursor: wait; pointer-events: none;
}
.btn-frame .arrow {
  font-family: var(--serif); font-size: 16px; line-height: 1;
  font-style: italic;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--grey-3);
  font-family: var(--sans);
  font-size: 10.5px; letter-spacing: 0.32em; text-transform: uppercase;
  padding: 6px 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.btn-ghost:hover { color: var(--paper); border-bottom-color: var(--paper); }

.btn-danger { color: #c79090; border-color: rgba(199,144,144,0.28); }
.btn-danger:hover { color: #d4a4a4; border-color: #c79090; }

/* Mini-Knopf (rund, drei Punkte) — z.B. fürs Editor-Bild-Popover */
.btn-dotted {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-bright);
  background: rgba(10,10,12,0.6);
  color: var(--paper);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
  backdrop-filter: blur(2px);
}
.btn-dotted::before {
  content: "•••";
  font-size: 10px; letter-spacing: 0.18em; line-height: 1;
}
.btn-dotted:hover { border-color: var(--paper); background: rgba(10,10,12,0.85); }

/* ------------ Inputs ------------ */

.input-frame {
  width: 100%;
  padding: 14px 16px;
  background: rgba(10,10,12,0.4);
  border: 1px solid var(--line-strong);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.input-frame::placeholder {
  color: var(--grey-2);
  font-style: italic;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.02em;
}
.input-frame:focus {
  border-color: var(--paper);
  background: rgba(10,10,12,0.65);
}
.input-frame:disabled { opacity: 0.5; cursor: not-allowed; }

textarea.input-frame { resize: vertical; min-height: 120px; line-height: 1.6; }

.field {
  display: flex; flex-direction: column; gap: 8px;
}
.field-label {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--grey-2);
}
/* Zwei Felder nebeneinander (Typ + Cat, Host + Port etc.). */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ------------ Cards / Tiles (für Hub) ------------ */

.tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 32px 28px;
  background: rgba(10,10,12,0.45);
  border: 1px solid var(--line);
  min-height: 200px;
  cursor: pointer;
  transition: border-color var(--t-slow), background var(--t-slow), transform var(--t-slow);
}
.tile:hover {
  border-color: var(--line-strong);
  background: rgba(10,10,12,0.7);
  transform: translateY(-2px);
}
.tile:hover .tile-arrow { transform: translateX(6px); }
.tile-num {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.18em;
  color: var(--grey-2);
  margin-bottom: 18px;
}
.tile-title {
  font-family: var(--serif);
  font-size: 30px; font-weight: 300;
  letter-spacing: -0.005em;
  line-height: 1.1;
  margin-bottom: 10px;
}
.tile-title em { font-style: italic; color: var(--grey-3); }
.tile-desc {
  font-size: 13.5px; line-height: 1.6;
  color: var(--grey-3);
  margin-bottom: 28px;
}
.tile-arrow {
  font-family: var(--serif); font-style: italic;
  color: var(--paper);
  font-size: 22px;
  align-self: flex-start;
  transition: transform var(--t-slow);
}

/* ------------ Layout-Helfer ------------ */

.atelier-shell {
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.atelier-bar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 40px;
  background: rgba(5,5,5,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--grey-3);
}
.atelier-bar .left, .atelier-bar .right {
  display: flex; gap: 22px; align-items: center;
}
.atelier-bar .right { justify-content: flex-end; }
.atelier-bar .center { color: var(--paper); letter-spacing: 0.42em; }
.atelier-bar .dot { width: 4px; height: 4px; background: var(--grey-3); border-radius: 50%; display: inline-block; }
/* Alle Links in der Bar bekommen das gleiche Verhalten — egal ob
   nav rechts oder „← Hub"-Back-Link links. So vermeiden wir
   `style="color: var(--grey-3)"`-Inline überall. */
.atelier-bar a {
  color: var(--grey-3);
  transition: color var(--t-fast);
}
.atelier-bar a:hover, .atelier-bar a.active { color: var(--paper); }
/* Markenname links: weiß + großzügiges Letter-Spacing */
.atelier-bar .brand {
  color: var(--paper);
  letter-spacing: 0.42em;
}

.atelier-main {
  flex: 1;
  padding: 80px 40px 120px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

.section-head {
  margin-bottom: 64px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.section-head h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin-top: 18px;
}
.section-head h1 em { font-style: italic; color: var(--grey-3); }

/* Atelier-Footer: schließt jede Sub-Seite mit einer Trennlinie und
   einem Hub-Rückkehr-Button links unten ab. Spiegelt die Bar oben. */
.atelier-foot {
  margin-top: 96px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-start;
}
@media (max-width: 760px) {
  .atelier-foot {
    margin-top: 60px;
    padding-top: 24px;
    justify-content: center;
  }
}

/* Settings-Layout: schmale Spalte, klar abgesetzte Sektionen mit
   Trennlinie statt Box-Karten. Wirkt wie ein Magazin-Editorial. */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 72px;
  max-width: 880px;
}
.settings-section + .settings-section {
  padding-top: 72px;
  border-top: 1px solid var(--line);
}
.settings-h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(28px, 3.6vw, 42px);
  line-height: 1.04;
  letter-spacing: -0.012em;
  margin: 14px 0 16px;
}
.settings-h2 em { font-style: italic; color: var(--grey-3); }

/* Action-Group-Modifier: rechts-justified für Speichern-Buttons. */
.action-group-end { justify-content: flex-end; }

/* Atmosphärischer Vorspann unter Section-Headlines — gleiche Schrift
   wie die Lede auf der Startseite, damit der Editor-Bereich sich
   nicht steril anfühlt. */
.atmospheric-lede {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 18px;
  line-height: 1.55;
  color: var(--grey-4);
  max-width: 56ch;
  margin-bottom: 36px;
}
.atmospheric-lede em { color: var(--grey-3); font-style: italic; }
/* Kleinere Variante für Hinweistexte innerhalb von Modals/Panels. */
.atmospheric-lede.is-mini {
  font-size: 14px;
  margin: 18px 0 0;
  max-width: none;
}

/* ------------ wiederverwendbare Hilfs-Klassen ------------
   Diese Klassen ersetzen wiederholte Inline-Styles in den
   Admin-HTMLs. Wenn neue Muster auftauchen, lieber hier eine
   Klasse anlegen als irgendwo `style="..."` einzustreuen. */

/* Vertikaler Abstands-Stack für Form-Felder. Default: 18px Lücke. */
.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.stack-roomy { gap: 22px; }
.stack-tight { gap: 14px; }

/* Kleiner Hinweis unter einem Input (z.B. „leer lassen für …"). */
.field-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  color: var(--grey-2);
}

/* Empty-State-Notiz für leere Listen (außerhalb von Tabellen). */
.empty-note {
  color: var(--grey-2);
  font-style: italic;
  font-family: var(--serif);
  font-size: 18px;
  padding: 60px 0;
  text-align: center;
}

/* Tabellen-Statuszeilen (Loading, Fehler, leer) — als Klasse auf
   das innere <td> setzen, nicht auf <tr>. */
.tbl-state {
  text-align: center !important;
  padding: 48px !important;
  color: var(--grey-3);
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
}

/* Hinweis auf eine zukünftige Funktion („— folgt in Phase 5"). */
.note-future {
  color: var(--grey-2);
  font-style: italic;
}

/* Gruppe horizontaler Action-Buttons (Cell-Actions, Modal-Footer). */
.action-group {
  display: flex;
  gap: 14px;
  align-items: center;
}

/* Body-Text in Modals (Confirm-Dialog Message). */
.modal-message {
  color: var(--grey-4);
  font-size: 15px;
  line-height: 1.6;
}

/* Klickbare Summary-Zeile im Mono-Caps-Stil (für <details>). */
.summary-mono {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--grey-2);
  cursor: pointer;
  padding: 8px 0;
}
.summary-mono:hover { color: var(--grey-4); }

/* ------------ Modal & Popover ------------ */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  animation: fadeIn var(--t-slow);
}
.modal {
  background: var(--ink-1);
  border: 1px solid var(--line-strong);
  position: relative;
  max-width: 720px; width: 100%;
  max-height: 86vh;
  overflow: auto;
  padding: 40px;
}
.modal-head {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  font-family: var(--serif); font-weight: 300; font-size: 28px; letter-spacing: -0.005em;
}
.modal-foot {
  margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; gap: 16px; justify-content: flex-end;
}

.popover {
  position: absolute;
  background: var(--ink-1);
  border: 1px solid var(--line-strong);
  padding: 6px 0;
  z-index: 60;
  min-width: 160px;
  animation: fadeIn 0.15s ease;
}
.popover button {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0;
  color: var(--grey-4);
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase;
  padding: 10px 18px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.popover button:hover { background: rgba(255,255,255,0.04); color: var(--paper); }
.popover button.popover-divider { border-top: 1px solid var(--line); }

/* ------------ Toast ------------ */

.toast-stack {
  position: fixed; right: 24px; bottom: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 300;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 14px 22px;
  background: var(--ink-1);
  border: 1px solid var(--line-strong);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 12.5px; letter-spacing: 0.04em;
  max-width: 360px;
  animation: toastIn 0.4s cubic-bezier(.2,.7,.2,1);
}
.toast.toast-error { border-color: #6a3535; }
.toast.toast-ok { border-color: #3a6a3a; }

/* ------------ Tabelle ------------ */

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tbl th, .tbl td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl th {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--grey-2);
  font-weight: 400;
  background: rgba(0,0,0,0.4);
  position: sticky; top: 64px;
}
.tbl tr:hover td { background: rgba(255,255,255,0.018); }
.tbl .row-actions { display: flex; gap: 14px; justify-content: flex-end; }
.tbl .status-pill {
  display: inline-block;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--grey-3);
}
.tbl .status-pill.published { color: var(--paper); border-color: var(--line-bright); }
.tbl .status-pill.draft { color: #c7b690; border-color: rgba(199,182,144,0.3); }
.tbl .status-pill.suggestion { color: #90b6c7; border-color: rgba(144,182,199,0.3); }
.tbl .status-pill.disabled { color: var(--grey-2); }

/* ------------ Animationen ------------ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------------ Responsive ------------ */

@media (max-width: 760px) {
  .atelier-main { padding: 40px 24px 80px; }
  .atelier-bar { padding: 14px 20px; font-size: 9px; }
}
