/* ===========================================================================
   Planturio – Stylesheet
   Modernes Blau/Grau-Design im technischen Industrie-Stil
   (großtechnische chemische Produktion).
   =========================================================================== */

:root {
  /* Marineblau & Stahlgrau */
  --marine-950: #0b1220;
  --marine-900: #0f172a;
  --marine-800: #1e293b;
  --stahl-600:  #475569;
  --stahl-500:  #64748b;
  --stahl-400:  #94a3b8;
  --stahl-300:  #cbd5e1;
  --stahl-200:  #e2e8f0;
  --stahl-100:  #f1f5f9;

  /* Akzentfarben */
  --blau-700:   #1d4ed8;
  --blau-600:   #2563eb;
  --blau-500:   #3b82f6;
  --blau-100:   #dbeafe;
  --blau-50:    #eff6ff;
  --cyan-600:   #0891b2;
  --cyan-50:    #ecfeff;
  --orange-600: #ea580c;
  --orange-50:  #fff7ed;
  --violett-600:#7c3aed;
  --violett-50: #f5f3ff;

  /* Status */
  --gruen-700:  #15803d;
  --gruen-50:   #f0fdf4;
  --rot-600:    #dc2626;
  --rot-50:     #fef2f2;

  --tinte:      #0f172a;
  --papier:     #ffffff;
  --hintergrund:#f4f6fa;

  --radius:     12px;
  --schatten:   0 1px 2px rgba(15,23,42,.05), 0 4px 16px rgba(15,23,42,.06);
  --schatten-gross: 0 8px 40px rgba(11,18,32,.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--tinte);
  background: var(--hintergrund);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  flex: 1;
}

/* Zentrierte Seiten (Login, Zustimmung, Setup) auf dunklem Industrie-Hintergrund */
body.centered {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(37,99,235,.28), transparent 60%),
    radial-gradient(800px 400px at 0% 110%, rgba(8,145,178,.18), transparent 60%),
    var(--marine-900);
}

body.centered .page {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}

h1 { font-size: 1.7rem; line-height: 1.25; margin: .4em 0 .3em; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: .3em 0 .4em; letter-spacing: -.01em; }
p  { margin: .5em 0; }

.muted { color: var(--stahl-500); }
.small { font-size: .875rem; }

a { color: var(--blau-600); }

/* --------------------------------------------------------------------------
   Kopfzeile – dunkle Industrieleiste mit Akzentlinie
   -------------------------------------------------------------------------- */
.topbar {
  background: var(--marine-900);
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--blau-600), var(--cyan-600)) 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .01em;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-icon { display: flex; color: var(--blau-500); }

.topnav { display: flex; gap: 4px; flex-wrap: wrap; }

.topnav a {
  text-decoration: none;
  color: var(--stahl-300);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .95rem;
}

