/* ===== Grundlegendes Styling & Theme-Variablen ===== */
:root {
  --bg: #f0f2f5;
  --text: #111111;
  --header-bg: #5da9e9;
  --header-text: #ffffff;
  --sidebar-bg: rgba(255, 255, 255, 0.95);
  --card-bg: #ffffff;
  --muted: #666666;
  --overlay: rgba(0, 0, 0, 0.2);
  --accent: #111111;
  --accent-text: #ffffff;
  --start-bg: #ffffff;
  --stat-shadow: rgba(0, 0, 0, 0.06);
}

.dark-theme {
  --bg: #0f1720;
  --text: #e6eef8;
  --header-bg: #0b3a5b;
  --header-text: #ffffff;
  --sidebar-bg: rgba(12, 18, 24, 0.95);
  --card-bg: #0c1722;
  --muted: #9aa6b2;
  --overlay: rgba(0, 0, 0, 0.6);
  --accent: #1f2937;
  --accent-text: #ffffff;
  --start-bg: #1a2430;
  --stat-shadow: rgba(0, 0, 0, 0.4);
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--header-bg);
  color: var(--header-text);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 1001;
}

header h1 {
  margin: 0;
  font-size: 20px;
}

.burger {
  font-size: 28px;
  cursor: pointer;
  margin-right: 20px;
}

/* New hamburger lines */
.burger {
  width: 30px;
  height: 22px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 6px;
  box-sizing: content-box;
}
.burger .bar {
  display: block;
  height: 3px;
  background: var(--header-text);
  border-radius: 3px;
  transition:
    transform 0.25s ease,
    opacity 0.2s ease,
    background 0.2s ease;
}
.burger.open .bar1 {
  transform: translateY(7px) rotate(45deg);
}
.burger.open .bar2 {
  opacity: 0;
  transform: scaleX(0);
}
.burger.open .bar3 {
  transform: translateY(-7px) rotate(-45deg);
}

/* Prevent mobile tap highlight on header and burger */
header h1,
.burger {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* ensure bars follow theme color */
.burger .bar {
  background: currentColor;
}
.dark-theme .burger .bar {
  background: currentColor;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 60px;
  left: -100%;
  width: 270px;
  height: calc(100% - 60px);
  background: var(--sidebar-bg);
  backdrop-filter: blur(10px);
  box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
  padding: 20px;
  transition: left 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1002;
}

.sidebar.active {
  left: 0;
}

.user-info {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid #ccc;
}

.sidebar h2 {
  margin: 0 0 5px 0;
  font-size: 24px;
}

.sidebar .class {
  font-size: 18px;
  color: var(--muted);
}

/* Ensure sidebar text is readable in dark theme */
.dark-theme .sidebar {
  color: var(--header-text);
}
.dark-theme .sidebar button,
.dark-theme .sidebar .sidebar-link,
.dark-theme .sidebar .accordion-toggle {
  color: var(--header-text);
}

/* Theme toggle button placement */
#theme-toggle {
  position: fixed;
  right: 25px;
  bottom: 40px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  z-index: 2000;
  transition:
    transform 0.12s ease,
    background 0.18s ease;
}

#theme-toggle:hover {
  transform: translateY(-3px);
}

/* Dark theme variation for floating button */
.dark-theme #theme-toggle {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* Sidebar SVGs adapt to theme: force fill/stroke to currentColor */
#xp-bar-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 86px; /* above floating theme button */
  z-index: 2000;
  width: calc(100% - 40px);
  max-width: 720px;
  pointer-events: none; /* allow clicks through padding except inner */
}
.xp-bar {
  pointer-events: auto;
  background: var(--card-bg);
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 6px 18px var(--stat-shadow);
  display: flex;
  gap: 12px;
  align-items: center;
}
.xp-info {
  font-weight: 700;
  min-width: 90px;
  color: var(--text);
}
.xp-progress {
  flex: 1;
  height: 12px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd54f, #ffb74d);
  transition: width 0.25s ease;
}
.dark-theme .xp-fill {
  background: linear-gradient(90deg, #6fc3ff, #4da6ff);
}
.xp-note {
  margin-top: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* Compact glassy XP bar */
.xp-bar.compact {
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  gap: 8px;
}
.dark-theme .xp-bar.compact {
  background: rgba(20, 28, 36, 0.22);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.36);
}
.xp-bar.compact .xp-info {
  min-width: 70px;
  font-size: 13px;
  font-weight: 700;
}
.xp-bar.compact .xp-progress {
  height: 10px;
}
.xp-bar.compact .xp-fill {
  border-radius: 6px;
}
.sidebar svg,
.sidebar svg * {
  fill: currentColor !important;
  stroke: currentColor !important;
}

/* Ensure sidebar uses theme-appropriate color */
.sidebar {
  color: var(--text);
}
.dark-theme .sidebar {
  color: var(--header-text);
}

/* Dark mode: make icons white with black outline */
.dark-theme .sidebar svg,
.dark-theme .sidebar svg *,
.dark-theme .start-item svg,
.dark-theme .start-item svg *,
.dark-theme #theme-toggle svg,
.dark-theme #theme-toggle svg * {
  fill: #ffffff !important;
  stroke-width: 1.25px !important;
}

