/* ════════════════════════════════════════════════════════════════════════
   HELP-PANEL — Staff-Anleitungen Inline-Slide-Out
   ════════════════════════════════════════════════════════════════════════
   Verwendung: Pille-Markup im Page-Header der Staff-Pages mit
     <button class="help-pill" data-help-url="/public/anleitungen/...">
   Klick öffnet Slide-Panel von rechts mit iframe-Inhalt.
   Version: 2026-05-12 (S5-Folge — Mitarbeiter-Anleitung-Pattern)
   ════════════════════════════════════════════════════════════════════════ */

/* ════ HELP-PILL (sitzt im page-header rechts oben) ═════════════════════
   SPEZIFITÄT-HÄRTUNG: Doppel-Klassen-Selektor (.page-header.page-header--with-help)
   überschreibt zuverlässig die page-specific CSS (z.B. create_approval.css)
   die NACH dieser CSS geladen wird. !important auf den kritischen
   Layout-Properties als zusätzliche Sicherung gegen weitere Konflikte. */

.page-header.page-header--with-help,
header.page-header--with-help {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    flex-wrap: wrap;
    gap: 24px;
}

button.help-pill,
.help-pill {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 18px !important;
    min-height: 44px !important;  /* WCAG 2.1 AA Touch-Target */
    background: rgba(229, 183, 186, 0.18) !important;
    border: 1px solid rgba(229, 183, 186, 0.45) !important;
    color: #233645 !important;
    border-radius: 9999px !important;
    font-family: 'Ingra Light', 'Ingra', 'Inter', system-ui, Arial, sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s ease,
                box-shadow 0.2s ease;
    flex-shrink: 0;
    /* Zusätzlicher Button-Reset gegen ggf. globale Button-Resets */
    margin: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

button.help-pill:hover,
.help-pill:hover {
    background: #e5b7ba !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(229, 183, 186, 0.35);
}

.help-pill:active {
    transform: translateY(0);
}

.help-pill:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(229, 183, 186, 0.4) !important;
}

.help-pill i,
button.help-pill i {
    color: #e5b7ba !important;
    font-size: 16px !important;
    line-height: 1 !important;
    transition: color 0.2s ease;
}

.help-pill:hover i {
    color: #233645 !important;
}

/* Pill-Text-Span gegen create_approval.css o.ä. absichern */
.help-pill span {
    display: inline-block !important;
    line-height: 1 !important;
}

/* ════ BACKDROP ═══════════════════════════════════════════════════════════ */

.help-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(35, 54, 69, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.help-panel-backdrop[data-open="true"] {
    opacity: 1;
    pointer-events: auto;
}

/* ════ SLIDE-PANEL (Aside rechts) ═════════════════════════════════════════ */

.help-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    /* Default-Breite: 1100px Desktop, 90vw auf größerer Screens, 95vw auf Mobile.
       Für Anleitungen mit Screenshots ist 720px zu schmal — 1100px lässt
       Vorlage-Layout (Hero-Card, Flow-Diagramm, Info-Tables) natürlich atmen. */
    width: min(1100px, 92vw);
    background: var(--color-bg-elevated);
    box-shadow: -12px 0 36px rgba(35, 54, 69, 0.18);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    /* Vermeidet horizontale Scrollbar während Slide-Animation */
    overflow: hidden;
}

.help-panel[data-open="true"] {
    transform: translateX(0);
}

.help-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: #233645;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.help-panel__title {
    margin: 0;
    font-family: 'Cabrito Didone Cond Book', 'Cabrito Didone', Georgia, serif;
    font-size: 20px;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.help-panel__close {
    min-width: 44px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.help-panel__close:hover {
    background: rgba(229, 183, 186, 0.30);
    transform: rotate(90deg);
}

.help-panel__close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(229, 183, 186, 0.45);
}

.help-panel__iframe {
    flex: 1 1 auto;
    width: 100%;
    border: 0;
    background: #f9fafb;
}

.help-panel__loader {
    position: absolute;
    inset: 60px 0 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #f9fafb;
    color: #6b7280;
    font-family: 'Ingra Light', 'Inter', system-ui, sans-serif;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.help-panel__loader[data-loading="true"] {
    opacity: 1;
}

.help-panel__loader i {
    font-size: 24px;
    color: #e5b7ba;
}

/* ════ MOBILE: Pill als Icon-only, Panel füllt fast Vollbreite ═══════════ */

@media (max-width: 640px) {
    .help-pill {
        padding: 10px 14px;
    }
    .help-pill span {
        display: none;  /* Nur Icon auf Mobile */
    }
    .help-panel {
        width: 100vw;
    }
}

/* ════ A11y: Reduced Motion ══════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .help-pill,
    .help-pill i,
    .help-panel,
    .help-panel-backdrop,
    .help-panel__close,
    .help-panel__loader {
        transition: none !important;
    }
    .help-panel__close:hover {
        transform: none;
    }
}

/* ════ Print: Panel + Pill verstecken (nicht relevant beim Drucken) ══════ */

@media print {
    .help-pill,
    .help-panel,
    .help-panel-backdrop {
        display: none !important;
    }
}
