/* Floating Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 14px;
    transition: left 0.35s cubic-bezier(.34,1.56,.64,1), right 0.35s cubic-bezier(.34,1.56,.64,1), top 0.35s cubic-bezier(.34,1.56,.64,1);
    will-change: left, top, right;
    touch-action: none;
}

.chat-widget--dragging {
    transition: none !important;
    cursor: grabbing;
    user-select: none;
}

/* Toggle Button */
.chat-widget__toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #25D366 0%, #0088cc 100%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(37, 211, 102, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    color: #fff;
    animation: chatPulse 2.5s ease-in-out infinite;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.chat-widget__toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
    cursor: grab;
}

.chat-widget__toggle:active {
    cursor: grabbing;
}

.chat-widget__icon {
    width: 26px;
    height: 26px;
    transition: opacity 0.25s ease, transform 0.25s ease;
    position: absolute;
    pointer-events: none;
}

.chat-widget__icon--close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
}

/* Open state */
.chat-widget--open .chat-widget__toggle {
    animation: none;
    background: #555;
}

.chat-widget--open .chat-widget__icon--open {
    opacity: 0;
    transform: rotate(90deg) scale(0.6);
}

.chat-widget--open .chat-widget__icon--close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Options container */
.chat-widget__options {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-widget--open .chat-widget__options {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* WhatsApp / Telegram link buttons */
.chat-widget__link {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}

.chat-widget__link:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.chat-widget__link svg {
    width: 22px;
    height: 22px;
}

.chat-widget__label {
    position: absolute;
    right: 58px;
    background: #333;
    color: #fff;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-widget__label::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: #333;
    border-right: none;
}

.chat-widget__link:hover .chat-widget__label {
    opacity: 1;
    transform: translateX(0);
}

/* Brand colors */
.chat-widget__link--whatsapp {
    background: #25D366;
}

.chat-widget__link--whatsapp:hover {
    background: #1ebc58;
}

.chat-widget__link--telegram {
    background: #0088cc;
}

.chat-widget__link--telegram:hover {
    background: #0077b3;
}

/* WeChat QR Code Card */
.chat-widget__qrcard {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    padding: 16px;
    text-align: center;
    min-width: 200px;
}

.chat-widget__qrcard-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #07C160;
    font-size: 14px;
    font-weight: 600;
}

.chat-widget__qr {
    width: 160px;
    height: 160px;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.chat-widget__qrcard-tip {
    margin: 10px 0 0;
    font-size: 12px;
    color: #999;
    line-height: 1.4;
}

/* Pulse animation */
@keyframes chatPulse {
    0% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(37, 211, 102, 0.5);
    }
    50% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 12px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
        gap: 10px;
    }

    .chat-widget__toggle {
        width: 48px;
        height: 48px;
    }

    .chat-widget__icon {
        width: 22px;
        height: 22px;
    }

    .chat-widget__link {
        width: 42px;
        height: 42px;
    }

    .chat-widget__link svg {
        width: 19px;
        height: 19px;
    }

    .chat-widget__label {
        display: none;
    }

    .chat-widget__options {
        gap: 10px;
    }

    .chat-widget__qrcard {
        min-width: 180px;
        padding: 12px;
    }

    .chat-widget__qr {
        width: 140px;
        height: 140px;
    }
}