/* Make PDF icon fully white in dark theme (no black outline) */
.dark-theme .icon-pdf,
.dark-theme .icon-pdf * {
  fill: #ffffff !important;
  stroke: #ffffff !important;
  color: #ffffff !important;
}

.sidebar-legal {
  margin-top: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-legal .sidebar-link {
  font-size: 14px;
  opacity: 0.8;
}

/* ===== Overlay ===== */
.overlay {
  position: fixed;
  top: 60px;
  left: 0;
  width: 100%;
  height: calc(100% - 60px);
  background: var(--overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
  z-index: 1000;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== Main Content ===== */
main {
  margin-top: 60px;
  padding: 30px;
  font-size: 18px;
  line-height: 1.6;
}

#main-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-bottom: 20px;
}

.floating-cloud {
  display: block;
  width: 100px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-15px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* ===== Accordion ===== */
.accordion {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  transition: max-height 0.3s ease; /* Smooth-Transition */
}

.accordion li {
  margin-bottom: 10px;
}

/* Normalize sidebar button spacing and layout */
.sidebar .sidebar-link,
.sidebar .accordion-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  margin: 6px 0;
  width: 100%;
}

.sidebar .accordion li {
  margin-bottom: 8px;
}

.accordion-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 10px 0;
  width: 100%;
  text-align: left;

  transition:
    max-height 0.35s ease,
    padding 0.3s ease;
}

.accordion li button {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-size: 18px;
  cursor: pointer;
  padding: 10px 0;
  transition: color 0.2s;
}

.accordion li button:hover {
  color: var(--header-bg);
}

.accordion li > ul {
  list-style: none;
  padding-left: 20px;
  display: none;
}

.accordion li ul li {
  margin-bottom: 5px;
}

.accordion li.active > ul {
  display: block;
}

/* ===== Buttons ===== */
button,
input[type="button"],
input[type="submit"],
a {
  -webkit-tap-highlight-color: transparent; /* kein Grauflash */
  outline: none;
  cursor: pointer;
  transition:
    transform 0.1s ease,
    background-color 0.2s ease;
}

/* Active / Focus neutralisieren */
button:active,
button:focus,
input[type="button"]:active,
input[type="button"]:focus,
input[type="submit"]:active,
input[type="submit"]:focus,
a:active,
a:focus {
  background-color: transparent !important;
  color: inherit !important;
}

/* Optional: leichtes Tap-Feedback */
button:active {
  transform: scale(0.98);
}

/* Spezielle Buttons */
button.quiz-btn {
  margin: 8px 0;
  display: block;
  padding: 12px 16px;
  font-size: 18px;
}

input[type="text"] {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  font-size: 18px;
}

/* Feedback Text */
.feedback {
  font-weight: bold;
  margin: 12px 0;
  font-size: 18px;
}

/* Code Styling */
code {
  background: rgba(224, 224, 224, 0.3);
  padding: 2px 5px;
  border-radius: 3px;
  font-family: monospace;
}

/* Farbe für Standard-Buttons */
button {
  color: black;
}

.run-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  background: var(--accent);
  color: var(--accent-text);

  border: 1px solid #000;
  border-radius: 8px;

  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.run-btn:active {
  transform: scale(0.96);
}
.start-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 30px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.start-item {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  box-shadow: 0 6px 18px var(--stat-shadow);
  background: var(--start-bg);
  border: none;
  cursor: pointer;
  transition: 0.2s;
  text-align: left;
}

/* Vertical separator between SVG icon and text inside start buttons */
.start-item > div {
  position: relative;
  padding-left: 12px; /* space for the separator */
}
.start-item > div::before {
  content: "";
  position: absolute;
  left: -12px; /* place between svg and text */
  top: 0;
  bottom: 0;
  width: 1px;
  background: #000; /* default (light theme): black */
  opacity: 0.9;
}
.dark-theme .start-item > div::before {
  background: #ffffff; /* dark theme: white */
}

.start-item div {
  display: flex;
  flex-direction: column;
}

.start-item span {
  font-size: 14px;
  color: var(--muted);
}

.start-item:active {
  transform: scale(0.98);
}

/* Statistik-Karten (Screentime + Streak) */
.stat-cards {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 18px;
  box-shadow: 0 6px 18px var(--stat-shadow);
  min-width: 100px;
  text-align: center;
}

.stat-title {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

/* Pet canvas background override (replaces inline color) */
/* Pet UI removed */
/* Python page: force readable light container text/background */
.python-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.python-page .python-row {
  width: 92vw;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.python-page .python-editor,
.python-page .python-output {
  width: 100%;
  min-height: 180px;
  font-family: monospace;
  background: #ffffff;
  color: #000000;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  overflow: auto;
}

.python-page .python-output {
  white-space: pre-wrap;
}

.python-page .terminal-row {
  width: 92vw;
  max-width: 1000px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.python-page .python-terminal-input {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-family: monospace;
}

.python-example {
  width: 92vw;
  max-width: 1000px;
  background: #e8f4ff;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid #99c2ff;
  font-family: monospace;
  box-sizing: border-box;
}

/* In dark-theme make the example box text explicitly black (user request) */
.dark-theme .python-example {
  color: #000 !important;
}

/* Desktop: show editor and output side-by-side */
@media (min-width: 900px) {
  .python-page .python-row {
    flex-direction: row;
  }
  .python-page .python-editor,
  .python-page .python-output {
    min-height: 300px;
  }
  .python-page .python-editor {
    flex: 1 1 55%;
  }
  .python-page .python-output {
    flex: 1 1 45%;
  }
  .python-page .terminal-row {
    gap: 12px;
  }
}

/* Startseiten-Button Überschriften im Dark-Mode weiß machen */
.dark-theme .start-item strong {
  color: var(--header-text) !important;
}

/* Drachen-UI: Toggle / Feed button & countdown text colors (override inline styles) */
/* Pet UI removed */

/* ===== Offline Screen ===== */
.offline-screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.98);
  z-index: 3005;
  padding: 20px;
  box-sizing: border-box;
}
.offline-screen.active {
  display: flex;
}
.offline-content {
  max-width: 420px;
  width: 100%;
  background: var(--card-bg);
  padding: 22px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
  text-align: center;
}
.offline-content h2 {
  margin: 0 0 8px 0;
  font-size: 22px;
}
.offline-content p {
  margin: 0 0 16px 0;
  color: var(--muted);
}
.offline-actions .run-btn {
  padding: 10px 16px;
}

/* ===== Loading Overlay (Dark Mode, centered icon, closing circle) ===== */
.loader-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #05060a 0%, #0b1220 100%);
  z-index: 4000;
  transition:
    opacity 0.6s ease,
    visibility 0.6s ease;
  opacity: 1;
  visibility: visible;
}
.loader-overlay.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-center {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loader-image {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  z-index: 2;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.6),
    0 1px 0 rgba(255, 255, 255, 0.02) inset;
}
.loader-ring {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
  z-index: 1;
}
.loader-ring .ring,
.loader-ring .ring-bg {
  transition:
    stroke-dashoffset 900ms cubic-bezier(0.22, 1, 0.36, 1),
    stroke 400ms ease;
}
.loader-ring .ring {
  stroke-dasharray: 339.292; /* 2 * PI * 54 */
  stroke-dashoffset: 339.292; /* hidden */
}
.loader-overlay.closing .loader-ring .ring {
  stroke-dashoffset: 0; /* closed */
}

/* small pulse while waiting */
.loader-overlay .loader-center::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(125, 211, 252, 0.06),
    transparent 40%
  );
  z-index: 0;
  filter: blur(10px);
  opacity: 0.9;
  transform: scale(1);
  transition: transform 0.9s ease;
}
.loader-overlay.closing .loader-center::after {
  transform: scale(0.9);
  opacity: 0;
}

