/* Giới hạn toàn bộ kiểu dáng trong vùng của tiện ích để tránh ảnh hưởng giao diện khác. */
#isb-contact-buttons {
    --isb-size: 48px;
    position: fixed;
    right: max(20px, env(safe-area-inset-right, 0px));
    bottom: max(24px, var(--isb-theme-clearance, 0px), env(safe-area-inset-bottom, 0px));
    z-index: 9999;
    /* Vùng bao và khoảng trống phải cho phép bấm xuyên xuống giao diện bên dưới. */
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #172d45;
    -webkit-tap-highlight-color: transparent;
    /* Cụm nút tự dịch lên khi website có nút nổi khác: chuyển mượt để không giật. */
    transition: bottom .18s ease;
}
#isb-contact-buttons, #isb-contact-buttons * { box-sizing: border-box; }
#isb-contact-buttons .isb-contact-list {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    max-height: calc(100vh - 140px - var(--isb-theme-clearance, 0px));
    max-height: calc(100dvh - 140px - var(--isb-theme-clearance, 0px));
    overflow-y: auto;
    /* Chừa chỗ cho nhãn bên trái, kể cả khi danh sách cần cuộn dọc. */
    padding: 8px 8px 8px min(280px, calc(100vw - 100px));
    margin: -8px;
    scrollbar-width: thin;
    pointer-events: none;
}
#isb-contact-buttons .contact-btn, #isb-contact-buttons .isb-back-to-top {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: var(--isb-size);
    height: var(--isb-size);
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font: inherit;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    box-shadow: none;
    transition: transform .18s ease;
}
#isb-contact-buttons .contact-btn::before, #isb-contact-buttons .contact-btn::after,
#isb-contact-buttons .isb-back-to-top::before, #isb-contact-buttons .isb-back-to-top::after { content: none; }
#isb-contact-buttons .isb-icon {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: var(--isb-size);
    height: var(--isb-size);
    border: 1px solid rgb(255 255 255 / 45%);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgb(23 45 69 / 14%), 0 1px 3px rgb(23 45 69 / 8%);
    transition: transform .18s ease, box-shadow .18s ease;
}
#isb-contact-buttons .isb-icon img {
    display: block;
    width: 30px;
    height: 30px;
    max-width: none;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
}
#isb-contact-buttons .zalo-btn .isb-icon { --isb-ring: #0068ff; background: #fff; border-color: #dbeafe; }
#isb-contact-buttons .zalo-btn img { width: 34px; height: 34px; }
#isb-contact-buttons .fb-btn .isb-icon { --isb-ring: #087aff; background: #087aff; }
#isb-contact-buttons .hotline-btn .isb-icon { --isb-ring: #e84451; background: #e84451; }
#isb-contact-buttons .hotline-btn img, #isb-contact-buttons .isb-back-to-top img { width: 24px; height: 24px; }
#isb-contact-buttons .telegram-btn .isb-icon { --isb-ring: #269fd6; background: #269fd6; }
#isb-contact-buttons .telegram-btn img { width: 42px; height: 42px; }
#isb-contact-buttons .isb-back-to-top .isb-icon { background: #17846b; }
#isb-contact-buttons .isb-back-to-top[hidden], #isb-contact-buttons .isb-contact-list[hidden] { display: none; }
#isb-contact-buttons .isb-text {
    position: absolute;
    right: calc(100% + 12px);
    width: max-content;
    max-width: min(260px, calc(100vw - 110px));
    padding: 9px 13px;
    border-radius: 10px;
    background: #172d45;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    text-align: left;
    overflow-wrap: anywhere;
    box-shadow: 0 4px 16px rgb(23 45 69 / 12%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(4px);
    transition: opacity .18s ease, transform .18s ease;
}
#isb-contact-buttons .contact-btn:hover .isb-text,
#isb-contact-buttons .contact-btn:focus-visible .isb-text,
#isb-contact-buttons .isb-back-to-top:hover .isb-text,
#isb-contact-buttons .isb-back-to-top:focus-visible .isb-text { opacity: 1; visibility: visible; transform: none; }
#isb-contact-buttons .contact-btn:focus-visible, #isb-contact-buttons .isb-back-to-top:focus-visible {
    outline: 3px solid #172d45;
    outline-offset: 4px;
}
@media (hover: hover) {
    #isb-contact-buttons .contact-btn:hover, #isb-contact-buttons .isb-back-to-top:hover { transform: translateY(-2px); }
    #isb-contact-buttons .contact-btn:hover .isb-icon, #isb-contact-buttons .isb-back-to-top:hover .isb-icon {
        transform: scale(1.06);
        box-shadow: 0 8px 20px rgb(23 45 69 / 20%), 0 2px 5px rgb(23 45 69 / 10%);
    }
}

