/* ==================== FLOATING SIDEBAR ==================== */

.hh-floating-sidebar {
    position: fixed;
    right: 16px;
    bottom: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.hh-fb-item {
    pointer-events: auto;
    position: relative;
    display: block;
}

.hh-fb-btn,
.hh-fb-item.hh-fb-top {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    transition: transform .2s cubic-bezier(.3,1.2,.4,1), box-shadow .2s;
    overflow: visible;
}

.hh-fb-btn:hover,
.hh-fb-item:hover > .hh-fb-btn,
.hh-fb-item.hh-fb-top:hover {
    transform: scale(1.08) translateX(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

.hh-fb-label {
    font-size: 8px;
    line-height: 1;
    opacity: .85;
}

.hh-fb-wechat   { background: linear-gradient(135deg,#07C160,#06AD56); }
.hh-fb-whatsapp { background: linear-gradient(135deg,#25D366,#1EBE5D); }
.hh-fb-telegram { background: linear-gradient(135deg,#2AABEE,#229ED9); }
.hh-fb-inquiry .hh-fb-btn { background: linear-gradient(135deg,#B8762A,#9E6520); }
.hh-fb-top      { background: linear-gradient(135deg,#1b1a17,#3a3630); }

/* ==================== POPUP POSITIONING ==================== */
/* Desktop default: LEFT of button, vertically centered */
.hh-fb-popup {
    position: absolute;
    right: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) translateX(12px);
    background: #fff;
    padding: 14px;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, transform .25s cubic-bezier(.3,1.2,.4,1), visibility .22s;
    width: 180px;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 2147483647;
}

.hh-fb-popup::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #fff;
}

.hh-fb-popup img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.hh-fb-popup-label {
    text-align: center;
    font-size: 12px;
    color: #1b1a17;
    margin-top: 8px;
    font-weight: 500;
}

/* Show: hover (desktop) OR .hh-open class (click via JS) */
.hh-fb-item:hover .hh-fb-popup,
.hh-fb-item.hh-open .hh-fb-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

/* Back to top */
.hh-fb-item.hh-fb-top {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .3s, transform .3s;
}
.hh-fb-item.hh-fb-top.hh-show {
    opacity: 1;
    transform: translateY(0);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .hh-floating-sidebar {
        right: 10px;
        bottom: 16px;
        gap: 8px;
    }
    .hh-fb-btn,
    .hh-fb-item.hh-fb-top {
        width: 44px;
        height: 44px;
    }
    .hh-fb-btn svg,
    .hh-fb-item.hh-fb-top svg {
        width: 20px;
        height: 20px;
    }
    .hh-fb-label { display: none; }

    /* MOBILE POPUP: ABOVE button, RIGHT-ALIGNED to button (never overflows!) */
    .hh-fb-popup {
        /* Cancel desktop positioning */
        right: 0;                   /* Right edge aligned to button right edge */
        top: auto;                  /* Cancel top:50% */
        bottom: calc(100% + 10px);  /* Place ABOVE button with 10px gap */
        left: auto;
        transform: translateY(8px); /* Small lift-up animation from below */
        width: 160px;
        padding: 12px;
    }

    /* Pointer arrow: now points DOWN to the button */
    .hh-fb-popup::after {
        right: 14px;
        top: auto;
        bottom: -6px;
        transform: none;
        border: 6px solid transparent;
        border-top-color: #fff;
        border-left-color: transparent;
    }

    /* Mobile show state: cancel desktop transform, use bottom-positioned one */
    .hh-fb-item:hover .hh-fb-popup,
    .hh-fb-item.hh-open .hh-fb-popup {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);  /* Slide down into place from above */
        pointer-events: auto;
    }
}
