/* ===== Dateibaum ===== */
.tree-row {
  display: flex; align-items: center; gap: 5px; padding: 3px 6px;
  border-radius: 7px; cursor: pointer; font-size: 13.5px; user-select: none;
  white-space: nowrap; min-height: 26px;
}
.tree-row:hover { background: var(--panel2); }
.tree-row.selected { background: var(--accent-dim); }
.tree-row.focused { outline: 1px solid var(--accent); outline-offset: -1px; }
.tree-row.current .tr-name { color: var(--accent); font-weight: 600; }
.tree-row.cut { opacity: .45; }
/* Versteckte Ordner (über das Auge eingeblendet): ausgegraut */
.tree-row.tree-hidden { opacity: .5; }
.tree-row.tree-hidden .tr-name { font-style: italic; }
#btn-show-hidden.on { color: var(--accent); background: var(--accent-dim); }
.tree-row.drop-target { background: var(--accent-dim); outline: 1.5px dashed var(--accent); outline-offset: -2px; }
.tree-row.flash { animation: tree-flash .9s ease; }
@keyframes tree-flash {
  0%, 60% { background: var(--accent-dim); }
  100% { background: transparent; }
}

.tr-arrow { width: 13px; text-align: center; color: var(--muted); font-size: 10px; flex-shrink: 0; }
.tr-ico { flex-shrink: 0; font-size: 14px; }
.tr-colordot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-left: -2px; }
.tr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.tr-tagdot { color: var(--accent); font-size: 11px; font-weight: 700; }
.tr-pin { color: var(--warn); font-size: 11px; }

/* Offline-Bearbeitet-Marke: Datei wurde offline geändert und überschreibt beim
   Reconnect den Server (Quelle: Upload-Warteschlange). */
.tr-offline-edit { display: inline-flex; align-items: center; flex-shrink: 0; color: #0ea5e9; }
.tr-offline-edit svg.ico { width: 13px; height: 13px; }
.tr-offline-edit.rollup { opacity: .55; }   /* Ordner-Sammelmarke (zugeklappt) */
/* Im Offline-Modus sanft pulsieren, damit die ausstehenden Edits auffallen. */
body.so-offline .tr-offline-edit:not(.rollup) { animation: tr-oe-pulse 2.2s ease-in-out infinite; }
@keyframes tr-oe-pulse {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 0 transparent); }
  50% { opacity: .5; filter: drop-shadow(0 0 3px #0ea5e9); }
}
@media (prefers-reduced-motion: reduce) {
  body.so-offline .tr-offline-edit:not(.rollup) { animation: none; }
}

/* ⋯-Knopf pro Zeile: Desktop nur bei Hover/Auswahl, Touch immer sichtbar */
.tr-more {
  display: none; flex-shrink: 0; border: 0; background: none; cursor: pointer;
  color: var(--muted); border-radius: 5px; padding: 1px 4px; line-height: 1;
}
.tr-more svg.ico { width: 14px; height: 14px; }
.tr-more:hover { background: var(--panel); color: var(--text); }
.tree-row:hover .tr-more, .tree-row.selected .tr-more { display: inline-flex; }
@media (pointer: coarse) {
  .tree-row { min-height: 36px; }
  .tr-more { display: inline-flex; padding: 6px 8px; }
}

/* Fokus-Pill über dem Baum */
#focus-pill {
  display: flex; align-items: center; gap: 6px; margin: 4px 8px;
  background: var(--accent-dim); border: 1px solid var(--accent);
  border-radius: 20px; padding: 3px 6px 3px 12px; font-size: 12.5px;
}
#focus-pill .fp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#focus-pill .fp-x {
  border: 0; background: none; color: var(--text); cursor: pointer;
  border-radius: 50%; padding: 0 5px; font-size: 14px;
}
#focus-pill .fp-x:hover { background: var(--panel); }
#focus-pill .fp-up {
  border: 0; background: none; color: var(--text); cursor: pointer;
  border-radius: 50%; padding: 2px 4px; display: flex; align-items: center;
}
#focus-pill .fp-up:hover { background: var(--panel); }
#focus-pill .fp-up svg.ico { width: 14px; height: 14px; }

/* ===== Sidebar-Sektionen (Favoriten/Recents/Tags) ===== */
.sb-row {
  display: flex; align-items: center; gap: 7px; padding: 3px 12px;
  cursor: pointer; font-size: 13px; border-radius: 6px; margin: 0 4px;
  white-space: nowrap;
}
.sb-row:hover { background: var(--panel2); }
.sb-row-ico { flex-shrink: 0; font-size: 13px; width: 16px; text-align: center; color: var(--accent); }
.sb-row-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb-row-sub { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.sb-tag-count {
  background: var(--panel2); border-radius: 9px; padding: 0 7px;
  font-size: 11px; color: var(--muted);
}
.sb-row-x {
  flex-shrink: 0; width: 18px; height: 18px; line-height: 1; padding: 0;
  border: 0; border-radius: 5px; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 15px; opacity: 0; transition: opacity .12s;
}
.sb-row:hover .sb-row-x, .sb-row-x:focus-visible { opacity: 1; }
.sb-row-x:hover { background: var(--panel); color: var(--err); }
.sb-empty { color: var(--muted); font-size: 12px; padding: 2px 14px 8px; }

/* Touch-Geräte haben kein Hover → ×-Entfernen-Knöpfe dauerhaft (dezent) zeigen */
@media (hover: none) {
  .hc-x, .sb-row-x { opacity: .55; }
}

#pinned-list, #recents-list, #tag-browser { padding-bottom: 6px; max-height: 30vh; overflow-y: auto; }

/* Kontextmenü-Erweiterungen */
.ctx-ico { width: 18px; text-align: center; flex-shrink: 0; }
.ctx-label { flex: 1; }
.ctx-hint { color: var(--muted); font-size: 11px; margin-left: 14px; }
.ctx-more { color: var(--muted); margin-left: 10px; }
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }

/* SVG-Icons im Baum */
.tr-arrow { display: inline-flex; align-items: center; justify-content: center; }
.tr-arrow svg.ico { width: 12px; height: 12px; }
.tr-arrow:hover svg.ico { color: var(--text); }
.tr-ico { display: inline-flex; align-items: center; color: var(--muted); }
.tr-ico svg.ico { width: 15px; height: 15px; }
.tree-row.dir .tr-ico { color: #e3b341; }
.tree-row.dir .tr-ico[style*="color"] svg { color: inherit; }
.tr-pin svg.ico { width: 11px; height: 11px; color: var(--warn); }
#focus-pill .fp-ico svg.ico { width: 13px; height: 13px; color: var(--accent); }
.sb-row-ico svg.ico { width: 14px; height: 14px; }

/* Custom-Reihenfolge: Einfüge-Linie beim Drag zwischen Zeilen */
.tree-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.tree-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }

/* Swipe-Gesten (Touch): links = trash/, rechts = Favorit */
.tree-row { touch-action: pan-y; }
.tree-row.swiping { transition: none; position: relative; z-index: 2; }
.tree-row:not(.swiping) { transition: transform .18s ease, background .18s ease; }
.tree-row.swipe-del { background: color-mix(in srgb, var(--err) 28%, transparent); }
.tree-row.swipe-pin { background: color-mix(in srgb, var(--warn) 30%, transparent); }
