/* =====================================================
   1. Farben und Grundwerte
   ===================================================== */
:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #cbd5e1;
  --line: #e5e7eb;
  
    /* Seitenfarben, die im Dark-Mode wechseln */
  --seite: #fefefe;
  --nav-text: #333;
  --text-soft: #5f6770;

  color-scheme: light dark;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --akzent: #1769aa;

  --grau: #77808c;
  --grau-hover: var(--akzent);
  --rot: #dc2626;
  --rot-hover: #b91c1c;

  --ok-bg: #dcfce7;
  --ok-text: #166534;
  --ok-border: #86efac;

  --fehler-bg: #fee2e2;
  --fehler-text: #991b1b;
  --fehler-border: #fca5a5;

  --hinweis-bg: #fef9c3;
  --hinweis-border: #fde047;
  --hinweis-text: #422006;

  --radius: 12px;

  /* Linker Abstand des Seiteninhalts */
  --inhalt-links: 110px;

  /* Rechter Abstand der Menüs (Hauptmenü und Benutzermenü) */
  --menue-rechts: 50px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #475569;
    --line: #334155;

    --primary: #3b82f6;
    --primary-hover: #60a5fa;

    --ok-bg: #14532d;
    --ok-text: #bbf7d0;
    --ok-border: #166534;

    --fehler-bg: #7f1d1d;
    --fehler-text: #fecaca;
    --fehler-border: #991b1b;

    --hinweis-bg: #422006;
    --hinweis-border: #a16207;
    --hinweis-text: #fef9c3;
	
	--seite: #162032;
    --nav-text: #e2e8f0;
    --text-soft: #94a3b8;
    --akzent: #60a5fa;
    --grau: #94a3b8;

  }
}


/* =====================================================
   2. Grundlagen (Reset, Body, Typografie)
   ===================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 1rem;
  font-family: Arial, sans-serif;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

h1 { margin: 0 0 .5rem; font-size: 1.5rem; }
h2 { margin: 2rem 0 .5rem; font-size: 1.15rem; color: var(--text); }
h3 { margin: 1.5rem 0 .3rem; font-size: 1rem; }

p { margin: .6rem 0; }

/* Links immer im Akzent-Blau – auch besucht, beim Darüberfahren und beim Klicken.
   :where() hält die Spezifität niedrig, damit Menü, Footer und .knopf ihre eigenen Farben behalten. */
:where(a, a:visited, a:hover, a:focus, a:active) { color: var(--akzent); }

small { color: var(--muted); }
.muted { color: var(--muted); }


/* =====================================================
   3. Seitenlayout (Wrapper, Header, Main, Footer)
   ===================================================== */
.page-wrapper {
  position: relative;
  width: min(1200px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background-color: var(--seite);   /* statt #fefefe */
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
}

/* ----- Header und Logo ----- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  padding: 0 var(--menue-rechts) 0 10px;
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  color: var(--grau);
  font-size: 14px;
  font-weight: bold;
}

/* ----- Hauptbereich ----- */
main {
  padding: 30px var(--inhalt-links) 90px var(--inhalt-links);
  text-align: left;
}

main h1 {
  margin-bottom: 20px;
  color: var(--akzent);
  font-size: clamp(2rem, 5vw, 3.5rem);
}

main p {
  max-width: 650px;
  margin: 0;
  color: var(--text-soft);          /* statt #5f6770 */
  font-size: 1.1rem;
  line-height: 1.7;
}

/* Login-Seite: Abstand nach oben */
.login-main {
  padding-top: 30px;
}

.login-schueler {
  margin-top: 1.5rem;
  font-size: .95rem;
}

/* ----- Footer ----- */
footer {
  padding: 24px 32px;
  border-top: 1px solid var(--line);
  color: var(--grau);
  font-size: 14px;
  text-align: center;
}

footer a[href="/datenschutz"],
footer a[href="/datenschutz"]:visited {
  color: inherit;
  font: inherit;
  text-decoration: none;
}


/* =====================================================
   4. Navigation
   ===================================================== */
/* Hauptmenü im Header */
nav ul {
  display: flex;
  gap: 28px;
  list-style: none;
}

nav a {
  color: var(--nav-text);           /* statt #333 */
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

nav a:hover,
nav a:focus {
  color: var(--akzent);
}

/* Benutzermenü: zweite Leiste unter dem Header */
.nav-user {
  padding: 10px var(--menue-rechts) 10px 10px;
  border-bottom: 1px solid var(--line);
}

.nav-user ul {
  justify-content: flex-end;
}

.nav-user a {
  font-size: .9rem;
  font-weight: 500;
}

.nav-user form {
  margin: 0;
}

.nav-user button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--nav-text);           /* statt #333 */
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}

.nav-user button:hover,
.nav-user button:focus {
  background: none;
  color: var(--akzent);
}

