/* ─── Reset & Basis ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --secondary-bg: #f1f5f9;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --bg: #ffffff;
  --header-bg: #1e293b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ────────────────────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

main.container { flex: 1; }

/* ─── Header ────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--header-bg);
  color: #fff;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 1rem;
}

.site-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.nav-link {
  color: #cbd5e1;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: color 0.15s;
}
.nav-link:hover, .nav-link.active { color: #fff; text-decoration: none; }

/* ─── Footer ────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--secondary-bg);
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}

.btn-primary   { background: var(--primary);   color: #fff; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; color: #fff; }

.btn-secondary { background: var(--secondary-bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; text-decoration: none; color: var(--text); }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); text-decoration: none; color: #fff; }

.btn-sm  { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.btn-full { width: 100%; text-align: center; }

/* ─── Formular-Elemente ─────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.input-text, .input-textarea, .input-file {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s;
}

.input-text:focus, .input-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.input-textarea { resize: vertical; min-height: 100px; }
.input-wide { max-width: 480px; }
.input-file { padding: 0.4rem; }

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

.hint { font-size: 0.82rem; color: var(--muted); margin-top: 0.25rem; }
.error { color: var(--danger); font-weight: 500; background: #fef2f2; border: 1px solid #fecaca; padding: 0.5rem 0.75rem; border-radius: var(--radius); margin-bottom: 1rem; }
.empty { color: var(--muted); font-style: italic; padding: 1rem 0; }

/* ─── Tutorial-Karten (Startseite) ─────────────────────────────────────── */
.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.tutorial-card {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, border-color 0.15s;
  color: var(--text);
  text-decoration: none;
}
.tutorial-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: var(--primary);
  text-decoration: none;
}
.tutorial-card h2 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.step-count { font-size: 0.82rem; color: var(--muted); }

/* ─── Tutorial-Ansicht (Scroll) ─────────────────────────────────────────── */
.tutorial-header { margin-bottom: 2rem; }
.tutorial-header h1 { margin: 0.5rem 0 0.25rem; font-size: 1.8rem; }
.step-total { color: var(--muted); font-size: 0.9rem; }

.steps-list { display: flex; flex-direction: column; gap: 2.5rem; }

.step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.step-number {
  background: var(--primary);
  color: #fff;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.step-title {
  padding: 0.75rem 1rem 0;
  font-size: 1.05rem;
}

.step-content {
  display: flex;
  gap: 1.5rem;
  padding: 1rem;
  align-items: flex-start;
}

.step-image {
  flex: 0 0 auto;
  max-width: 380px;
  width: 45%;
}
.step-image img {
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  display: block;
}

.no-image {
  background: var(--secondary-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.step-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.7;
  min-width: 0;
}

@media (max-width: 600px) {
  .step-content { flex-direction: column; }
  .step-image { width: 100%; max-width: 100%; }
}

/* ─── Admin-Allgemein ───────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; }

.admin-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.admin-section h2 { font-size: 1rem; margin-bottom: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

.admin-list { display: flex; flex-direction: column; gap: 0.75rem; }

.admin-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.admin-row-title { font-weight: 500; flex: 1 1 auto; }
.admin-row-meta  { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.admin-row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ─── Schritt-Liste (Edit Tutorial) ────────────────────────────────────── */
.step-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }

.step-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: default;
  transition: background 0.1s;
  flex-wrap: wrap;
}
.step-row.drag-over { background: #dbeafe; border-color: var(--primary); }
.step-row.dragging  { opacity: 0.4; }

.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1.1rem;
  padding: 0 0.25rem;
  flex-shrink: 0;
  user-select: none;
}

.step-thumb { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); flex-shrink: 0; }
.no-img-thumb { width: 48px; height: 36px; background: var(--border); border-radius: 4px; display: inline-block; flex-shrink: 0; }

.step-row-label { flex: 1; font-size: 0.9rem; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-row-actions { display: flex; gap: 0.4rem; }

.step-add-form { max-width: 540px; }

/* ─── Schritt bearbeiten ────────────────────────────────────────────────── */
.edit-step-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 680px) {
  .edit-step-grid { grid-template-columns: 1fr; }
}

.current-image { margin-bottom: 1rem; }
.current-image img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 0.4rem;
}
.current-image p { font-size: 0.82rem; color: var(--muted); }
.no-image-hint { font-size: 0.9rem; color: var(--muted); margin-bottom: 1rem; }

.upload-form { margin-top: 0.5rem; }

/* ─── Login-Seite ───────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--secondary-bg);
}

.login-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-box h1 { font-size: 1.4rem; margin-bottom: 1.25rem; }
.back-link { display: inline-block; margin-top: 1rem; font-size: 0.88rem; color: var(--muted); }
.back-link:hover { color: var(--primary); }

.back-bottom { margin-top: 3rem; padding-bottom: 1rem; text-align: center; }
