/* ======================================
   Grundlayout
====================================== */
body {
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  background: #ffffff;
  color: #000000;
  padding-left: 10px;
  padding-right: 10px;
  padding-bottom: 10px;
}
a {
  color: #000000;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  color: #000000;
  font-size: 20px;
  margin-bottom: 20px;
}

/* Der Hauptinhalt (alles außer Footer) */
body > *:not(.footer) {
  flex: 1;
}

/* ======================================
   Navbar
====================================== */
.navbar {
  background-color: #333;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  box-sizing: border-box;
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
  margin-bottom: 10px;
}

.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Burger Toggle (mobil) - reine CSS-Lösung */
.menu-checkbox {
  display: none;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid #fff;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 18px;
  cursor: pointer;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

.nav-left li,
.nav-right li {
  margin: 0;
  display: block;
  white-space: nowrap;
}

.lernfeld-link {
  display: none;
}

.lernfeld-link a {
  display: none;
}

.topnav a {
  display: block;
  color: white;
  padding: 14px 16px;
  text-decoration: none;
  white-space: nowrap;
}

.topnav a:hover:not(.active) {
  background-color: #111;
}

.topnav a.active {
  background-color: #459388;
}

/* Zustand, wenn Kopfzeile umbricht (via JS-Klasse .nav-wrapped) */
.navbar .menu-toggle {
  display: block;
  align-self: flex-end;
  margin: 8px 8px 0 0;
  position: relative;
  z-index: 1002;
}

/* Dropdown-Panel als Overlay unter der Navbar platzieren */
.navbar {
  position: sticky;
  top: 0;
  overflow: visible;
}

.navbar .topnav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #333;
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
  z-index: 1001;
}

.navbar.nav-open .topnav {
  display: flex;
}

.navbar .nav-left,
.navbar .nav-right {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

.navbar .topnav a {
  padding: 12px 16px;
}

/* Breakpoint: Unter 900px Burger, darüber klassische Leiste */
@media (min-width: 900px) {
  .navbar .menu-toggle { display: none; }
  .navbar .topnav {
    position: static;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 0;
    box-shadow: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  .navbar .nav-left,
  .navbar .nav-right {
    flex-direction: row;
    width: auto;
  }
}

/* Mobile: Burger-Menü für alle Geräte unter 900px */
@media (max-width: 899px) {
  .navbar .menu-toggle { display: block !important; }
  .navbar .topnav { 
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: #ffffff !important;
    display: none !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1) !important;
    border: 1px solid #ddd !important;
    border-top: none !important;
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
    z-index: 1001 !important;
  }
  .menu-checkbox:checked ~ .topnav { display: flex !important; }
  .navbar .nav-left,
  .navbar .nav-right {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
  }
  .navbar .topnav a {
    padding: 14px 18px !important;
    border-bottom: 1px solid #eee !important;
    transition: background-color 0.2s ease !important;
    color: #000000 !important;
  }
  .navbar .topnav a:hover {
    background-color: #f5f5f5 !important;
    text-decoration: none !important;
  }
  .navbar .topnav a:last-child {
    border-bottom: none !important;
  }
}

ul {
  position: -webkit-sticky; /* Safari */
  position: sticky;
}

li {
  border-right: 1px solid #bbb;
}

li:last-child {
  border-right: none;
}

/* ======================================
   FAQ
====================================== */
.fragefaq {
  font-weight: bold;
  margin-top: 20px;
}

.antwortfaq {
  margin-top: 6px;
}

/* ======================================
   Page Title
====================================== */
.page-title {
  text-align: center;
  font-size: 24px;
  margin-bottom: 20px;
  color: #000000;
}

/* ======================================
   Lernfeld Button Layout
====================================== */
.button-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  padding: 16px 12px;
  min-width: 150px;
  max-width: 300px;
  width: 100%;
  text-align: center;
  border: 1px solid #000000;
  color: #FFFFFF;
  background-color: #459388;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease;
  margin: 0 auto;
  gap: 4px;
}

.lernfeld-number {
  font-size: 16px;
  font-weight: bold;
  line-height: 1.2;
}

.lernfeld-emoji {
  font-size: 24px;
  line-height: 1;
}

.lernfeld-title {
  font-size: 14px;
  font-weight: bold;
  line-height: 1.3;
  text-align: center;
  word-break: break-word;
  hyphens: auto;
}

/* ======================================
   Buttons zum Klicken
====================================== */
.button-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  max-width: 1200px;
  margin: 0 10px;
  padding: 0;
}

/* Basestyle für alle Buttons - wird durch Lernfeld Button Layout überschrieben */

.button-link:hover {
  background-color: #3b9d8f;
  text-decoration: none;
}

/* Standard-Ansicht: vertikal */
.button-list.list-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* Grid-Ansicht: Spalten */
.button-list.grid-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  row-gap: 10px;     /* vertikaler Abstand */
  column-gap: 10px;  /* horizontaler Abstand */
  max-width: 1200px;
  margin: 0 auto;
}

