.tcb {
    position: fixed;
    bottom: 24px;
    z-index: 9999;
    font-family: inherit;
}

.tcb-right { right: 24px; }
.tcb-left  { left: 24px; }

/* Main toggle button */
.tcb-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border: 0;
    border-radius: 50%;
    background: var(--tcb-main, #E3FF04);
    color: #111;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s ease, box-shadow .25s ease;
    z-index: 2;
}

.tcb-toggle:hover {
    transform: scale(1.06);
}

.tcb-toggle svg {
    width: 28px;
    height: 28px;
}

.tcb-toggle-open,
.tcb-toggle-close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .2s ease, transform .25s ease;
}

/* Close (X) icon, drawn with pseudo-elements */
.tcb-toggle-close {
    width: 24px;
    height: 24px;
    opacity: 0;
    transform: rotate(-90deg);
}
.tcb-toggle-close::before,
.tcb-toggle-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}
.tcb-toggle-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.tcb-toggle-close::after  { transform: translate(-50%, -50%) rotate(-45deg); }

.tcb.is-open .tcb-toggle-open  { opacity: 0; transform: rotate(90deg); }
.tcb.is-open .tcb-toggle-close { opacity: 1; transform: rotate(0deg); }

/* Channel list */
.tcb-list {
    position: absolute;
    bottom: 76px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 1;
}
.tcb-right .tcb-list { right: 6px; align-items: flex-end; }
.tcb-left  .tcb-list { left: 6px;  align-items: flex-start; }

.tcb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}
.tcb-left .tcb-item { flex-direction: row-reverse; }

/* Fully hide the list until opened so nothing peeks behind the button */
.tcb:not(.is-open) .tcb-list {
    visibility: hidden;
    pointer-events: none;
}

.tcb.is-open .tcb-item {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}
.tcb.is-open .tcb-item:nth-child(1) { transition-delay: .05s; }
.tcb.is-open .tcb-item:nth-child(2) { transition-delay: .10s; }
.tcb.is-open .tcb-item:nth-child(3) { transition-delay: .15s; }
.tcb.is-open .tcb-item:nth-child(4) { transition-delay: .20s; }
.tcb.is-open .tcb-item:nth-child(5) { transition-delay: .25s; }

.tcb-label {
    background: #fff;
    color: #191716;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}

.tcb-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
    transition: transform .2s ease;
}
.tcb-item:hover .tcb-icon {
    transform: scale(1.08);
}
.tcb-icon svg {
    width: 24px;
    height: 24px;
}

/* Greeting tooltip */
.tcb-greeting {
    position: absolute;
    bottom: 14px;
    background: #fff;
    color: #191716;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 32px 10px 14px;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
    animation: tcbFadeIn .4s ease both;
}
.tcb-right .tcb-greeting { right: 74px; }
.tcb-left  .tcb-greeting { left: 74px; }
.tcb.is-open .tcb-greeting { display: none; }

.tcb-greeting-close {
    position: absolute;
    top: 4px;
    right: 8px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #999;
}

@keyframes tcbFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .tcb { bottom: 16px; }
    .tcb-right { right: 16px; }
    .tcb-left  { left: 16px; }
    .tcb-greeting { display: none; }
}

/* Theme's go-to-top button shares the bottom-right corner: lift it above
   the bubble (centred on it) while the bubble is on the right. */
body:has(.tcb.tcb-right) .scroll-top {
    bottom: 100px !important;
    right: 29px !important;
}
@media (max-width: 600px) {
    body:has(.tcb.tcb-right) .scroll-top { bottom: 90px !important; right: 21px !important; }
}
/* While the chat is open its buttons take that space: hide go-to-top. */
body:has(.tcb.is-open) .scroll-top {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
