/* Modernes, aufgeräumtes Design - eher Teenager als Kind. */
:root {
  --bg: #f7f5f8;
  --card: #ffffff;
  --ink: #1f1b2e;
  --muted: #817c8d;
  --accent: #d6457c;
  --accent-dark: #b7356a;
  --accent-soft: #fbeef4;
  --green: #2bb673;
  --green-dark: #1e9560;
  --line: #ece8f0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(31, 27, 46, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .topbar-title, .card-title, .article-title {
  font-family: "Poppins", "Inter", system-ui, sans-serif;
  letter-spacing: -0.01em;
}

a { color: var(--accent-dark); }

/* ---- Topbar ---- */
.topbar {
  background: var(--card);
  color: var(--ink);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.topbar-title {
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
}

/* ---- Hero-Banner auf der Startseite ---- */
.hero { width: 100%; background: #e6ddf4; line-height: 0; }
.hero img { width: 100%; max-height: 360px; object-fit: cover; display: block; }
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}
.topbar-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.topbar-nav a:hover { color: var(--accent-dark); }

/* ---- Zahnrad-Menü (eingeloggt) ---- */
.menu { position: relative; }
.menu summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--muted);
  padding: 4px;
  border-radius: 8px;
  transition: color 0.15s, transform 0.3s;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { color: var(--accent-dark); }
.menu[open] summary { color: var(--accent-dark); transform: rotate(45deg); }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 190px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.menu-list a,
.menu-list button {
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}
.menu-list a:hover,
.menu-list button:hover { background: var(--accent-soft); color: var(--accent-dark); }
.menu-list hr { border: none; border-top: 1px solid var(--line); margin: 5px 4px; width: auto; }

