/* viewer.css – nur die für meinWissen eigenen Teile (Galerie, Filter, Karten,
   Bulk-Leiste, Edit). Alles andere (Header, Nav, Buttons, Modal, Login,
   Einstellungen) kommt 1:1 aus den Werkbank-CSS (tokens/base/components/screens). */

/* Board-Toolbar-Aktionen */
.board-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.btn-flat {
  height: 32px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--fs-small);
  font-family: inherit;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
}
.btn-flat:hover, .btn-flat.active { border-color: var(--accent-sky); color: var(--accent-sky); }
.toolbar-count { margin-left: auto; color: var(--text-muted); font-size: var(--fs-small); }

/* Filterleiste (Kategorien) */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-base);
  overflow-x: auto;
}

/* Mehrfachauswahl: Alle/Zähler/Löschen/Bearbeiten direkt in der Toolbar
   (die frühere .bulkbar-Extra-Leiste ist entfallen, Spec 2026-07-29). */
.select-controls { display: inline-flex; align-items: center; gap: 10px; }

/* Werkbank-Optik der Toolbar (2026-07-29): 32er-Icon-Boxen mit Tooltip,
   dezente Trennstriche zwischen Gruppen – wie die Board-Toolbar drüben. */
.toolbar-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: 14px; line-height: 1;
  transition: border-color 0.15s, color 0.15s;
}
.toolbar-icon:hover, .toolbar-icon.active { border-color: var(--accent-sky); color: var(--accent-sky); }
.toolbar-icon.danger:hover { border-color: var(--status-error); color: var(--status-error); }
.toolbar-accent {
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--accent-sky); border-radius: var(--radius-md);
  color: var(--accent-sky); transition: background 0.15s;
}
.toolbar-accent:hover { background: color-mix(in srgb, var(--accent-sky) 15%, transparent); }
.toolbar-accent:disabled { opacity: .5; cursor: default; }
.toolbar-separator { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }
.bulk-all { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-small); color: var(--text-secondary); }
.bulk-all input { accent-color: var(--accent-sky); }
.bulk-count { font-size: var(--fs-small); color: var(--text-muted); }

/* Import-Leiste – gleiche Anatomie wie .bulkbar (Fortschritt statt Auswahl). */
.importbar { display: flex; align-items: center; gap: 12px; padding: 8px 20px;
  border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.importbar a { color: var(--accent-sky); }

/* Galerie */
.gallery {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, 1fr);
  padding: 16px 20px;
}
@media (max-width: 1100px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .gallery { grid-template-columns: 1fr; padding: 12px; } }

.g-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s;
}
.g-card:hover { border-color: var(--accent-sky); }
.g-card.g-zoomable { cursor: zoom-in; }
/* Nicht-zoomende Kinder zeigen den Zoom-Cursor nicht. */
.g-zoomable :is(input, textarea) { cursor: auto; }
.g-zoomable .tag-chip { cursor: default; }
.g-card.selected { border-color: var(--accent-sky); box-shadow: inset 0 0 0 1px var(--accent-sky); }

.g-media {
  background: var(--surface-1);
  display: flex; align-items: center; justify-content: center;
  height: 255px; flex-shrink: 0; border-bottom: 1px solid var(--border);
}
.g-media img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.g-media .g-placeholder { color: var(--text-muted); font-size: 26px; }
.g-media .g-placeholder-note { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 22px; }
.g-media .g-placeholder-label { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: var(--ls-label); }

