/* =====================================================================
   WebNoah+ – lists.css: Listen & Klassen-Seiten
   ---------------------------------------------------------------------
   Seiten: Nachschlagelisten (Lehrer, Klassen, Fächer, Räume),
   Sprechstunden, Raumbelegung, PeterMeter, Prüfungen und Klassendienste
   (je Klasse), 5DK-Klassenliste.
   JS dazu: lists.js (alle Listen), pruefungen-page.js, dienste-page.js,
   raumbelegung-page.js, petermeter-page.js.

   Inhalt:
     1. Listen (Karte mit Suche, Tabelle / Karten am Handy)
     2. Prüfungen
     3. Raumbelegung
     4. Klassendienste, 5DK-Klassenliste
     5. Interaktion
   ===================================================================== */

/* =====================================================================
   1. Listen (Lehrer-, Fächer-, Klassen-, Raumliste, Sprechstunden)
   gebaut von js/lists.js
   ===================================================================== */
#list-root.list-page {
  max-width: 1080px;
  padding-top: 24px;
}

.list-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: left;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.list-search {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
  display: block;
}

.list-search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

:root .list-search input {
  width: 100%;
  min-height: 44px;
  padding-left: 40px;
  border-radius: 999px;
  background: var(--surface-2);
}

.list-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.list-scroll {
  overflow-x: auto;
}

/* Tabelle: ohne eigene Karte (die Karte ist .list-card) */
:root table.list-table {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 14px;
}

:root .list-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  white-space: nowrap;
}

:root .list-table td {
  text-align: left;
  vertical-align: top;
  padding: 11px 14px;
  line-height: 1.45;
}

:root .list-table tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

:root .list-table td.col-main {
  font-weight: 600;
}

:root .list-table td.col-main a {
  color: var(--text);
}

:root .list-table td.col-main a:hover {
  color: var(--link);
}

.list-table .col-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

:root .list-table th.col-num {
  text-align: right;
}

.list-table .col-nowrap,
.list-table .col-code {
  white-space: nowrap;
  width: 1%;
}

.list-table .col-wide {
  min-width: 200px;
}

.list-table code {
  font: 600 12.5px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  white-space: nowrap;
}

.list-table td.col-main code {
  color: var(--text);
}

.list-table .none {
  color: var(--muted);
  opacity: .7;
}

.list-table small.sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.list-table .names {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

:root .pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

:root a.pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}

.list-table tr.list-empty td {
  text-align: center;
  color: var(--muted);
  padding: 28px 14px;
}

/* Handy: jede Zeile eine Karte, Spaltenname steht davor */
@media (max-width: 720px) {
  #list-root.list-page {
    padding: 16px 12px 0;
  }

  .list-card {
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }

  .list-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px 0;
    background: var(--bg);
    border: 0;
  }

  .list-search {
    max-width: none;
  }

  .list-scroll {
    overflow: visible;
  }

  :root table.list-table,
  :root .list-table tbody,
  :root .list-table tr,
  :root .list-table td {
    display: block;
    width: auto;
    background: none;
  }

  :root table.list-table {
    background: transparent;
  }

  .list-table thead {
    display: none;
  }

  :root .list-table tbody tr {
    margin: 0 0 10px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
  }

  :root .list-table tbody tr:hover td {
    background: none;
  }

  :root .list-table td {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 10px;
    align-items: start;
    padding: 4px 0;
    border: 0;
    text-align: left;
  }

  :root .list-table td::before {
    content: attr(data-label);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 2px;
  }

  /* erste Spalte = Titel der Karte, ohne Beschriftung */
  :root .list-table td.col-main {
    display: block;
    padding: 0 0 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
    font-size: 16px;
  }

  :root .list-table td.col-main::before {
    display: none;
  }

  .list-table .col-num,
  :root .list-table th.col-num {
    text-align: left;
  }

  .list-table .col-wide {
    min-width: 0;
  }

  .list-table tr.list-empty td {
    display: block;
  }

  .list-table tr.list-empty td::before {
    display: none;
  }
}

.list-table .cell {
  min-width: 0;
}

@media (max-width: 720px) {
  .list-search {
    flex-basis: 100%;
  }

  .list-count {
    padding-left: 4px;
  }

  .list-table .cell {
    display: block;
  }

  .list-table .cell code {
    display: inline-block;
  }
}

