/* ===================================================================== */
/* Lausitz Admin — Steuerzentrale                                          */
/*                                                                         */
/* Visuell ans Public-Frontend angeglichen (gleiches Dark-Theme +          */
/* #d94c3d Accent, gleiche Display-Font, gleiche Card-Sprache). Layout    */
/* nimmt das Muster von lausitz.app auf: TopBar mit Suche + Segmented     */
/* Tabs + Sidebar-Filter + Card-Grid in der Mitte.                        */
/* ===================================================================== */

:root {
  /* Mirror der Public-Variablen aus apps/web/styles.css */
  --bg: #0c0d10;
  --surface: rgba(255,255,255,0.04);
  --surface-2: rgba(255,255,255,0.08);
  --panel: rgba(18,19,23,0.94);
  --line: rgba(255,255,255,0.08);
  --text: #f6f7fa;
  --muted: #9da5b4;
  --accent: #d94c3d;
  --accent-soft: rgba(217,76,61,0.18);
  --accent-deep: #8b2a20;
  --accent-ink: #fff;
  --success: #d4ff1d;
  --danger: #ff6a78;
  --display: 'Iowan Old Style', 'Charter', 'Georgia', 'Times New Roman', serif;
  --gutter: clamp(20px, 4vw, 40px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.eyebrow {
  margin: 0; color: var(--muted);
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
}

/* ================ TOP BAR ================ */
.admin-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 14px var(--gutter);
  background: rgba(12,13,16,0.94);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: baseline; gap: 6px;
  font-family: var(--display); font-weight: 700;
  font-size: 1.15rem; letter-spacing: 0.02em;
  text-decoration: none; color: var(--text);
  white-space: nowrap;
}
.brand em { color: var(--accent); font-style: normal; }
.brand small { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; margin-left: 12px; }
.topbar-search {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.topbar-search:focus-within { border-color: var(--accent); background: rgba(255,255,255,0.06); }
.topbar-search svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.topbar-search input {
  flex: 1; border: 0; background: transparent; outline: none;
  color: var(--text); font-size: 0.92rem;
}
.topbar-actions { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.topbar-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line);
  color: var(--muted); text-decoration: none; font-size: 0.86rem;
  transition: color 0.14s ease, border-color 0.14s ease;
}
.topbar-link:hover { color: var(--text); border-color: rgba(255,255,255,0.18); }
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px;
  background: var(--accent); color: #fff; border: 0;
  font-weight: 600; font-size: 0.92rem;
  box-shadow: 0 8px 24px rgba(217,76,61,0.25);
  transition: background 0.14s ease, transform 0.14s ease;
}
.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); font-size: 0.88rem;
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px; border-radius: 999px;
  background: rgba(255,106,120,0.1); border: 1px solid rgba(255,106,120,0.32);
  color: var(--danger); font-size: 0.88rem;
}
.btn-danger:hover { background: rgba(255,106,120,0.22); }

/* ================ TABS ================ */
.admin-tabs {
  display: flex; gap: 28px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  background: rgba(12,13,16,0.92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  position: sticky; top: 64px; z-index: 25;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs button {
  position: relative;
  padding: 16px 2px;
  background: transparent; border: 0; color: var(--muted);
  font-size: 0.92rem; font-weight: 500;
  white-space: nowrap;
  transition: color 0.12s ease;
}
.admin-tabs button:hover { color: var(--text); }
.admin-tabs button.active { color: var(--text); }
.admin-tabs button.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent);
}
.admin-tabs button .tab-count {
  display: inline-block;
  margin-left: 6px; padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
.admin-tabs button.active .tab-count { background: var(--accent-soft); color: var(--accent); }

/* ================ MAIN SHELL ================ */
.admin-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
}
.admin-sidebar {
  border-right: 1px solid var(--line);
  padding: 28px var(--gutter) 60px 24px;
  display: grid; gap: 22px;
  align-content: start;
  min-height: calc(100vh - 113px);
}
.admin-sidebar h4 {
  margin: 0; font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  font-weight: 600;
}
.filter-group { display: grid; gap: 8px; }
.filter-pill {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  color: var(--muted); font-size: 0.88rem; text-align: left;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.filter-pill:hover { color: var(--text); background: var(--surface); }
.filter-pill.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(217,76,61,0.32); }
.filter-pill .count {
  font-variant-numeric: tabular-nums;
  color: var(--muted); font-size: 0.78rem;
}
.filter-pill.active .count { color: var(--accent); }
.filter-reset {
  margin-top: 8px;
  padding: 8px 12px; border-radius: 10px;
  background: transparent; border: 1px solid var(--line);
  color: var(--muted); font-size: 0.84rem;
  width: 100%; text-align: center;
}
.filter-reset:hover { color: var(--text); border-color: rgba(255,255,255,0.18); }

