/* MeinOrt Verwaltung – Minimal Admin CSS
   Primärfarbe: #2E4F63 (Wältersbach-Blau)
   Akzent: #A55C38 (Herbstlaub-Kupfer)
   Hintergrund: #F8F6F1
   ────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --c-primary:   #2E4F63;
  --c-primary-d: #213a4b;
  --c-accent:    #A55C38;
  --c-bg:        #F8F6F1;
  --c-surface:   #ffffff;
  --c-border:    #ddd8d0;
  --c-text:      #2a2420;
  --c-muted:     #6b6560;
  --c-success:   #2e6b3a;
  --c-error:     #8A3E34;
  --c-info:      #2E4F63;
  --radius:      6px;
  --shadow:      0 1px 4px rgba(0,0,0,.08);
}

html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background:  var(--c-bg);
  color:       var(--c-text);
  margin: 0;
  line-height: 1.55;
}

/* ─── Navigationsleiste ─────────────────────────────────────────────────── */

.admin-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--c-primary);
  color: #fff;
  padding: .6rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-brand {
  font-weight: 700;
  letter-spacing: .03em;
  margin-right: auto;
}

.nav-links { display: flex; gap: .75rem; }

.nav-links a {
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .9rem;
  padding: .2rem .4rem;
  border-radius: var(--radius);
}
.nav-links a:hover,
.nav-links a.active { color: #fff; background: rgba(255,255,255,.15); }

.nav-logout button {
  background: transparent;
  border: 1px solid rgba(255,255,255,.4);
  color: rgba(255,255,255,.85);
  padding: .25rem .7rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .85rem;
}
.nav-logout button:hover { background: rgba(255,255,255,.12); }

/* ─── Haupt-Content ─────────────────────────────────────────────────────── */

.admin-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.page-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.page-header h2 { margin: 0; font-size: 1.4rem; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */

.card {
  background:    var(--c-surface);
  border:        1px solid var(--c-border);
  border-radius: var(--radius);
  padding:       1.25rem;
  margin-bottom: 1rem;
  box-shadow:    var(--shadow);
}
.card h3 { margin: 0 0 .75rem; font-size: 1rem; color: var(--c-primary); }

/* ─── Badges ────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-admin   { background: #d4e3ed; color: #1a3346; }
.badge-editor  { background: #e8ede3; color: #2b3d25; }
.badge-active  { background: #d6edda; color: #1a4526; }
.badge-inactive { background: #f0e4e2; color: #5c2020; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: .5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn:active { opacity: .75; }

.btn-primary {
  background: var(--c-primary);
  color: #fff;
}
.btn-secondary {
  background: var(--c-bg);
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
}
.btn-danger {
  background: var(--c-error);
  color: #fff;
}
.btn-full { width: 100%; text-align: center; }
.btn-sm   { padding: .25rem .6rem; font-size: .8rem; }

.btn-delete-user {
  background: transparent;
  border: 1px solid #b91c1c;
  color: #b91c1c;
  padding: .25rem .6rem;
  font-size: .8rem;
  border-radius: var(--radius);
  font-family: inherit;
  cursor: pointer;
}
.btn-delete-user:hover { background: #b91c1c; color: #fff; }

/* ─── Alerts ────────────────────────────────────────────────────────────── */

.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-success { background: #d6edda; color: #1a4526; border: 1px solid #a8d5b0; }
.alert-error   { background: #f0e4e2; color: #5c2020; border: 1px solid #d9a9a4; }
.alert-info    { background: #d4e3ed; color: #1a3346; border: 1px solid #9bbcd1; }

/* ─── Auth-Layout (Login, Register) ─────────────────────────────────────── */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-box {
  background:    var(--c-surface);
  border:        1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow:    var(--shadow);
  padding:       2rem 2.25rem;
  width:         100%;
  max-width:     400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-logo-icon { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.auth-logo h1   { margin: 0; font-size: 1.3rem; color: var(--c-primary); }

/* ─── Passkey Status ────────────────────────────────────────────────────── */

.passkey-status, .magic-status {
  margin-top: .75rem;
  padding: .6rem .8rem;
  border-radius: var(--radius);
  font-size: .875rem;
  text-align: center;
}
.status-info  { background: #d4e3ed; color: #1a3346; }
.status-error { background: #f0e4e2; color: #5c2020; }

/* ─── Recovery / Magic-Link ─────────────────────────────────────────────── */

.recovery-details {
  margin-top: 1.25rem;
  border-top: 1px solid var(--c-border);
  padding-top: 1rem;
}
.recovery-details summary {
  color: var(--c-muted);
  font-size: .875rem;
  cursor: pointer;
  list-style: none;
}
.recovery-details summary::before { content: '▸ '; }
.recovery-details[open] summary::before { content: '▾ '; }

.magic-form {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-top: .75rem;
}
.magic-form label { font-size: .875rem; color: var(--c-muted); }
.magic-form input {
  width: 100%;
  padding: .45rem .65rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
}

/* ─── Tabelle ───────────────────────────────────────────────────────────── */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: .5rem .6rem;
  border-bottom: 1px solid var(--c-border);
}
.admin-table th { color: var(--c-muted); font-weight: 600; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.row-inactive { opacity: .55; }

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  align-items: center;
}
.inline-form { display: inline; }

/* ─── Formular-Grid (Nutzer anlegen) ────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  align-items: end;
}
.form-grid label { display: flex; flex-direction: column; gap: .25rem; font-size: .875rem; }
.form-grid input,
.form-grid select {
  padding: .4rem .65rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
}

/* ─── DL-Grid (Kontoinfo) ───────────────────────────────────────────────── */

.dl-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .3rem .75rem;
  margin: 0;
  font-size: .9rem;
}
.dl-grid dt { color: var(--c-muted); font-weight: 500; }
.dl-grid dd { margin: 0; }

/* ─── Credential-Liste ──────────────────────────────────────────────────── */

.cred-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.cred-list li {
  display: flex;
  justify-content: space-between;
  font-size: .875rem;
  padding: .4rem .6rem;
  background: var(--c-bg);
  border-radius: var(--radius);
}
.cred-label { font-weight: 500; }
.cred-date  { color: var(--c-muted); font-size: .8rem; }

/* ─── Reg-Link Anzeige ──────────────────────────────────────────────────── */

.reg-link {
  display: block;
  word-break: break-all;
  font-size: .8rem;
  margin: .4rem 0;
}
.btn-copy {
  font-size: .8rem;
  padding: .2rem .6rem;
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

/* ─── Hilfsklassen ──────────────────────────────────────────────────────── */

.text-muted  { color: var(--c-muted); }
.text-center { text-align: center; }

/* ─── Dashboard-Sections ────────────────────────────────────────────────── */

.dashboard-section { margin-bottom: 1.5rem; }
.dashboard-section > h3 {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--c-muted);
  margin: 0 0 .65rem;
}

/* ─── Inhaltstyp-Kacheln (Dashboard) ───────────────────────────────────── */

.content-type-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .75rem;
}

.content-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: 1.25rem .75rem 1rem;
  background: var(--c-surface);
  border: 2px solid var(--tile-color, var(--c-primary));
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--c-text);
  box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.content-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.content-tile-emoji  { font-size: 1.75rem; line-height: 1; }
.content-tile-label  { font-size: .8rem; font-weight: 600; text-align: center; }
.content-tile-count  {
  font-size: .7rem;
  background: var(--tile-color, var(--c-primary));
  color: #fff;
  border-radius: 100px;
  padding: .1rem .5rem;
  min-width: 1.5rem;
  text-align: center;
}

/* ─── Content-Listen-Karten (Listenansicht) ─────────────────────────────── */

.content-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: .5rem;
}

.content-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--card-accent, var(--c-primary));
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.content-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.content-card-img {
  height: 110px;
  background-size: cover;
  background-position: center;
}
.content-card-img--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: var(--c-bg);
  color: var(--c-border);
}
.content-card-body {
  padding: .75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.content-card-title { font-size: .9rem; font-weight: 600; margin: 0; }
.content-card-meta  { font-size: .75rem; color: var(--c-muted); margin: 0; }

.content-card--new {
  align-items: center;
  justify-content: center;
  min-height: 150px;
  border-style: dashed;
  color: var(--c-muted);
  font-size: .85rem;
  gap: .5rem;
}
.content-card-new-icon {
  font-size: 2rem;
  font-weight: 300;
  color: var(--card-accent, var(--c-primary));
}

.empty-hint { color: var(--c-muted); grid-column: 1/-1; }

/* ─── Tab-Navigation (json-sections) ───────────────────────────────────── */

.tab-nav {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--c-border);
  margin-bottom: 1rem;
}
.tab-link {
  padding: .45rem .85rem;
  border-radius: var(--radius) var(--radius) 0 0;
  text-decoration: none;
  color: var(--c-muted);
  font-size: .875rem;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  transition: color .1s;
}
.tab-link:hover { color: var(--c-text); background: var(--c-bg); }
.tab-link.active {
  color: var(--c-primary);
  font-weight: 600;
  background: var(--c-surface);
  border-color: var(--c-border);
  margin-bottom: -2px;
}

/* ─── Editor-Layout ─────────────────────────────────────────────────────── */

.editor-form { display: flex; flex-direction: column; gap: 1.25rem; }

.editor-fields {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  box-shadow: var(--shadow);
}

.editor-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.editor-section h3 {
  margin: 0 0 .75rem;
  font-size: .9rem;
  color: var(--c-primary);
  font-weight: 600;
}

.editor-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
}

/* ─── Formular-Felder (Editor) ──────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.form-group label {
  font-size: .825rem;
  font-weight: 500;
  color: var(--c-muted);
}
.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .45rem .65rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
  background: var(--c-bg);
  transition: border-color .12s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  background: #fff;
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .875rem;
  cursor: pointer;
}
.checkbox-wrap input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--c-primary);
}

.req { color: var(--c-error); }

/* Event-Felder-Gruppe */
.field-group-collapse {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.field-group-collapse summary {
  padding: .6rem .75rem;
  background: var(--c-bg);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  color: var(--c-muted);
  list-style: none;
  user-select: none;
}
.field-group-collapse summary::before { content: '▸ '; }
.field-group-collapse[open] summary::before { content: '▾ '; }
.field-group-inner {
  padding: .85rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

/* ─── Markdown-Editor ───────────────────────────────────────────────────── */

.md-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-bottom: .4rem;
}
.md-tool {
  padding: .25rem .55rem;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: inherit;
  font-size: .8rem;
  cursor: pointer;
  line-height: 1.4;
}
.md-tool:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

.md-editor {
  width: 100%;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: .875rem;
  line-height: 1.65;
  padding: .65rem .75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-bg);
  resize: vertical;
  min-height: 260px;
  color: var(--c-text);
}
.md-editor:focus {
  outline: none;
  border-color: var(--c-primary);
  background: #fff;
}

/* ─── Bild-Editor ───────────────────────────────────────────────────────── */

.image-editor-wrap { display: flex; flex-direction: column; gap: .75rem; }

.current-img-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  display: block;
}
.current-img-preview .meta { font-size: .75rem; color: var(--c-muted); margin: .25rem 0 0; }