/* Individuelle Positionen */
.btn-lernfeld02  { grid-column: 1; grid-row: 1; }
.btn-lernfeld04  { grid-column: 1; grid-row: 2; }
.btn-lernfeld05  { grid-column: 1; grid-row: 3; }
.btn-lernfeld06  { grid-column: 2; grid-row: 1; }
.btn-lernfeld07  { grid-column: 2; grid-row: 2; }
.btn-lernfeld08  { grid-column: 2; grid-row: 3; }
.btn-lernfeld11  { grid-column: 3; grid-row: 1; }
.btn-lernfeld12  { grid-column: 3; grid-row: 2; }

/* ======================================
   Aufgabenüberschrift
====================================== */
#aufgabe > p:first-child {
  font-weight: bold;
  margin-bottom: 10px;
}

/* ======================================
   Aufgabenbeschreibung
====================================== */
#aufgabe p {
  margin: 6px 0;
}

/* ======================================
   Eingabe und Buttons
====================================== */
input[type="text"] {
  font-family: Arial, sans-serif;
  font-size: 18px;
  padding: 10px;
  border: 1px solid #000000;
  border-radius: 6px;
  margin-top: 15px;
  display: block;
  width: 100%;
  max-width: 300px;
  box-sizing: border-box;
  outline: none;
}

input[type="text"]:focus {
  border-color: #459388;
  box-shadow: 0 0 4px #459388;
}

button {
  background-color: #459388;
  color: white;
  border: 1px solid #000000;
  padding: 8px 14px;
  margin-top: 5px;
  font-size: 18px;
  border-radius: 5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:hover {
  background-color: #3b9d8f;
}

/* ======================================
   Navigations-Buttons unten
====================================== */
#navigationButtons {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

/* ======================================
   Rechenweg – luftige Darstellung
====================================== */
.rechenweg {
  background-color: #f3f3f3;
  padding: 10px 16px;
  margin-top: 15px;
  border-radius: 5px;
  border: 1px solid #000000;
}

.rechenweg p {
  margin: 10px 0;
  line-height: 1.6;
}

.rechenweg p:first-child {
  margin-top: 0;
}

.rechenweg p:last-child {
  margin-bottom: 0;
}

.aufgabenstellung {
  background-color: #f3f3f3;
  padding: 10px 16px;
  margin-top: 5px;
  border-radius: 5px;
  border: 1px solid #000000;
}

.eingabezeile {
  display: flex;
  align-items: baseline;
  margin-top: 10px;
  gap: 10px;
}

.eingabezeile label {
  width: 180px;
  font-weight: bold;
}
/* ======================================
   Responsive: Typografie und Layout
====================================== */
@media (max-width: 900px) {
  body {
    font-size: 17px;
  }

  .page-title {
    font-size: 22px;
    margin-bottom: 16px;
  }

  .button-list,
  .button-list.grid-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Reset individual grid positions for mobile */
  .btn-lernfeld02,
  .btn-lernfeld04,
  .btn-lernfeld05,
  .btn-lernfeld06,
  .btn-lernfeld07,
  .btn-lernfeld08,
  .btn-lernfeld11,
  .btn-lernfeld12 {
    grid-column: 1;
    grid-row: auto;
  }

  .button-link {
    padding: 14px 10px;
    max-width: 100%;
  }

  .lernfeld-number {
    font-size: 1.6em;
  }

  .lernfeld-emoji {
    font-size: 1.6em;
  }

  .lernfeld-title {
    font-size: 1.15em;
  }

  .eingabezeile {
    flex-direction: column;
    align-items: stretch;
  }

  .eingabezeile label {
    width: auto;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .page-title {
    font-size: 20px;
    margin-bottom: 14px;
  }

  .rechenweg {
    padding: 10px 12px;
  }

  .button-list {
    grid-template-columns: 1fr;
    margin: 0;
    gap: 10px;
  }

  .button-list.grid-layout {
    grid-template-columns: 1fr;
  }

  .button-link {
    padding: 12px 8px;
    min-height: 80px;
  }

  .lernfeld-number {
    font-size: 1.4em;
  }

  .lernfeld-emoji {
    font-size: 1.4em;
  }

  .lernfeld-title {
    font-size: 1.05em;
  }

  .topnav a {
    padding: 12px 14px;
  }

  input[type="text"],
  button {
    font-size: 16px;
  }

  .tg {
    font-size: 16px;
  }
}

/* Zwischenbereich: 2 Spalten auf Tablets/kleineren Screens */
@media (min-width: 600px) and (max-width: 899px) {
  .button-list.grid-layout {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* ======================================
   Tabellen-Stil
====================================== */
.tg {
  border-collapse: collapse;
  border-spacing: 0;
  margin-top: 10px;
  margin-bottom: 20px;
  font-size: 18px;
  width: auto;
  text-align: left;
}

.tg th,
.tg td {
  font-family: Arial, sans-serif;
  padding: 4px 8px;
  border: 1px solid #999;
  text-align: center;
}

/* ======================================
   🔝 Nach-oben-Button
====================================== */
#backToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  background-color: #459388;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 30px;
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.5s ease;
  opacity: 0;
  visibility: hidden;
  touch-action: manipulation;
}

#backToTop.visible {
  opacity: 1;
  visibility: visible;
}

#backToTop:hover {
  background-color: #3b9d8f;
  transform: translateY(-2px);
}

/* ======================================
   Mailbox
====================================== */
.mail-box {
  border: 1px solid #ccc;
  padding: 12px;
  border-radius: 5px;
  background-color: #fdfdfd;
  margin: 10px 0;
  line-height: 1.5;
}