/* ═══════════════════════════════════════════════════════════════════
   CONTACT HUB WIDGET - PREMIUM GLASSMORPHISM 2026
   C2A Compliance - Floating Multi-Channel Communication Hub
   Button fixed bottom-right, menu expands UPWARD on hover
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --hub-primary: #008BC2;
    --hub-secondary: #78B52F;
    --hub-z-index: 9990;
    --hub-transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    --hub-whatsapp: #25D366;
    --hub-messenger: #0084FF;
    --hub-linkedin: #0A66C2;
    --hub-chatbot: #008BC2;
}

/* ══════════════════════════════════════
   CONTAINER — pinned to absolute bottom-right
   flex-direction: column = menu on top, button on bottom
   ══════════════════════════════════════ */
.contact-hub {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--hub-z-index);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
    font-family: 'DM Sans', 'Space Grotesk', sans-serif;
}

/* ══════════════════════════════════════
   MAIN TOGGLE BUTTON — #78B52F green
   ══════════════════════════════════════ */
.hub-toggle {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #78B52F 0%, #5a8f24 100%);
    color: #ffffff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 6px 28px rgba(120, 181, 47, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: var(--hub-transition);
    z-index: 2;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    order: 2; /* force button to bottom in flex column */
}

.hub-toggle:hover {
    transform: scale(1.12);
    box-shadow:
        0 10px 44px rgba(120, 181, 47, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.2);
}

.hub-toggle:focus-visible {
    outline: 3px solid rgba(120, 181, 47, 0.5);
    outline-offset: 4px;
}

/* Pulse glow */
.hub-toggle::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: rgba(120, 181, 47, 0.35);
    animation: hubPulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes hubPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.4); opacity: 0; }
}

.contact-hub.is-open .hub-toggle::before {
    animation: none;
    opacity: 0;
}

/* Icon swap on open */
.hub-toggle .hub-icon-open,
.hub-toggle .hub-icon-close {
    position: absolute;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hub-toggle .hub-icon-open {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.hub-toggle .hub-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.contact-hub.is-open .hub-toggle .hub-icon-open {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.contact-hub.is-open .hub-toggle .hub-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Canvas background */
.hub-canvas-container {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.hub-canvas-container canvas {
    width: 100%;
    height: 100%;
}

/* ══════════════════════════════════════
   NOTIFICATION BADGE
   ══════════════════════════════════════ */
.hub-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
    z-index: 3;
    animation: hubBadgeBounce 2s ease-in-out infinite;
}

@keyframes hubBadgeBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ══════════════════════════════════════
   MENU — sits ABOVE button, expands UPWARD
   ══════════════════════════════════════ */
.hub-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
    order: 1; /* menu above button */
}

.contact-hub.is-open .hub-menu {
    pointer-events: auto;
}

/* ══════════════════════════════════════
   MENU ITEMS — hidden by default,
   animate from BELOW (translateY +20) to normal
   so they visually "rise upward"
   ══════════════════════════════════════ */
.hub-item {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: row-reverse;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.contact-hub.is-open .hub-item {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Staggered open — bottom items first (closest to button) */
.contact-hub.is-open .hub-item:nth-child(4) { transition-delay: 0.05s; }
.contact-hub.is-open .hub-item:nth-child(3) { transition-delay: 0.10s; }
.contact-hub.is-open .hub-item:nth-child(2) { transition-delay: 0.15s; }
.contact-hub.is-open .hub-item:nth-child(1) { transition-delay: 0.20s; }

/* Staggered close — top items first */
.hub-item:nth-child(1) { transition-delay: 0.02s; }
.hub-item:nth-child(2) { transition-delay: 0.05s; }
.hub-item:nth-child(3) { transition-delay: 0.08s; }
.hub-item:nth-child(4) { transition-delay: 0.11s; }

/* ══════════════════════════════════════
   ITEM BUTTONS
   ══════════════════════════════════════ */
.hub-item-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #ffffff;
    position: relative;
    transition: var(--hub-transition);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    outline: none;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.hub-item-btn:hover {
    transform: scale(1.15);
}

.hub-item-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 3px;
}

/* Glow on hover */
.hub-item-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hub-item-btn:hover::after {
    opacity: 1;
}

/* Channel colors */
.hub-item-btn.hub-chatbot {
    background: linear-gradient(135deg, var(--hub-chatbot), #006a9e);
}
.hub-item-btn.hub-chatbot::after {
    box-shadow: 0 0 20px rgba(0, 139, 194, 0.5);
}

.hub-item-btn.hub-whatsapp {
    background: linear-gradient(135deg, var(--hub-whatsapp), #1ebe5d);
}
.hub-item-btn.hub-whatsapp::after {
    box-shadow: 0 0 20px rgba(37, 211, 102, 0.5);
}

.hub-item-btn.hub-messenger {
    background: linear-gradient(135deg, var(--hub-messenger), #0066cc);
}
.hub-item-btn.hub-messenger::after {
    box-shadow: 0 0 20px rgba(0, 132, 255, 0.5);
}

.hub-item-btn.hub-linkedin {
    background: linear-gradient(135deg, var(--hub-linkedin), #004182);
}
.hub-item-btn.hub-linkedin::after {
    box-shadow: 0 0 20px rgba(10, 102, 194, 0.5);
}

/* ══════════════════════════════════════
   TOOLTIP LABELS
   ══════════════════════════════════════ */
.hub-item-label {
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hub-item:hover .hub-item-label {
    opacity: 1;
    transform: translateX(0);
}

/* ══════════════════════════════════════
   HOVER OPEN — menu opens on hover too
   ══════════════════════════════════════ */
.contact-hub:hover .hub-menu {
    pointer-events: auto;
}

.contact-hub:hover .hub-item {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.contact-hub:hover .hub-item:nth-child(4) { transition-delay: 0.05s; }
.contact-hub:hover .hub-item:nth-child(3) { transition-delay: 0.10s; }
.contact-hub:hover .hub-item:nth-child(2) { transition-delay: 0.15s; }
.contact-hub:hover .hub-item:nth-child(1) { transition-delay: 0.20s; }

.contact-hub:hover .hub-toggle::before {
    animation: none;
    opacity: 0;
}

/* ══════════════════════════════════════
   BACKDROP (mobile)
   ══════════════════════════════════════ */
.hub-backdrop {
    display: none;
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 768px) {
    .contact-hub {
        bottom: 14px;
        right: 14px;
    }

    .hub-toggle {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .hub-item-btn {
        width: 46px;
        height: 46px;
        font-size: 20px;
    }

    .hub-item-label {
        display: none;
    }

    /* On mobile, hover doesn't exist — rely on click only */
    .contact-hub:hover .hub-item {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
        pointer-events: none;
    }
    .contact-hub.is-open .hub-item {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

    .hub-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: calc(var(--hub-z-index) - 1);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .hub-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ══════════════════════════════════════
   PRINT — hide
   ══════════════════════════════════════ */
@media print {
    .contact-hub,
    .hub-backdrop {
        display: none !important;
    }
}
