/* ═══════════════════════════════════════════════
   HK Floating Sidebar – Frontend Styles
   
   HTML-Reihenfolge wird in PHP gesteuert:
     RIGHT/BOTTOM: <label><icon> (Icon am Rand)
     LEFT:         <icon><label> (Icon am Rand)
   
   CSS macht NUR Layout, keine Reihenfolge!
   ═══════════════════════════════════════════════ */

/* ─── Reset ─── */
.hfs-sidebar,
.hfs-sidebar *,
.hfs-sidebar *::before,
.hfs-sidebar *::after {
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
}

.hfs-sidebar {
    position: fixed !important;
    z-index: 99990 !important;
    pointer-events: none !important;
    outline: none !important;
}

.hfs-elements {
    list-style: none !important;
    display: flex !important;
    pointer-events: auto !important;
}

/* ═══════════════════════════════════════════════
   RIGHT – HTML: [label][icon] → Icon klebt rechts
   ═══════════════════════════════════════════════ */
.hfs-pos-right {
    right: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}
.hfs-pos-right .hfs-elements {
    flex-direction: column !important;
    gap: 4px !important;
    align-items: flex-end !important;
}
.hfs-pos-right .hfs-element {
    transform: translateX(100%);
    display: flex !important;
    justify-content: flex-end !important;
}
.hfs-pos-right .hfs-element.hfs-entered {
    transform: translateX(0);
}
.hfs-pos-right .hfs-el-trigger {
    display: inline-flex !important;
    flex-direction: row !important;
    border-radius: 8px 0 0 8px !important;
}
.hfs-pos-right .hfs-el-label {
    max-width: 0 !important;
    opacity: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
}
.hfs-pos-right .hfs-element.hfs-open .hfs-el-label {
    max-width: 240px !important;
    opacity: 1 !important;
    padding: 0 14px !important;
}

/* ═══════════════════════════════════════════════
   LEFT – HTML: [icon][label] → Icon klebt links
   ═══════════════════════════════════════════════ */
.hfs-pos-left {
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}
.hfs-pos-left .hfs-elements {
    flex-direction: column !important;
    gap: 4px !important;
    align-items: flex-start !important;
}
.hfs-pos-left .hfs-element {
    transform: translateX(-100%);
    display: flex !important;
    justify-content: flex-start !important;
}
.hfs-pos-left .hfs-element.hfs-entered {
    transform: translateX(0);
}
.hfs-pos-left .hfs-el-trigger {
    display: inline-flex !important;
    flex-direction: row !important;
    border-radius: 0 8px 8px 0 !important;
}
.hfs-pos-left .hfs-el-label {
    max-width: 0 !important;
    opacity: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
}
.hfs-pos-left .hfs-element.hfs-open .hfs-el-label {
    max-width: 240px !important;
    opacity: 1 !important;
    padding: 0 14px !important;
}

/* ═══════════════════════════════════════════════
   BOTTOM – HTML: [label][icon] → Icon klebt unten
   ═══════════════════════════════════════════════ */
.hfs-pos-bottom {
    bottom: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    padding: 0 12px !important;
}
.hfs-pos-bottom .hfs-elements {
    flex-direction: row !important;
    gap: 4px !important;
    justify-content: center !important;
    align-items: flex-end !important;
}
.hfs-pos-bottom .hfs-element {
    transform: translateY(100%);
}
.hfs-pos-bottom .hfs-element.hfs-entered {
    transform: translateY(0);
}
.hfs-pos-bottom .hfs-el-trigger {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    border-radius: 8px 8px 0 0 !important;
}
.hfs-pos-bottom .hfs-el-icon {
    width: 48px !important;
    height: 48px !important;
}
.hfs-pos-bottom .hfs-el-label {
    max-height: 0 !important;
    opacity: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    font-size: 11px !important;
    text-align: center !important;
}
.hfs-pos-bottom .hfs-element.hfs-open .hfs-el-label {
    max-height: 40px !important;
    opacity: 1 !important;
    padding: 10px 12px 0 12px !important;
}

/* ═══════════════════════════════════════════════
   Element Base
   ═══════════════════════════════════════════════ */
.hfs-element {
    transition:
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.4s ease;
    transition-delay: var(--hfs-delay, 0ms);
    opacity: 0;
}
.hfs-element.hfs-entered {
    opacity: 1;
}