/* ensure loader always looks dark even if theme changes */
.loader-overlay .loader-image,
.loader-overlay .loader-ring {
  -webkit-user-select: none;
  user-select: none;
}

/* ===== Subtiler Hintergrund: getrennte Ebenen ===== */
/* - ::before: weiche Farbtupfer (geblurrt)
   - ::after: feines Gitter aus kurzen Strichen + Punkten (scharf)
   Ziel: dezente Struktur, nicht ablenkend, für Light + Dark */
body {
  position: relative;
  z-index: 0;
}

/* weiche Farbtupfer (hinterste Ebene) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background-image:
    radial-gradient(
      circle at 12% 20%,
      rgba(93, 169, 233, 0.04) 0px,
      rgba(93, 169, 233, 0.03) 100px,
      transparent 180px
    ),
    radial-gradient(
      circle at 78% 78%,
      rgba(93, 169, 233, 0.03) 0px,
      rgba(93, 169, 233, 0.02) 120px,
      transparent 220px
    ),
    radial-gradient(
      circle at 50% 50%,
      rgba(255, 181, 77, 0.02) 0px,
      rgba(255, 181, 77, 0.01) 180px,
      transparent 320px
    );
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-position: center, center, center;
  filter: blur(10px);
  opacity: 0.75; /* dezenter */
  transition: opacity 0.35s ease;
  will-change: transform;
  animation: bg-subtle-drift 20s linear infinite;
}

