﻿.chat-popup {
    position: fixed;
    top: 80px; /* ✅ Start with a safe default */
    left: calc(100% - 400px);
    width: 360px;
    /*height: 520px;*/
    height: 600px;
    background: #111b21;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    resize: both;
    transition: transform 0.2s ease-out, opacity 0.3s ease, box-shadow 0.3s ease;
    transform: scale(1.02);
    z-index: 9999;
    will-change: transform;
}

    .chat-popup.hidden {
        transform: scale(0.95);
        opacity: 0;
        pointer-events: none;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0);
        transition: transform 0.3s ease-in, opacity 0.3s ease, box-shadow 0.3s ease;
    }

    .chat-popup:not(.hidden) {
        transform: translateY(0) scale(1);
        animation: popup-spring 0.35s ease-out;
        pointer-events: auto;
    }

    .chat-popup.dragging {
        animation: none !important;
        transform: none !important;
        transition: none !important;
    }

.chat-fab-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.chat-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #25d366;
    color: #fff;
    font-size: 24px;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.chat-popup.minimized {
    height: 70px;
    width: 280px;
    resize: none;
    overflow: hidden;
}

.chat-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #202c33;
    border-bottom: 1px solid #2a3942;
    cursor: move;
    user-select: none;
}

.avatar-strip {
    display: flex;
    gap: 6px;
}

.avatar {
    width: 36px;
    height: 36px;
    background: #2a3942;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e9edef;
    font-weight: bold;
    cursor: pointer;
}

    .avatar.active {
        outline: 2px solid #25d366;
    }

.actions {
    display: flex;
    gap: 4px;
}

.min-btn,
.close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #e9edef;
}

.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: se-resize;
    background: transparent;
}

@keyframes popup-spring {
    0% {
        transform: translateY(100%) scale(0.95);
        opacity: 0;
    }

    70% {
        transform: translateY(-5px) scale(1.03);
        opacity: 1;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}
