/* ======================================================
   ROOT-VARIABLEN
   ====================================================== */
:root {
  /* Hauptfarben */
  --color-primary: #1B4E9B;
  --color-primary-dark: #0F2B55;
  --color-dark: #000;

  /* Grau- und Weißtöne */
  --color-light: #f9f9f9;
  --color-mid: #CECECD;
  --color-border: #ccc;
  --color-bg-even: #eee;
  --color-bg-odd: #e5e5e5;
  --color-bg-hover: #ccc;

  /* Akzentfarben */
  --color-error: red;

  /* Text & Basis */
  --font-base: 'Asap', sans-serif;
  --font-size-base: 18px;

  /* Abstände & Layout */
  --radius: 5px;
  --shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  --transition: 0.3s ease;
}

/* ======================================================
   RESET & BASIS
   ====================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-base);
  font-size: var(--font-size-base);
  color: var(--color-dark);
  margin: 0;
  padding: 0;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2000 1500'%3E%3Cdefs%3E%3Crect stroke='%23ffffff' stroke-width='0.4' width='1' height='1' id='s'/%3E%3Cpattern id='a' width='3' height='3' patternUnits='userSpaceOnUse' patternTransform='scale(8.45) translate(-881.66 -661.24)'%3E%3Cuse fill='%23fcfcfc' href='%23s' y='2'/%3E%3Cuse fill='%23fcfcfc' href='%23s' x='1' y='2'/%3E%3Cuse fill='%23fafafa' href='%23s' x='2' y='2'/%3E%3Cuse fill='%23fafafa' href='%23s'/%3E%3Cuse fill='%23f7f7f7' href='%23s' x='2'/%3E%3Cuse fill='%23f7f7f7' href='%23s' x='1' y='1'/%3E%3C/pattern%3E%3Cpattern id='b' width='7' height='11' patternUnits='userSpaceOnUse' patternTransform='scale(8.45) translate(-881.66 -661.24)'%3E%3Cg fill='%23f5f5f5'%3E%3Cuse href='%23s'/%3E%3Cuse href='%23s' y='5' /%3E%3Cuse href='%23s' x='1' y='10'/%3E%3Cuse href='%23s' x='2' y='1'/%3E%3Cuse href='%23s' x='2' y='4'/%3E%3Cuse href='%23s' x='3' y='8'/%3E%3Cuse href='%23s' x='4' y='3'/%3E%3Cuse href='%23s' x='4' y='7'/%3E%3Cuse href='%23s' x='5' y='2'/%3E%3Cuse href='%23s' x='5' y='6'/%3E%3Cuse href='%23s' x='6' y='9'/%3E%3C/g%3E%3C/pattern%3E%3Cpattern id='h' width='5' height='13' patternUnits='userSpaceOnUse' patternTransform='scale(8.45) translate(-881.66 -661.24)'%3E%3Cg fill='%23f5f5f5'%3E%3Cuse href='%23s' y='5'/%3E%3Cuse href='%23s' y='8'/%3E%3Cuse href='%23s' x='1' y='1'/%3E%3Cuse href='%23s' x='1' y='9'/%3E%3Cuse href='%23s' x='1' y='12'/%3E%3Cuse href='%23s' x='2'/%3E%3Cuse href='%23s' x='2' y='4'/%3E%3Cuse href='%23s' x='3' y='2'/%3E%3Cuse href='%23s' x='3' y='6'/%3E%3Cuse href='%23s' x='3' y='11'/%3E%3Cuse href='%23s' x='4' y='3'/%3E%3Cuse href='%23s' x='4' y='7'/%3E%3Cuse href='%23s' x='4' y='10'/%3E%3C/g%3E%3C/pattern%3E%3Cpattern id='c' width='17' height='13' patternUnits='userSpaceOnUse' patternTransform='scale(8.45) translate(-881.66 -661.24)'%3E%3Cg fill='%23f2f2f2'%3E%3Cuse href='%23s' y='11'/%3E%3Cuse href='%23s' x='2' y='9'/%3E%3Cuse href='%23s' x='5' y='12'/%3E%3Cuse href='%23s' x='9' y='4'/%3E%3Cuse href='%23s' x='12' y='1'/%3E%3Cuse href='%23s' x='16' y='6'/%3E%3C/g%3E%3C/pattern%3E%3Cpattern id='d' width='19' height='17' patternUnits='userSpaceOnUse' patternTransform='scale(8.45) translate(-881.66 -661.24)'%3E%3Cg fill='%23ffffff'%3E%3Cuse href='%23s' y='9'/%3E%3Cuse href='%23s' x='16' y='5'/%3E%3Cuse href='%23s' x='14' y='2'/%3E%3Cuse href='%23s' x='11' y='11'/%3E%3Cuse href='%23s' x='6' y='14'/%3E%3C/g%3E%3Cg fill='%23efefef'%3E%3Cuse href='%23s' x='3' y='13'/%3E%3Cuse href='%23s' x='9' y='7'/%3E%3Cuse href='%23s' x='13' y='10'/%3E%3Cuse href='%23s' x='15' y='4'/%3E%3Cuse href='%23s' x='18' y='1'/%3E%3C/g%3E%3C/pattern%3E%3Cpattern id='e' width='47' height='53' patternUnits='userSpaceOnUse' patternTransform='scale(8.45) translate(-881.66 -661.24)'%3E%3Cg fill='%23FFFFFF'%3E%3Cuse href='%23s' x='2' y='5'/%3E%3Cuse href='%23s' x='16' y='38'/%3E%3Cuse href='%23s' x='46' y='42'/%3E%3Cuse href='%23s' x='29' y='20'/%3E%3C/g%3E%3C/pattern%3E%3Cpattern id='f' width='59' height='71' patternUnits='userSpaceOnUse' patternTransform='scale(8.45) translate(-881.66 -661.24)'%3E%3Cg fill='%23FFFFFF'%3E%3Cuse href='%23s' x='33' y='13'/%3E%3Cuse href='%23s' x='27' y='54'/%3E%3Cuse href='%23s' x='55' y='55'/%3E%3C/g%3E%3C/pattern%3E%3Cpattern id='g' width='139' height='97' patternUnits='userSpaceOnUse' patternTransform='scale(8.45) translate(-881.66 -661.24)'%3E%3Cg fill='%23FFFFFF'%3E%3Cuse href='%23s' x='11' y='8'/%3E%3Cuse href='%23s' x='51' y='13'/%3E%3Cuse href='%23s' x='17' y='73'/%3E%3Cuse href='%23s' x='99' y='57'/%3E%3C/g%3E%3C/pattern%3E%3C/defs%3E%3Crect fill='url(%23a)' width='100%25' height='100%25'/%3E%3Crect fill='url(%23b)' width='100%25' height='100%25'/%3E%3Crect fill='url(%23h)' width='100%25' height='100%25'/%3E%3Crect fill='url(%23c)' width='100%25' height='100%25'/%3E%3Crect fill='url(%23d)' width='100%25' height='100%25'/%3E%3Crect fill='url(%23e)' width='100%25' height='100%25'/%3E%3Crect fill='url(%23f)' width='100%25' height='100%25'/%3E%3Crect fill='url(%23g)' width='100%25' height='100%25'/%3E%3C/svg%3E"); background-attachment: fixed;
  background-size: cover;
}

/* ======================================================
   TEXT & TYPOGRAPHIE
   ====================================================== */
