/* Global Assistant Button */
.global-assistant-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #579f0d, #4a8a0b);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(87, 159, 13, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1050;
    font-size: 14px;
    max-width: 200px;
}

    .global-assistant-button:hover {
        background: linear-gradient(135deg, #4a8a0b, #3d7209);
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(87, 159, 13, 0.4);
    }

.assistant-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.assistant-robot-icon {
    position: absolute;
    font-size: 20px;
    color: #579f0d;
}

.assistant-text {
    white-space: nowrap;
}

/* Global Assistant Panel */
.global-assistant-panel {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 600px;
    height: 400px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 1051;
    overflow: hidden;
    border: 1px solid #e9ecef;
    resize: none;
    cursor: default;
    user-select: text !important; /* Ensure text can be selected in the panel */
}

.assistant-header {
    background: linear-gradient(135deg, #579f0d, #4a8a0b);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Remove cursor: move since we handle it dynamically */
}

.assistant-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assistant-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.assistant-header-actions {
    display: flex;
    align-items: center;
}

.assistant-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8f9fa;
    user-select: text !important; /* Ensure text can be selected in the container */
}

.assistant-message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 16px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin-bottom: 10px;
    user-select: text !important;
}

    .assistant-message.user {
        background: #579f0d;
        color: white;
        align-self: flex-end;
        margin-left: auto;
        font-size: 16px;
    }

    .assistant-message.ai {
        background: white;
        color: #333;
        align-self: flex-start;
        border: 1px solid #e9ecef;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
        font-size: 16px; /* Adjust the font size to 12px for standard text */
    }

        .assistant-message.ai h5,
        .assistant-message.ai h6 {
            color: #2c3e50 !important;
            margin-bottom: 10px;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            font-size: 18px !important; /* Adjust the font size to 14px for headings */
        }

        .assistant-message.ai h5 {
            font-weight: bold;
        }

        .assistant-message.ai h6 {
            font-weight: bold;
        }

        .assistant-message.ai strong {
            color: #2c3e50;
            font-weight: bold;
        }

        .assistant-message.ai a {
            color: #579f0d;
            text-decoration: none;
        }

            .assistant-message.ai a:hover {
                text-decoration: underline;
            }

        .assistant-message.ai p {
            margin-bottom: 10px;
        }

        .assistant-message.ai ul,
        .assistant-message.ai ol {
            padding-left: 20px;
            margin-bottom: 10px;
        }

        .assistant-message.ai li {
            margin-bottom: 5px;
        }

        .assistant-message.ai code {
            background-color: #f8f9fa;
            padding: 2px 4px;
            border-radius: 3px;
            font-family: monospace;
        }

        .assistant-message.ai pre {
            background-color: #f8f9fa;
            padding: 10px;
            border-radius: 5px;
            overflow-x: auto;
        }

.smaller-header {
    font-size: 13px !important;
    color: #6c757d !important;
    font-weight: bold;
    margin-bottom: 8px !important;
}

.smallest-header {
    font-size: 12px !important; /* Adjust the font size to 12px for smallest headers */
    color: #6c757d !important;
    font-weight: bold;
    margin-bottom: 8px !important;
}

.assistant-input-area {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
    /* Re-enable text selection in input area */
    user-select: auto;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: end;
}

#global-chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 12px 16px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

    #global-chat-input:focus {
        border-color: #579f0d;
    }

#global-send-btn {
    background: #579f0d;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

    #global-send-btn:hover {
        background: #4a8a0b;
        transform: scale(1.05);
    }

    #global-send-btn:disabled {
        background: #ccc;
        cursor: not-allowed;
        transform: none;
    }

.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-action-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
    /* Re-enable text selection for buttons */
    user-select: auto;
}

    .quick-action-btn:hover {
        background: #e9ecef;
        color: #495057;
    }

/* Overlay */
.global-assistant-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1049;
    display: none;
}

/* Remove all visible resize handles - we'll handle resizing invisibly */
.resize-handle {
    display: none;
}

.resize-handle-top,
.resize-handle-right,
.resize-handle-bottom,
.resize-handle-left,
.resize-handle-top-left,
.resize-handle-top-right,
.resize-handle-bottom-left,
.resize-handle-bottom-right {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .global-assistant-panel {
        width: 90%;
        height: 80%;
    }

    .global-assistant-button {
        right: 20px;
        bottom: 20px;
        padding: 10px 16px;
    }

    .assistant-text {
        display: none;
    }
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

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

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

    .typing-dot: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;
    }
}