.image-editor {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: .85rem;
  background: var(--c-bg);
}

.image-editor-canvas-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
}
#image-preview-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  cursor: default;
}

.image-editor-controls { margin-top: .75rem; }
.image-editor-controls .form-group { max-width: 360px; }

.image-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .6rem;
}

.btn-delete-outline {
  background: transparent;
  border: 1px solid var(--c-error);
  color: var(--c-error);
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
  cursor: pointer;
}
.btn-delete-outline:hover { background: var(--c-error); color: #fff; }

#processed-preview { margin-top: .75rem; }
#processed-preview .meta { font-size: .75rem; color: var(--c-muted); margin-bottom: .35rem; }
#processed-img-thumb {
  max-width: 100%;
  max-height: 150px;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  display: block;
}

/* ─── Löschen-Button ────────────────────────────────────────────────────── */

.btn-delete {
  background: transparent;
  border: 2px solid #b91c1c;
  color: #b91c1c;
  padding: .45rem .9rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
  margin-left: auto;
}
.btn-delete:hover { background: #fee2e2; }
.btn-delete--confirm {
  background: #b91c1c !important;
  color: #fff !important;
  border-color: #991b1b !important;
}

/* ─── Zurück-Link ───────────────────────────────────────────────────────── */

.btn-back {
  font-size: .8rem;
  color: var(--c-muted);
  text-decoration: none;
  display: block;
  margin-bottom: .2rem;
}
.btn-back:hover { color: var(--c-primary); }

/* ─── Hilfsklassen ──────────────────────────────────────────────────────── */

.text-muted  { color: var(--c-muted); }
.text-center { text-align: center; }

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .admin-table { font-size: .8rem; }
  .action-cell { flex-direction: column; align-items: flex-start; }
  .content-type-tiles { grid-template-columns: repeat(3, 1fr); }
  .content-card-grid  { grid-template-columns: repeat(2, 1fr); }
  .editor-actions { flex-wrap: wrap; }
  .page-header { flex-wrap: wrap; gap: .5rem; }
}
