@import url("https://cdn.jsdelivr.net/npm/@n8n/chat/dist/style.css");

/* Chat window */
#n8n-chat .chat-window {
    border-color: #5D5FEF;
    border-radius: 1rem;
    box-shadow: 0 15px 35px -10px rgba(93, 95, 239, 0.25), 0 8px 15px -5px rgba(20, 184, 166, 0.15);
    overflow: hidden;
}

/* Header */
#n8n-chat .chat-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #5D5FEF 0%, #14B8A6 100%);
}

#n8n-chat .chat-header h1 {
    font-size: 22px;
    margin: 0 auto;
    margin-left: 40px;
    font-weight: 600;
}

/* Body */
#n8n-chat .chat-body {
    background-color: #f8fafc;
}

/* Avatar */
#n8n-chat .chat-heading::before {
    content: "";
    display: inline-block;
    width: 60px;
    height: 60px;
    margin: -10px 0;
    background-image: url('/img/ava.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    vertical-align: middle;
    border-radius: 50%;
}

/* Messages */
#n8n-chat .chat-message {
    padding: 12px 16px;
    border-radius: 2rem;
    margin: 8px;
    max-width: 80%;
    clear: both;
}

#n8n-chat .chat-message * {
    font-size: 16px;
    line-height: 1.5;
    font-weight: 400;
}

/* User message */
#n8n-chat .chat-message-from-user {
    background: linear-gradient(135deg, rgba(93, 95, 239, 0.9) 0%, rgba(20, 184, 166, 0.85) 100%);
    box-shadow: 0 4px 12px -4px rgba(93, 95, 239, 0.25);
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    float: right;
    border-bottom-right-radius: 0.25rem;
    margin-left: auto;
    color: white;
}

#n8n-chat .chat-message-from-user:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px -4px rgba(93, 95, 239, 0.35);
}

/* Bot message */
#n8n-chat .chat-message-from-bot {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.3) 0%, rgba(93, 95, 239, 0.18) 100%);
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.15);
    float: left;
    border-bottom-left-radius: 0.25rem;
    margin-right: auto;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#n8n-chat .chat-message-from-bot:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px -4px rgba(20, 184, 166, 0.25);
}

/* Messages container */
#n8n-chat .chat-messages-container {
    overflow-y: auto;
    padding: 10px;
}

/* Send button */
#n8n-chat .chat-input-send-button {
    margin: 0 !important;
    color: #5D5FEF;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#n8n-chat .chat-input-send-button:hover {
    transform: scale(1.1);
}

/* Toggle button */
#n8n-chat .chat-window-toggle {
    background: linear-gradient(135deg, #5D5FEF 0%, #14B8A6 100%);
    background-size: 200% 200%;
    animation: waterFlow 5s ease infinite;
    box-shadow: 0 8px 20px -6px rgba(93, 95, 239, 0.4);
    border-radius: 1rem;
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 1.25rem;
    padding: 16px;
    position: relative;
}

#n8n-chat .chat-window-toggle:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 28px -6px rgba(93, 95, 239, 0.5);
}

#n8n-chat .chat-window-toggle::after {
    content: "";
    position: absolute;
    top: -5px;
    right: -5px;
    width: 15px;
    height: 15px;
    background-color: #FF3B30;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

/* Hide "powered by" */
#n8n-chat .chat-powered-by {
    display: none;
}

/* Animations */
@keyframes waterFlow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(255, 59, 48, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    }
}

/* Clear floats */
#n8n-chat .chat-messages-container::after {
    content: "";
    display: table;
    clear: both;
}

/* --- Chat Input Area  --- */

#n8n-chat .chat-input {
    padding: 10px 12px !important;
    background: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
}

/* Layout container for textarea + button */
#n8n-chat .chat-inputs {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

/* Textarea styling */
#n8n-chat .chat-inputs textarea {
    flex: 1 !important;
    width: auto !important;
    min-height: 42px !important;
    max-height: 120px !important;
    padding: 10px 14px !important;
    border-radius: 0.75rem !important;
    border: 1px solid #d1d5db !important;
    background: #f9fafb !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    resize: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

/* Focus glow */
#n8n-chat .chat-inputs textarea:focus {
    outline: none !important;
    border-color: #5D5FEF !important;
    box-shadow: 0 0 0 3px rgba(93, 95, 239, 0.25) !important;
}

/* Wrapper for the send button */
#n8n-chat .chat-inputs-controls {
    display: flex !important;
    align-items: center !important;
}

/* Send button */
#n8n-chat .chat-input-send-button {
    width: 42px !important;
    height: 42px !important;
    border-radius: 0.75rem !important;
    background: linear-gradient(135deg, #5D5FEF 0%, #14B8A6 100%) !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: 0.25s ease !important;
    box-shadow: 0 4px 12px rgba(93, 95, 239, 0.25) !important;
}

/* Hover animation */
#n8n-chat .chat-input-send-button:hover {
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 6px 18px rgba(93, 95, 239, 0.35) !important;
}
