/* Admin-spezifisches Styling — basiert auf style.css.
 * Konzept: KONZEPT §10.2.
 */

.admin-shell {
  display: grid;
  /* minmax(0, 1fr): Die Spalte waechst nicht mit der breiten Submissions-Tabelle mit;
     die Tabelle scrollt in .admin-table-wrap statt der ganzen Seite. */
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

@media (max-width: 768px) {
  .admin-shell { grid-template-columns: 1fr; }
}

.admin-sidebar {
  background: var(--color-bg-soft);
  border-right: 1px solid var(--color-border);
  padding: 1rem;
}

.admin-sidebar h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 600;
  margin: 1rem 0 0.5rem;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-nav a, .admin-nav button {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
}

.admin-nav a:hover, .admin-nav button:hover { background: var(--color-accent-soft); }

.admin-nav a.is-active, .admin-nav button.is-active {
  background: var(--color-accent);
  color: #fff;
  font-weight: 500;
}

.admin-main {
  padding: 1.5rem 2rem 3rem;
  max-width: 1400px;  /* seit 2026-08-04 breiter: Submissions-Tabelle hat mit
                         Channel-Spalte + CRM-Spalte 12 Spalten und braucht Platz. */
}

@media (max-width: 768px) {
  .admin-main { padding: 1rem; }
}

/* --- Stat-Tiles --- */

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-tile {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.stat-tile__label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
}

.stat-tile__value {
  font-size: 1.75rem;
  font-weight: 600;
}

.stat-tile__hint { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 0.25rem; }

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

.admin-table-wrap {
  /* Vertikal + horizontal scrollen im Wrapper (statt in der Page):
     der Scrollbalken bleibt so IM Viewport, statt am Boden einer sehr langen
     Tabelle unter der Falz zu landen. Sticky-Header (siehe .admin-table th)
     braucht zwingend overflow auf dem direkten Parent. */
  max-height: calc(100vh - 260px);
  overflow: auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th, .admin-table td {
  padding: 0.55rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.admin-table th {
  background: var(--color-bg-soft);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  /* Sticky, damit der Header beim Scrollen sichtbar bleibt. */
  position: sticky;
  top: 0;
  z-index: 5;
  /* box-shadow als visuelle Trennlinie unter dem Header, weil border-bottom
     bei sticky-cells nicht mitscrollt. */
  box-shadow: inset 0 -1px 0 var(--color-border);
}

.admin-table tr:hover { background: var(--color-bg-soft); }

.admin-table td.is-deleted, .admin-table tr.is-deleted { color: var(--color-text-muted); font-style: italic; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge--startklar { background: var(--quadrant-4); color: #1c2733; }
.badge--moeglichmacher { background: var(--quadrant-2); color: #1c2733; }
.badge--strukturiert { background: var(--quadrant-3); color: #1c2733; }
.badge--fruehstarter { background: var(--quadrant-1); color: #1c2733; }

.badge--draft { background: #fff5d8; color: #6b5200; }
.badge--published { background: #d4f0d6; color: #1d5b27; }
.badge--archived { background: var(--color-bg-soft); color: var(--color-text-muted); }

/* --- Filter-Bar --- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.filter-bar select, .filter-bar input {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  width: auto;
}

.filter-bar input[type="text"] { min-width: 200px; }
.filter-bar select { padding-right: 2rem; background-position: right 0.6rem center; }

/* --- Survey-Editor --- */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
}

.tabs button {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  margin-bottom: -1px;
}

.tabs button.is-active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.question-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.question-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  display: grid;
  grid-template-columns: 24px 80px 1fr 100px auto;
  gap: 0.75rem;
  align-items: center;
}

.question-item__drag {
  cursor: grab;
  color: var(--color-text-muted);
  text-align: center;
}

.question-item .badge { font-size: 0.7rem; }

/* --- Persona-Cards --- */

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.persona-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.persona-card:hover { border-color: var(--color-accent); box-shadow: var(--shadow-card); }

.persona-card__quadrant {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

/* --- Donut (inline SVG container) --- */

.donut-chart { display: flex; justify-content: center; padding: 0.5rem; }
.donut-chart svg { max-width: 180px; }

.timeseries-chart svg { width: 100%; height: 120px; }

/* --- Modals --- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 39, 51, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(28, 39, 51, 0.3);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* --- Banner --- */

.banner-warn {
  background: #fff5d8;
  border: 1px solid #e0c87a;
  border-left: 4px solid #c79e2f;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.banner-success {
  background: #d4f0d6;
  border-left: 4px solid #2f6f3f;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.banner-error {
  background: #fff5f5;
  border-left: 4px solid #b03a3a;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--color-error);
}

/* --- Diff-Viewer --- */

.diff-block {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  max-height: 320px;
  overflow-y: auto;
}

.diff-line--added { background: #d4f0d6; color: #1d5b27; }
.diff-line--removed { background: #fff0f0; color: #b03a3a; text-decoration: line-through; }
.diff-line--meta { color: var(--color-text-muted); }

/* --- Lists in Persona-Editor --- */

.list-editor-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: start;
  background: var(--color-bg-soft);
  padding: 0.5rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.list-editor-item input { background: var(--color-bg); }

/* ===========================================================================
   Print-Layout fuer die Admin-Detail-Ansicht (Button "Als PDF speichern" ruft
   window.print() auf). Blendet Nav, Inputs, Loeschen-Karte u.ae. aus; alle
   Content-Karten sichtbar, mit sauberen Seitenumbruechen.
   =========================================================================== */
@media print {
  @page { size: A4; margin: 1.5cm; }
  body { background: white; color: black; }
  .admin-sidebar, .admin-nav, .flash, .no-print,
  .filter-bar, textarea, button, input[type="submit"] { display: none !important; }
  .admin-main { padding: 0; margin: 0; max-width: none; }
  .card {
    page-break-inside: avoid;
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
    background: white;
    margin-bottom: 0.6rem;
  }
  h1, h2, h3 { page-break-after: avoid; }
  a { color: black; text-decoration: none; }
  /* Loeschen-Karte und Notiz-Textarea-Card weg (haben keine .no-print, aber
     deren Buttons wuerden ohnehin verschwinden; die Container selbst halten
     wir fuers Volltext-Ergebnis). Wenn die 'Submission loeschen'-Karte stoeren
     sollte, kann sie bei Bedarf eine .no-print-Klasse bekommen. */
}
