/* Fotosammlung – Instrumentalgruppe KLJB Borkenwirthe */

:root {
  --bg: #F1F4EF;
  --surface: #FFFFFF;
  --ink: #1B2A22;
  --muted: #5F6E66;
  --green: #1E5C43;
  --green-deep: #143E2E;
  --green-soft: #DCE8E0;
  --brass: #C8963E;
  --brass-soft: #F6ECD8;
  --line: #D3DCD5;
  --danger: #B23B3B;
  --danger-soft: #F7E3E3;
  --ok-soft: #DDF0E4;
  --radius: 14px;
  --radius-small: 9px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
}
a { color: var(--green); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--green-soft); padding: 1px 5px; border-radius: 4px; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--green-soft); padding: 12px; border-radius: var(--radius-small); word-break: break-all; white-space: pre-wrap; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hint { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.optional { color: var(--muted); font-weight: 400; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

.wrap { width: 100%; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 640px; }

/* ---------- Typografie ---------- */
.org { margin: 0 0 6px; font-weight: 700; color: var(--green); font-size: 15px; }
.h1 { font-size: 30px; line-height: 1.15; font-weight: 800; margin: 0 0 14px; letter-spacing: -.01em; color: var(--green-deep); }
.h1-hero { font-size: clamp(32px, 7vw, 46px); }
.h2 { font-size: 19px; font-weight: 800; margin: 0 0 12px; color: var(--green-deep); }
.lead { font-size: 17px; margin: 0 0 14px; max-width: 58ch; }
.deadline { margin: 0; padding: 10px 14px; background: var(--brass-soft); border-radius: var(--radius-small); display: inline-block; font-size: 15px; }
.deadline strong { color: #7D5A16; }

/* ---------- Logo ---------- */
.logo { display: block; width: min(260px, 60vw); height: auto; margin: 0 0 22px; }
.logo-small { width: min(200px, 50vw); margin-bottom: 18px; }
.topbar-logo { width: 46px; height: auto; background: #fff; border-radius: 6px; padding: 3px; flex: none; }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 26px; }
.hero .lead { color: var(--ink); }

/* ---------- Karten & Formulare ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
}
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label, .field > span { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.input {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-small);
  background: #fff;
  color: var(--ink);
  min-height: 48px;
}
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.input[readonly] { background: var(--bg); }
.input-small { padding: 8px 12px; min-height: 40px; font-size: 15px; }
select.input { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231E5C43' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; }
.form-inline .input { flex: 1; min-width: 200px; }
.copy-row { display: flex; gap: 8px; }

.btn {
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  padding: 11px 18px;
  min-height: 46px;
  border-radius: var(--radius-small);
  border: 1.5px solid var(--green);
  background: #fff;
  color: var(--green);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--green-soft); }
.btn:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-deep); }
.btn-large { padding: 14px 26px; font-size: 17px; min-height: 52px; }
.btn-small { padding: 7px 12px; min-height: 36px; font-size: 14px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--green-soft); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }

.alert { padding: 12px 14px; border-radius: var(--radius-small); margin: 0 0 16px; font-size: 15px; }
.alert-error { background: var(--danger-soft); color: #6F1F1F; }
.alert-ok { background: var(--ok-soft); color: var(--green-deep); }

.progress { height: 6px; background: var(--green-soft); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress-bar { height: 100%; width: 0; background: var(--brass); transition: width .2s linear; }

/* ---------- Dropzone (das eine auffällige Element) ---------- */
.card-drop { padding: 0; border: 0; background: transparent; }
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 34px 20px 30px;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  border: 3px dashed rgba(255,255,255,.55);
  transition: background .15s, border-color .15s;
}
.dropzone:hover, .dropzone:focus-visible { background: var(--green-deep); border-color: #fff; outline: none; }
.dropzone.is-over { background: var(--green-deep); border-color: var(--brass); border-style: solid; }
.drop-icon { width: 60px; height: 60px; color: var(--brass); margin-bottom: 4px; }
.drop-title { font-size: 22px; font-weight: 800; }
.drop-sub { font-size: 15px; opacity: .85; line-height: 1.45; }
.is-uploading .dropzone { opacity: .5; pointer-events: none; }

/* ---------- Dateiliste ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-head .h2 { margin: 0; }
.count { color: var(--muted); font-weight: 600; }
.file-list { list-style: none; margin: 14px 0 0; padding: 0; }
.file-item {
  display: grid;
  grid-template-columns: 64px 1fr 36px;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.file-thumb {
  width: 64px; height: 64px;
  border-radius: 8px;
  background: var(--green-soft);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--green);
  font-weight: 800; font-size: 13px;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-thumb.is-video { font-size: 22px; }
.file-body { min-width: 0; }
.file-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.file-note { font-size: 15px; }
.file-remove {
  font: inherit; font-size: 24px; line-height: 1;
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--muted);
  cursor: pointer;
}
.file-remove:hover { background: var(--danger-soft); color: var(--danger); }
.file-item.is-done .file-status { color: var(--green); font-weight: 700; }
.file-item.is-done .file-note { display: none; }
.file-item.is-error .file-status { color: var(--danger); font-weight: 700; }
.file-item.is-uploading .file-status { color: var(--brass); }

/* ---------- Sticky-Leiste unten ---------- */
.summary {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(20,62,46,.10);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  z-index: 20;
}
.summary-inner { display: flex; align-items: center; gap: 14px; }
.summary-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.summary-text strong { font-size: 16px; }
.summary .progress { margin-top: 6px; }
body.has-summary { padding-bottom: 120px; }

/* ---------- Danke ---------- */
.done { text-align: center; padding: 36px 20px; }
.done-icon { width: 64px; height: 64px; color: var(--green); }
.done p { max-width: 46ch; margin: 0 auto 18px; }
.closed { text-align: center; padding: 36px 20px; font-size: 18px; }

.foot { padding: 24px 16px 40px; font-size: 13px; color: var(--muted); }
.foot p { margin: 0 0 8px; }
.heart { color: var(--danger); }

/* ---------- Installer ---------- */
.checklist { list-style: none; padding: 0; margin: 0 0 12px; }
.checklist li { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.checklist li span { width: 22px; font-weight: 800; }
.checklist li.ok span { color: var(--green); }
.checklist li.fail span { color: var(--danger); }
.page-admin .wrap.narrow { padding-top: 32px; padding-bottom: 40px; }

/* =====================================================================
   Verwaltung
   ===================================================================== */
.login { padding-top: 60px; }
.login .card { margin-top: 20px; }
.login .btn { width: 100%; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--green);
  color: #fff;
  padding: 0 16px;
}
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 0; }
.topbar-title { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-title strong { font-size: 17px; }
.topbar-title .muted { color: rgba(255,255,255,.75); font-size: 13px; }
.topbar-nav { margin-left: auto; display: flex; gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.topbar .btn-ghost { color: #fff; }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.14); }

.admin { padding: 12px 12px 60px; }
.toolbar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.toolbar-row { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-row + .toolbar-row { margin-top: 8px; }
.toolbar-row .input { flex: 1 1 150px; width: auto; }
.toolbar-actions { align-items: center; }

.selection-bar {
  position: sticky; top: 62px; z-index: 25;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--brass-soft);
  border: 1px solid #E5D3AC;
  border-radius: var(--radius-small);
  padding: 8px 12px;
  margin-bottom: 10px;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.tile { position: relative; margin: 0; background: var(--surface); border-radius: var(--radius-small); overflow: hidden; border: 2px solid transparent; }
.tile.is-selected { border-color: var(--brass); }
.tile-img { aspect-ratio: 1; background: var(--green-soft); cursor: pointer; position: relative; }
.tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--green); font-size: 22px; }
.tile-badge { position: absolute; right: 6px; bottom: 6px; background: rgba(20,62,46,.85); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.tile figcaption { padding: 6px 8px 8px; font-size: 12px; line-height: 1.3; }
.tile-name { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-by { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-check {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,.35);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.tile.is-selected .tile-check { background: var(--brass); border-color: var(--brass); }
.tile.is-selected .tile-check::after { content: '✓'; color: #fff; font-weight: 800; font-size: 15px; line-height: 24px; }
@media (hover: hover) {
  .tile-check { opacity: 0; transition: opacity .12s; }
  .tile:hover .tile-check, .tile.is-selected .tile-check, body.has-selection .tile-check { opacity: 1; }
}
/* Gruppen nach Person */
.group { margin-bottom: 14px; }
.group-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  font: inherit; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-small);
  padding: 8px 12px; margin-bottom: 8px;
}
.group-head:hover { background: var(--green-soft); }
.group-chevron { width: 22px; font-size: 14px; color: var(--green); transition: transform .15s; }
.group.is-collapsed .group-chevron { transform: rotate(-90deg); }
.group-name { font-weight: 800; font-size: 16px; color: var(--green-deep); }
.group-count { color: var(--muted); font-size: 14px; }
.group-head .btn { margin-left: auto; }
.group.is-collapsed .grid { display: none; }
.sentinel { height: 1px; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; max-width: 40ch; margin: 0 auto; }

/* Viewer */
.viewer {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(12,24,18,.96);
  display: grid;
  grid-template-rows: 1fr auto;
  color: #fff;
}
body.viewer-open { overflow: hidden; }
.viewer-media { display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 10px; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.viewer-ph { text-align: center; color: rgba(255,255,255,.75); font-size: 18px; }
.viewer-info { background: #fff; color: var(--ink); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.viewer-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-meta { font-size: 13px; color: var(--muted); line-height: 1.4; }
.viewer-info .field { margin: 0; }
.viewer-actions { display: flex; gap: 8px; }
.viewer-close, .viewer-nav {
  position: absolute; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.15); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer;
}
.viewer-close { top: 10px; right: 10px; }
.viewer-nav { top: 40%; }
.viewer-prev { left: 8px; } .viewer-next { right: 8px; }
.viewer-nav:disabled { opacity: .25; }
@media (min-width: 900px) {
  .viewer { grid-template-rows: 1fr; grid-template-columns: 1fr 320px; }
  .viewer-info { align-content: start; padding: 20px; }
  .viewer-nav { top: 50%; transform: translateY(-50%); }
  .viewer-next { right: 336px; }
  .viewer-close { right: 336px; }
}

/* Panels */
.panel { position: fixed; inset: 0; z-index: 90; background: rgba(20,62,46,.45); display: flex; align-items: flex-end; justify-content: center; }
.panel-inner { background: #fff; width: 100%; max-width: 620px; max-height: 88vh; overflow: auto; border-radius: var(--radius) var(--radius) 0 0; padding: 18px 18px calc(24px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .panel { align-items: center; } .panel-inner { border-radius: var(--radius); } }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head .h2 { margin: 0; }
.panel-close { font: inherit; font-size: 26px; border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; color: var(--muted); }
.panel-close:hover { background: var(--green-soft); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 8px; }
.table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 700; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td:last-child { text-align: right; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .card { padding: 18px 16px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .tile figcaption { display: none; }
  .tile { border-radius: 4px; }
  .topbar-nav .btn { padding: 6px 9px; }
  .file-item { grid-template-columns: 56px 1fr 32px; gap: 10px; }
  .file-thumb { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
