/* ============================================================
   os-box Hilfe – Stylesheet im os-box Design
   Farben, Schriften und Layout angelehnt an die Tkinter-App:
   - Haupt-BG #F0F0F0, Buttons #E1E1E1, Akzent #0078D4
   - Submenu-Titel #2c3e50, Info-Box weiß
   - Modul-Farben: Convert rot, Markieren dunkel, Organisieren grün,
     Drucken blau, OCR violett, Editor grau (#6C6C6B)
   ============================================================ */

/* ---------- RESET & BASIS ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", "Arial", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #202020;
  background: #F0F0F0;
}

/* ---------- FARBVARIABLEN (Module) ---------- */
:root {
  --os-bg:          #F0F0F0;
  --os-surface:     #FFFFFF;
  --os-button:      #E1E1E1;
  --os-button-hover:#D0D0D0;
  --os-border:      #CCCCCC;
  --os-accent:      #0078D4;
  --os-accent-dark: #005A9E;
  --os-title:       #2c3e50;
  --os-title-dark:  #1a252f;
  --os-text:        #202020;
  --os-text-muted:  #666666;
  --os-success:     #107C10;
  --os-error:       #E81123;
  --os-warning:     #D83B01;

  --mod-convert:    #e74c3c;
  --mod-edit:       #2c3e50;
  --mod-merge:      #27ae60;
  --mod-hyperprint: #2980b9;
  --mod-ocr:        #8e44ad;
  --mod-editor:     #6C6C6B;   /* Editor: grau */
  --mod-settings:   #607d8b;
  --mod-help:       #455a64;
}

/* ---------- HEADER ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #FFFFFF;
  color: var(--os-text);
  border-bottom: 1px solid var(--os-border);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.site-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.site-logo {
  height: 28px;
  width: auto;
  display: block;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-version {
  font-size: 13px;
  opacity: 0.8;
}

.lang-switch {
  background: var(--os-button);
  border: 1px solid var(--os-border);
  color: var(--os-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  letter-spacing: 0.5px;
}

.lang-switch:hover {
  background: var(--os-button-hover);
  border-color: #999;
}

.lang-switch:focus {
  outline: 2px solid var(--os-accent);
  outline-offset: 1px;
}

/* ---------- LAYOUT ---------- */
.layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 130px);
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  position: sticky;
  top: 55px;
  align-self: flex-start;
  width: 270px;
  flex-shrink: 0;
  max-height: calc(100vh - 55px);
  overflow-y: auto;
  background: #F8F8F8;
  border-right: 1px solid var(--os-border);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
}

.search-box {
  position: relative;
  padding: 0 14px 14px;
}

.search-box input {
  width: 100%;
  padding: 8px 30px 8px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--os-border);
  border-radius: 6px;
  background: #FFFFFF;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box input:focus {
  border-color: var(--os-accent);
  box-shadow: 0 0 0 2px rgba(0,120,212,0.15);
}