.topnav a:hover { background: var(--marine-800); color: #fff; }
.topnav a.logout { color: #fca5a5; }
.topnav a.logout:hover { background: rgba(220,38,38,.15); color: #fecaca; }

/* --------------------------------------------------------------------------
   Fußzeile
   -------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--stahl-200);
  background: var(--papier);
  padding: 14px 16px;
  text-align: center;
}

.footer-links { font-size: .875rem; color: var(--stahl-400); }
.footer-links a { color: var(--stahl-500); text-decoration: none; margin: 0 6px; }
.footer-links a:hover { color: var(--blau-600); text-decoration: underline; }

/* --------------------------------------------------------------------------
   Karten & Formulare
   -------------------------------------------------------------------------- */
.card {
  background: var(--papier);
  border: 1px solid var(--stahl-200);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 22px;
  margin: 16px 0;
}

.auth-card { max-width: 420px; width: 100%; text-align: center; border: none; box-shadow: var(--schatten-gross); }
.consent-card { max-width: 560px; width: 100%; border: none; box-shadow: var(--schatten-gross); }
.auth-logo { display: flex; justify-content: center; color: var(--blau-600); margin-bottom: 4px; }

label { display: block; text-align: left; font-weight: 600; margin: 14px 0 4px; font-size: .95rem; }

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  border: 1.5px solid var(--stahl-300);
  border-radius: 9px;
  background: var(--papier);
  color: var(--tinte);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blau-500);
  box-shadow: 0 0 0 3px var(--blau-100);
}

.btn {
  display: inline-block;
  border: none;
  font: inherit;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  margin-top: 14px;
  transition: background .15s, border-color .15s;
}

.btn.primary { background: var(--blau-600); color: #fff; }
.btn.primary:hover { background: var(--blau-700); }
.btn.ghost { background: transparent; color: var(--blau-600); border: 1.5px solid var(--blau-500); }
.btn.ghost:hover { background: var(--blau-50); }
.btn.small { padding: 6px 14px; font-size: .9rem; margin-top: 8px; }

.alert {
  padding: 10px 14px;
  border-radius: 9px;
  margin: 12px 0;
  font-size: .95rem;
  text-align: left;
}

.alert.error { background: var(--rot-50); color: var(--rot-600); border: 1px solid #fecaca; }
.alert.success { background: var(--gruen-50); color: var(--gruen-700); border: 1px solid #bbf7d0; }

.checkline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  margin: 14px 0;
  padding: 12px;
  background: var(--stahl-100);
  border: 1px solid var(--stahl-200);
  border-radius: 9px;
  cursor: pointer;
}

.checkline input { margin-top: 4px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--blau-600); }

/* --------------------------------------------------------------------------
   Dashboard-Kacheln & Themenlisten
   -------------------------------------------------------------------------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.tile {
  background: var(--papier);
  border: 1px solid var(--stahl-200);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 20px;
  text-decoration: none;
  color: var(--tinte);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: var(--blau-500);
  box-shadow: 0 4px 20px rgba(37,99,235,.13);
}

.tile-icon {
  font-size: 1.5rem;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--blau-50);
  border: 1px solid var(--blau-100);
  border-radius: 10px;
}

.tile-title { font-weight: 700; font-size: 1.05rem; }
.tile-desc { color: var(--stahl-500); font-size: .9rem; }

.breadcrumb { font-size: .9rem; color: var(--stahl-400); margin-top: 8px; }
.breadcrumb a { color: var(--stahl-500); text-decoration: none; }
.breadcrumb a:hover { color: var(--blau-600); text-decoration: underline; }
.breadcrumb span { margin: 0 4px; }

.topic-list { margin: 20px 0; display: flex; flex-direction: column; gap: 10px; }

.topic-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--papier);
  border: 1px solid var(--stahl-200);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 14px 18px;
  text-decoration: none;
  color: var(--tinte);
  transition: border-color .12s, box-shadow .12s;
}

.topic-row:hover { border-color: var(--blau-500); box-shadow: 0 4px 20px rgba(37,99,235,.13); }

.topic-num {
  background: var(--marine-900);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.topic-body { display: flex; flex-direction: column; }
.topic-title { font-weight: 600; }
.topic-desc { color: var(--stahl-500); font-size: .9rem; }
.topic-arrow { margin-left: auto; color: var(--stahl-400); font-size: 1.4rem; }

/* --------------------------------------------------------------------------
   Inhaltsbausteine
   -------------------------------------------------------------------------- */
.card-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--stahl-100);
  color: var(--stahl-600);
  margin-bottom: 10px;
}

.content-card.type-info .card-badge { background: var(--blau-50); color: var(--blau-600); }
.content-card.type-situation .card-badge { background: var(--orange-50); color: var(--orange-600); }
.content-card.type-aufgaben .card-badge { background: var(--cyan-50); color: var(--cyan-600); }
.chat-card .card-badge { background: var(--violett-50); color: var(--violett-600); }