a {
  color: var(--color-primary);
  text-decoration: none;
  outline: none;
  transition: color var(--transition);
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3 {
  margin: 2em 0 1em;
  font-weight: 600;
}

h1 {
  font-size: 1rem;
  color: var(--color-primary-dark);
}

h2 {
  font-size: 1.2rem;
  text-transform: uppercase;
  color: var(--color-primary-dark);
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 1.5em 0 0.5em;
}

h1:first-child,
h2:first-child {
  margin-top: 0;
}

h1 + h2 {
  margin-top: 0.5em;
}

p, ol, ul {
  margin: 0;
  padding: 0;
}

ol, ul {
  margin: 15px 0 20px 30px;
  list-style-position: outside;
  text-align: left;
}

ol {
  list-style-type: decimal-leading-zero;
}

ul {
  list-style-type: square;
}

li {
  padding-bottom: 15px;
}

strong {
  font-weight: bold;
}

.nobr { white-space: nowrap; }
.center, center { text-align: center; }

pre {
  background: #fff;
  overflow: auto;
  padding: 1rem;
  font-family: monospace;
  font-size: 1rem;
  line-height: 1rem;
}

/* ======================================================
   BUTTONS
   ====================================================== */
button,
.button {
  background-color: var(--color-primary);
  border: none;
  color: #fff;
  padding: 1rem;
  font-size: 1rem;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background-color var(--transition);
}

button:hover,
.button:hover {
  background-color: var(--color-primary-dark);
  text-decoration: none;
}

/* ======================================================
   LOGIN-BEREICH
   ====================================================== */
#login-wrap {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

#login {
  width: 500px;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  background: var(--color-light);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

#login * {
  font-size: 1.2rem;
}

