/* ======================================================= */
/* CHATBOT STYLES: Designed to be non-interfering and encapsulated */
/* ======================================================= */

/* 1. Base Container and Toggle Button (The Floating Icon) */
.chatbot-container {
    /* Base container for scoping, no styles applied here */
}

.chatbot-container .chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #3f51b5; /* NATAAC Blue */
    color: white;
    border-radius: 50%;
    text-align: center;
    /* Centers the icon vertically and horizontally */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px; 
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10000; /* High z-index to ensure it sits above everything */
    user-select: none;
}
/* Ensure the Font Awesome icon inside is the right size */
.chatbot-container .chat-toggle i {
    line-height: 1; /* Reset any inherited line-height */
}


/* 2. Main Chat Window */
.chatbot-container .chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    display: none; /* Starts closed */
    flex-direction: column;
    z-index: 10000;
    font-family: Arial, sans-serif; /* Specify a common font for isolation */
}

.chatbot-container .chat-window.open {
    display: flex;
}

/* 3. Header and Close Button */
.chatbot-container .chat-header {
    background-color: #3f51b5;
    color: white;
    padding: 15px;
    font-size: 1.1em;
    font-weight: bold;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-container .close-btn {
    cursor: pointer;
    font-size: 1.5em;
    line-height: 1;
    user-select: none;
}

/* 4. Chat Body (Scrollable Messages Area) */
.chatbot-container .chat-body {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

/* 5. Message Styles */
.chatbot-container .message {
    padding: 8px 12px;
    border-radius: 15px;
    margin-bottom: 10px;
    max-width: 80%;
    line-height: 1.4;
    word-wrap: break-word; 
    clear: both;
}

.chatbot-container .bot-message {
    background-color: #e0e0e0;
    float: left;
    text-align: left;
}

.chatbot-container .user-message {
    background-color: #4CAF50; 
    color: white;
    float: right;
    margin-left: auto;
    text-align: right;
}

/* 6. Input and Send Button */
.chatbot-container .chat-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid #eee;
}

.chatbot-container #userInput {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; 
    font-size: 1em;
    font-family: inherit; /* Ensure input font matches chat window font */
}

.chatbot-container #sendBtn {
    background-color: #3f51b5;
    color: white;
    border: none;
    padding: 8px 15px;
    margin-left: 10px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

/* 7. Training Panel Toggles and Modal */
.chatbot-container .admin-feature {
    width: 100%;
    padding: 8px;
    background: none;
    border: none;
    border-top: 1px solid #eee;
    color: #3f51b5;
    cursor: pointer;
    font-size: 0.9em;
    font-family: inherit;
}

.training-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    padding: 20px;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    z-index: 10001; 
    display: none; 
    font-family: Arial, sans-serif;
}

.training-panel h3 {
    /* Style H3 only within the training panel */
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.training-panel textarea {
    width: 100%;
    height: 150px;
    margin: 10px 0;
    padding: 10px;
    resize: vertical;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
}

.training-panel button {
    /* Style buttons only within the training panel */
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    font-family: inherit;
}

.training-panel #submitTraining {
    background-color: #4CAF50;
    color: white;
}

.training-panel #closeTraining {
    background-color: #f44336;
    color: white;
}