/* N8N Live Chat Widget Styles */

.n8nlivebot-widget {
    position: fixed;
    z-index: 999999;
}

.n8nlivebot-widget[data-position="bottom-right"] {
    bottom: 20px;
    right: 20px;
}

.n8nlivebot-widget[data-position="bottom-left"] {
    bottom: 20px;
    left: 20px;
}

.n8nlivebot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--n8n-primary) 0%, var(--n8n-secondary) 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.n8nlivebot-button:hover {
    transform: scale(1.1);
}

.n8nlivebot-button:active {
    transform: scale(0.95);
}

.n8nlivebot-window {
    position: fixed;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.n8nlivebot-widget[data-position="bottom-right"] .n8nlivebot-window {
    bottom: 100px;
    right: 20px;
}

.n8nlivebot-widget[data-position="bottom-left"] .n8nlivebot-window {
    bottom: 100px;
    left: 20px;
}

.n8nlivebot-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.n8nlivebot-header {
    background: linear-gradient(135deg, var(--n8n-primary) 0%, var(--n8n-secondary) 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.n8nlivebot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.n8nlivebot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.n8nlivebot-profile h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.n8nlivebot-profile small {
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.n8nlivebot-status {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.n8nlivebot-close {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.n8nlivebot-close:hover {
    opacity: 1;
}

/* Body */
.n8nlivebot-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.n8nlivebot-body::-webkit-scrollbar {
    width: 6px;
}

.n8nlivebot-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.n8nlivebot-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.n8nlivebot-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Messages */
.n8nlivebot-message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.n8nlivebot-message.n8nlivebot-user {
    flex-direction: row-reverse;
}

.n8nlivebot-message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.n8nlivebot-agent .n8nlivebot-message-avatar {
    background: linear-gradient(135deg, var(--n8n-primary) 0%, var(--n8n-secondary) 100%);
    color: white;
}

.n8nlivebot-user .n8nlivebot-message-avatar {
    background: #e5e7eb;
    color: #6b7280;
}

.n8nlivebot-message-content {
    max-width: 70%;
}

.n8nlivebot-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.n8nlivebot-agent .n8nlivebot-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.n8nlivebot-user .n8nlivebot-bubble {
    background: linear-gradient(135deg, var(--n8n-primary) 0%, var(--n8n-secondary) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.n8nlivebot-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 4px;
}

/* Typing Indicator */
.n8nlivebot-typing {
    display: none;
    padding: 10px;
}

.n8nlivebot-typing.active {
    display: block;
}

.n8nlivebot-typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.n8nlivebot-typing-dots span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.n8nlivebot-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.n8nlivebot-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Footer */
.n8nlivebot-footer {
    padding: 5px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.n8nlivebot-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.n8nlivebot-input {
    flex: 1;
    height: 80px;
    padding: 12px 15;
    border: 1px solid #e5e7eb;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.n8nlivebot-input:focus {
    border-color: var(--n8n-primary);
}

.n8nlivebot-send {
    width: 20px !important;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--n8n-primary) 0%, var(--n8n-secondary) 100%);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.n8nlivebot-send:hover {
    transform: scale(1.1);
}

.n8nlivebot-send:active {
    transform: scale(0.95);
}

.n8nlivebot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error Message */
.n8nlivebot-error {
    background: #fee;
    color: #c00;
    padding: 10px 15px;
    border-radius: 8px;
    margin: 10px;
    font-size: 13px;
    display: none;
}

.n8nlivebot-error.active {
    display: block;
}

/* Quick Replies */
.n8nlivebot-quick-replies {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.n8nlivebot-quick-reply {
    padding: 8px 15px;
    background: white;
    border: 1px solid var(--n8n-primary);
    color: var(--n8n-primary);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.n8nlivebot-quick-reply:hover {
    background: linear-gradient(135deg, var(--n8n-primary) 0%, var(--n8n-secondary) 100%);
    color: white;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .n8nlivebot-window {
        width: calc(100vw - 40px) !important;
        height: calc(100vh - 140px) !important;
        max-width: 100%;
        max-height: 100%;
    }
    
    .n8nlivebot-widget[data-position="bottom-right"] .n8nlivebot-window,
    .n8nlivebot-widget[data-position="bottom-left"] .n8nlivebot-window {
        left: 20px;
        right: 20px;
    }
    
    .n8nlivebot-button {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
}

@media screen and (max-width: 480px) {
    .n8nlivebot-widget[data-position="bottom-right"],
    .n8nlivebot-widget[data-position="bottom-left"] {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    
    .n8nlivebot-window {
        width: calc(100vw - 20px) !important;
        height: calc(100vh - 100px) !important;
    }
    
    .n8nlivebot-widget[data-position="bottom-right"] .n8nlivebot-window,
    .n8nlivebot-widget[data-position="bottom-left"] .n8nlivebot-window {
        left: 10px;
        right: 10px;
        bottom: 80px;
    }
    
    .n8nlivebot-header {
        padding: 15px;
    }
    
    .n8nlivebot-body {
        padding: 15px;
    }
    
    .n8nlivebot-footer {
        padding: 12px;
    }
}