#login p {
  color: var(--color-error);
  padding: 1em 0;
}

#login input {
  margin: 1rem 0;
  text-align: left !important;
}

/* ======================================================
   LAYOUT
   ====================================================== */

/* ======================================================
   NEUES MODERNES LAYOUT (CSS GRID & FLEXBOX)
   ====================================================== */
#wrap {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem;
}

#container {
  max-width: 1400px; /* Etwas mehr Platz für breite Tabellen */
  width: 100%;
  display: grid;
  grid-template-columns: 240px 1fr; /* Festes Raster: Links Nav, rechts Content */
  grid-template-rows: auto auto;
  grid-template-areas: 
    "brand user"
    "sidebar main";
  background: var(--color-light);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden; /* Verhindert, dass Ecken herausragen */
}

/* Header-Bereich (wird zu "brand") */
#head {
  grid-area: brand;
  padding: 2rem 1.5rem;
  background: var(--color-light);
  display: flex;
  align-items: center;
}

#head h1 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--color-primary-dark);
}

/* User-Bereich oben rechts */
#user {
  grid-area: user;
  background: var(--color-primary);
  color: #fff;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#user a {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  color: #fff;
  text-decoration: none;
  transition: background var(--transition);
}

#user a:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Navigation links */
#navigation {
  grid-area: sidebar;
  padding: 1.5rem;
  background: #f0f4f8; /* Leicht abgesetzter Hintergrund für die Nav */
  border-right: 1px solid var(--color-border);
}

/* Content rechts */
#content {
  grid-area: main;
  padding: 2rem;
  min-width: 0; /* WICHTIG: Verhindert, dass pre/tables das Grid sprengen */
}

/* ======================================================
   NAVIGATION
   ====================================================== */
.nav {
  border-top: 1px dashed var(--color-mid);
  line-height: 2em;
  cursor: pointer;
}

.nav:first-child {
  border-top: none;
}

.navsub {
  margin-bottom: 1rem;
}

.navsub ul {
  margin: 0;
  padding: 0;
  list-style: square inside;
}

.navsub ul li {
  font-size: 1rem;
  line-height: 1.5em;
  padding-bottom: 0;
}

.navsub ul li a {
  color: var(--color-primary);
}

/* ======================================================
   RESPONSIVE DESIGN (MOBILE)
   ====================================================== */
@media (max-width: 950px) {
  #container {
    grid-template-columns: 1fr; /* Alles untereinander schieben */
    grid-template-areas: 
      "brand"
      "user"
      "sidebar"
      "main";
  }

  #navigation {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  #head {
    text-align: center;
    justify-content: center;
  }

  #user {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}

/* ======================================================
   HAMBURGER-MENU LOGIK & STYLING
   ====================================================== */

/* Versteckt die Checkbox und das Label im Desktop-Modus */
.nav-toggle-checkbox,
.nav-toggle-label {
  display: none;
}

/* Responsive Anpassungen ab 950px und kleiner */
@media (max-width: 950px) {
  #container {
    grid-template-columns: 1fr;
    grid-template-areas: 
      "brand"
      "user"
      "toggle" /* Platzhalter für den Hamburger */
      "sidebar"
      "main";
  }

  /* Hamburger Button Design */
  .nav-toggle-label {
    grid-area: toggle;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: #e0f0ff;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
  }

  /* Der eigentliche Strich des Hamburgers */
  .nav-toggle-label span,
  .nav-toggle-label span::before,
  .nav-toggle-label span::after {
    display: block;
    background: var(--color-primary);
    height: 3px;
    width: 28px;
    position: relative;
    transition: transform var(--transition), top var(--transition);
  }

  .nav-toggle-label span::before,
  .nav-toggle-label span::after {
    content: '';
    position: absolute;
  }

  .nav-toggle-label span::before { top: -8px; }
  .nav-toggle-label span::after { top: 8px; }

  /* NAVIGATION MOBIL: Standardmäßig geschlossen */
  #navigation {
    grid-area: sidebar;
    max-height: 0;
    overflow: hidden;
    padding: 0 1.5rem; /* Padding oben/unten weg, sonst blitzt es hervor */
    background: #f0f4f8;
    border-right: none;
    border-bottom: none;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
  }

  /* DIE MAGIE: Wenn Checkbox aktiv, wird die Navigation ausgefahren */
  .nav-toggle-checkbox:checked ~ #navigation {
    max-height: 500px; /* Groß genug wählen, damit alle Menüpunkte Platz haben */
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
  }

  /* Hamburger-Animation zum "X" bei Aktivierung */
  .nav-toggle-checkbox:checked + .nav-toggle-label span {
    background: transparent;
  }
  .nav-toggle-checkbox:checked + .nav-toggle-label span::before {
    top: 0;
    transform: rotate(45deg);
  }
  .nav-toggle-checkbox:checked + .nav-toggle-label span::after {
    top: 0;
    transform: rotate(-45deg);
  }

  /* Kopfbereiche mobil anpassen */
  #head { text-align: center; justify-content: center; }
  #user { flex-direction: column; gap: 10px; text-align: center; }
}




