﻿/* Chatbot Styles - Higher specificity */
div.chatbot-container {
    position: fixed !important;
    bottom: 90px !important; /* More spacing from bottom */
    right: 60px !important;
    width: 350px;
    max-height: 500px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 2000 !important; /* Higher z-index */
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
    overflow: hidden !important;
}

    div.chatbot-container.closed {
        max-height: 60px !important;
    }

    div.chatbot-container.open {
        max-height: 500px !important;
    }

.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    color: white;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    user-select: none;
}

    .chatbot-header:hover {
        background: linear-gradient(135deg, #4a5fc8 0%, #5a3180 100%);
    }

.chatbot-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-close-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s, background-color 0.2s;
}

    .chatbot-close-btn:hover {
        opacity: 1;
        background-color: rgba(255, 255, 255, 0.1);
    }

    .chatbot-close-btn:active {
        background-color: rgba(255, 255, 255, 0.2);
    }

.chatbot-chevron {
    opacity: 0.8;
    transition: transform 0.3s ease;
}

/* Ensure the close button doesn't interfere with header click */
.chatbot-close-btn {
    z-index: 10;
    position: relative;
}

.chatbot-title {
    font-weight: 600 !important;
    font-size: 16px !important;
    flex: 1 !important;
}

.chatbot-header .bi-chevron-down,
.chatbot-header .bi-chevron-up {
    margin-left: auto !important;
}

.chatbot-body {
    height: 440px !important;
    display: flex !important;
    flex-direction: column !important;
    background: white !important;
}

.chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 15px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

.user-message, .bot-message {
    display: flex !important;
    flex-direction: column !important;
}

.user-message {
    align-items: flex-end !important;
}

.bot-message {
    align-items: flex-start !important;
}

.message-content {
    max-width: 80% !important;
    padding: 10px 12px !important;
    border-radius: 18px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
}

.user-message .message-content {
    background: #007bff !important;
    color: white !important;
    border-bottom-right-radius: 8px !important;
}

.bot-message .message-content {
    background: #f8f9fa !important;
    color: #333 !important;
    border: 1px solid #e9ecef !important;
    border-bottom-left-radius: 8px !important;
}

/* Specific styling for welcome message */
.bot-message.welcome .message-content {
    max-width: 90% !important;
}

.message-time {
    font-size: 11px !important;
    color: #6c757d !important;
    margin-top: 4px !important;
    padding: 0 12px !important;
}

.chat-input {
    padding: 15px !important;
    border-top: 1px solid #e0e0e0 !important;
    background: #fafafa !important;
    border-radius: 0 0 10px 10px !important;
}

    .chat-input .input-group {
        border-radius: 25px !important;
        overflow: hidden !important;
    }

    .chat-input .form-control {
        border: 1px solid #ddd !important;
        border-radius: 25px 0 0 25px !important;
        border-right: none !important;
        padding: 10px 15px !important;
        font-size: 14px !important;
    }

        .chat-input .form-control:focus {
            border-color: #007bff;
            box-shadow: none;
        }

    .chat-input .btn {
        border-radius: 0 25px 25px 0 !important;
        border-left: none !important;
        padding: 10px 15px !important;
    }

.suggested-questions {
    margin-top: 15px !important;
    padding: 15px !important;
    background: #f8f9fa !important;
    border-radius: 10px !important;
    border: 1px solid #e9ecef !important;
}

.suggestions-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #495057 !important;
    margin-bottom: 10px !important;
}

.suggestion-btn {
    display: block !important;
    margin: 5px 0 !important;
    text-align: left !important;
    font-size: 13px !important;
    border-radius: 15px !important;
    border-color: #dee2e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100% !important;
}

    .suggestion-btn:hover {
        background-color: #e9ecef;
        border-color: #adb5bd;
    }

.follow-ups {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.followup-btn {
    display: block;
    text-align: left;
    font-size: 12px;
    color: #007bff !important;
    text-decoration: none;
    margin: 2px 0;
}

    .followup-btn:hover {
        text-decoration: underline !important;
    }

.typing-indicator {
    display: flex !important;
    gap: 4px !important;
    padding: 8px 0 !important;
}

    .typing-indicator span {
        height: 8px !important;
        width: 8px !important;
        background-color: #999 !important;
        border-radius: 50% !important;
        animation: typing 1.4s infinite ease-in-out !important;
    }

        .typing-indicator span:nth-child(1) {
            animation-delay: -0.32s !important;
        }

        .typing-indicator span:nth-child(2) {
            animation-delay: -0.16s !important;
        }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .chatbot-container {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        max-height: 70vh;
    }

    .chatbot-body {
        height: calc(70vh - 60px);
    }
}

/* Badge styles */
.badge {
    position: absolute !important;
    top: -5px !important;
    right: -5px !important;
    font-size: 10px !important;
    padding: 4px 6px !important;
}

/* Optional: Add a slight animation when the menu item appears */
.dxbl-treeview-item {
    transition: opacity 0.3s ease;
}
.chatbot-container.mobile-icon-only {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    right: 20px !important;
    bottom: 20px !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
}

    .chatbot-container.mobile-icon-only .chatbot-header {
        justify-content: center !important;
        padding: 18px !important;
        border-radius: 50% !important;
        width: 60px !important;
        height: 60px !important;
        position: relative !important;
    }

        .chatbot-container.mobile-icon-only .chatbot-header .bi-robot {
            font-size: 24px !important;
        }

    .chatbot-container.mobile-icon-only .chatbot-body {
        display: none !important;
    }

/* Expanded state on mobile */
.chatbot-container.mobile-expanded {
    width: calc(100vw - 40px) !important;
    height: 70vh !important;
    max-height: 500px !important;
    border-radius: 10px !important;
    bottom: 20px !important;
    right: 20px !important;
    left: 20px !important;
}

    .chatbot-container.mobile-expanded .chatbot-header {
        padding: 12px 16px !important;
        border-radius: 8px 8px 0 0 !important;
        width: 100% !important;
        height: auto !important;
        justify-content: space-between !important;
    }

    .chatbot-container.mobile-expanded .chatbot-body {
        display: flex !important;
        height: calc(100% - 60px) !important;
    }

/* Mobile tooltip */
.mobile-tooltip {
    position: absolute;
    bottom: 70px;
    right: -20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 2001;
    pointer-events: none;
}

.chatbot-container.mobile-icon-only:hover .mobile-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Tooltip arrow */
.mobile-tooltip::after {
    content: "";
    position: absolute;
    bottom: -6px;
    right: 35px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.8);
}

/* Badge positioning for mobile icon */
.chatbot-container.mobile-icon-only .badge {
    position: absolute !important;
    top: -5px !important;
    right: -5px !important;
    font-size: 10px !important;
    padding: 4px 6px !important;
}