.g-body { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.g-top { display: flex; align-items: flex-start; gap: 6px; }
.g-title { flex: 1; min-width: 0; font-size: var(--fs-small); color: var(--text-muted); word-break: break-word; }
.g-actions { display: flex; gap: 4px; flex-shrink: 0; }
.g-icon {
  width: 24px; height: 24px; border-radius: var(--radius-sm); line-height: 1;
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 12px; display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.g-icon.edit:hover { border-color: var(--accent-sky); color: var(--accent-sky); }
.g-icon.del:hover { border-color: var(--status-error); color: var(--status-error); }
/* Auswahl-Tickbox als Overlay oben rechts auf dem Bild (Spec 2026-07-29). */
.g-check {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  padding: 3px; border-radius: 50%;
  background: rgba(0, 0, 0, .5); cursor: pointer;
}
.g-check input { width: 13px; height: 13px; accent-color: var(--accent-sky); cursor: pointer; display: block; }
/* Im Auswahlmodus wählt ein Klick irgendwo in der Karte (Feinschliff 2026-07-29). */
.g-card.g-selectable { cursor: pointer; }

.g-caption { font-size: var(--fs-body); color: var(--text-primary); word-break: break-word; }
.g-caption.empty { color: var(--text-muted); font-style: italic; }
.g-top .g-caption {
  flex: 1; min-width: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.g-modified { margin-top: auto; padding-top: 4px; font-size: var(--fs-small); color: var(--text-muted); }
.g-note {
  font-size: var(--fs-small); color: var(--text-secondary); white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.g-note a { color: var(--accent-sky); text-decoration: underline; word-break: break-all; }
.g-note a:hover { color: var(--text-primary); }
/* Verarbeitet (Layout-Test 2026-07-29): feste Text-Zonen statt fließender Höhe –
   3 Zeilen Bildunterschrift, 2 Zeilen Text; Notizen erst in der Detailansicht. */
.g-processed .g-top .g-caption { -webkit-line-clamp: 3; min-height: calc(3 * var(--lh-body) * 1em); }
.g-processed .g-note { -webkit-line-clamp: 2; min-height: calc(2 * var(--lh-body) * 1em); }
.g-due { font-size: var(--fs-small); color: var(--status-warning); }

/* Inline-Bearbeiten (nutzt modal-input/-textarea-Look) */

/* Zustände + Lightbox */
.state { padding: 32px; text-align: center; color: var(--text-muted); font-size: var(--fs-small); }
.gallery-wrap { flex: 1; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-primary);
  padding: 10px 20px; border-radius: var(--radius-md); font-size: var(--fs-small); z-index: 300;
  box-shadow: 0 8px 30px rgba(0,0,0,.35); max-width: 90vw;
}
.toast.error { border-color: var(--status-error); }
.lightbox { position: fixed; inset: 0; z-index: 250; background: var(--surface-1); display: flex; align-items: stretch; justify-content: center; gap: 12px; padding: 24px; cursor: zoom-out; }
/* Die Bühne schrumpft aufs Bild – Bild und Infobox stehen als Gruppe mittig,
   mit demselben Abstand wie die Karten in der Galerie (12px). */
.lightbox-stage { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center; }
.lightbox.solo .lightbox-stage { flex: 1; }
/* align-items:center statt Flex-Stretch und die Höhe direkt am Viewport
   verankert: Bei EXIF-gedrehten Fotos (Import, Orientation 6) rechnet der
   Browser die Flex-Größen sonst mit dem UNgedrehten Seitenverhältnis und
   verzerrt das Bild (Marcs Befund 2026-07-29). */
.lightbox-figure { position: relative; display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; }
/* Dünner Rahmen: Bilder mit weißem Hintergrund heben sich sonst nicht ab. */
.lightbox img { width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 48px); border-radius: var(--radius-md); border: 1px solid var(--border); }
.lightbox-zoom {
  position: absolute; top: 10px; right: 10px; z-index: 2;   /* über den Pfeil-Zonen */
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--accent-sky); color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  display: flex; align-items: center; justify-content: center; cursor: zoom-in;
}
.lightbox-zoom svg { display: block; }
.lightbox-zoom:hover { background: var(--accent-sky-hover); }
/* Blätter-Zonen: unsichtbare Randstreifen überm Bild – der Pfeil erscheint nur,
   wenn die Maus im jeweiligen Streifen steht (nicht schon irgendwo überm Bild;
   Marcs Korrektur 2026-07-29). Der ganze Streifen ist Klickfläche. Auf
   Touch-Geräten ausgeblendet – dort wird gewischt (Hover klebt auf Touch). */
.lightbox-nav {
  /* Nur der mittlere Bildbereich ist Zone – volle Höhe hatte die Lupe oben
     rechts verdeckt (Marcs Befund 2026-07-29), und schmaler wirkt ruhiger. */
  position: absolute; top: 30%; bottom: 30%; width: 14%; min-width: 44px; max-width: 90px;
  border: none; background: none; padding: 0 10px; cursor: pointer;
  display: flex; align-items: center;
  opacity: 0; transition: opacity .15s ease;
}
.lightbox-nav.prev { left: 0; justify-content: flex-start; }
.lightbox-nav.next { right: 0; justify-content: flex-end; }
.lightbox-nav:hover { opacity: 1; }
.lightbox-nav-chip {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-sky); color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  display: flex; align-items: center; justify-content: center;
}
.lightbox-nav:hover .lightbox-nav-chip { background: var(--accent-sky-hover); }
.lightbox-nav svg { display: block; }
.lightbox-nav[hidden], .lightbox.solo .lightbox-nav { display: none; }
@media (hover: none) { .lightbox-nav { display: none; } }
/* Stufe 2: nur das Bild, dunkel – wie die klassische Lightbox. */
.lightbox.solo { background: rgba(0, 0, 0, .85); }
.lightbox.solo .lightbox-panel { display: none; }
.lightbox.solo .lightbox-zoom { cursor: zoom-out; }
.lightbox-panel {
  width: min(360px, 40vw); flex-shrink: 0;
  align-self: center; height: min(430px, 100%);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.lb-head { display: flex; align-items: flex-start; gap: 8px; }
.lb-head .lb-caption { flex: 1; min-width: 0; }
.lb-caption { font-size: var(--fs-body); color: var(--text-primary); word-break: break-word; }
.lb-caption.empty { color: var(--text-muted); font-style: italic; }
.lb-note { font-size: var(--fs-small); color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; }
.lb-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-note a { color: var(--accent-sky); text-decoration: underline; word-break: break-all; }
.lb-foot { margin-top: auto; padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.lb-changed { font-size: var(--fs-small); color: var(--text-muted); }
.lb-meta { border-top: 1px solid var(--border); padding-top: 6px; font-size: var(--fs-label); color: var(--text-muted); word-break: break-all; }
@media (max-width: 640px) {
  .lightbox { flex-direction: column; align-items: stretch; padding: 12px; }
  .lightbox-stage { flex: 1; min-height: 0; }
  .lightbox-panel { width: 100%; height: auto; max-height: 40%; align-self: stretch; }
}
/* Settings-Ergänzungen */
.settings-status { font-size: var(--fs-small); color: var(--text-muted); margin-left: 8px; }
.settings-status.ok { color: var(--status-success); }
.settings-status.error { color: var(--status-error); }
.settings-hint { font-size: var(--fs-small); color: var(--text-muted); line-height: 1.5; margin: 0 0 12px; }

[hidden] { display: none !important; }
