.leadchat-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.leadchat-overlay.active {
    opacity: 1;
    visibility: visible;
}

.leadchat-container {
    width: 100%;
    max-width: 640px;
    height: 90vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    overflow: hidden;
    transform: translateY(30px) scale(0.97);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.leadchat-overlay.active .leadchat-container {
    transform: translateY(0) scale(1);
}

/* Close */
.leadchat-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 28px;
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}
.leadchat-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Header */
.leadchat-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.leadchat-logo {
    width: 42px;
    height: 42px;
    background: #fff;
    color: #000;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.leadchat-header-text h2 {
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}
.leadchat-header-text p {
    color: rgba(255,255,255,0.4);
    font-size: 13px;
    margin: 2px 0 0;
}

/* Messages */
.leadchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}
.leadchat-messages::-webkit-scrollbar { width: 4px; }
.leadchat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.leadchat-msg {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.55;
    animation: msgIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.leadchat-msg.assistant {
    align-self: flex-start;
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.9);
    border-bottom-left-radius: 6px;
}
.leadchat-msg.user {
    align-self: flex-end;
    background: #fff;
    color: #000;
    border-bottom-right-radius: 6px;
}

/* Typing indicator */
.leadchat-typing {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    align-self: flex-start;
    background: rgba(255,255,255,0.07);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    animation: msgIn 0.3s ease;
}
.leadchat-typing span {
    width: 7px;
    height: 7px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}
.leadchat-typing span:nth-child(2) { animation-delay: 0.15s; }
.leadchat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-5px); opacity: 0.8; }
}

/* Input */
.leadchat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 16px 20px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
#leadchat-input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 12px 16px;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    transition: border-color 0.2s;
}
#leadchat-input::placeholder { color: rgba(255,255,255,0.25); }
#leadchat-input:focus { border-color: rgba(255,255,255,0.2); }

#leadchat-send {
    background: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #000;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.15s;
}
#leadchat-send:hover { opacity: 0.85; }
#leadchat-send:active { transform: scale(0.95); }

/* Mobile */
@media (max-width: 680px) {
    .leadchat-container {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    .leadchat-messages { padding: 20px 16px; }
    .leadchat-msg { max-width: 90%; }
}

/* Complete state */
.leadchat-complete {
    text-align: center;
    padding: 40px 20px;
    animation: msgIn 0.5s ease;
}
.leadchat-complete .checkmark {
    width: 64px;
    height: 64px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
}
.leadchat-complete p {
    color: rgba(255,255,255,0.7);
    font-size: 15px;
    line-height: 1.6;
}