.search-clear {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-70%);
  background: none;
  border: none;
  color: #888;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: none;
}
.search-clear:hover { background: #EEE; color: #000; }

.nav {
  display: flex;
  flex-direction: column;
  padding: 0 8px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--os-text);
  text-decoration: none;
  font-size: 14px;
  border-radius: 5px;
  border-left: 3px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.nav a:hover { background: #EFEFEF; }

/* Farbpunkt nur bei den Modul-Einträgen */
.nav .nav-group-modules a::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot-color, #CCCCCC);
  flex-shrink: 0;
}

.nav a.active {
  background: #E7F3FF;
  color: var(--os-accent);
  font-weight: 600;
  border-left-color: var(--os-accent);
}

/* ---------- MODUL-GRUPPE (eingerückt unter „Einstellungen") ---------- */
.nav-group-modules {
  display: flex;
  flex-direction: column;
  margin: 2px 0 2px 6px;
  padding-left: 12px;
  border-left: 2px solid var(--os-border);
}

/* Innerhalb der Gruppe etwas kompakter, damit die Gruppierung optisch wirkt */
.nav-group-modules a {
  padding-top: 7px;
  padding-bottom: 7px;
}

/* Aktiv-Zustand innerhalb der Gruppe: linke Border der Gruppe bleibt sichtbar */
.nav-group-modules a.active {
  border-left-color: transparent;   /* verhindert doppelte Linie */
  background: #E7F3FF;
}

/* Modul-spezifische Farbcodes für die Nav-Punkte */
.nav a[data-topic="erste-schritte"]::before    { --dot-color: var(--os-accent); }
.nav a[data-topic="ueberblick"]::before        { --dot-color: var(--os-text-muted); }
.nav a[data-topic="startmenue"]::before        { --dot-color: var(--os-text-muted); }
.nav a[data-topic="einstellungen"]::before     { --dot-color: var(--mod-settings); }
.nav a[data-topic="editor"]::before            { --dot-color: var(--mod-editor); }  /* grau */
.nav a[data-topic="convert"]::before           { --dot-color: var(--mod-convert); }
.nav a[data-topic="edit"]::before              { --dot-color: var(--mod-edit); }
.nav a[data-topic="merge"]::before             { --dot-color: var(--mod-merge); }
.nav a[data-topic="hyperprint"]::before        { --dot-color: var(--mod-hyperprint); }
.nav a[data-topic="ocr"]::before               { --dot-color: var(--mod-ocr); }
.nav a[data-topic="lizenz"]::before            { --dot-color: var(--os-text-muted); }
.nav a[data-topic="faq"]::before               { --dot-color: var(--os-text-muted); }
.nav a[data-topic="tastenkuerzel"]::before     { --dot-color: var(--os-text-muted); }

.search-results {
  padding: 8px;
  margin: 8px 8px 0;
  background: #FFFEF5;
  border: 1px solid #F0E0A0;
  border-radius: 6px;
  max-height: 300px;
  overflow-y: auto;
}
.search-results .result-item {
  display: block;
  padding: 8px 10px;
  color: var(--os-text);
  text-decoration: none;
  font-size: 13px;
  border-radius: 4px;
  border-bottom: 1px solid #F5EFD0;
}
.search-results .result-item:last-child { border-bottom: none; }
.search-results .result-item:hover { background: #FFF8D0; }
.search-results .result-item .result-snippet {
  color: #555;
  font-size: 12px;
  display: block;
}
.search-results .no-results {
  padding: 10px;
  color: #888;
  font-style: italic;
  font-size: 13px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 14px 0;
  border-top: 1px solid var(--os-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-action {
  display: block;
  padding: 7px 12px;
  color: var(--os-accent);
  text-decoration: none;
  font-size: 13px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.1s;
}
.sidebar-action:hover { background: #E7F3FF; }

/* ---------- INHALT ---------- */
#content {
  flex: 1;
  padding: 24px 40px 60px;
  min-width: 0;
}

#content section {
  margin-bottom: 48px;
  scroll-margin-top: 80px;
}
#content section:last-child { margin-bottom: 0; }

h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--os-text);
  padding-bottom: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--os-accent);
}

/* Modul-spezifische Akzentlinie unter h2 */
#erste-schritte h2 { border-bottom-color: var(--os-accent); }
#ueberblick h2     { border-bottom-color: var(--os-text-muted); }
#startmenue h2     { border-bottom-color: var(--os-text-muted); }
#einstellungen h2  { border-bottom-color: var(--mod-settings); }
#editor h2         { border-bottom-color: var(--mod-editor); }  /* grau #6C6C6B */
#convert h2        { border-bottom-color: var(--mod-convert); }
#edit h2           { border-bottom-color: var(--mod-edit); }
#merge h2          { border-bottom-color: var(--mod-merge); }
#hyperprint h2     { border-bottom-color: var(--mod-hyperprint); }
#ocr h2            { border-bottom-color: var(--mod-ocr); }
#lizenz h2         { border-bottom-color: var(--os-text-muted); }
#faq h2            { border-bottom-color: var(--os-text-muted); }
#tastenkuerzel h2  { border-bottom-color: var(--os-text-muted); }

h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--os-text);
  margin-top: 24px;
  margin-bottom: 10px;
}
h4 {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-top: 16px;
  margin-bottom: 6px;
}

