/* =============================================================
 * Strandmöllen Hilfe-Modul (v1.0)
 * Inline-Hilfe mit ⓘ-Icons, Popover und Handbuch-Verlinkung
 * =============================================================
 * Farb-Variablen lassen sich durch die Host-App überschreiben,
 * indem :root im index.html z.B. --help-accent setzt.
 * ============================================================= */

:root {
  --help-accent:        #0066b2;   /* Strandmöllen Blau */
  --help-accent-hover:  #004f8a;
  --help-bg:            #ffffff;
  --help-fg:            #1f2937;
  --help-muted:         #6b7280;
  --help-border:        #e5e7eb;
  --help-shadow:        0 8px 24px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.04);
  --help-radius:        10px;
  --help-max-width:     320px;
  --help-z-icon:        50;
  --help-z-popover:     10000;
}

/* ---------- ⓘ Icon-Button ---------- */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0;
  border: 1px solid var(--help-border);
  border-radius: 50%;
  background: transparent;
  color: var(--help-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
  transition: all 0.15s ease;
  user-select: none;
  z-index: var(--help-z-icon);
}

.help-icon:hover,
.help-icon:focus {
  background: var(--help-accent);
  border-color: var(--help-accent);
  color: #ffffff;
  outline: none;
  transform: scale(1.1);
}

.help-icon:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 102, 178, 0.25);
}

/* Wenn das Icon direkt in einem Button/Label steckt, geht es nicht auf die nächste Zeile */
.help-icon-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ---------- Popover ---------- */
.help-popover {
  position: fixed;
  max-width: var(--help-max-width);
  min-width: 240px;
  background: var(--help-bg);
  color: var(--help-fg);
  border: 1px solid var(--help-border);
  border-radius: var(--help-radius);
  box-shadow: var(--help-shadow);
  padding: 14px 16px 12px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  z-index: var(--help-z-popover);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.help-popover.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.help-popover__title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--help-fg);
}

.help-popover__close {
  border: 0;
  background: transparent;
  color: var(--help-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  margin: -2px -4px 0 0;
  border-radius: 4px;
}
.help-popover__close:hover { color: var(--help-fg); background: var(--help-border); }

.help-popover__body {
  margin: 0 0 10px 0;
  color: var(--help-fg);
}

.help-popover__body p { margin: 0 0 6px 0; }
.help-popover__body p:last-child { margin-bottom: 0; }

.help-popover__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--help-accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 12.5px;
  padding-top: 6px;
  border-top: 1px solid var(--help-border);
  margin-top: 6px;
  width: 100%;
}
.help-popover__link:hover { color: var(--help-accent-hover); text-decoration: underline; }
.help-popover__link::after { content: "→"; margin-left: 2px; }

.help-popover__missing {
  color: var(--help-muted);
  font-style: italic;
}

/* Ein kleines Dreieck/Pfeilchen an der Popover-Kante (optional, je nach Position gesetzt) */
.help-popover::before {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  background: var(--help-bg);
  border-left: 1px solid var(--help-border);
  border-top: 1px solid var(--help-border);
  transform: rotate(45deg);
}
.help-popover[data-arrow="top"]::before    { top: -6px;  left: 20px; }
.help-popover[data-arrow="bottom"]::before { bottom: -6px; left: 20px; transform: rotate(225deg); }
.help-popover[data-arrow="left"]::before   { top: 20px; left: -6px; transform: rotate(315deg); }
.help-popover[data-arrow="right"]::before  { top: 20px; right: -6px; transform: rotate(135deg); }

/* ---------- F1-Hinweis im Popover (nur beim ersten Öffnen sichtbar) ---------- */
.help-popover__hint {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--help-muted);
}
.help-popover__hint kbd {
  display: inline-block;
  padding: 1px 5px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px;
  background: var(--help-border);
  border-radius: 3px;
  border: 1px solid #d1d5db;
}

/* ---------- Mobile: zentriert von unten ---------- */
@media (max-width: 520px) {
  .help-popover {
    position: fixed;
    left: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    top: auto !important;
    max-width: none;
    min-width: 0;
  }
  .help-popover::before { display: none; }
}

/* ---------- Dark-Mode via prefers-color-scheme ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --help-bg:     #1f2937;
    --help-fg:     #f3f4f6;
    --help-muted:  #9ca3af;
    --help-border: #374151;
  }
  .help-icon { color: #9ca3af; }
}

/* =============================================================
 * v1.1 – Tab-FAB und Accordion-Hilfe-Karten (Phase 6)
 * ============================================================= */

/* ---------- Tab-Hilfe-Link: Variante A — dezenter Textlink in der Tableiste ---------- */
.help-tab-fab {
  position: static;
  z-index: 40;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: underline;
  text-decoration-color: #94a3b8;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  white-space: nowrap;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.help-tab-fab:hover,
.help-tab-fab:focus {
  color: var(--help-accent);
  text-decoration-color: var(--help-accent);
  background: rgba(0, 102, 178, 0.06);
  outline: none;
}
.help-tab-fab:focus-visible {
  box-shadow: 0 0 0 2px rgba(0, 102, 178, 0.35);
}

/* Auf schmalen Screens Label kürzen */
@media (max-width: 640px) {
  .help-tab-fab {
    font-size: 12px;
    padding: 5px 8px;
  }
}

/* ---------- Accordion-Hilfe-Karte in den Haupt-Tabs ---------- */
.help-card {
  background: #E6F1FB;
  border: 1px solid #B5D4F4;
  border-radius: 10px;
  margin: 0 0 14px 0;
  overflow: hidden;
  transition: background 0.15s ease;
}
.help-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}
.help-card__head:hover { background: rgba(0, 102, 178, 0.04); }

.help-card__icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--help-accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}
.help-card__title {
  font-size: 13.5px;
  font-weight: 600;
  color: #0C447C;
  flex: 1;
  margin: 0;
}
.help-card__chev {
  color: var(--help-accent);
  font-size: 13px;
  transition: transform 0.18s ease;
  margin-right: 4px;
}
.help-card.is-collapsed .help-card__chev { transform: rotate(-90deg); }

.help-card__close {
  border: 0;
  background: transparent;
  color: var(--help-muted);
  font-size: 16px;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.help-card__close:hover { background: rgba(0, 0, 0, 0.06); color: #0C447C; }

.help-card__body {
  padding: 0 14px 12px 52px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #185FA5;
  max-height: 400px;
  overflow: hidden;
  transition: max-height 0.22s ease, padding 0.22s ease;
}
.help-card__body p { margin: 0 0 6px 0; }
.help-card__body p:last-child { margin-bottom: 0; }

.help-card.is-collapsed .help-card__body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* ---------- Hilfe-Tab: Iframe mit Handbuch ---------- */
.help-tab-iframe {
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 520px;
  border: 1px solid var(--help-border);
  border-radius: 10px;
  background: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .help-card {
    background: #0C447C;
    border-color: #185FA5;
  }
  .help-card__title { color: #B5D4F4; }
  .help-card__body { color: #B5D4F4; }
  .help-card__head:hover { background: rgba(255, 255, 255, 0.04); }
}