/* ================ CONTENT AREA ================ */
.admin-content {
  padding: 28px var(--gutter) 80px;
}
.content-head {
  display: flex; justify-content: space-between; align-items: end;
  gap: 14px;
  margin-bottom: 22px;
}
.content-head h2 {
  margin: 0;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
  letter-spacing: -0.02em;
}
.content-head .result-count { color: var(--muted); font-size: 0.86rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.card-grid.is-empty {
  display: block;
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
}
.card-grid.is-empty p { margin: 0 0 6px; font-size: 0.95rem; }
.card-grid.is-empty .hint { font-size: 0.82rem; color: rgba(255,255,255,0.4); }

.item-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.item-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.18);
  box-shadow: 0 12px 28px rgba(0,0,0,0.4);
}
.item-card .poster {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  overflow: hidden;
}
.item-card[data-kind="audio"] .poster { aspect-ratio: 1 / 1; }
.item-card[data-kind="ebook"] .poster { aspect-ratio: 9 / 12; }
.item-card .poster img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.item-card .poster-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--display); font-size: 3rem; font-weight: 700;
  color: rgba(255,255,255,0.4);
}
.item-card .badges {
  position: absolute; top: 8px; left: 8px;
  display: flex; gap: 4px;
}
.item-card .badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.7); color: #fff;
  font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.item-card .badge.tier-rental { background: rgba(245,158,11,0.85); color: #000; }
.item-card .badge.tier-plan { background: rgba(76,217,123,0.85); color: #000; }
.item-card .badge.tier-registered { background: rgba(77,119,214,0.85); color: #fff; }
.item-card .badge.tier-public { display: none; }
.item-card .badge.featured { background: var(--accent); color: #fff; }
.item-card .meta {
  padding: 12px 14px 14px;
  display: grid; gap: 4px;
}
.item-card .meta-row {
  display: flex; gap: 6px; align-items: center;
  font-size: 0.72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.item-card .meta-row .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.item-card .title {
  margin: 2px 0 0;
  font-family: var(--display); font-weight: 700;
  font-size: 1rem; line-height: 1.2;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.item-card .tagline {
  margin: 0; color: var(--muted);
  font-size: 0.82rem; line-height: 1.4;
  overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ================ EDITOR DRAWER ================ */
.editor-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: stretch end;
  background: rgba(0,0,0,0.6);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.editor-drawer {
  width: min(680px, 100%); height: 100%;
  overflow-y: auto;
  background: var(--bg);
  border-left: 1px solid var(--line);
  animation: slideIn 0.22s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0 } to { transform: none; opacity: 1 } }
.editor-topbar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px;
  background: rgba(12,13,16,0.95);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
.editor-topbar .eyebrow-stack { flex: 1; }
.editor-topbar h3 {
  margin: 2px 0 0;
  font-family: var(--display); font-weight: 700;
  font-size: 1.15rem;
}
.editor-topbar .draft-badge {
  padding: 3px 10px; border-radius: 999px;
  background: rgba(245,158,11,0.18); color: #f59e0b;
  font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 16px; height: 16px; }

.editor-form {
  padding: 24px;
  display: grid; gap: 16px;
}
.editor-form label {
  display: grid; gap: 6px;
  color: var(--muted);
  font-size: 0.78rem; letter-spacing: 0.04em;
}
.editor-form label > span:first-child { font-weight: 500; }
.editor-form input,
.editor-form textarea,
.editor-form select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.editor-form input:focus,
.editor-form textarea:focus,
.editor-form select:focus {
  outline: none; border-color: var(--accent); background: rgba(255,255,255,0.06);
}
.editor-form textarea { resize: vertical; min-height: 80px; }
.editor-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface);
}
.checkbox-row input { width: auto; padding: 0; }
.checkbox-row span { font-size: 0.92rem; color: var(--text); }
.editor-actions {
  position: sticky; bottom: 0;
  display: flex; gap: 10px;
  padding: 16px 24px;
  margin: 12px -24px -24px;
  background: rgba(12,13,16,0.95);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}
.editor-actions .btn-primary { flex: 1; justify-content: center; }
.field-hint { margin: -8px 0 0; font-size: 0.78rem; color: var(--muted); min-height: 1em; }
.field-hint.is-success { color: var(--accent); }
.field-hint.is-error { color: var(--danger); }

/* ================ ASSET DROPZONE ================ */
.asset-drop {
  display: grid; place-items: center;
  padding: 28px 20px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,0.2);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.asset-drop:hover, .asset-drop.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.asset-drop.is-uploading { pointer-events: none; opacity: 0.7; }
.asset-drop.is-uploading::after {
  content: 'Lädt…'; margin-left: 8px; color: var(--accent); font-weight: 600;
}
.asset-drop-label { margin: 0; font-size: 0.88rem; color: var(--muted); text-align: center; }
.asset-list { display: grid; gap: 6px; margin-top: 10px; }
.asset-list:empty { display: none; }
.asset-row {
  display: grid; grid-template-columns: auto 1fr auto auto;
  gap: 12px; align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: rgba(0,0,0,0.2);
  font-size: 0.85rem;
}
.asset-row .asset-kind {
  padding: 2px 8px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent);
}
.asset-row .asset-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-row .asset-size { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.75rem; }
.asset-row .asset-unlink {
  padding: 4px 10px; border-radius: 6px;
  background: rgba(255,80,80,0.1);
  border: 1px solid rgba(255,80,80,0.3);
  color: var(--danger); font-size: 0.74rem;
}
.asset-row .asset-unlink:hover { background: rgba(255,80,80,0.2); }

/* ================ PLAN PICKER ================ */
.plan-picker > span { display: block; margin-bottom: 6px; }
.plan-picker-list {
  display: grid; gap: 2px;
  padding: 6px;
  border: 1px solid var(--line); border-radius: 8px;
  max-height: 180px; overflow-y: auto;
  background: rgba(0,0,0,0.2);
}
.plan-row {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 10px;
  padding: 8px 10px;
  cursor: pointer; border-radius: 6px;
}
.plan-row:hover { background: rgba(255,255,255,0.04); }
.plan-row input[type="checkbox"] { width: auto; padding: 0; }
.plan-row-name { font-size: 0.92rem; color: var(--text); }
.plan-row-meta {
  font-size: 0.68rem; color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* ================ RESPONSIVE ================ */
@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; padding: 18px var(--gutter); }
  .admin-tabs { top: 64px; }
  .topbar-search { max-width: none; }
}
@media (max-width: 640px) {
  .admin-topbar { gap: 8px; padding: 12px 16px; }
  .topbar-actions .topbar-link { display: none; }
  .brand small { display: none; }
  .editor-form { padding: 18px; }
  .editor-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   BUG-REPORTS TAB
   ============================================================ */
.bug-filters {
  display: flex; gap: 10px; align-items: center;
  padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.bug-filters select {
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 13px;
}
.bug-filters .filter-pill {
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 13px;
}
.bug-filters .filter-pill:hover { background: var(--surface-2); }
.bug-list {
  display: grid; gap: 4px;
  max-height: calc(100vh - 240px); overflow-y: auto;
}
.bug-row {
  display: grid;
  grid-template-columns: 120px 80px 80px 1fr auto 160px;
  align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left; cursor: pointer; font-family: inherit;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.bug-row:hover { background: var(--surface-2); border-color: var(--line-strong); }
.bug-cell { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bug-date { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bug-snippet { color: var(--text); }
.bug-user { color: var(--muted); font-size: 12px; text-align: right; }
.bug-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 10px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: #1a1d23;
}
.bug-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.bug-tag {
  display: inline-block; padding: 2px 8px;
  background: rgba(217,76,61,0.15); color: var(--accent);
  border-radius: 999px; font-size: 10px; font-weight: 600;
}
.bug-empty { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 14px; }

.bug-detail {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(520px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop, 0 30px 60px -20px rgba(0,0,0,0.7));
  overflow-y: auto;
  z-index: 60;
  animation: bugSlide 0.18s ease;
}
@keyframes bugSlide { from { transform: translateX(20px); opacity: 0 } to { transform: none; opacity: 1 } }
.bug-detail-head {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.bug-detail-head h3 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.bug-detail-close {
  width: 32px; height: 32px;
  border: 0; background: transparent; color: var(--muted);
  font-size: 1.5rem; cursor: pointer; border-radius: 50%;
}
.bug-detail-close:hover { background: var(--surface-2); color: var(--text); }
.bug-detail-body { padding: 18px 20px 24px; }
.bug-detail-comment {
  margin: 0 0 14px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px; line-height: 1.5;
  white-space: pre-wrap;
}
.bug-detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.bug-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 16px;
}
.bug-detail-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.bug-detail-grid select {
  padding: 8px 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px;
}
.bug-detail-meta {
  display: grid; grid-template-columns: 100px 1fr; gap: 4px 12px;
  font-size: 12px; margin: 0 0 18px;
}
.bug-detail-meta dt { color: var(--muted); font-weight: 600; }
.bug-detail-meta dd { margin: 0; color: var(--text); word-break: break-word; }
.bug-detail-meta code { font-family: var(--mono, monospace); font-size: 11px; }
.bug-ua { display: block; max-height: 60px; overflow-y: auto; }
.bug-detail-section { margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.bug-detail-section summary { padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 13px; }
.bug-detail-section[open] summary { border-bottom: 1px solid var(--line); }
.bug-console { width: 100%; font-family: var(--mono, monospace); font-size: 11px; border-collapse: collapse; }
.bug-console th, .bug-console td { padding: 6px 10px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.bug-console th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 10px; }
.bug-console-error td { color: #ff6a78; }
.bug-console-warn td { color: #f59e0b; }
.bug-snapshot { padding: 12px; font-family: var(--mono, monospace); font-size: 11px; overflow-x: auto; max-height: 320px; margin: 0; }
.bug-screenshot-link { display: block; padding: 12px; }
.bug-screenshot {
  width: 100%; height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: zoom-in;
  transition: opacity 0.14s ease;
}
.bug-screenshot:hover { opacity: 0.9; }