/* ======================================================
   FORM & SONSTIGES
   ====================================================== */
.formfehler { color: var(--color-error); }

img.bild {
  max-width: 200px;
  display: block;
  margin: 8px 0;
  border: 1px solid var(--color-border);
}

.iconbox {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
}

.iconbox a {
  display: flex; 
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  text-decoration: none;
}

.iconbox a:hover {
  background-color: var(--color-primary-dark);
  color: #fff;
}

.iconbox span {
  font-size: 1.5rem;
  width: 1.5rem;
  text-align: center;
}

/* ======================================================
   FREIZEIT-ICONS
   ====================================================== */
.freizeiticons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.freizeiticons div {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--color-border);
  padding: 5px;
  width: calc(25% - 0.75rem);
}

.freizeiticons span {
  font-size: 0.65rem;
}

.freizeiticons img {
  background: #777;
  width: 45px;
}

/* -------------------------------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 1rem;
}

.filter-bar div {
  width: 100%;
  font-weight: bold;
}

.filter-bar a{
  padding: 0.5rem;
  background: var(--color-primary)!important;
  border-radius: 5px;
  color: #fff!important;
  text-decoration: none!important;
}

a.filter-bar-active {
  background: var(--color-primary-dark)!important;
}

/* -------------------------------------------- */

table.datatb {
  border-collapse: collapse!important;
  width: 100%;
}

table.datatb tr th {
  font-weight: 600!important;
  background: var(--color-primary)!important;
  color: #fff!important;
  padding: 1rem!important;
  text-align: left;
}

table.datatb tr td {
  padding: 1rem!important; 
  vertical-align:middle;
}

table.datatb tr:nth-of-type(even) td { background: #eee!important;}
table.datatb tr:nth-of-type(odd) td { background: #e5e5e5!important;}
table.datatb tr:hover td { background: #ccc!important;}

table.datatb tr.nichtfreigeschaltet td {
  background-color: #ff5353!important;
}

table.datatb tr.old td {
  color: #bbb!important;
}



/* --- AB HIER NEU: RESPONSIVE STRUKTUR --- */
@media screen and (max-width: 768px) {
  
  /* Blendet den echten Tabellenkopf auf Smartphones aus */
  table.datatb thead, 
  table.datatb tr th {
    display: none!important;
  }
  
  /* Verwandelt Zeilen und Zellen in Block-Elemente */
  table.datatb tr {
    display: block!important;
    margin-bottom: 1rem!important;
    border: 1px solid #ccc!important;
  }
  
  table.datatb tr td {
    display: block!important;
    text-align: right!important; /* Inhalt rechtsbündig */
    padding: 0.75rem 1rem!important;
    position: relative!important;
    border-bottom: 1px solid #ddd!important;
  }
  
  /* Entfernt den Rahmen von der letzten Zelle einer Kachel */
  table.datatb tr td:last-child {
    border-bottom: 0!important;
  }
  
  /* Erzeugt die Spaltenbeschriftung links über das data-label Attribut */
  table.datatb tr td::before {
    content: attr(data-label);
    position: absolute!important;
    left: 1rem!important;
    width: 45%!important;
    text-align: left!important;
    font-weight: 600!important;
    color: #333!important;
  }
  
  /* Falls Icons/Buttons zentriert werden sollen auf Mobilgeräten */
  table.datatb tr td .iconbox {
    display: inline-flex!important;
    justify-content: flex-end!important;
  }
}



/* System- und Feedback-Meldungen */
.alert {
    padding: 1rem;
    border-radius: var(--radius, 4px);
    margin-bottom: 1.5rem;
}
.alert-success {
    background-color: #e2f0d9;
    color: #385723;
    border: 1px solid #c5e1b7;
}
.alert-error {
    background-color: #fce4d6;
    color: #c65911;
    border: 1px solid #f7caac;
}
.alert-info {
    background-color: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
}