/* ========== Chat Toggle Button ========== */
#n8n-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366; /* WhatsApp green */
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, background 0.3s;
}

#n8n-chat-toggle:hover {
    transform: scale(1.1);
    background: #1DA851;
}

/* ========== Chat Window ========== */
#n8n-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: n8n-slide-up 0.3s ease-out;
}

@keyframes n8n-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== Header ========== */
#n8n-chat-header {
    background: #075E54; /* WhatsApp dark green */
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.n8n-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.n8n-chat-avatar {
    font-size: 28px;
}

.n8n-chat-title {
    font-weight: 600;
    font-size: 16px;
}

.n8n-chat-status {
    font-size: 12px;
    opacity: 0.8;
}

#n8n-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
}

/* ========== Messages Area ========== */
#n8n-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #ECE5DD; /* WhatsApp chat bg */
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 300px;
    max-height: 340px;
}

.n8n-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}

.n8n-msg-user {
    align-self: flex-end;
    background: #DCF8C6;
    border-bottom-right-radius: 4px;
}

.n8n-msg-bot {
    align-self: flex-start;
    background: #fff;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.n8n-msg-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

/* ========== Typing Indicator ========== */
#n8n-chat-typing {
    padding: 8px 16px;
    background: #ECE5DD;
}

.n8n-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 12px;
    width: fit-content;
}

.n8n-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: n8n-typing 1.4s infinite;
}

.n8n-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.n8n-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes n8n-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-6px); opacity: 1; }
}

/* ========== Input Area ========== */
#n8n-chat-form {
    display: flex;
    padding: 10px;
    background: #f0f0f0;
    gap: 8px;
    border-top: 1px solid #ddd;
}

#n8n-chat-input {
    flex: 1;
    border: none;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

#n8n-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #25D366;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#n8n-chat-send:hover {
    background: #1DA851;
}

/* ========== Mobile Responsive ========== */
@media (max-width: 480px) {
    #n8n-chat-window {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 90px;
        max-height: 70vh;
    }
}