@keyframes bg-subtle-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  33% {
    transform: translate3d(14px, -10px, 0) scale(1.01);
  }
  66% {
    transform: translate3d(-12px, 8px, 0) scale(1.005);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* feine Striche + Punkte (klares Gitter, wiederholend) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  /* layers: short horizontal dashes, short vertical dashes, small dot-grid */
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.03) 0 3px,
      rgba(0, 0, 0, 0) 3px 28px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.028) 0 3px,
      rgba(0, 0, 0, 0) 3px 28px
    ),
    radial-gradient(circle, rgba(0, 0, 0, 0.06) 22%, transparent 23%);
  background-size:
    22px 22px,
    22px 22px,
    22px 22px;
  background-position:
    0 0,
    0 0,
    11px 11px; /* punkt zentriert zwischen Strichen */
  background-repeat: repeat, repeat, repeat;
  opacity: 0.085; /* etwas sichtbarer, gleiche Größe */
  mix-blend-mode: normal;
  will-change: transform, opacity;
  animation: bg-pattern-drift 36s linear infinite;
}

@keyframes bg-pattern-drift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(8px, -6px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Dark theme: helle Linien / Punkte mit gleicher Zurückhaltung */
.dark-theme body::after {
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0 3px,
      rgba(255, 255, 255, 0) 3px 28px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.02) 0 3px,
      rgba(255, 255, 255, 0) 3px 28px
    ),
    radial-gradient(circle, rgba(255, 255, 255, 0.06) 22%, transparent 23%);
  opacity: 0.08;
}

.dark-theme body::before {
  background-image:
    radial-gradient(
      circle at 12% 20%,
      rgba(111, 195, 255, 0.03) 0px,
      rgba(111, 195, 255, 0.02) 100px,
      transparent 180px
    ),
    radial-gradient(
      circle at 78% 78%,
      rgba(77, 166, 255, 0.025) 0px,
      rgba(77, 166, 255, 0.02) 120px,
      transparent 220px
    ),
    radial-gradient(
      circle at 50% 50%,
      rgba(100, 120, 140, 0.015) 0px,
      rgba(100, 120, 140, 0.008) 180px,
      transparent 320px
    );
  opacity: 0.7;
}
.materials {
  max-width: 1100px;
  padding: 20px;
  margin: auto;
}

.materials h2 {
  text-align: center;
  color: var(--text);
  margin-bottom: 10px;
}

.intro {
  text-align: center;
  color: var(--muted);
  margin-bottom: 30px;
}

/* ===== Suchleiste ===== */
.search-bar {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 30px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid var(--overlay);
  background-color: var(--card-bg);
  color: var(--text);
}

.search-bar::placeholder {
  color: var(--muted);
}

/* ===== Grid für Materialkarten ===== */
.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

/* ===== Materialkarte ===== */
.material-card {
  background-color: #3a6a9120;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px var(--stat-shadow);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.material-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px var(--stat-shadow);
}

.material-card h3 {
  margin-top: 0;
  color: var(--text);
}

.material-card p {
  color: var(--muted);
}

/* ===== PDF Preview ===== */
.pdf-preview {
  margin: 15px 0;
  border: 1px solid var(--overlay);
  border-radius: 8px;
  overflow: hidden;
}

/* ===== Download Button ===== */
.download-btn {
  display: inline-block;
  margin-top: 10px;
  text-decoration: none;
  font-weight: bold;
  color: var(--accent-text);
  background-color: var(--accent);
  padding: 8px 14px;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.download-btn:hover {
  background-color: var(--header-bg);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .search-bar {
    font-size: 14px;
    padding: 10px;
  }
}
.first-time-notice {
  position: fixed;
  top: 30px;
  right: 15px;
  left: 15px;

  width: 340px;
  background: rgba(45, 55, 72, 0.6); /* halbtransparent */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); /* Safari */
  color: white;
  padding: 18px 22px;
  border-radius: 12px;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.45);
  z-index: 9999;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  border-left: 5px solid #394b62;
  display: none;
}