/* ---- Layout ---- */
.container { max-width: 980px; margin: 0 auto; padding: 28px 20px; }
.narrow { max-width: 620px; }
.muted { color: var(--muted); }
.footer {
  text-align: center;
  color: var(--muted);
  padding: 30px;
  margin-top: 40px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn.big { padding: 13px 26px; font-size: 1.05rem; }
.btn.small { padding: 7px 14px; font-size: 0.85rem; }
.btn.ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1.5px solid var(--line);
}
.btn.ghost:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn.danger { background: transparent; color: #d64545; border: 1.5px solid #f0d0d0; }
.btn.danger:hover { background: #fceaea; border-color: #d64545; }
.btn.danger-solid { background: #e23e3e; color: #fff; border: none; }
.btn.danger-solid:hover { background: #c62f2f; }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { color: var(--accent-dark); }
.inline { display: inline; margin: 0; }

/* ---- Blog-Übersicht (Karten) ---- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(31,27,46,0.12); }
.card-img {
  height: 180px;
  background-size: cover;
  background-position: center;
  background-color: var(--accent-soft);
}
.card-img-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.card-body { padding: 16px 18px 20px; }
.card-title { margin: 0 0 6px; font-size: 1.3rem; }
.card-date { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; }
.card-text { margin: 0; }

/* ---- Einzelner Beitrag ---- */
.article { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.article-img { width: 100%; max-height: 420px; object-fit: cover; display: block; }
.article-title { margin: 0; padding: 24px 28px 4px; font-size: 2rem; }
.article-date { margin: 0; padding: 0 28px; color: var(--muted); }
.article-text { padding: 18px 28px 28px; white-space: pre-wrap; font-size: 1.1rem; }

/* ---- Kommentare ---- */
.comments { margin-top: 40px; }
.comments h2 { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.comment {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}
.comment-name { margin: 0; font-weight: bold; }
.comment-date { color: var(--muted); font-weight: normal; font-size: 0.85rem; }
.comment-text { margin: 4px 0 0; white-space: pre-wrap; }

/* ---- Formulare ---- */
.form, .comment-form { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
label { font-weight: bold; display: flex; flex-direction: column; gap: 6px; }
input[type="text"], input[type="password"], textarea {
  font: inherit;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  width: 100%;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type="file"] { font: inherit; }
textarea { resize: vertical; }
.checkbox { flex-direction: row; align-items: center; gap: 8px; font-weight: normal; }
hr { border: none; border-top: 2px solid var(--line); width: 100%; }

.editor-buttons { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.editor-back { margin-left: auto; }
.current-img .img-wrap { position: relative; display: inline-block; }
.current-img img { max-width: 220px; border-radius: 12px; display: block; margin: 6px 0; }
.img-remove {
  position: absolute;
  top: 12px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(31, 27, 46, 0.6);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}
.img-remove:hover { background: #e23e3e; }
.img-removed-note { color: var(--muted); }
.link-inline {
  background: none;
  border: none;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

/* ---- Beitragsliste (Verwaltung) ---- */
.admin-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; }
.admin-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.post-list { list-style: none; padding: 0; margin: 20px 0 0; }
.post-row {
  position: relative;
  background: var(--card);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 92px 132px 1fr auto auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
}
/* Die ganze Zeile ist anklickbar (öffnet den Beitrag zum Bearbeiten) */
.row-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.post-row:hover { border-color: var(--accent); background: var(--accent-soft); cursor: pointer; }
/* Der Verstecken/Veröffentlichen-Knopf liegt über dem Zeilen-Link */
.post-row .post-row-actions { position: relative; z-index: 2; }

/* ---- Kommentar-Sprechblase ---- */
.comment-bubble {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 25px;
  padding: 0 9px;
  background: var(--accent);
  color: #fff;
  border-radius: 13px;
  font-size: 0.8rem;
  font-weight: 700;
}
.comment-bubble::after {
  content: "";
  position: absolute;
  left: 9px;
  bottom: -3px;
  width: 9px;
  height: 9px;
  background: inherit;
  border-radius: 0 0 0 2px;
  transform: rotate(45deg);
}
.comment-bubble.zero { background: var(--line); color: var(--muted); }
.post-row-date {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.post-row .badge { justify-self: start; }
.post-row-title {
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.post-row-actions .btn.small { font-size: 0.8rem; padding: 6px 12px; }

/* ---- Abonnenten-Zeile (eine Zeile pro Person) ---- */
.sub-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 12px;
}
.sub-email {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sub-date { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.sub-remove { margin-left: 4px; }
.badge { padding: 4px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: bold; }
.badge { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.badge.published { background: #e3f5ec; color: var(--green-dark); }
.badge.draft { background: #f3eefb; color: #7a5bb0; }

/* ---- Anmeldung für Updates ---- */
.subscribe {
  margin-top: 50px;
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 32px 26px;
  text-align: center;
  border: 1px solid var(--line);
}
.subscribe h2 { margin: 0 0 6px; }
.subscribe p { margin: 0 0 16px; color: var(--muted); }
.subscribe-form {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.subscribe-form input {
  max-width: 320px;
  flex: 1 1 240px;
}

/* ---- Löschen-Bereich im Editor ---- */
.danger-sep { margin: 36px 0 18px; }

/* ---- Bestätigungs-Fenster (Modal) ---- */
.modal-overlay[hidden] { display: none; }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 27, 46, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 30px 28px;
  max-width: 430px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(31, 27, 46, 0.35);
  text-align: center;
}
.modal h2 { margin: 0 0 10px; }
.modal p { color: var(--muted); margin: 0; }
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ---- Meldungen ---- */
.error { background: #ffe0e0; color: #b00020; padding: 10px 14px; border-radius: 10px; }
.success { background: #d9f7e7; color: var(--green-dark); padding: 10px 14px; border-radius: 10px; }
.empty { text-align: center; padding: 50px 0; }

/* Kurz-/Lang-Beschriftung für kleine Schirme */
.lbl-mini { display: none; }

/* ===== Tablet & schmaler: Kurz-Beschriftung, damit die drei
   Editor-Knöpfe immer in einer Zeile bleiben ===== */
@media (max-width: 700px) {
  .btn { padding: 9px 14px; font-size: 0.9rem; }
  .btn.big { padding: 11px 18px; font-size: 1rem; }
  .lbl-full { display: none; }
  .lbl-mini { display: inline; }
  .editor-buttons { gap: 8px; }
}

/* ============ Handy / schmaler Bildschirm ============ */
@media (max-width: 560px) {
  .container { padding-left: 16px; padding-right: 16px; }

  /* Beitrags-Liste: Titel oben, darunter Datum/Status/Kommentare + Knopf */
  .post-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
  }
  .post-row-title {
    flex: 1 1 100%;
    order: -1;
    white-space: normal;
    overflow: visible;
  }
  .post-row-date { order: 1; }
  .post-row .badge { order: 2; }
  .comment-bubble { order: 3; }
  .post-row-actions { order: 4; margin-left: auto; }
}
