/* Leanx AI Chatbot Stylesheet - Premium Edition */
:root {
    --lx-primary: #1d4ed8;
    --lx-primary-hover: #1e40af;
    --lx-primary-dark: #0f172a;
    --lx-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #1d4ed8 100%);
    --lx-accent: #f59e0b;
    --lx-accent-hover: #d97706;
    --lx-bg-user: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    --lx-bg-bot: #ffffff;
    --lx-border: #e2e8f0;
    --lx-border-dark: rgba(255, 255, 255, 0.15);
    --lx-text: #0f172a;
    --lx-text-muted: #64748b;
    --lx-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(15, 23, 42, 0.08);
}

/* Chatbot Root Container */
#leanx-chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--lx-text);
}

/* Launcher Button */
.lx-launcher-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--lx-gradient);
    box-shadow: 0 10px 25px rgba(29, 78, 216, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.25);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #ffffff;
}

.lx-launcher-btn:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 14px 30px rgba(29, 78, 216, 0.55), 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.lx-launcher-btn svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

.lx-launcher-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
    animation: lx-pulse 2s infinite;
}

/* Proactive Welcome Tooltip */
.lx-welcome-tooltip {
    position: absolute;
    bottom: 78px;
    right: 0;
    background: #ffffff;
    color: var(--lx-primary-dark);
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    width: 260px;
    font-size: 13px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: lx-slide-up 0.4s ease-out;
}

.lx-welcome-tooltip:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.lx-welcome-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 26px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.04);
}

.lx-welcome-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--lx-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Chat Window Modal */
.lx-chat-window {
    position: absolute;
    bottom: 82px;
    right: 0;
    width: 400px;
    height: 620px;
    max-height: calc(100vh - 120px);
    background: #f8fafc;
    border-radius: 24px;
    box-shadow: var(--lx-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transform-origin: bottom right;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.lx-chat-window.lx-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Header */
.lx-chat-header {
    background: var(--lx-gradient);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.lx-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lx-header-avatar {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.lx-header-status {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border: 2px solid #0f172a;
    border-radius: 50%;
}

.lx-header-title {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.lx-header-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.lx-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lx-action-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.lx-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Category Quick-Nav Bar */
.lx-category-nav {
    background: #0f172a;
    padding: 8px 12px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    scrollbar-width: none;
    flex-shrink: 0;
}

.lx-category-nav::-webkit-scrollbar {
    display: none;
}

.lx-cat-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lx-cat-item:hover, .lx-cat-item.active {
    background: var(--lx-primary);
    border-color: #60a5fa;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Messages Area */
.lx-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.lx-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.lx-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Message Bubble Styles */
.lx-msg-row {
    display: flex;
    gap: 8px;
    max-width: 90%;
    animation: lx-msg-in 0.25s ease-out forwards;
}

.lx-msg-row.lx-bot {
    align-self: flex-start;
}

.lx-msg-row.lx-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.lx-bot-avatar {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: var(--lx-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.lx-msg-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lx-msg-bubble {
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}

.lx-bot .lx-msg-bubble {
    background: var(--lx-bg-bot);
    color: var(--lx-text);
    border-radius: 18px 18px 18px 4px;
    border: 1px solid var(--lx-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.lx-user .lx-msg-bubble {
    background: var(--lx-bg-user);
    color: #ffffff;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.25);
}

/* Message Meta & Action Bar */
.lx-msg-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    font-size: 10px;
    color: var(--lx-text-muted);
}

.lx-msg-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.lx-msg-actions:hover {
    opacity: 1;
}

.lx-icon-action {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: var(--lx-text-muted);
    transition: all 0.2s;
    border-radius: 4px;
}

.lx-icon-action:hover {
    color: var(--lx-primary);
    background: #e2e8f0;
}

/* Quick Action Chips */
.lx-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.lx-chip {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--lx-primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.lx-chip:hover {
    background: #eff6ff;
    border-color: var(--lx-primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(29, 78, 216, 0.15);
}

/* Rich Cards (VAs, Jobs, Courses, Products) */
.lx-rich-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px;
    margin-top: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s;
}

.lx-rich-card:hover {
    transform: translateY(-1px);
    border-color: #93c5fd;
}

.lx-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lx-card-img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    object-fit: cover;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.lx-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--lx-text);
    margin: 0;
}

.lx-card-subtitle {
    font-size: 11px;
    color: var(--lx-text-muted);
}

.lx-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.lx-card-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
}

.lx-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    padding: 8px;
    background: #eff6ff;
    color: var(--lx-primary);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid #bfdbfe;
    box-sizing: border-box;
}

.lx-card-btn:hover {
    background: var(--lx-primary);
    color: #ffffff;
}

/* VA Cost Calculator Card */
.lx-calculator-card {
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    padding: 14px;
    margin-top: 8px;
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.08);
}

.lx-calc-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--lx-primary-dark);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lx-calc-select {
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    margin-bottom: 10px;
    outline: none;
}

.lx-calc-hours-group {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.lx-hour-btn {
    flex: 1;
    padding: 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.lx-hour-btn.active {
    background: var(--lx-primary);
    color: #ffffff;
    border-color: var(--lx-primary);
}

.lx-calc-submit-btn {
    width: 100%;
    padding: 9px;
    background: var(--lx-gradient);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.lx-calc-submit-btn:hover {
    opacity: 0.95;
}

/* In-Chat Lead Form */
.lx-lead-form {
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    padding: 14px;
    margin-top: 8px;
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.08);
}

.lx-form-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--lx-primary-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lx-form-group {
    margin-bottom: 8px;
}

.lx-form-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
    background: #f8fafc;
}

.lx-form-input:focus {
    border-color: var(--lx-primary);
    background: #ffffff;
}

.lx-form-submit {
    width: 100%;
    padding: 9px;
    background: var(--lx-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.lx-form-submit:hover {
    background: var(--lx-primary-hover);
}

/* Typing Indicator Animation */
.lx-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: var(--lx-bg-bot);
    border: 1px solid var(--lx-border);
    border-radius: 18px 18px 18px 4px;
    width: fit-content;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.lx-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: lx-typing 1.4s infinite ease-in-out both;
}

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

/* Input Footer */
.lx-chat-footer {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid var(--lx-border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.lx-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.lx-chat-input {
    width: 100%;
    padding: 10px 38px 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    background: #f8fafc;
    box-sizing: border-box;
}

.lx-chat-input:focus {
    border-color: var(--lx-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.lx-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--lx-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.lx-send-btn:hover {
    background: var(--lx-primary-hover);
    transform: scale(1.05);
}

.lx-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* Animations */
@keyframes lx-pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes lx-slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes lx-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes lx-typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Mobile Responsive - Fixes Ref 2.6 (No obstruction of navigation/content) */
@media (max-width: 768px) {
    /* Never cover navigation menus, buttons, or page content with auto-popup tooltip */
    .lx-welcome-tooltip {
        display: none !important;
    }
    
    /* Neatly position launcher button above mobile bottom bar */
    #leanx-chatbot-widget {
        bottom: 74px !important;
        right: 14px !important;
    }

    body:has(.app-bottombar) #leanx-chatbot-widget,
    body:has(#mobile-bottom-nav) #leanx-chatbot-widget,
    .app-bottombar ~ #leanx-chatbot-widget,
    #mobile-bottom-nav ~ #leanx-chatbot-widget {
        bottom: 74px !important;
    }
    
    .lx-chat-window {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
}
