/* Notizen – Gestaltung zu public/notizen.js.

   Arbeitet ausschliesslich mit den Werten aus styles.css: Farben ueber
   var(--...), Schriftgroessen ueber --fs-xs..--fs-2xl, Radien 8px/var(--radius),
   Abstaende in 4/8/12/16/24px. Keine neuen Farben, keine neuen Groessen.

   Haarlinien sind Raender in var(--border) – dieselbe ruhige Trennung wie in
   den uebrigen Modulen. Kaum Schatten: nur die Karten tragen var(--shadow).

   Zwei Spalten am Schreibtisch (Liste links, Editor rechts), auf dem Handy eine
   Spalte mit Umschaltung ueber die Klasse ist-editor an der Wurzel – dieselbe
   Idee wie ist-gespraech im Chat.

   Geladen in index.html nach styles.css. */

.nz { max-width: 1100px; }

.nz-flaechen {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 16px;
  align-items: start;
}

/* ============================================================ Liste links */

.nz-liste-spalte {
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
}

.nz-kopf { display: flex; align-items: center; gap: 8px; }
.nz-titel { font-size: var(--fs-xl); font-weight: 600; flex: 1; }
.nz-neu { flex: none; }
.nz-neu svg { width: 18px; height: 18px; }

/* ---- Suche ---- */

.nz-suche { position: relative; display: flex; align-items: center; }
.nz-suche-lupe {
  position: absolute; left: 10px; width: 18px; height: 18px;
  color: var(--text-muted); pointer-events: none;
}
.nz-suche-feld {
  width: 100%; padding: 8px 12px 8px 34px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text-primary);
  font-size: var(--fs-md); font-family: inherit;
}
.nz-suche-feld:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- Filter nach Sichtbarkeit ---- */

.nz-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.nz-chip {
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-secondary); cursor: pointer;
  padding: 4px 12px; border-radius: 999px;
  font-size: var(--fs-sm); font-weight: 600;
}
.nz-chip:hover { color: var(--text-primary); }
.nz-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.nz-chip.an {
  background: var(--accent-soft); color: var(--accent-fg);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ---- Eintraege ---- */

.nz-eintraege { display: flex; flex-direction: column; gap: 8px; }

.nz-eintrag {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  width: 100%; cursor: pointer;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-primary);
  transition: border-color var(--dur-schnell) var(--easing);
}
.nz-eintrag:hover { border-color: var(--border-strong); }
.nz-eintrag:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
/* Die gewaehlte Zeile bekommt einen ruhigen Rand in der Akzentfarbe – ein
   Zustand, kein Alarm. */
.nz-eintrag.ist-aktiv {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--surface-1);
}
/* Angepinnt: ein schmaler Streifen links, damit die Zeile beim Ueberfliegen
   auffindbar ist, ohne dass eine zweite Farbe die Liste unruhig macht. */
.nz-eintrag.ist-gepinnt { border-left: 3px solid var(--accent); }

.nz-eintrag-kopf { display: flex; align-items: baseline; gap: 8px; }
.nz-eintrag-name {
  font-weight: 600; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nz-eintrag-zeit {
  flex: none; font-size: var(--fs-xs); color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.nz-eintrag-vorschau {
  font-size: var(--fs-sm); color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nz-eintrag-fuss { display: flex; align-items: center; gap: 8px; }
.nz-eintrag-pin { color: var(--text-muted); display: inline-flex; }
.nz-eintrag-pin svg { width: 14px; height: 14px; }

/* Die Sichtbarkeitsmarke: derselbe entsaettigte Ton wie sonst, kein grelles
   Abzeichen. Privat ist die ruhigste, Firma die kraeftigste – die Reichweite
   steigt sichtbar mit. */
.nz-sicht-marke {
  font-size: var(--fs-xs); font-weight: 600;
  padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted);
}
.nz-sicht-privat { color: var(--text-muted); }
.nz-sicht-gruppe {
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.nz-sicht-firma {
  color: var(--accent-fg);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-soft);
}

/* ---- Meldungen an Stelle der Liste ---- */

.nz-meldung {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; padding: 32px 16px; color: var(--text-secondary);
}
.nz-meldung svg { width: 40px; height: 40px; color: var(--text-muted); }

/* ============================================================ Editor rechts */

.nz-editor-spalte {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); box-shadow: var(--shadow);
  min-height: 420px; padding: 16px;
  position: sticky; top: 16px;
}

.nz-editor-leer {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; text-align: center;
  height: 100%; min-height: 380px; color: var(--text-secondary);
}
.nz-editor-leer svg { width: 48px; height: 48px; color: var(--text-muted); }

.nz-editor { display: flex; flex-direction: column; gap: 12px; }

.nz-editor-kopf { display: flex; align-items: center; gap: 8px; }
.nz-zurueck { flex: none; display: none; }   /* nur auf dem Handy sichtbar */
.nz-zurueck svg { width: 18px; height: 18px; }
.nz-editor-titel { font-size: var(--fs-lg); font-weight: 600; flex: 1; }
.nz-editor-zeit {
  font-size: var(--fs-xs); color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.nz-feld { display: flex; flex-direction: column; gap: 4px; }
.nz-feld label { font-weight: 600; color: var(--text-secondary); font-size: var(--fs-sm); }

.nz-feld-titel {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-1); color: var(--text-primary);
  font-size: var(--fs-lg); font-weight: 600; font-family: inherit;
}
.nz-feld-titel:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.nz-feld-inhalt { flex: 1; }
.nz-feld-inhalt-feld {
  width: 100%; min-height: 220px; resize: vertical;
  padding: 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-1); color: var(--text-primary);
  font-size: var(--fs-md); font-family: inherit; line-height: 1.55;
}
.nz-feld-inhalt-feld:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.nz-editor-zeile {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
}
.nz-feld-sicht { flex: 1; min-width: 180px; }
.nz-select {
  width: 100%; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-primary); font-size: var(--fs-md); font-family: inherit;
}
.nz-select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.nz-pin-schalter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 0; cursor: pointer; color: var(--text-secondary); font-weight: 600;
}
.nz-pin-schalter svg { width: 16px; height: 16px; }
.nz-pin-schalter input { width: 16px; height: 16px; accent-color: var(--accent); }

.nz-editor-fuss {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 12px;
}
.nz-editor-fuss-rechts { display: flex; gap: 8px; margin-left: auto; }
/* Loeschen ist kein Alarm – ein ruhiger Nebenweg. Die Farbe kommt erst beim
   Ueberfahren, damit der gefaehrlichste Knopf nicht der lauteste ist. */
.nz-loeschen { color: var(--text-muted); }
.nz-loeschen:hover { color: var(--critical-ink); }

/* ------------------------------------------------------------------ Handy */

@media (max-width: 720px) {
  /* Eine Spalte. Sichtbar ist entweder die Liste oder der Editor – umgeschaltet
     ueber ist-editor an der Wurzel, gesetzt von notizen.js. So verschwindet auf
     dem kleinen Bildschirm nichts halb, und der Zurueck-Pfeil fuehrt heraus. */
  .nz-flaechen { grid-template-columns: 1fr; }
  .nz-editor-spalte { position: static; min-height: 0; }

  .nz .nz-editor-spalte { display: none; }
  .nz.ist-editor .nz-liste-spalte { display: none; }
  .nz.ist-editor .nz-editor-spalte { display: block; }

  .nz-zurueck { display: inline-flex; }
}

/* Wer die Bewegung abgestellt hat, bekommt sie auch hier nicht. */
@media (prefers-reduced-motion: reduce) {
  .nz-eintrag { transition: none; }
}
