/* Sieht aus wie die bestehenden Panels: farbiger Kopf, helle Karten, im Dark Theme die Panum-Farben. */

:root {
  --bg: #fff;
  --card: #f8f9fa;
  --field: #fff;
  --border: #e9ecef;
  --text: #495057;
  --text-soft: #6c757d;
  --head-a: #00838f;
  --head-b: #006978;
  --exam: #00838f;
  --homework: #b36a00;
  --danger: #c62828;
  color-scheme: light;
}

html.panum-dark-theme {
  --bg: #151d28;
  --card: #1a202b;
  --field: #171b22;
  --border: #303a4b;
  --text: #e8edf5;
  --text-soft: #b5bfce;
  --exam: #4fc3d0;
  --homework: #f0a94a;
  --danger: #ef9a9a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
}

button, input, textarea { font: inherit; color: inherit; }

.head {
  position: relative;
  background: linear-gradient(135deg, var(--head-a), var(--head-b));
  color: #fff;
  padding: 20px 60px 16px 18px;
}
.head-title { font-size: 20px; font-weight: bold; margin-bottom: 6px; }
.head-sub { font-size: 14px; opacity: 0.9; }
.head-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.head-close:hover { background: rgba(255, 255, 255, 0.35); transform: scale(1.05); }

main { flex: 1; overflow-y: auto; padding: 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.filters, .actions { display: flex; gap: 6px; }
.actions { justify-content: flex-end; }

.filter, .btn {
  border: 1px solid var(--border);
  background: var(--field);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.filter { display: flex; align-items: center; gap: 6px; }
.filter.active { border-color: var(--head-a); box-shadow: inset 0 0 0 1px var(--head-a); }
.btn.primary { background: var(--head-a); border-color: var(--head-a); color: #fff; }
.btn.danger { color: var(--danger); }
.btn:hover, .filter:hover { filter: brightness(0.96); }
html.panum-dark-theme .btn:hover, html.panum-dark-theme .filter:hover { filter: brightness(1.15); }

.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.exam, .entry.exam .bar { background: var(--exam); }
.dot.homework, .entry.homework .bar { background: var(--homework); }

.day { margin: 14px 0 6px; font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.day .rel { font-weight: normal; font-size: 12px; color: var(--text-soft); }
.day.today .rel { color: var(--head-a); font-weight: 600; }
html.panum-dark-theme .day.today .rel { color: var(--exam); }

.entry {
  display: flex;
  align-items: stretch;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
  cursor: pointer;
}
.entry .bar { width: 4px; flex: none; }
.entry .body { flex: 1; min-width: 0; padding: 9px 0; }
.entry .title { font-weight: 600; overflow-wrap: anywhere; }
.entry .meta { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.entry .note { font-size: 12px; color: var(--text-soft); margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry .kind { font-weight: 600; }
.entry.exam .kind { color: var(--exam); }
.entry.homework .kind { color: var(--homework); }
.entry .check { display: flex; align-items: center; padding: 0 12px 0 2px; }
.entry .check input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--homework); }
.entry.done .title { text-decoration: line-through; opacity: 0.6; }

.empty { text-align: center; color: var(--text-soft); padding: 28px 12px; }

.link {
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--text-soft);
  text-decoration: underline;
  cursor: pointer;
}
#toggle-past { display: block; margin: 12px auto 0; }
#toggle-past[hidden] { display: none; }

.foot {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-soft);
}

.undo {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #212529;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.undo[hidden] { display: none; }
.undo .link { color: #fff; font-weight: 600; }

.sheet {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.sheet[hidden] { display: none; }

.form {
  width: 100%;
  background: var(--bg);
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-title { font-size: 16px; font-weight: bold; }

.types { display: flex; gap: 6px; }
.type { flex: 1; cursor: pointer; }
.type input { position: absolute; opacity: 0; }
.type span {
  display: block;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-weight: 600;
  font-size: 13px;
}
.type.exam input:checked + span { border-color: var(--exam); color: var(--exam); }
.type.homework input:checked + span { border-color: var(--homework); color: var(--homework); }
.type input:focus-visible + span { outline: 2px solid var(--head-a); outline-offset: 1px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; flex: 1; min-width: 0; }
.field.narrow { flex: 0 0 92px; }
.field input, .field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  font-size: 14px;
  font-weight: normal;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--head-a); }

.row { display: flex; gap: 8px; }
.form-actions { display: flex; gap: 6px; align-items: center; }
.form-actions .btn { padding: 8px 16px; font-size: 13px; }
.spacer { flex: 1; }

/* ---- Verbindung zur Klasse ---- */

.hint { font-size: 13px; line-height: 1.45; }
.hint.error, #sync-status.error { color: var(--danger); }

.notice { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; border-color: var(--head-a); }
.notice[hidden] { display: none; }

.toggles { display: flex; justify-content: center; gap: 16px; margin-top: 12px; }
.toggles #toggle-past { margin: 0; }

.foot { flex-direction: column; gap: 8px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.foot-links .link[hidden] { display: none; }

.entry.deleted { opacity: 0.6; }
.entry.deleted .title { text-decoration: line-through; }

.authors { font-size: 12px; color: var(--text-soft); }
#history-btn { align-self: flex-start; }
.history { max-height: 150px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; padding: 4px 8px; }
.history[hidden], .authors[hidden] { display: none; }
.history-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.history-row:last-child { border-bottom: none; }
.history-info { flex: 1; min-width: 0; }
.history-row .btn { padding: 4px 8px; }

#qr { align-self: center; border-radius: 8px; background: #fff; }
#phone-url {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  font-size: 12px;
}

/* ---- Eigene Seite auf dem Handy (calendar.panumic.com) ---- */

html.standalone #close { display: none; }
html.standalone .head { padding: calc(18px + env(safe-area-inset-top)) 18px 16px; }
html.standalone body { max-width: 640px; margin: 0 auto; position: relative; }
html.standalone .filter, html.standalone .btn { padding: 9px 12px; font-size: 13px; }
html.standalone .entry .body { padding: 12px 0; }
html.standalone .foot { padding-bottom: env(safe-area-inset-bottom); }
html.standalone .row { flex-wrap: wrap; }
html.standalone .welcome { background: var(--bg); align-items: flex-start; padding-top: 120px; }

.pin { font-size: 26px; font-weight: bold; letter-spacing: 3px; text-align: center; font-variant-numeric: tabular-nums; }
#qr[hidden] { display: none; }
#welcome-code {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  font-size: 20px;
  letter-spacing: 2px;
  text-align: center;
}
html.standalone .welcome .row { flex-wrap: nowrap; }

/* ---- Abo-Dialog ---- */

a.abo { display: block; text-align: center; text-decoration: none; padding: 10px 12px; font-size: 13px; }
#abo-url { width: 100%; padding: 8px 10px; border: 2px solid var(--border); border-radius: 6px; background: var(--field); font-size: 12px; }

/* ---- Einmalige Einführung (features/tour.js) ---- */

.tour {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  background: var(--bg);
  border: 2px solid var(--head-a);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.tour[hidden] { display: none; }
.tour.tour-top { bottom: auto; top: 14px; }
.tour-count { font-size: 11px; color: var(--text-soft); margin-bottom: 4px; }
.tour-title { font-size: 15px; font-weight: bold; margin-bottom: 6px; }
.tour-text { font-size: 13px; line-height: 1.45; }
.tour-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.tour-actions .btn { padding: 8px 16px; font-size: 13px; }
.tour-target { outline: 3px solid var(--head-a); outline-offset: 3px; border-radius: 6px; animation: tour-pulse 1.2s ease-in-out infinite; }
@keyframes tour-pulse { 50% { outline-offset: 6px; } }