/* ========================================================== 2. Prüfungen */
.pf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  margin: 8px auto 18px;
  color: var(--text);
  font-size: 14px;
}

.pf-toolbar label {
  font-weight: 600;
}

.pf-toolbar select {
  margin-left: 6px;
  padding: 6px 10px;
}

.pf-summary {
  color: var(--muted);
  font-size: 13px;
}

.pf-archive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 600;
}

.pf-group {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto 18px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.pf-group-heading {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15px;
  border-bottom: 1px solid var(--line);
}

.pf-group-count {
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}

.pf-card {
  background: transparent;
  color: var(--text);
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.pf-group .pf-card:first-of-type {
  border-top: none;
}

.pf-card-title {
  font-weight: 700;
  font-size: 15px;
}

.pf-badge-live {
  display: inline-block;
  background: var(--sa-ring);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 8px;
  margin-right: 6px;
  vertical-align: middle;
}

.pf-day-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  border-radius: 999px;
  padding: 2px 9px;
  margin-right: 8px;
  vertical-align: middle;
}

.pf-card-tag {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.pf-card-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

/* ======================================================= 3. Raumbelegung */
.rb-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 12px;
  border-radius: 999px;
  padding: 2px 10px;
  margin-right: 8px;
}

.rb-badge.rb-free {
  background: var(--lk-bg);
  color: var(--lk-fg);
}

.rb-badge.rb-busy {
  background: var(--sa-bg);
  color: var(--sa-fg);
}

.rb-occupant {
  font-size: 13px;
  color: var(--muted);
}

#rb-list tr.rb-row {
  cursor: pointer;
}

#rb-list tr.rb-row:hover {
  background: var(--accent-soft);
}

#rb-list tr.rb-row-active {
  background: var(--accent-soft);
}

#rb-detail {
  color: var(--text);
}

#rb-detail h3 {
  margin-top: 24px;
}

#rb-detail .rb-room-code {
  font-weight: 400;
  color: var(--muted);
  font-size: 14px;
}

.rb-day-heading {
  width: min(760px, calc(100% - 32px));
  margin: 14px auto 0;
  text-align: left;
  color: var(--text);
}

/* Suchfelder der Listen-Seiten */
#nl-search,
#ss-search {
  display: block;
  margin: 20px auto 8px;
  width: min(360px, calc(100% - 32px));
}

/* Raumbelegung: Suchfeld wie bei den anderen Listen */
:root #nl-search {
  min-height: 44px;
  margin: 24px auto 0;
  width: min(420px, calc(100% - 32px));
  padding-left: 40px;
  border-radius: 999px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center / 18px;
}

#rb-list {
  padding-top: 12px;
}

/* Raumbelegung: Filter "nur freie Räume" */
.rb-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px auto 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.rb-filter input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.rb-occupant b {
  color: var(--text);
}

:root .rb-now {
  margin: 4px auto 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

/* ============================================ 4. Klassendienste & Klassenliste */
/* Ämter-Tabellen: Bezeichnung rechtsbündig, Name linksbündig */
#dienste-root th {
  text-align: right;
  font-weight: 500;
}

#dienste-root td {
  text-align: left;
}

table.roster th {
  font-weight: 500;
}

/* Dienste: Ueberschriften zwischen den Tabellen */
#dienste-root h2 {
  margin-top: 28px;
}

#dienste-root hr + hr,
#dienste-root hr + hr + hr {
  display: none;
}

/* 5DK-Klassenliste: Katalognummer schmal und rechtsbuendig */
table.roster td:first-child,
table.roster th:first-child {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

table.roster td,
table.roster th {
  text-align: left;
}

/* ====================================================== 5. Interaktion */
:root .list-table tbody tr td {
  transition: background-color .12s ease;
}

/* Zeile unter der Maus bekommt links einen Akzent */
:root .list-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

:root .list-table a:not(.pill):hover {
  color: var(--link);
  text-decoration: underline;
}

#rb-list tr.rb-row {
  transition: background-color .12s ease;
}

