/* Simple n8n Chat Widget Styling */

/* Fix chat button color to light navy blue */
:root {
    --chat--toggle--background: #0B1F3A !important;
    --chat--toggle--hover--background: #1E3A8A !important;
    --chat--toggle--active--background: #0B1F3A !important;
}

/* User message text color fix */
.n8n-chat__message--user .n8n-chat__message-text,
.n8n-chat__message--user .n8n-chat__message-text * {
    color: #000000 !important;
    background-color: #F3F4F6 !important;
}

/* Bot message styling */
.n8n-chat__message--bot .n8n-chat__message-text {
    color: #1F2937 !important;
    background-color: #FFFFFF !important;
    border: 1px solid #E5E7EB !important;
}

/* Hide empty messages */
.n8n-chat__message:empty,
.n8n-chat__message-text:empty {
    display: none !important;
}

/* Fix chat button background color directly */
.chat-window-wrapper .chat-window-toggle {
    background-color: #0B1F3A !important;
}

.chat-window-wrapper .chat-window-toggle:hover {
    background-color: #1E3A8A !important;
}

/* Safe mobile chat positioning fixes */
@media (max-width: 768px) {
    /* Hide chat initially to prevent flash in wrong position */
    .chat-window-wrapper {
        opacity: 0 !important;
        transition: opacity 0.3s ease !important;
    }
    
    /* Show and position chat properly */
    .chat-window-wrapper.positioned {
        opacity: 1 !important;
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        left: auto !important;
        top: auto !important;
        z-index: 999 !important;
        width: auto !important;
        height: auto !important;
    }
    
    /* Keep the button normal size */
    .chat-window-wrapper .chat-window-toggle {
        position: relative !important;
        width: 56px !important;
        height: 56px !important;
        border-radius: 50% !important;
    }
    
    /* Fix chat window positioning when opened */
    .chat-window-wrapper .chat-window {
        position: fixed !important;
        bottom: 80px !important;
        right: 20px !important;
        width: calc(100vw - 40px) !important;
        max-width: 400px !important;
        left: auto !important;
        top: auto !important;
    }
    
    /* Ensure send button is visible and properly positioned in mobile */
    .chat-input-send-button,
    .chat-window .chat-input button,
    .chat-window [type="submit"],
    .chat-window button[aria-label*="send" i],
    .chat-window button[title*="send" i],
    .chat-window .send-button {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
        right: 8px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 10 !important;
        min-width: 32px !important;
        height: 32px !important;
        border-radius: 16px !important;
    }
}

/* Desktop - ensure send button works normally */
@media (min-width: 769px) {
    .chat-input-send-button,
    .chat-window .chat-input button,
    .chat-window [type="submit"],
    .chat-window button[aria-label*="send" i],
    .chat-window button[title*="send" i],
    .chat-window .send-button {
        position: static !important;
        transform: none !important;
        display: inline-flex !important;
    }
}