/*
  Datei:    styles.css  (CSS des PDF-Editors, klassischer Windows-Look wie BildWerk)
  Version:  0.2.0
  Changelog:
    2026-12-04  0.2.0  - Eigenständige CSS-Datei; Bildauswahl, Ordnerwahl und Anmeldung.
    2026-11-17  0.1.0  - Erste Version: Raster-Layout, Menüs, Reiter, Seitenansicht mit Ebenen
                         (PDF-Canvas, Anmerkungs-Canvas, Formularfelder), Miniaturen, Palette,
                         Unterschriftenliste, Dialog, Warte-Anzeige, Statusleiste.
*/
  :root {
    --grau: #f0f0f0;
    --grau2: #e3e3e3;
    --hell: #ffffff;
    --dunkel: #a0a0a0;
    --sehrdunkel: #696969;
    --blau: #0a246a;
    --blau2: #3a6ea5;
    --hover: #cce4f7;
    --arbeit: #808080;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; overflow: hidden; }
  body { background: var(--grau); font: 12px Tahoma, "Segoe UI", Arial, sans-serif; color: #000; user-select: none; }
  button { font: inherit; }

  #app { display: grid; grid-template-rows: 22px 30px 1fr 22px; height: 100vh; }

  /* ---------- Menüleiste ---------- */
  #menueleiste { display: flex; align-items: stretch; background: var(--grau); border-bottom: 1px solid var(--dunkel); }
  .menue { position: relative; padding: 3px 8px; cursor: default; }
  .menue:hover, .menue.offen { background: var(--hover); }
  .menue.offen { background: var(--blau2); color: #fff; }
  .untermenue { display: none; position: absolute; left: 0; top: 100%; z-index: 50; min-width: 250px;
    background: var(--grau); border: 1px solid var(--sehrdunkel); box-shadow: 2px 2px 3px rgba(0,0,0,.35); padding: 2px; color: #000; }
  .menue.offen .untermenue { display: block; }
  .eintrag { display: flex; justify-content: space-between; gap: 20px; padding: 3px 18px 3px 22px; white-space: nowrap; }
  .eintrag:hover { background: var(--blau2); color: #fff; }
  .eintrag .kurz { color: #555; }
  .eintrag:hover .kurz { color: #ddd; }
  .menueTrenner { height: 1px; background: var(--dunkel); border-bottom: 1px solid var(--hell); margin: 3px 2px; }

  /* ---------- Leisten ---------- */
  .leiste { display: flex; align-items: center; gap: 1px; padding: 2px 4px; border-bottom: 1px solid var(--dunkel); border-top: 1px solid var(--hell); }
  .knopf { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent; background: transparent; padding: 0; cursor: default; }
  .knopf:hover { border-color: var(--hell) var(--sehrdunkel) var(--sehrdunkel) var(--hell); }
  .knopf:active, .knopf.aktiv { border-color: var(--sehrdunkel) var(--hell) var(--hell) var(--sehrdunkel); background: var(--grau2); }
  .leistenTrenner { width: 2px; height: 20px; margin: 0 4px; border-left: 1px solid var(--dunkel); border-right: 1px solid var(--hell); }
  #dokName { margin-left: auto; padding: 0 8px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }

  /* ---------- Hauptbereich ---------- */
  #haupt { display: grid; grid-template-columns: 220px 1fr 190px; min-height: 0; }
  .panel { background: var(--grau); border: 1px solid var(--dunkel); display: flex; flex-direction: column; min-height: 0; }
  .panelKopf { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px;
    background: linear-gradient(to right, var(--blau), var(--blau2)); color: #fff; font-weight: bold; flex: none; }
  .panelKopf span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mini { padding: 0 4px; height: 18px; line-height: 16px; min-width: 18px; background: var(--grau);
    border: 1px solid; border-color: var(--hell) var(--sehrdunkel) var(--sehrdunkel) var(--hell); color: #000; }
  .mini:active { border-color: var(--sehrdunkel) var(--hell) var(--hell) var(--sehrdunkel); }

  /* Reiter im linken Panel */
  #reiter { display: flex; gap: 2px; padding: 3px 3px 0; flex: none; }
  .reiter { flex: 1; height: 20px; background: var(--grau2); border: 1px solid var(--dunkel); border-bottom: none; }
  .reiter.aktiv { background: var(--grau); font-weight: bold; }
  .reiterInhalt { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .reiterInhalt[hidden] { display: none; }

  #driveListe, #miniListe { flex: 1; overflow: auto; background: #fff; border: 1px inset var(--dunkel); margin: 2px; }
  .dEintrag { display: flex; align-items: center; gap: 4px; padding: 2px 4px; white-space: nowrap; cursor: default; }
  .dEintrag:hover { background: var(--hover); }
  .dEintrag.gewaehlt { background: var(--blau2); color: #fff; }
  .dEintrag svg { flex: none; }
  .dEintrag .dName { flex: 1; overflow: hidden; text-overflow: ellipsis; }
  .dEintrag .mini { visibility: hidden; }
  .dEintrag:hover .mini { visibility: visible; }
  .dHinweis { padding: 6px; color: #555; white-space: normal; }

  /* Miniaturen */
  #miniListe { background: #9a9a9a; padding: 6px 0; }
  .miniSeite { margin: 0 auto 8px; width: 140px; text-align: center; padding: 4px; border: 2px solid transparent; cursor: default; }
  .miniSeite canvas { display: block; margin: 0 auto; background: #fff; box-shadow: 1px 1px 3px rgba(0,0,0,.5); }
  .miniSeite .nr { color: #fff; margin-top: 2px; }
  .miniSeite.aktuell { border-color: #ddd; }
  .miniSeite.gewaehlt { border-color: #ffd400; background: rgba(255,212,0,.25); }
  .miniSeite.dropVor { box-shadow: 0 -4px 0 #ffd400; }
  .miniSeite.dropNach { box-shadow: 0 4px 0 #ffd400; }

  /* ---------- Arbeitsfläche ---------- */
  #arbeitsflaeche { background: var(--arbeit); overflow: auto; position: relative; }
  #seitenContainer { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 14px; min-width: max-content; }
  .seite { position: relative; background: #fff; box-shadow: 2px 2px 6px rgba(0,0,0,.5); flex: none; }
  .seite canvas { position: absolute; left: 0; top: 0; display: block; }
  .seite .ovl { touch-action: none; cursor: crosshair; }
  .seite .formLayer { position: absolute; inset: 0; pointer-events: none; }
  .seitenNr { position: absolute; left: -2px; top: -13px; font-size: 10px; color: #eee; }
  #leerHinweis { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
  #leerHinweis[hidden] { display: none; }
  .leerBox { background: var(--grau); border: 2px outset var(--grau); padding: 16px 24px; text-align: center; pointer-events: auto; line-height: 1.5; }
  #leerOeffnen { cursor: pointer; color: var(--blau2); }

  /* Formularfelder als HTML-Elemente über der Seite (nur im Auswahl-Werkzeug bedienbar) */
  .formFeld { position: absolute; margin: 0; padding: 0 2px; border: 1px solid rgba(40,90,190,.55);
    background: rgba(200,220,255,.45); font-family: Helvetica, Arial, sans-serif; color: #000; outline: none; resize: none; }
  .formFeld:focus { background: rgba(255,255,255,.9); border-color: #1f5fbf; }
  input.formFeld[type=checkbox], input.formFeld[type=radio] { accent-color: #1f5fbf; }
  .wz-auswahl .formLayer .formFeld { pointer-events: auto; }

  /* ---------- Palette rechts ---------- */
  #palette { overflow-y: auto; }
  #werkzeuge { display: grid; grid-template-columns: repeat(5, 28px); gap: 2px; justify-content: center; padding: 4px 0; }
  #werkzeuge .knopf { width: 28px; height: 28px; }
  .trenner { height: 2px; margin: 4px 3px; border-top: 1px solid var(--dunkel); border-bottom: 1px solid var(--hell); flex: none; }
  #optionen { padding: 2px 6px 6px; font-size: 11px; }
  #optionen label { display: block; margin-top: 4px; }
  #optionen input[type=range] { width: 100%; margin: 0; }
  .optZeile { display: flex; align-items: center; justify-content: space-between; }
  .optZeile input[type=color] { width: 60px; height: 20px; padding: 0; border: 1px solid var(--sehrdunkel); }
  #farbpalette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; margin-top: 4px; }
  #farbpalette div { height: 14px; border: 1px solid var(--sehrdunkel); }
  .hinweisKlein { margin-top: 6px; color: #444; min-height: 14px; white-space: normal; }
  #sigKnoepfe { display: flex; gap: 2px; padding: 4px; flex: none; }
  #sigKnoepfe .mini:not(:last-child) { flex: 1; }
  #sigListe { padding: 0 4px 6px; }
  .sig { margin-bottom: 4px; padding: 3px; border: 2px solid transparent; text-align: center;
    background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
  .sig img { max-width: 100%; max-height: 60px; display: block; margin: 0 auto; pointer-events: none; }
  .sig .sigName { font-size: 10px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(255,255,255,.8); }
  .sig.gewaehlt { border-color: var(--blau2); }

  /* ---------- Statusleiste ---------- */
  #statusleiste { display: flex; gap: 2px; align-items: stretch; padding: 2px; border-top: 1px solid var(--hell); }
  #statusleiste > span { border: 1px solid; border-color: var(--dunkel) var(--hell) var(--hell) var(--dunkel); padding: 1px 6px; white-space: nowrap; overflow: hidden; }
  #statusText { flex: 1; }
  #statusSeite { width: 110px; }
  #statusZoom { width: 60px; }

  /* ---------- Dialog ---------- */
  #dialogHg { position: fixed; inset: 0; background: rgba(0,0,0,.15); display: flex; align-items: center; justify-content: center; z-index: 100; }
  #dialogHg[hidden] { display: none; }
  #dialog { min-width: 340px; max-width: 90vw; max-height: 90vh; overflow: auto; background: var(--grau); border: 2px outset var(--grau); box-shadow: 3px 3px 8px rgba(0,0,0,.5); }
  .fensterTitel { background: linear-gradient(to right, var(--blau), var(--blau2)); color: #fff; font-weight: bold; padding: 3px 6px; white-space: nowrap; }
  #dialogInhalt { padding: 12px; user-select: text; }
  #dialogInhalt .zeile { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  #dialogInhalt .zeile > span:first-child { width: 120px; flex: none; }
  #dialogInhalt input[type=number], #dialogInhalt input[type=text], #dialogInhalt select { width: 200px; font: inherit; }
  #dialogInhalt textarea { width: 100%; min-width: 300px; height: 90px; font: 13px Helvetica, Arial, sans-serif; }
  #dialogInhalt .regler input { flex: 1; }
  #dialogInhalt .regler output { width: 36px; text-align: right; }
  #dialogInhalt .hinweis { color: #444; margin-top: 6px; max-width: 420px; white-space: normal; }
  #sigZeichenflaeche { display: block; background: #fff; border: 1px inset var(--dunkel); touch-action: none; cursor: crosshair; }
  #dialogKnoepfe { display: flex; justify-content: flex-end; gap: 6px; padding: 0 12px 12px; }
  #dialogKnoepfe button { min-width: 75px; height: 23px; background: var(--grau); border: 1px solid; border-color: var(--hell) var(--sehrdunkel) var(--sehrdunkel) var(--hell); }
  #dialogKnoepfe button:active { border-color: var(--sehrdunkel) var(--hell) var(--hell) var(--sehrdunkel); }
  #dialogKnoepfe button[hidden] { display: none; }

  /* ---------- Warte-Anzeige ---------- */
  #warten { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.2); display: flex; align-items: center; justify-content: center; cursor: wait; }
  #warten[hidden] { display: none; }
  #wartenText { background: var(--grau); border: 2px outset var(--grau); padding: 14px 24px; box-shadow: 3px 3px 8px rgba(0,0,0,.5); }
  /* NEU 0.2.0: Bildauswahl ("Bild einfügen"), Ordnerwahl und Anmeldung */
  .bildWahl { display: grid; grid-template-columns: repeat(3, 150px); gap: 6px; max-height: 320px; overflow: auto; }
  .bildWahl .sig { cursor: pointer; margin: 0; }
  .bildWahl .sig:hover { border-color: var(--blau2); }
  .ordnerWahl { width: 420px; height: 260px; overflow: auto; background: #fff; border: 1px inset var(--grau); }
  #anmeldeKnopf { padding: 6px 18px; font-size: 13px; }
