/**
 * RapidSkill Chatbot UI
 * 
 * WooChatbot chat window styling for improved UX.
 * 
 * @version 1.0.0
 */

/* ==========================================================================
   Chat Window Container - Clean & Seamless
   ========================================================================== */
#woo-chatbot-ball-container {
    border-radius: 20px !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08) !important;
    overflow: hidden !important;
    border: none !important;
    background: #ffffff !important;
    /* DO NOT force display - let plugin control visibility */
    /* Ensure the container doesn't block the close button below */
    margin-bottom: 20px !important;
    pointer-events: auto !important;
}

/* Only apply flex layout when container is visible (plugin adds inline style or class) */
#woo-chatbot-ball-container[style*="display: block"],
#woo-chatbot-ball-container[style*="display: flex"],
#woo-chatbot-ball-container.woo-chatbot-ball-container-visible {
    display: flex !important;
    flex-direction: column !important;
}

/* ==========================================================================
   Chat Header
   ========================================================================== */
.woo-chatbot-admin {
    background: linear-gradient(135deg, #0066ff 0%, #0052cc 100%) !important;
    padding: 16px 20px !important;
    border-radius: 16px 16px 0 0 !important;
}

.woo-chatbot-admin * {
    color: #ffffff !important;
}

/* ==========================================================================
   Messages Area - Maximized Space
   ========================================================================== */
.woo-chatbot-messages-wrapper {
    background: #f8fafc !important;
    /* Soft distinct background for chat area */
    padding: 20px !important;
    flex: 1 !important;
    /* Take up all available space */
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

#woo-chatbot-messages-container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

/* Message Bubbles - Refined spacing */
.woo-chatbot-messages-container li,
#woo-chatbot-messages-container li {
    margin-bottom: 16px !important;
    padding: 12px 18px !important;
    border-radius: 12px !important;
    max-width: 80% !important;
    line-height: 1.5 !important;
    font-size: 14px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* User messages (right) */
.woo-chatbot-messages-container li.woo-chatbot-user-msg,
#woo-chatbot-messages-container li.woo-chatbot-user-msg {
    background: #ffffff !important;
    color: #1a1a2e !important;
    border: 1px solid #e2e8f0 !important;
    border-bottom-right-radius: 4px !important;
    margin-left: auto !important;
}

/* ==========================================================================
   Input Area - Professional Edge-to-Edge
   ========================================================================== */
.woo-chatbot-editor-container {
    background: #ffffff !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
    padding: 16px 20px !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    position: relative !important;
    border-radius: 0 !important;
    /* Flush with bottom */
}

/* Input Field - Pill Shape */
#woo-chatbot-editor {
    width: 100% !important;
    background: #f1f5f9 !important;
    border: 1px solid transparent !important;
    border-radius: 24px !important;
    padding: 12px 48px 12px 20px !important;
    /* Right padding for button */
    font-size: 14px !important;
    color: #334155 !important;
    outline: none !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    height: 48px !important;
    /* Fixed comfortable height */
}

#woo-chatbot-editor:focus {
    background: #ffffff !important;
    border-color: #0066ff !important;
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.05) !important;
}

#woo-chatbot-editor::placeholder {
    color: #94a3b8 !important;
}

/* Send Button - Integrated */
#woo-chatbot-send-message {
    position: absolute !important;
    right: 32px !important;
    /* 20px container pad + 12px inside input */
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 32px !important;
    height: 32px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    transition: transform 0.2s ease !important;
    z-index: 10 !important;
}

#woo-chatbot-send-message:hover {
    transform: translateY(-50%) scale(1.1) !important;
}

#woo-chatbot-send-message svg,
#woo-chatbot-send-message img {
    width: 20px !important;
    height: 20px !important;
    filter: none !important;
}

#woo-chatbot-send-message path {
    fill: #0066ff !important;
}

/* ==========================================================================
   Close Button (Toggle) - Clean White Circle
   ========================================================================== */
#woo-chatbot-ball,
.woo-chatbot-ball {
    width: 48px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
    border-radius: 50% !important;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    z-index: 2147483647 !important;
    /* Max Z-Index to be above everything */
    cursor: pointer !important;
    pointer-events: auto !important;
}

#woo-chatbot-ball:hover {
    transform: scale(1.1) rotate(90deg) !important;
    /* Nice interaction */
}

#woo-chatbot-ball img {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

/* Hide robot icon when chat open, show X */
.woo-chatbot-ball-container-visible+#woo-chatbot-icon-container #woo-chatbot-ball {
    background: #ffffff !important;
}

/* ==========================================================================
   Mobile Optimizations
   ========================================================================== */
@media (max-width: 768px) {
    #woo-chatbot-ball-container {
        width: calc(100vw - 32px) !important;
        max-width: 380px !important;
        right: 16px !important;
        bottom: 80px !important;
        border-radius: 20px !important;
    }

    .woo-chatbot-messages-wrapper {
        padding: 16px !important;
    }

    .woo-chatbot-editor-container {
        padding: 12px 16px !important;
    }

    #woo-chatbot-send-message {
        right: 28px !important;
    }
}