/* ─── Trigger ─── */
.hfs-el-trigger {
    align-items: center !important;
    background-color: var(--hfs-bg, #333) !important;
    text-decoration: none !important;
    cursor: pointer !important;
    border: none !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}
a.hfs-el-trigger,
a.hfs-el-trigger:visited,
a.hfs-el-trigger:hover,
a.hfs-el-trigger:focus,
a.hfs-el-trigger:active {
    color: var(--hfs-text-color, #fff) !important;
    text-decoration: none !important;
    background-image: none !important;
}
button.hfs-el-trigger {
    color: var(--hfs-text-color, #fff) !important;
}
.hfs-el-trigger:hover,
.hfs-el-trigger:focus-visible {
    background-color: var(--hfs-bg-hover, var(--hfs-bg, #555)) !important;
}
.hfs-el-trigger:focus-visible {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.5), 0 0 0 5px var(--hfs-bg, #333) !important;
}
.hfs-el-trigger:active {
    filter: brightness(0.9);
}

/* ─── Icon ─── */
.hfs-el-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 48px !important;
    height: 48px !important;
    flex-shrink: 0 !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: var(--hfs-icon-color, #fff) !important;
}
.hfs-el-icon i,
.hfs-el-icon .fab,
.hfs-el-icon .fas,
.hfs-el-icon .far {
    color: inherit !important;
    font-size: inherit !important;
    width: auto !important;
    height: auto !important;
}
.hfs-el-icon-img {
    width: 28px !important;
    height: 28px !important;
    object-fit: contain !important;
    border-radius: 4px !important;
}

/* ─── Label ─── */
.hfs-el-label {
    color: var(--hfs-text-color, #fff) !important;
    transition:
        max-width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
        max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
        opacity 0.3s ease 0.08s,
        padding 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════
   Scroll-to-Top
   ═══════════════════════════════════════════════ */
.hfs-scroll-top {
    opacity: 0 !important;
    pointer-events: none !important;
}
.hfs-scroll-top.hfs-entered.hfs-scroll-visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ═══════════════════════════════════════════════
   Reduced Motion
   ═══════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .hfs-element,
    .hfs-el-label,
    .hfs-el-trigger {
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }
}

/* ═══════════════════════════════════════════════
   Mobile → Bottom Dock
   PHP liefert für mobile schon position=bottom,
   daher HTML-Reihenfolge ist [label][icon].
   CSS-Fallback für gecachte Seiten.
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    .hfs-sidebar[data-position-original="left"],
    .hfs-sidebar[data-position-original="right"] {
        top: auto !important;
        left: 50% !important;
        right: auto !important;
        bottom: 0 !important;
        transform: translateX(-50%) !important;
        padding: 0 8px !important;
    }
    .hfs-sidebar[data-position-original="left"] .hfs-elements,
    .hfs-sidebar[data-position-original="right"] .hfs-elements {
        flex-direction: row !important;
        gap: 3px !important;
        justify-content: center !important;
        align-items: flex-end !important;
    }
    .hfs-sidebar[data-position-original="left"] .hfs-element,
    .hfs-sidebar[data-position-original="right"] .hfs-element {
        transform: translateY(100%);
        display: block !important;
    }
    .hfs-sidebar[data-position-original="left"] .hfs-element.hfs-entered,
    .hfs-sidebar[data-position-original="right"] .hfs-element.hfs-entered {
        transform: translateY(0);
    }
    .hfs-sidebar[data-position-original="left"] .hfs-el-trigger,
    .hfs-sidebar[data-position-original="right"] .hfs-el-trigger {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: center !important;
        border-radius: 8px 8px 0 0 !important;
    }
    .hfs-sidebar[data-position-original="left"] .hfs-el-icon,
    .hfs-sidebar[data-position-original="right"] .hfs-el-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
    }
    .hfs-sidebar[data-position-original="left"] .hfs-el-label,
    .hfs-sidebar[data-position-original="right"] .hfs-el-label {
        max-width: unset !important;
        max-height: 0 !important;
        opacity: 0 !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        font-size: 11px !important;
    }
    .hfs-sidebar[data-position-original="left"] .hfs-element.hfs-open .hfs-el-label,
    .hfs-sidebar[data-position-original="right"] .hfs-element.hfs-open .hfs-el-label {
        max-height: 36px !important;
        opacity: 1 !important;
        padding: 8px 10px 0 10px !important;
    }
}