/* ----------------------------------------------------------------------
 * Hiệu ứng thu hút: nhẹ, chỉ dùng transform/opacity để không gây giật.
 * - Nút hiện dần lần lượt khi trang tải.
 * - Sóng viền lan ra theo màu từng kênh, các nút nối tiếp nhau rồi nghỉ.
 * - Biểu tượng Hotline rung nhẹ như chuông đổ.
 * Hiệu ứng đặt trên .isb-icon, không đặt trên thẻ <a>, để kích thước thẻ <a>
 * mà bộ tính khoảng nhường đo không bị đổi. Độ phóng sóng tối đa 1.24 (kể cả khi rê chuột phóng 1.06) giữ
 * sóng nằm trong 8px đệm của danh sách, không làm phát sinh thanh cuộn.
 * -------------------------------------------------------------------- */
#isb-contact-buttons .contact-btn .isb-icon {
    animation: isb-enter .5s cubic-bezier(.2, .8, .3, 1.2) backwards;
    animation-delay: calc(var(--isb-i, 0) * 80ms);
}
#isb-contact-buttons .contact-btn .isb-icon::after {
    content: "";
    position: absolute;
    inset: -1px;
    border: 2px solid var(--isb-ring, #172d45);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: isb-pulse 4s ease-out infinite;
    animation-delay: calc(1.2s + var(--isb-i, 0) * .35s);
}
#isb-contact-buttons .hotline-btn .isb-icon img {
    animation: isb-phone 4s ease-in-out infinite;
    animation-delay: calc(1.2s + var(--isb-i, 0) * .35s);
}
#isb-contact-buttons .isb-back-to-top .isb-icon { animation: isb-enter .35s ease-out backwards; }
#isb-contact-buttons .contact-btn:active .isb-icon, #isb-contact-buttons .isb-back-to-top:active .isb-icon {
    transform: scale(.92);
    transition-duration: .08s;
}
@keyframes isb-enter {
    from { opacity: 0; transform: scale(.6); }
    to { opacity: 1; transform: none; }
}
@keyframes isb-pulse {
    0% { opacity: 0; transform: scale(1); }
    6% { opacity: .6; transform: scale(1.02); }
    45%, 100% { opacity: 0; transform: scale(1.24); }
}
@keyframes isb-phone {
    0%, 24%, 100% { transform: none; }
    3% { transform: rotate(-14deg); }
    6% { transform: rotate(12deg); }
    9% { transform: rotate(-10deg); }
    12% { transform: rotate(8deg); }
    15% { transform: rotate(-5deg); }
    18% { transform: rotate(3deg); }
    21% { transform: rotate(0deg); }
}
#isb-contact-spacer { display: none; }
@media (max-width: 767px) {
    #isb-contact-buttons {
        --isb-size: 44px;
        right: 0;
        left: 0;
        bottom: var(--isb-theme-clearance, 0px);
        width: auto;
        gap: 0;
    }
    #isb-contact-buttons .isb-contact-list {
        flex-direction: row;
        align-items: flex-start;
        gap: 4px;
        width: 100%;
        max-height: none;
        margin: 0;
        padding: 10px max(10px, env(safe-area-inset-right, 0px)) calc(9px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
        border-top: 1px solid #e5ebf2;
        background: #fff;
        box-shadow: 0 -4px 24px rgb(23 45 69 / 7%);
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        pointer-events: auto;
    }
    #isb-contact-buttons .contact-btn {
        flex: 1 0 64px;
        flex-direction: column;
        justify-content: flex-start;
        gap: 5px;
        width: auto;
        height: auto;
        padding: 2px 3px;
        border-radius: 10px;
    }
    #isb-contact-buttons .contact-btn .isb-text {
        position: static;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        width: 100%;
        max-width: 120px;
        max-height: 34px;
        padding: 0;
        background: transparent;
        color: #243c55;
        box-shadow: none;
        border-radius: 0;
        font-size: 12px;
        font-weight: 600;
        line-height: 17px;
        text-align: center;
        overflow: hidden;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    #isb-contact-buttons .isb-back-to-top {
        position: absolute;
        right: max(16px, env(safe-area-inset-right, 0px));
        bottom: calc(100% + 12px);
    }
    #isb-contact-buttons.isb-empty .isb-back-to-top { bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
    #isb-contact-spacer { display: block; width: 100%; pointer-events: none; }
    #isb-contact-buttons .contact-btn:focus-visible { outline-offset: -2px; }
}
@media (prefers-reduced-motion: reduce) {
    #isb-contact-buttons, #isb-contact-buttons .contact-btn, #isb-contact-buttons .isb-back-to-top, #isb-contact-buttons .isb-text,
    #isb-contact-buttons .isb-icon { transition: none; }
    /* Selector phải đặc hiệu ngang khối hiệu ứng phía trên thì mới tắt được. */
    #isb-contact-buttons .contact-btn .isb-icon, #isb-contact-buttons .contact-btn .isb-icon::after,
    #isb-contact-buttons .contact-btn .isb-icon img, #isb-contact-buttons .isb-back-to-top .isb-icon { animation: none; }
}
@media print {
    #isb-contact-buttons, #isb-contact-spacer { display: none !important; }
}
