:root {
  --bg-color: #f4f5fb;
  --bg-elevated: #ffffff;
  --border-soft: #e0e3f0;
  --text-main: #1f2933;
  --text-muted: #5f6c80;
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.08);
  --accent: #f97316;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-pill: 999px;
  --max-width: 1100px;
  --danger: #b91c1c;
}

[data-theme="dark"] {
  --bg-color: #020617;
  --bg-elevated: #0b1220;
  --border-soft: #1f2937;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --primary: #60a5fa;
  --primary-soft: rgba(96, 165, 250, 0.12);
  --accent: #fb923c;
  --danger: #fecaca;
}

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

body {
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-color);
  color: var(--text-main);
  margin: 0;
}

.app-shell {
  max-width: var(--max-width);
  width: 100%;
  margin: 24px auto 32px;
  padding: 0 16px;
}

.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
  padding: 20px 18px 20px;
}

@media (min-width: 768px) {
  .card {
    padding: 24px 28px 24px;
  }
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.brand {
  font-family: "Roboto Serif", "Times New Roman", serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-links a {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--primary);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.theme-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

h1,
h2,
h3 {
  font-family: "Roboto Serif", "Times New Roman", serif;
}

h1 {
  font-size: clamp(1.8rem, 2.4vw + 1rem, 2.4rem);
  margin-bottom: 8px;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

p.lead {
  font-size: 0.96rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.hero-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-secondary {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--primary);
}

[data-theme="dark"] .btn-secondary {
  background: #020617;
}

.btn-secondary:hover {
  background: var(--primary-soft);
}

.alert {
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.alert-info {
  background: var(--primary-soft);
  color: var(--primary);
}

.alert-danger {
  background: #fef2f2;
  color: #b91c1c;
}

[data-theme="dark"] .alert-danger {
  background: rgba(127, 29, 29, 0.3);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

@media (min-width: 640px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

label {
  font-size: 0.85rem;
  margin-bottom: 3px;
  display: block;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  font-size: 0.9rem;
  background: #ffffff;
  color: var(--text-main);
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: #020617;
}

input[type="submit"] {
  margin-top: 10px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}

.table th {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
}

.badge-success {
  border-color: #16a34a;
  color: #16a34a;
}

.badge-pending {
  border-color: #ea580c;
  color: #ea580c;
}

.badge-locked {
  border-color: #9ca3af;
  color: #9ca3af;
}

.module-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .module-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.module-card {
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  padding: 10px 12px;
  background: #f8fafc;
}

[data-theme="dark"] .module-card {
  background: #020617;
}

.module-card h3 {
  font-size: 0.96rem;
  margin-bottom: 4px;
}

.module-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.module-actions {
  margin-top: 6px;
}

.quiz-question {
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border-soft);
}

.quiz-question h3 {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.quiz-options label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.certificate {
  text-align: center;
  padding: 30px 10px;
}

.certificate h1 {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.certificate p {
  margin-bottom: 6px;
}

.cert-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 8px 0;
}

/* Video-Bereiche für Module */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin-top: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-native {
  margin-top: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}

.video-native video {
  width: 100%;
  display: block;
}

/* Startseite / Hero-Bereich */

.hero {
  margin-bottom: 28px;
}

.hero-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}

.hero-text {
  flex: 1 1 260px;
  max-width: 620px;
}

.hero-stat {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--primary-soft);
}

.hero-stat h2 {
  margin-bottom: 4px;
}

.hero-stat p {
  font-size: 0.9rem;
  color: var(--text-main);
}

.hero-image {
  flex: 0 0 auto;
  max-width: 380px;
  width: 100%;
}

.hero-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
}

.section-intro {
  margin-top: 4px;
}

/* Mobile Anpassung */
@media (max-width: 768px) {
  .top-bar {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .nav-links {
    order: 3;
  }

  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-image {
    max-width: 100%;
  }
}

/* Dashboard-Layout */

.dashboard {
  margin-top: 8px;
}

.dashboard-header-card {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(135deg, var(--bg-elevated), rgba(37, 99, 235, 0.03));
  margin-bottom: 18px;
}

.dashboard-header-text {
  flex: 1 1 260px;
}

.dashboard-alert {
  margin-top: 10px;
}

.dashboard-header-status {
  flex: 0 0 auto;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pill-inactive {
  background: #fee2e2;
  color: #b91c1c;
}

[data-theme="dark"] .status-pill-inactive {
  background: rgba(127, 29, 29, 0.35);
  color: #fecaca;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
}

.status-pill-inactive .status-dot {
  background: #b91c1c;
}

.status-meta {
  font-size: 0.78rem;
  text-align: right;
  color: var(--text-muted);
}

/* Modul-Grid und Karten */

.dashboard-modules {
  margin-top: 10px;
}

.dashboard-modules h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.dashboard-modules-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.module-list {
  margin-top: 4px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 768px) {
  .module-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.module-card {
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: #f9fafb;
  padding: 10px 12px;
}

[data-theme="dark"] .module-card {
  background: #020617;
}

.module-card-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.module-card-text h3 {
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.module-card-text p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.module-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Badges / Statuschips */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  background: #ffffff;
}

[data-theme="dark"] .badge {
  background: #020617;
}

.badge-success {
  border-color: #22c55e;
  color: #15803d;
  background: #ecfdf3;
}

[data-theme="dark"] .badge-success {
  background: rgba(21, 128, 61, 0.25);
  color: #bbf7d0;
}

.badge-pending {
  border-color: #f97316;
  color: #c2410c;
  background: #fff7ed;
}

[data-theme="dark"] .badge-pending {
  background: rgba(248, 153, 54, 0.25);
  color: #fed7aa;
}

.badge-locked {
  border-color: #e5e7eb;
  color: #9ca3af;
  background: #f9fafb;
}

[data-theme="dark"] .badge-locked {
  background: rgba(148, 163, 184, 0.15);
}

/* Button im Modulstatus etwas kompakter */

.module-open-btn {
  padding: 4px 12px;
  font-size: 0.8rem;
}

/* Zertifikatsbereich */

.dashboard-certificate {
  margin-top: 18px;
}

.dashboard-certificate-inner {
  border-radius: 16px;
  border: 1px dashed var(--border-soft);
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(37, 99, 235, 0.02);
}

.dashboard-certificate-inner p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .dashboard-header-card {
    align-items: flex-start;
  }

  .dashboard-header-status {
    align-items: flex-start;
  }

  .status-meta {
    text-align: left;
  }

  .module-card-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .module-status {
    align-items: flex-start;
  }
}

/* Inline-Bilder in Modultexten (Platzhalter) – Thumbnails mit Hover-Zoom */

.module-img-inline {
  display: inline-block;
  margin: 4px 0 8px 10px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.module-img-inline img {
  display: block;
  width: 140px;        /* Thumbnail-Größe Desktop */
  max-width: 140px;
  height: auto;
}

.module-img-right {
  float: right;
  margin-left: 16px;
}

.module-img-link {
  text-decoration: none;
  color: inherit;
}

/* Hover-Zoom nur für Geräte mit Maus */
@media (hover: hover) and (pointer: fine) {
  .module-img-inline:hover {
    transform: scale(1.14);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.28);
  }
}

.module-image-zoom-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Mobil: Bilder zentriert, kleiner, kein Float */

@media (max-width: 768px) {
  .module-img-right {
    float: none;
    margin: 12px auto;
  }

  .module-img-inline {
    display: block;
    margin: 12px auto;
  }

  .module-img-inline img {
    width: 55vw;       /* ca. halbe Bildschirmbreite */
    max-width: 220px;  /* Obergrenze, damit es nicht riesig wird */
  }
}
/* --- Inline-Bilder in Modul-Texten (FOLIE2 / FOLIE3) --- */

.module-content::after {
  /* sorgt dafür, dass Floats den Textbereich nicht "aufreißen" */
  content: "";
  display: block;
  clear: both;
}

.module-img-inline {
  display: inline-block;
  margin: 8px 0 8px 12px;
  max-width: 140px;          /* Desktop: kleines Thumbnail */
  vertical-align: top;
}

.module-img-inline img {
  display: block;
  width: 100%;               /* Bild passt sich dem Thumbnail an */
  height: auto;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out;
}

.module-img-inline:hover img {
  /* Hover-Zoom nur auf Desktop wirklich sinnvoll */
  transform: scale(1.4);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.28);
}

.module-img-right {
  float: right;
  margin-left: 16px;
}

.module-img-link {
  text-decoration: none;
  color: inherit;
}

.module-image-zoom-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- Mobile: Bild kleiner & unter dem Text, kein Float --- */

@media (max-width: 768px) {
  .module-img-right {
    float: none;
    margin: 12px auto 4px;
  }

  .module-img-inline {
    display: block;
    max-width: 60%;          /* nicht bildschirmfüllend, aber gut sichtbar */
    margin-left: auto;
    margin-right: auto;
  }
}
