/* Kubio Chatbot Frontend Styles */
#kubio-chatbot-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.4;
    z-index: 10000;
}

/* Posiciones */
.kubio-chatbot-position-bottom-right {
    position: fixed;
    bottom: 20px;
    right: 20px;
}

.kubio-chatbot-position-bottom-left {
    position: fixed;
    bottom: 20px;
    left: 20px;
}

.kubio-chatbot-position-top-right {
    position: fixed;
    top: 20px;
    right: 20px;
}

.kubio-chatbot-position-top-left {
    position: fixed;
    top: 20px;
    left: 20px;
}

/* Botón flotante */
.kubio-chatbot-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 25px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    font-weight: 500;
}

.kubio-chatbot-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.kubio-chatbot-avatar-emoji {
    font-size: 1.2em;
}

.kubio-chatbot-avatar-icon {
    color: white;
}

.kubio-chatbot-avatar-image {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

/* Ventana del chat */
.kubio-chatbot-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kubio-chatbot-position-bottom-left .kubio-chatbot-window {
    right: auto;
    left: 0;
}

.kubio-chatbot-position-top-right .kubio-chatbot-window {
    bottom: auto;
    top: 70px;
}

.kubio-chatbot-position-top-left .kubio-chatbot-window {
    bottom: auto;
    top: 70px;
    right: auto;
    left: 0;
}

/* Header */
.kubio-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    color: white;
}

.kubio-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kubio-chatbot-header-text {
    display: flex;
    flex-direction: column;
}

.kubio-chatbot-header-text strong {
    font-size: 1em;
}

.kubio-chatbot-status {
    font-size: 0.8em;
    opacity: 0.9;
}

.kubio-chatbot-close {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #ff4444; /* Rojo para mejor visibilidad */
    cursor: pointer;
    padding: 10px;
    border-radius: none;
    transition: all 0.3s;
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10; /* Ocultar texto del dashicon */
}

/* Crear una X personalizada */
.kubio-chatbot-close::before {
    content: "X"; /* X Unicode */
    font-size: 10px;
    font-weight: bold;
}

/* Efecto hover */
.kubio-chatbot-close:hover {
    background: white;
    transform: scale(1.1);
}

.kubio-chatbot-close:hover {
    background: rgba(8, 84, 216, 0.2);
}

/* Área de mensajes */
.kubio-chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
}

.kubio-chatbot-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    word-wrap: break-word;
    animation: messageAppear 0.3s ease;
}

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

.kubio-chatbot-message-user {
    align-self: flex-end;
    background: #007cba;
    color: white;
    border-bottom-right-radius: 5px;
}

.kubio-chatbot-message-bot {
    align-self: flex-start;
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 5px;
}

/* Indicador de typing */
.kubio-chatbot-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
}

.kubio-chatbot-typing-indicator {
    display: flex;
    gap: 3px;
}

.kubio-chatbot-typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

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

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

.kubio-chatbot-typing-text {
    font-size: 0.9em;
    color: #666;
}

/* Input */
.kubio-chatbot-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e1e5e9;
}

.kubio-chatbot-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.kubio-chatbot-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e1e5e9;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s;
}

.kubio-chatbot-input:focus {
    border-color: #007cba;
}

.kubio-chatbot-send-button {
    background: #007cba;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.kubio-chatbot-send-button:hover {
    background: #005a87;
}

.kubio-chatbot-send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Quick Replies */
.kubio-chatbot-quick-replies {
    padding: 10px 15px;
    background: white;
    border-top: 1px solid #e1e5e9;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kubio-chatbot-quick-reply {
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 16px;
    padding: 8px 16px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.kubio-chatbot-quick-reply:hover {
    background: #e8f0fe;
    border-color: #007cba;
}

/* Responsive */
/* REEMPLAZA ESTO EN TU CSS */
@media (max-width: 480px) {
    .kubio-chatbot-window {
        width: 95vw;
        height: 70vh;
        max-height: 500px;
        bottom: 80px;
        right: 2.5vw;
        left: auto;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }
    
    /* Para otras posiciones */
    .kubio-chatbot-position-bottom-left .kubio-chatbot-window {
        right: 2.5vw;
        left: auto;
    }
    
    .kubio-chatbot-position-top-right .kubio-chatbot-window,
    .kubio-chatbot-position-top-left .kubio-chatbot-window {
        top: 80px;
        bottom: auto;
        right: 2.5vw;
        left: auto;
        width: 95vw;
        height: 70vh;
        max-height: 500px;
    }
    
    /* Asegurar que el botón de cerrar sea visible */
    .kubio-chatbot-close {
        width: 10px !important;
        height: 10px !important;
        font-size: 1.4em !important;
        background: rgba(255, 255, 255, 0.9) !important;
        border-radius: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* Estados */
.kubio-chatbot-window.kubio-chatbot-minimized {
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.kubio-chatbot-window.kubio-chatbot-maximized {
    height: 500px;
    opacity: 1;
}