.thuy-toolbar,
.thuy-toolbar * {
    box-sizing: border-box;
}

.thuy-toolbar {
    position: fixed;
    right: 24px;
    bottom: 88px;
    z-index: 9999;
    transform: none;
    --thuy-toolbar-icon-size: 44px;
}

.thuy-toolbar-right {
    right: 24px;
    left: auto;
}

.thuy-toolbar-left {
    right: auto;
    left: 24px;
}

.thuy-toolbar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.thuy-toolbar-item {
    position: relative;
    margin: 0;
    padding: 0;
}

.thuy-toolbar-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #1f2f38;
    text-align: center;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.thuy-toolbar-link:hover {
    color: #1f2f38;
    transform: translateY(-2px);
}

.thuy-toolbar-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--thuy-toolbar-icon-size);
    height: var(--thuy-toolbar-icon-size);
    padding: 2px;
    color: #fff;
    border-radius: 100%;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thuy-toolbar-icon::before {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 100%;
    background: var(--thuy-toolbar-item-color);
}

.thuy-toolbar-icon svg {
    position: relative;
    z-index: 1;
    display: block;
    width: 58%;
    height: 58%;
    fill: currentColor;
}

.thuy-toolbar-link:hover .thuy-toolbar-icon {
    transform: scale(1.05);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.thuy-toolbar-text {
    display: block;
    min-width: 92px;
    color: #1f2f38;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 400;
    white-space: nowrap;
}

.thuy-toolbar-item-phone {
    --thuy-toolbar-item-color: #ff1f1f;
}

.thuy-toolbar-item-zalo {
    --thuy-toolbar-item-color: #19aee8;
}

.thuy-toolbar-item-messenger {
    --thuy-toolbar-item-color: #1285ff;
}

.thuy-toolbar-item-map {
    --thuy-toolbar-item-color: #18b45a;
}

.thuy-toolbar-link.animation_swing .thuy-toolbar-icon {
    animation: thuy-toolbar-swing 1.6s ease-in-out infinite;
    transform-origin: 50% 100%;
}

@keyframes thuy-toolbar-swing {
    0%,
    100% {
        transform: rotate(0deg);
    }

    15% {
        transform: rotate(12deg);
    }

    30% {
        transform: rotate(-10deg);
    }

    45% {
        transform: rotate(7deg);
    }

    60% {
        transform: rotate(-4deg);
    }
}

@media (min-width: 561px) {
    .thuy-toolbar-link .thuy-toolbar-text {
        position: absolute;
        top: 50%;
        right: calc(var(--thuy-toolbar-icon-size) + 14px);
        z-index: 9;
        height: 36px;
        min-width: 0;
        padding: 6px 12px;
        color: #1f2f38;
        font-size: 13px;
        line-height: 24px;
        text-align: center;
        white-space: nowrap;
        background-color: #fff;
        border-radius: 5px;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-50%);
        transition: all 200ms linear;
    }

    .thuy-toolbar-left .thuy-toolbar-link .thuy-toolbar-text {
        right: auto;
        left: calc(var(--thuy-toolbar-icon-size) + 14px);
    }

    .thuy-toolbar-link .thuy-toolbar-text::after {
        content: "";
        position: absolute;
        top: 50%;
        right: -7px;
        width: 0;
        height: 0;
        border-top: 7px solid transparent;
        border-bottom: 7px solid transparent;
        border-left: 7px solid #fff;
        transform: translateY(-50%);
    }

    .thuy-toolbar-left .thuy-toolbar-link .thuy-toolbar-text::after {
        right: auto;
        left: -7px;
        border-right: 7px solid #fff;
        border-left: 0;
    }

    .thuy-toolbar-link:hover .thuy-toolbar-text {
        visibility: visible;
        opacity: 1;
    }
}

@media (max-width: 560px) {
    .thuy-toolbar {
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.62)),
            rgba(255, 255, 255, 0.48);
        border: 1px solid rgba(255, 255, 255, 0.72);
        border-radius: 22px;
        box-shadow:
            0 18px 42px rgba(28, 38, 32, 0.22),
            inset 0 1px 0 rgba(255, 255, 255, 0.9),
            inset 0 -1px 0 rgba(183, 201, 139, 0.18);
        transform: none;
        -webkit-backdrop-filter: saturate(180%) blur(22px);
        backdrop-filter: saturate(180%) blur(22px);
    }

    .thuy-toolbar::before {
        content: "";
        position: absolute;
        inset: 1px 1px auto;
        height: 42%;
        border-radius: 21px 21px 16px 16px;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0));
        pointer-events: none;
    }

    .thuy-toolbar-list {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        position: relative;
        z-index: 1;
        gap: 5px;
        width: 100%;
    }

    .thuy-toolbar-item {
        min-width: 0;
    }

    .thuy-toolbar-link {
        display: flex;
        gap: 6px;
        width: 100%;
        min-width: 0;
        padding: 6px 2px 4px;
        border-radius: 16px;
        transition: background 0.2s ease, transform 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .thuy-toolbar-link:hover,
    .thuy-toolbar-link:focus {
        background: rgba(183, 201, 139, 0.13);
        transform: translateY(-1px);
    }

    .thuy-toolbar-icon {
        margin-top: -2px;
        box-shadow:
            0 8px 18px rgba(26, 42, 32, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 0.75);
    }

    .thuy-toolbar-text {
        width: 100%;
        min-width: 0;
        overflow: hidden;
        color: #24313a;
        font-size: 11.5px;
        line-height: 1.2;
        font-weight: 500;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body {
        padding-bottom: calc(86px + env(safe-area-inset-bottom));
    }

    #top-link.back-to-top {
        display: none !important;
    }
}
