/* Mediamatiker Lernplattform */

:root {
  --ink: #1a1f1c;
  --ink-muted: #5a635c;
  --paper: #f3f0e8;
  --paper-2: #e8e4d8;
  --cream: #faf8f3;
  --teal: #0d7377;
  --teal-dark: #095456;
  --teal-soft: #d4e8e9;
  --ember: #c45c26;
  --ember-soft: #f3e0d4;
  --ok: #2d6a4f;
  --ok-soft: #d8f3dc;
  --warn: #9a3412;
  --line: rgba(26, 31, 28, 0.12);
  --shadow: 0 12px 40px rgba(26, 31, 28, 0.08);
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --max: 920px;
  --wide: 1100px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(13, 115, 119, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(196, 92, 38, 0.1), transparent 50%),
    linear-gradient(180deg, var(--cream) 0%, var(--paper) 40%, var(--paper-2) 100%);
  background-attachment: fixed;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

a {
  color: var(--teal-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--ember);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(250, 248, 243, 0.85);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 55%, var(--ember) 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-text strong {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
}
.brand-text span {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.header-nav {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}
.header-nav a {
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 0.95rem;
}
.header-nav a:hover,
.header-nav a.is-active {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-chip {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  background: var(--paper-2);
  border-radius: 999px;
}

.site-main {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 1.5rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}
.footer-inner {
  max-width: var(--wide);
  margin: 0 auto;
}
.footer-hint {
  opacity: 0.8;
}

/* Typography */
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.75rem;
}
h1 { font-size: clamp(1.85rem, 3vw, 2.4rem); }
h2 { font-size: 1.45rem; margin-top: 2rem; }
h3 { font-size: 1.15rem; font-family: var(--font); font-weight: 650; }

.lead {
  font-size: 1.15rem;
  color: var(--ink-muted);
  max-width: 42rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  border: 1.5px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover {
  background: var(--teal-dark);
  color: #fff;
}
.btn-secondary {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.btn-secondary:hover {
  background: var(--ink);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border-color: var(--line);
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}
.btn-ember {
  background: var(--ember);
  color: #fff;
}
.btn-ember:hover {
  background: #a34a1c;
  color: #fff;
}

/* Login */
.login-page {
  min-height: calc(100vh - 4rem);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-panel {
  width: min(420px, 100%);
  padding: 2.5rem 2rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  animation: rise 0.6s ease both;
}

.login-panel h1 {
  font-size: 1.75rem;
}

.form-group {
  margin-bottom: 1.1rem;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.form-group input:focus,
.form-group textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}
.alert-error {
  background: #fde8e4;
  color: var(--warn);
  border: 1px solid #f5c4b8;
}
.alert-ok {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid #b7e4c7;
}

/* Dashboard */
.dash-hero {
  margin-bottom: 2.5rem;
  animation: rise 0.5s ease both;
}
.dash-hero h1 span {
  color: var(--teal);
}

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

.module-tile {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 1.75rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
  animation: rise 0.55s ease both;
}
.module-tile:nth-child(2) { animation-delay: 0.08s; }
.module-tile:hover {
  transform: translateY(-4px);
  border-color: rgba(13, 115, 119, 0.35);
  color: inherit;
}

.module-tile .mod-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 1rem;
}
.module-tile.php .mod-icon { background: var(--teal); }
.module-tile.js .mod-icon { background: var(--ember); }

.nav-modules {
  position: relative;
}
.nav-modules summary {
  list-style: none;
  cursor: pointer;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-modules summary::-webkit-details-marker { display: none; }
.nav-modules summary:hover,
.nav-modules summary.is-active {
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.nav-modules-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 180px;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  z-index: 60;
}
.nav-modules-panel a {
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.9rem;
}
.nav-modules-panel a:hover,
.nav-modules-panel a.is-active {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.progress-bar {
  height: 8px;
  background: var(--paper-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 1rem 0 0.4rem;
}
.progress-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #14919b);
  transition: width 0.4s ease;
}
.module-tile.js .progress-bar > span {
  background: linear-gradient(90deg, var(--ember), #d97706);
}
.progress-label {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
  animation: rise 0.6s ease 0.12s both;
}
.stat {
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 140px;
}
.stat strong {
  display: block;
  font-family: var(--display);
  font-size: 1.5rem;
}
.stat span {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* Module index / lesson */
.module-header {
  margin-bottom: 2rem;
}
.module-header .estimate {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.lesson-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.lesson-item a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.15s, transform 0.15s;
}
.lesson-item a:hover {
  border-color: var(--teal);
  transform: translateX(4px);
  color: inherit;
}
.lesson-item.done a {
  border-color: rgba(45, 106, 79, 0.35);
  background: rgba(216, 243, 220, 0.35);
}

.lesson-num {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.lesson-item.done .lesson-num {
  background: var(--ok);
  color: #fff;
}
.lesson-meta {
  flex: 1;
}
.lesson-meta strong {
  display: block;
}
.lesson-meta span {
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.badge-done {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ok);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Lesson content */
.lesson-layout {
  display: grid;
  gap: 2rem;
}

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.content-block {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.5rem;
  max-width: var(--max);
}

.content-block p:first-child { margin-top: 0; }
.content-block p:last-child { margin-bottom: 0; }

.content-block ul,
.content-block ol {
  padding-left: 1.25rem;
}

.callout {
  border-left: 4px solid var(--teal);
  background: var(--teal-soft);
  padding: 1rem 1.15rem;
  border-radius: 0 10px 10px 0;
  margin: 1.25rem 0;
}
.callout.tip {
  border-color: var(--ember);
  background: var(--ember-soft);
}
.callout strong {
  display: block;
  margin-bottom: 0.25rem;
}

pre, code {
  font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
  font-size: 0.88em;
}
pre {
  background: #1a1f1c;
  color: #e8e4d8;
  padding: 1.1rem 1.2rem;
  border-radius: 10px;
  overflow-x: auto;
  line-height: 1.5;
  margin: 1rem 0;
}
code {
  background: var(--paper-2);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Exercises */
.exercise {
  border: 1.5px dashed rgba(13, 115, 119, 0.45);
  background: rgba(212, 232, 233, 0.35);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  max-width: var(--max);
}
.exercise h3 {
  margin-top: 0;
  color: var(--teal-dark);
}
.exercise .points {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  margin: 0.4rem 0;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.quiz-option:hover,
.quiz-option:has(input:checked) {
  border-color: var(--teal);
}
.quiz-option input {
  margin-top: 0.25rem;
}

.quiz-feedback {
  margin-top: 0.75rem;
  font-weight: 600;
  display: none;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.ok { color: var(--ok); }
.quiz-feedback.bad { color: var(--warn); }

.complete-box {
  max-width: var(--max);
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}
.complete-box.is-done {
  background: var(--ok-soft);
  border-color: #b7e4c7;
}

/* Playground */
.playground {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}
@media (min-width: 800px) {
  .playground.split {
    grid-template-columns: 1fr 1fr;
  }
}
.playground textarea {
  width: 100%;
  min-height: 180px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.85rem;
  padding: 0.85rem;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #1a1f1c;
  color: #e8e4d8;
  resize: vertical;
}
.playground-out {
  min-height: 180px;
  padding: 0.85rem;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 0.95rem;
  overflow: auto;
}
.playground-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* JS practice widgets */
.widget {
  padding: 1.25rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 1rem 0;
}
.widget h4 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.todo-widget input[type="text"] {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.todo-widget .row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.todo-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
.todo-list li.done span {
  text-decoration: line-through;
  color: var(--ink-muted);
}

.counter-display {
  font-family: var(--display);
  font-size: 2.5rem;
  text-align: center;
  margin: 0.5rem 0 1rem;
}

/* Admin */
.admin-table-wrap {
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  font-weight: 650;
}
.mini-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}
.mini-progress .progress-bar {
  flex: 1;
  margin: 0;
  min-width: 70px;
}
.mini-progress span {
  font-size: 0.8rem;
  color: var(--ink-muted);
  white-space: nowrap;
}
.muted {
  color: var(--ink-muted);
  font-size: 0.9rem;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1rem;
}
.admin-grid .content-block {
  margin-bottom: 0;
}
.admin-mod-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-lesson-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.admin-lesson-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.admin-lesson-list li strong {
  display: block;
}
.admin-lesson-list li.is-done {
  background: linear-gradient(90deg, rgba(216, 243, 220, 0.45), transparent);
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 8px;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row .form-group {
  flex: 1;
  min-width: 140px;
}
.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.upload-form input[type="file"] {
  width: 100%;
  padding: 0.6rem;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  background: #fff;
}

.exercise-upload {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px dashed rgba(13, 115, 119, 0.35);
}
.exercise-upload h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--teal-dark);
}
.exercise-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.65rem;
}
.exercise-upload-row input[type="file"] {
  flex: 1 1 180px;
  min-width: 0;
  padding: 0.45rem;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.85rem;
}
.exercise-upload-row input[type="text"] {
  flex: 1 1 140px;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
}
.exercise-upload-list {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0 0;
}
.exercise-upload-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.exercise-upload-list .muted {
  display: inline;
  font-size: 0.8rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .header-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }
  .header-user {
    margin-left: auto;
  }
}
