/* n8n Chat Widget Styles */

#n8n-chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Posiciones */
.n8n-chat-bottom-right {
    bottom: 20px;
    right: 20px;
}

.n8n-chat-bottom-left {
    bottom: 20px;
    left: 20px;
}

.n8n-chat-top-right {
    top: 20px;
    right: 20px;
}

.n8n-chat-top-left {
    top: 20px;
    left: 20px;
}

/* Botón de toggle */
#n8n-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6d5a 0%, #ff5722 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

#n8n-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.n8n-chat-icon {
    font-size: 24px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Container del chat */
#n8n-chat-container {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

/* Header */
#n8n-chat-header {
    background: linear-gradient(135deg, #0f4674 0%, #07b9fd 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#n8n-chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
	color:white;
}

#n8n-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#n8n-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mensajes */
#n8n-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.n8n-message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.n8n-message.user {
    justify-content: flex-end;
}

.n8n-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.n8n-message.user .n8n-message-content {
    background: linear-gradient(135deg, #ff6d5a 0%, #ff5722 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.n8n-message.bot .n8n-message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 4px;
}

.n8n-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

.n8n-message.bot .n8n-message-time {
    text-align: left;
}

/* Indicador de escritura */
#n8n-chat-typing {
    padding: 10px 20px;
    background: #f8f9fa;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input */
#n8n-chat-input {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e1e5e9;
    display: flex;
    gap: 10px;
    align-items: center;
}

#n8n-message-input {
    flex: 1;
    border: 1px solid #e1e5e9;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#n8n-message-input:focus {
    border-color: #ebebeb;
}

#n8n-send-button {
    background: linear-gradient(135deg, #ff6d5a 0%, #ff5722 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

#n8n-send-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 109, 90, 0.3);
}

#n8n-send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Tema Oscuro */
.n8n-theme-dark #n8n-chat-container {
    background: #2d3748;
    color: white;
}

.n8n-theme-dark #n8n-chat-messages {
    background: #1a202c;
}

.n8n-theme-dark .n8n-message.bot .n8n-message-content {
    background: #4a5568;
    color: white;
    border-color: #2d3748;
}

.n8n-theme-dark #n8n-chat-input {
    background: #2d3748;
    border-color: #4a5568;
}

.n8n-theme-dark #n8n-message-input {
    background: #4a5568;
    color: white;
    border-color: #2d3748;
}

.n8n-theme-dark #n8n-message-input::placeholder {
    color: #a0aec0;
}

/* Tema Minimalista */
.n8n-theme-minimal #n8n-chat-toggle {
    background: #000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.n8n-theme-minimal #n8n-chat-header {
    background: #000;
}

.n8n-theme-minimal .n8n-message.user .n8n-message-content {
    background: #000;
}

.n8n-theme-minimal #n8n-send-button {
    background: #000;
}

.n8n-theme-minimal #n8n-send-button:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 480px) {
    #n8n-chat-container {
        width: 300px;
        height: 400px;
    }
    
    .n8n-chat-bottom-right,
    .n8n-chat-bottom-left {
        bottom: 10px;
    }
    
    .n8n-chat-bottom-right {
        right: 10px;
    }
    
    .n8n-chat-bottom-left {
        left: 10px;
    }
}

@media (max-width: 360px) {
    #n8n-chat-container {
        width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px !important;
    }
    
    .n8n-chat-bottom-right #n8n-chat-container,
    .n8n-chat-bottom-left #n8n-chat-container {
        right: 0;
        left: 0;
    }
}

/* Scrollbar personalizado */
#n8n-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#n8n-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#n8n-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#n8n-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animaciones adicionales */
.n8n-message {
    animation: messageSlide 0.3s ease;
}

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

/* Estados de carga */
.n8n-loading {
    opacity: 0.7;
    pointer-events: none;
}

.n8n-error {
    color: #e53e3e;
    font-style: italic;
}

/* Notificaciones */
.n8n-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #48bb78;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.n8n-notification.error {
    background: #e53e3e;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}