#rb-list tr.rb-row:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ===================================================== 6. Kleine Specials */
/* Raumbelegung: Tabellen (früher direkt in specials/raumbelegung.html) */
#rb-list table td,
#rb-list table th,
#rb-detail table td,
#rb-detail table th {
  text-align: left;
  padding: 6px 10px;
}

#rb-list table th:first-child,
#rb-list table td:first-child {
  font-weight: 600;
}

/* PeterMeter(TM) (früher direkt in specials/petermeter.html) */
:root #pm-root {
  max-width: 420px;
  margin: 24px auto 0;
  padding: 1.2rem 1.5rem 1.6rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

#pm-gauge {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  color: var(--text); /* Zeiger + Mittelpunkt (currentColor) -- auch im Dark Mode sichtbar */
}

#pm-value-label {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0.3rem 0;
}

#pm-mood-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.8rem;
}

#pm-word {
  font-style: italic;
  font-size: 1.05rem;
  border-left: 4px solid var(--accent);
  padding: 0.4rem 0 0.4rem 0.8rem;
  margin: 1rem 0 0.4rem;
  text-align: left;
}

/* Peter-Fotos rund um die Anzeige: am PC je 3 links und rechts, am Handy
   je 3 drüber und drunter. Leicht verdreht wie Polaroids, schweben sanft,
   beim Drüberfahren/Antippen kommen sie nach vorne. */
.pm-stage {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 0.6rem;
  max-width: 1080px;
  margin: 24px auto 0;
  padding: 0 0.5rem;
}

.pm-stage #pm-root {
  margin: 0;
  width: 100%;
  position: relative;
  z-index: 2;
}

.pm-pics {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 440px;
  padding: 0.6rem 0;
}

.pm-pic {
  --r: -5deg;
  flex: 0 1 33%;
  max-width: 150px;
  margin: 0 -0.6rem;
  padding: 6px 6px 18px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22), 0 2px 6px rgba(0, 0, 0, .12);
  transform: rotate(var(--r));
  animation: pm-in .6s cubic-bezier(.2, .9, .3, 1.3) backwards, pm-float 5s ease-in-out infinite;
  transition: transform .25s ease, box-shadow .25s ease;
  position: relative;
  cursor: zoom-in;
}

.pm-pic img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 25%;
  border-radius: 3px;
}

.pm-pic:nth-child(1) { --r: -7deg; animation-delay: .05s, 0s; }
.pm-pic:nth-child(2) { --r: 4deg; top: 10px; z-index: 1; animation-delay: .15s, -1.6s; }
.pm-pic:nth-child(3) { --r: -3deg; animation-delay: .25s, -3.2s; }
.pm-pics-b .pm-pic:nth-child(1) { --r: 5deg; animation-delay: .35s, -.8s; }
.pm-pics-b .pm-pic:nth-child(2) { --r: -4deg; animation-delay: .45s, -2.4s; }
.pm-pics-b .pm-pic:nth-child(3) { --r: 7deg; animation-delay: .55s, -4s; }

.pm-pic:hover,
.pm-pic:active {
  animation-play-state: paused;
  transform: rotate(0deg) scale(1.35);
  z-index: 5;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}

[data-theme="dark"] .pm-pic {
  background: #f1f1ec;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
}

@keyframes pm-in {
  from { opacity: 0; transform: rotate(calc(var(--r) * 3)) scale(.6); }
}

@keyframes pm-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}

@media (min-width: 900px) {
  .pm-stage {
    grid-template-columns: 1fr minmax(0, 420px) 1fr;
    align-items: center;
    gap: 1.5rem;
  }

  .pm-pics {
    flex-direction: column;
    align-items: center;
    max-width: 220px;
    padding: 0;
  }

  .pm-pic {
    flex: none;
    width: 170px;
    max-width: none;
    margin: -1.2rem 0;
  }

  .pm-pics-a .pm-pic:nth-child(odd) { left: 22px; }
  .pm-pics-a .pm-pic:nth-child(2) { left: -18px; top: 0; }
  .pm-pics-b .pm-pic:nth-child(odd) { left: -22px; }
  .pm-pics-b .pm-pic:nth-child(2) { left: 18px; top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pm-pic { animation: none; }
}

#pm-word .pm-sig {
  font-style: normal;
  font-weight: 600;
}

#pm-stand {
  font-size: 0.8rem;
  color: var(--muted);
}