/* Linkliste auf der Konto-Seite: untereinander */
.nav {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
  color: var(--text-soft); 
}

/* =====================================================
   5. Box (Login, Dashboard, Konto, Admin)
   ===================================================== */
.box {
  max-width: 300px;
  margin-left: 0;
  margin-right: auto;
  padding: 0;
  background: transparent;
}

.box.breit {
  max-width: 900px;
}


/* =====================================================
   6. Formulare
   ===================================================== */
label {
  display: block;
  margin-top: 1rem;
  font-weight: 600;
}

input,
select {
  width: 100%;
  margin-top: .3rem;
  padding: .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

input:-webkit-autofill,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--card) inset;
  caret-color: var(--text);
}

/* =====================================================
   7. Buttons
   ===================================================== */
button {
  margin-top: 1.2rem;
  padding: .6rem 1.2rem;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

button:hover { background: var(--primary-hover); }
button:disabled { background: #94a3b8; cursor: not-allowed; }

button.grau { background: var(--grau); }
button.grau:hover { background: var(--grau-hover); }

button.rot { background: var(--rot); }
button.rot:hover { background: var(--rot-hover); }

.abmelden { margin-top: 1.5rem; }
.abmelden button { margin-top: 0; }


/* =====================================================
   8. Meldungen und Hinweisfelder
   ===================================================== */
#meldung {
  display: none;
  margin: 1rem 0;
  padding: .8rem 1rem;
  border-radius: 6px;
  font-weight: 600;
}

#meldung.ok {
  display: block;
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid var(--ok-border);
}

#meldung.fehler {
  display: block;
  background: var(--fehler-bg);
  color: var(--fehler-text);
  border: 1px solid var(--fehler-border);
}

/* Gelbe Hinweisfelder (neues Passwort, Einladungslink) */
#neuesPasswort,
#neuerLink {
  display: none;
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 6px;
  background: var(--hinweis-bg);
  border: 1px solid var(--hinweis-border);
  color: var(--hinweis-text);
}

#neuesPasswort code,
#neuerLink code {
  font-size: .95rem;
  user-select: all;
  word-break: break-all;
}


/* =====================================================
   9. Admin: Eingabezeile und Tabellen
   ===================================================== */
.zeile {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}

.zeile input,
.zeile select,
.zeile label,
.zeile button {
  width: auto;
  margin: 0;
}

.zeile input[type="text"] { flex: 1 1 12rem; }
.zeile label { font-weight: normal; }

.tabelle { overflow-x: auto; }

table {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
}

th,
td {
  padding: .5rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

td select.rolle {
  width: auto;
  margin: 0;
  padding: .3rem .5rem;
}

td button {
  margin: .1rem;
  padding: .4rem .8rem;
  font-size: .9rem;
}

/* Datei-Browser (Informatik-Seite) */
.pfadleiste {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  margin-top: .5rem;
}

.pfadleiste span { color: var(--muted); }
.pfadleiste .pfad-label { color: var(--text); font-weight: 600; }

.dateibrowser td:first-child { word-break: break-word; }
.dateibrowser td a { text-decoration: none; }
.dateibrowser td a:hover { text-decoration: underline; }
.dateibrowser td:not(:first-child),
.dateibrowser th:not(:first-child) { white-space: nowrap; }

/* Link, der wie ein kleiner Button aussieht */
a.knopf,
.dateibrowser td a.knopf {
  display: inline-block;
  margin: .1rem;
  padding: .4rem .8rem;
  border-radius: 6px;
  background: var(--grau);
  color: #fff;
  font-size: .9rem;
  text-decoration: none;
}

/* „← Zurück“ oben auf den Seiten: so groß wie die übrigen Knöpfe (button) */
a.knopf.zurueck {
  margin: 0 0 .4rem;
  padding: .6rem 1.2rem;
  font-size: 1rem;
  line-height: inherit;
}

a.knopf:hover,
.dateibrowser td a.knopf:hover {
  background: var(--grau-hover);
  color: #fff;
  text-decoration: none;
}

/* Nur für Screenreader sichtbar */
.unsichtbar {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}


/* =====================================================
   10. Responsive (immer am Dateiende)
   ===================================================== */
@media (max-width: 700px) {
  .page-wrapper {
    width: 100%;
  }

  header {
    flex-direction: column;
    gap: 20px;
    padding: 24px;
  }

  nav ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
  }

  .nav-user {
    padding: 12px 24px;
	flex-wrap: wrap;
	justify-content: center;
  }
  
  .nav-user ul {
    justify-content: center;
    text-align: center;
  }

  main {
    padding: 60px 24px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0 .5rem;
  }

  .box {
    padding: 1.25rem;
  }
}

@media (prefers-color-scheme: dark) {
  .logo {
    background: url('/logo-dark.svg') center / contain no-repeat;
  }
  .logo img {
    visibility: hidden;
  }
}