p { margin-bottom: 12px; }

ul, ol { margin-bottom: 14px; padding-left: 26px; }
ul li, ol li { margin-bottom: 5px; }

strong { font-weight: 600; }

a { color: var(--os-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: "Cascadia Code", "Consolas", "Monaco", monospace;
  font-size: 13px;
  background: #F3F3F3;
  padding: 2px 6px;
  border-radius: 3px;
  color: #C7254E;
}

pre {
  background: #F5F5F5;
  border: 1px solid var(--os-border);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 12px 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}
pre code { background: none; padding: 0; color: var(--os-text); }

kbd {
  display: inline-block;
  font-family: "Cascadia Code", "Consolas", "Monaco", monospace;
  font-size: 12px;
  padding: 2px 6px;
  background: #FFFFFF;
  border: 1px solid var(--os-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--os-text);
  line-height: 1;
}

/* ---------- BOXEN (wie Submenu-Info-Box in der App) ---------- */
.info-box,
.warning-box,
.error-box {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 14px 0;
  border-left: 4px solid;
  font-size: 14px;
}
.info-box {
  background: #FFFFFF;
  border-color: var(--os-accent);
  color: #0A3A66;
}
.warning-box {
  background: #FFF4E5;
  border-color: var(--os-warning);
  color: #6B3D00;
}
.error-box {
  background: #FDE7E9;
  border-color: var(--os-error);
  color: #6B0008;
}

/* ---------- TABELLEN (wie Treeview) ---------- */
.overview-table,
.shortcut-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 14px;
}
.overview-table th,
.shortcut-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--os-button);
  font-weight: 600;
  border-bottom: 2px solid var(--os-border);
  color: var(--os-text);
}
.overview-table td,
.shortcut-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #EEEEEE;
  vertical-align: top;
}
.overview-table tbody tr:nth-child(even),
.shortcut-table tbody tr:nth-child(even) { background: #FAFAFA; }

.shortcut-table td:first-child { white-space: nowrap; width: 220px; }

/* ---------- MODUL-BADGES (für Überblickstabelle) ---------- */
.module-badge {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.badge-convert    { background: var(--mod-convert); }
.badge-edit       { background: var(--mod-edit); }
.badge-merge      { background: var(--mod-merge); }
.badge-hyperprint { background: var(--mod-hyperprint); }
.badge-ocr        { background: var(--mod-ocr); }
.badge-editor     { background: var(--mod-editor); }  /* grau */
.badge-settings   { background: var(--mod-settings); }

/* ---------- FAQ ---------- */
.faq-item {
  border-left: 3px solid var(--os-accent);
  padding: 10px 16px;
  margin-bottom: 14px;
  background: #F8FBFF;
  border-radius: 0 6px 6px 0;
}
.faq-question {
  font-weight: 600;
  color: var(--os-text);
  margin-bottom: 6px;
}
.faq-answer { color: #444; margin-bottom: 0; }

/* ---------- LOG-BOX (wie Submenu-Log in der App) ---------- */
.log-box {
  background: #F8F9FA;
  border: 1px solid #7E7E7E;
  border-radius: 4px;
  padding: 10px 14px;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  color: #202020;
  white-space: pre-wrap;
  margin: 12px 0;
  max-height: 280px;
  overflow-y: auto;
}

/* ---------- KONTAKT ---------- */
.contact-section { margin-bottom: 60px; }

.contact-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  max-width: 400px;
  user-select: none;
}
.contact-row:hover { background: #F0F7FF; }
.contact-row:focus { outline: 2px solid var(--os-accent); outline-offset: 1px; }

.contact-icon { font-size: 18px; line-height: 1; flex-shrink: 0; }
.contact-label {
  font-size: 15px;
  color: var(--os-accent);
  transition: color 0.15s;
}
.contact-row:hover .contact-label { color: var(--os-accent-dark); }

.contact-response-time {
  margin-top: 18px;
  padding: 12px 16px;
  background: #F8FBFF;
  border-left: 3px solid var(--os-accent);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: #444;
  max-width: 400px;
}

/* ---------- FOOTER ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 16px 40px;
  background: #F8F8F8;
  border-top: 1px solid var(--os-border);
  color: #666;
  font-size: 13px;
}
.footer-meta { color: #888; }

/* ---------- MODAL (Druck-Dialog) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--os-border);
}
.modal-header h2 {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 17px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #666;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.modal-close:hover { background: #F0F0F0; color: #000; }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-intro { margin: 0 0 14px; font-weight: 600; color: var(--os-text); }

.radio-option,
.checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.1s;
}
.radio-option:hover,
.checkbox-option:hover { background: #F5F9FF; }
.radio-option input,
.checkbox-option input { margin-top: 4px; cursor: pointer; }

.radio-text { display: flex; flex-direction: column; gap: 2px; }
.radio-text strong { font-weight: 600; color: var(--os-text); }
.radio-text small { color: #666; font-size: 12px; }

.section-checklist {
  margin: 10px 0 10px 32px;
  padding: 10px;
  background: #F8F8F8;
  border-radius: 6px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--os-border);
}
.section-checklist .checkbox-option { padding: 5px 8px; margin-bottom: 2px; }

.modal-options {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--os-border);
}
.modal-options .checkbox-option { padding: 6px 8px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--os-border);
  background: #FAFAFA;
}

.btn-primary,
.btn-secondary {
  padding: 8px 20px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.1s;
}
.btn-primary {
  background: var(--os-accent);
  color: #FFFFFF;
}
.btn-primary:hover { background: var(--os-accent-dark); }
.btn-secondary {
  background: #F0F0F0;
  color: var(--os-text);
}
.btn-secondary:hover { background: #E0E0E0; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: relative;
    top: 0;
    width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--os-border);
    padding: 12px 0;
  }
  #content { padding: 20px 20px 40px; }
  .header-inner { padding: 12px 20px; }
  .site-footer {
    flex-direction: column;
    gap: 4px;
    padding: 14px 20px;
  }
  .shortcut-table td:first-child { width: auto; }
  .modal { max-width: 100%; }
}

@media (max-width: 600px) {
  .site-logo { height: 22px; }
  .site-title { gap: 6px; font-size: 16px; }
}

/* ---------- MODUL-ICONS IN H2-TITELN (Variante A) ---------- */
h2.with-icon {
  display: flex;
  align-items: center;
  gap: 12px;
}
h2.with-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ---------- MODUL-ICONS IN ÜBERBLICK-TABELLE (Variante C) ---------- */
.overview-table td .module-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 8px;
}

/* ---------- DRUCK ---------- */
@media print {
  .site-header,
  .sidebar,
  .sidebar-footer,
  .site-footer,
  .modal-overlay,
  .no-print { display: none !important; }

  body {
    background: #FFFFFF;
    color: #000000;
    font-size: 11pt;
    line-height: 1.45;
  }

  .layout {
    display: block;
    max-width: 100%;
    min-height: auto;
  }

  #content {
    margin: 0;
    padding: 0;
    width: 100%;
  }

  #content section {
    page-break-after: always;
    margin-bottom: 0;
    scroll-margin-top: 0;
  }
  #content section:last-child { page-break-after: auto; }
  #content section.print-exclude { display: none !important; }

  .print-toc { page-break-after: always; }
  .print-toc h1 { font-size: 18pt; margin-bottom: 20pt; }
  .print-toc ol { font-size: 12pt; line-height: 1.9; padding-left: 30pt; }

  h2 { font-size: 16pt; margin-bottom: 12pt; }
  h3 { font-size: 13pt; margin-top: 14pt; }
  p, li { font-size: 11pt; }

  a[href]:not([href^="#"])::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
  }

  .info-box,
  .warning-box,
  .error-box,
  .faq-item {
    page-break-inside: avoid;
    border: 1px solid #999;
    background: #F5F5F5 !important;
  }

  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; }

  pre, code { background: #F0F0F0 !important; border: 1px solid #CCC; }
  kbd { border: 1px solid #666; background: #FFF !important; }

  h2.with-icon img,
  .overview-table td .module-icon {
    display: none;
  }
}