#espe-chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

#espe-chat-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--espe-chat-primary);
    border: none;
    color: white;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 114, 61, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
}

#espe-chat-trigger:hover {
    transform: scale(1.1);
    background: var(--espe-chat-primary-dark);
}

#espe-chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 380px;
    max-height: 600px;
    height: 70vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-origin: bottom right;
    border: 1px solid rgba(0,0,0,0.05);
}

#espe-chat-window.hidden {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

.chat-header {
    background: var(--espe-chat-primary);
    color: white;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

#chat-header-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.6;
}

.bot-avatar-icon, .chat-title, #close-chat {
    position: relative;
    z-index: 2;
}

.bot-avatar-container {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.bot-custom-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-title { z-index: 2; flex-grow: 1; }
.chat-title h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #ffffff !important;
}

.chat-title .status {
    font-size: 11px;
    opacity: 0.8;
    display: flex;
    align-items: center;
}

.chat-title .status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    margin-right: 5px;
    box-shadow: 0 0 8px #10b981;
}

#close-chat {
    position: absolute;
    right: 20px;
    top: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
}

#close-chat:hover { opacity: 1; }

#chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8fafc;
}

/* Lead Form Overlay */
.chat-overlay {
    position: absolute;
    top: 85px;
    left: 0;
    width: 100%;
    height: calc(100% - 85px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    box-sizing: border-box;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lead-content { width: 100%; text-align: center; }
.lead-content h4 { margin-top: 0; color: #1e293b; font-size: 18px; margin-bottom: 10px; }
.lead-content p { font-size: 13px; color: #64748b; margin-bottom: 25px; }
.lead-content input, .lead-content select {
    width: 100%; padding: 12px 15px; margin-bottom: 15px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 14px; outline: none; transition: 0.3s;
}
.lead-content input:focus { border-color: var(--espe-chat-primary); box-shadow: 0 0 0 3px rgba(0, 114, 61, 0.1); }
#start-chat-btn {
    width: 100%; padding: 14px; background: var(--espe-chat-primary); color: white; border: none; border-radius: 10px; font-weight: 600; cursor: pointer; transition: 0.3s;
}
#start-chat-btn:hover { background: var(--espe-chat-primary-dark); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0, 114, 61, 0.2); }

/* Suggestions */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 5px 0;
    margin-bottom: 10px;
}
.suggestion-btn {
    background: white; border: 1.5px solid var(--espe-chat-primary); color: var(--espe-chat-primary); padding: 7px 14px; border-radius: 20px; font-size: 12px; cursor: pointer; transition: 0.3s; font-weight: 500;
}
.suggestion-btn:hover { background: var(--espe-chat-primary); color: white; transform: scale(1.05); }

.message {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: messageIn 0.3s ease-out;
}

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

.message.assistant {
    background: #f1f5f9;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.user {
    background: var(--espe-chat-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 10px;
    background: white;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 15px;
    outline: none;
    transition: border-color 0.3s;
}

#chat-input:focus {
    border-color: var(--espe-chat-primary);
}

#send-chat {
    background: var(--espe-chat-primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

#send-chat:hover {
    background: var(--espe-chat-primary-dark);
    transform: scale(1.05);
}

.typing-indicator {
    align-self: flex-start;
    background: #f1f5f9;
    padding: 12px 20px;
    border-radius: 18px;
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    animation: typing 1s infinite alternate;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    from { opacity: 0.3; transform: scale(1); }
    to { opacity: 1; transform: scale(1.2); }
}

@media (max-width: 480px) {
    #espe-chat-window {
        width: calc(100vw - 40px);
        height: 60vh;
        bottom: 70px;
        right: -10px;
    }
}
