/* Kontakt-Hub: ein Floating-Button, Menü: Telefon, WhatsApp, E-Mail, Termin, KI-Chat */
.contact-hub {
    position: fixed;
    right: 24px;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    /* über fast allen Seitenelementen, aber: Chat-Widget-Wrapper muss niedriger liegen, sonst blockiert
       der volle Viewport-Layer (mobil) das Kontaktmenü. Bei geöffnetem Chat: .chat-panel-open hebt #chatbot-widget. */
    z-index: 2147483646;
    isolation: isolate;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    pointer-events: none;
}

.contact-hub * {
    pointer-events: auto;
}

.contact-hub-fab {
    position: relative;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #fbbf24 0%, #d97706 100%);
    color: #0a0a0a;
    box-shadow: 0 6px 22px rgba(217, 119, 6, 0.45), 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 3;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.contact-hub-fab:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 10px 28px rgba(217, 119, 6, 0.5);
}

.contact-hub-fab[aria-expanded="true"] {
    background: linear-gradient(145deg, #0a0a0a 0%, #1f1f1f 100%);
    color: #fbbf24;
}

.contact-hub-fab[aria-expanded="true"] .contact-hub-fab-icon-open {
    display: block;
}
.contact-hub-fab[aria-expanded="true"] .contact-hub-fab-icon-closed {
    display: none;
}
.contact-hub-fab:not([aria-expanded="true"]) .contact-hub-fab-icon-open {
    display: none;
}
.contact-hub-fab:not([aria-expanded="true"]) .contact-hub-fab-icon-closed {
    display: block;
}

.contact-hub-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}

.contact-hub:not(.is-open) .contact-hub-backdrop {
    display: none;
}
.contact-hub.is-open .contact-hub-backdrop {
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.contact-hub-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: min(300px, calc(100vw - 40px));
    max-height: min(480px, 85vh, 85dvh, 85svh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #0a0a0a;
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: var(--radius-lg, 20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    padding: 8px;
    z-index: 2;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.contact-hub.is-open .contact-hub-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.contact-hub-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(251, 191, 36, 0.9);
    padding: 8px 12px 4px;
    margin: 0;
}

.contact-hub-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    text-decoration: none;
    color: #fafafa;
    background: transparent;
    border: none;
    border-radius: var(--radius-md, 16px);
    padding: 12px 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    border: 1px solid transparent;
    box-sizing: border-box;
}

a.contact-hub-item {
    color: #fafafa;
}

.contact-hub-item:hover {
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
}

.contact-hub-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm, 12px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
}

.contact-hub-item-icon.whatsapp {
    background: #25d36622;
    color: #25d366;
}
.contact-hub-item-icon.phone {
    color: #fde68a;
}
.contact-hub-item-icon.email {
    color: #94a3b8;
}
.contact-hub-item-icon.booking {
    color: #fbbf24;
}
.contact-hub-item-icon.ki {
    color: #a78bfa;
}

.contact-hub-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.contact-hub-item-text small {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
}

/* Chat-Paneel offen: Hub verbergen (liegt visuell darunter, aber keine Klicks) */
body.chat-panel-open .contact-hub {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
    transition: opacity 0.2s, transform 0.2s;
}

/* Wenn Hub aktiv ist: separaten alten KI-Button ausblenden */
body.has-contact-hub #chatbot-toggle {
    position: fixed !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Chat-Wrapper: unter dem Kontakt-Hub (wichtig auf index/mobil: 100dvh-Layer sonst fängt Touches/Scroll) */
body.has-contact-hub #chatbot-widget {
    z-index: 2147482000 !important;
    bottom: max(16px, env(safe-area-inset-bottom, 0px)) !important;
    right: max(16px, env(safe-area-inset-right, 0px)) !important;
}

/* Geöffnetes Chat-Panel über allem inkl. Hub */
body.has-contact-hub.chat-panel-open #chatbot-widget {
    z-index: 2147483647 !important;
}

@media (max-width: 768px) {
    .contact-hub {
        right: max(12px, env(safe-area-inset-right, 0px));
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }
    .contact-hub-fab {
        width: 56px;
        height: 56px;
    }
    .contact-hub-panel {
        bottom: 66px;
        max-height: min(82dvh, 82svh, 480px);
    }
}