.first-time-notice.show {
  display: block;
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notice-content {
  position: relative;
}

.close-btn {
  position: absolute;
  top: -4px;
  right: -8px;
  background: #e53e3e;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.close-btn:hover {
  background: #c53030;
}

.profile-button-hint {
  color: #a0d2ff;
  font-weight: bold;
}
.language-navbar {
  position: sticky;
  top: 60px;
  z-index: 900;
  background: #3b83f669;
  color: white;
  padding: 8px 16px;
  /* Zentrierung */
  display: flex;
  justify-content: center; /* ← das Wichtigste für Desktop-Zentrierung */
  gap: 12px;
  border-bottom: #00000033 1px solid;
  height: 25px; /* etwas mehr Höhe → angenehmer */
  align-items: center;
  overflow-x: auto;
  scroll-padding-left: 16px;
  -webkit-overflow-scrolling: touch;
  overflow-y: hidden;
}

/* Entfernt das unnötige nowrap + snap für besseres Gefühl */
.language-navbar button {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 6px;
  background: transparent;
  color: white;
  border: none;
  white-space: nowrap;
  font-size: 0.95rem;
  position: relative; /* für den underline */
  transition: background-color 0.2s ease;
}

/* === Smooth underline effect von links nach rechts === */
.language-navbar button::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 14px; /* passt zu padding */
  width: 0;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: width 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  transform-origin: left;
}

.language-navbar button:hover::after,
.language-navbar button.active::after {
  width: calc(100% - 28px); /* 14px padding links + 14px rechts */
}

/* Scrollbar verstecken */
.language-navbar::-webkit-scrollbar {
  display: none;
}

/* ================= Dark Mode ================= */
body.dark .language-navbar {
  background: #1e1e1ecc; /* etwas transparenter wirkt meist besser */
  border-bottom-color: #333;
}

body.dark .language-navbar button {
  color: white;
}

body.dark .language-navbar button:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.dark .language-navbar button::after {
  background: #4da3ff;
}

/* Bei sehr wenig Platz → trotzdem linksbündig starten */
@media (max-width: 480px) {
  .language-navbar {
    justify-content: flex-start;
  }
}
/* Seiten-Container */
.python-page {
  display: flex;
  justify-content: center;
  padding: 30px 12px;
  background: var(--bg);
  color: var(--text);
}

/* Haupt-Wrapper */
.learn-container {
  background: transparent;
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 1000px;
}

/* Überschriften */
.learn-container h2 {
  margin-top: 0;
  text-align: center;
  font-size: 28px;
  color: var(--text);
}

.learn-container h3 {
  margin-top: 30px;
  color: var(--text);
}

/* Erklärungskarten */
.info-box {
  background: var(--start-bg);
  border-left: 5px solid var(--header-bg);
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  color: var(--text);
}

/* Editor Container */
.editor-box {
  background: var(--accent);
  border-radius: 10px;
  padding: 12px;
  margin-top: 12px;
}

/* Textarea */
.python-editor {
  width: 100%;
  height: 170px;
  background: var(--sidebar-bg);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 12px;
  font-family: monospace;
  resize: vertical;
  font-size: 14px;
}

/* Output */
.python-output {
  margin-top: 10px;
  background: var(--sidebar-bg);
  color: #22c55e;
  padding: 10px;
  border-radius: 8px;
  min-height: 80px;
  font-family: monospace;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Run Button */
.run-btn {
  margin-top: 12px;
  padding: 10px 20px;
  background: var(--header-bg);
  border: none;
  color: var(--header-text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s;
}

.run-btn:hover {
  opacity: 0.85;
}

/* Beispiel Box */
.example-box {
  background: var(--start-bg);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 14px;
  margin-top: 10px;
  font-family: monospace;
  white-space: pre-wrap;
  color: var(--text);
}

/* Trennlinie */
.learn-container hr {
  margin: 35px 0;
  border: none;
  height: 1px;
  background: rgba(0, 0, 0, 0.15);
}

/* Dark Mode Verbesserungen */
.dark-theme .python-editor,
.dark-theme .python-output,
.dark-theme .example-box,
.dark-theme .info-box {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Mobile */
@media (max-width: 600px) {
  .learn-container {
    padding: 18px;
  }
}
.learn-container,
.editor-box,
iframe {
  max-width: 100%;
  box-sizing: border-box;
}
.learn-container {
  max-width: fit-content;
}