.prose h1 { font-size: 1.45rem; }
.prose h2 { font-size: 1.2rem; margin-top: 1.2em; }
.prose h3 { font-size: 1.05rem; margin-top: 1em; }
.prose img { max-width: 100%; border-radius: 10px; }
.prose blockquote {
  margin: 1em 0; padding: 8px 16px;
  border-left: 3px solid var(--blau-500);
  background: var(--blau-50);
  border-radius: 0 9px 9px 0;
}
.prose code { background: var(--stahl-100); padding: 2px 6px; border-radius: 6px; font-size: .9em; }
.prose pre { background: var(--marine-900); color: var(--stahl-200); padding: 14px; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; color: inherit; padding: 0; }
.table-wrap { overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.prose th, .prose td { border: 1px solid var(--stahl-200); padding: 8px 12px; text-align: left; }
.prose th { background: var(--marine-900); color: #fff; border-color: var(--marine-800); }
.prose tr:nth-child(even) td { background: var(--stahl-100); }

/* --------------------------------------------------------------------------
   Interaktive Aufgaben
   -------------------------------------------------------------------------- */
.task-title { font-size: 1.2rem; margin: 0 0 4px; }
.task-desc { color: var(--stahl-500); margin-top: 0; }

.mc-question { margin: 18px 0 6px; font-weight: 600; }
.mc-hint { color: var(--stahl-500); font-size: .85rem; margin: 0 0 10px; }

/* Fortschritts-Punkte (eine Frage pro Ansicht, Navigation per Klick) */
.mc-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
  padding: 10px 12px;
  background: var(--stahl-100);
  border: 1px solid var(--stahl-200);
  border-radius: 9px;
}

.mc-dot {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid var(--stahl-300);
  background: var(--papier);
  cursor: pointer;
  padding: 0;
  transition: transform .1s, border-color .1s;
}

.mc-dot:hover { transform: scale(1.2); border-color: var(--blau-500); }
.mc-dot.current { border-color: var(--blau-600); box-shadow: 0 0 0 3px var(--blau-100); }
.mc-dot.right { background: var(--gruen-700); border-color: var(--gruen-700); }
.mc-dot.wrong { background: var(--rot-600); border-color: var(--rot-600); }

.mc-count { font-size: .85rem; color: var(--stahl-500); margin-left: auto; white-space: nowrap; }

.mc-round-badge {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: var(--blau-600);
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
}

/* Warum-Kommentar unter falsch gewählten Antworten */
.mc-why {
  background: var(--orange-50);
  border-left: 3px solid var(--orange-600);
  color: var(--tinte);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  margin: -2px 0 10px;
  font-size: .92rem;
}

.mc-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

.mc-summary { text-align: center; padding: 12px 0 4px; }
.mc-summary .score { font-size: 2.1rem; font-weight: 800; color: var(--marine-900); letter-spacing: -.02em; }

.mc-option {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1.5px solid var(--stahl-200);
  border-radius: 9px;
  padding: 10px 12px;
  margin: 8px 0;
  cursor: pointer;
  transition: border-color .1s, background .1s;
  font-weight: 400;
}

.mc-option:hover { border-color: var(--blau-500); }
.mc-option input { margin-top: 4px; accent-color: var(--blau-600); flex-shrink: 0; }
.mc-option.correct { border-color: var(--gruen-700); background: var(--gruen-50); }
.mc-option.wrong { border-color: var(--rot-600); background: var(--rot-50); }
.mc-option.missed { border-color: var(--orange-600); background: var(--orange-50); }

.task-feedback { border-radius: 9px; padding: 10px 14px; margin-top: 12px; font-weight: 600; display: none; }
.task-feedback.good { display: block; background: var(--gruen-50); color: var(--gruen-700); }
.task-feedback.bad { display: block; background: var(--rot-50); color: var(--rot-600); }
.task-explanation { font-weight: 400; margin-top: 6px; color: var(--tinte); }

.gap-input {
  display: inline-block;
  width: auto;
  min-width: 90px;
  padding: 3px 8px;
  margin: 0 2px;
  border: 1.5px solid var(--stahl-400);
  border-radius: 7px;
  font: inherit;
  font-size: .95em;
}

.gap-input.correct { border-color: var(--gruen-700); background: var(--gruen-50); }
.gap-input.wrong { border-color: var(--rot-600); background: var(--rot-50); }
.gap-solution { color: var(--gruen-700); font-weight: 600; margin-left: 4px; }

.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.memory-card {
  aspect-ratio: 3 / 2;
  border: none;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--marine-800), var(--marine-950));
  color: var(--blau-500);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform .15s, background .15s;
  overflow: hidden;
}

.memory-card:hover { transform: scale(1.03); }
.memory-card .memory-text { display: none; }
.memory-card::before { content: "?"; font-size: 1.3rem; font-weight: 800; }
.memory-card.open, .memory-card.done {
  background: var(--papier);
  color: var(--tinte);
  border: 1.5px solid var(--blau-500);
}
.memory-card.open::before, .memory-card.done::before { content: none; }
.memory-card.open .memory-text, .memory-card.done .memory-text { display: block; }
.memory-card.done { opacity: .55; cursor: default; border-color: var(--stahl-300); }
.memory-stats { color: var(--stahl-500); font-size: .9rem; }

/* --------------------------------------------------------------------------
   Chat
   -------------------------------------------------------------------------- */
.chat-title { margin-top: 0; }

.chat-log {
  background: var(--stahl-100);
  border: 1px solid var(--stahl-200);
  border-radius: 10px;
  padding: 14px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-msg.bot { background: var(--papier); border: 1px solid var(--stahl-200); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-msg.user { background: var(--blau-600); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-msg.error { background: var(--rot-50); color: var(--rot-600); align-self: stretch; max-width: 100%; }
.chat-msg.typing { color: var(--stahl-400); font-style: italic; }

.chat-form { display: flex; gap: 10px; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: vertical; }
.chat-form .btn { margin-top: 0; }

/* --------------------------------------------------------------------------
   Verwaltung
   -------------------------------------------------------------------------- */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 4px; max-width: 560px; }
.ok-badge { color: var(--gruen-700); font-weight: 600; font-size: .85rem; margin-left: 6px; }
.warn-badge { color: var(--rot-600); font-weight: 600; font-size: .85rem; margin-left: 6px; }

/* --------------------------------------------------------------------------
   Mobil
   -------------------------------------------------------------------------- */
@media (max-width: 560px) {
  h1 { font-size: 1.4rem; }
  .card { padding: 16px; }
  .chat-form { flex-direction: column; align-items: stretch; }
  .memory-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}
