/* --- CONTAINER AND LAYOUT --- */
.ai-chatbot-container {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    box-sizing: border-box;
}

/* --- HEADER BAR (Timer + Clear Button) --- */
.ai-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ai-bot-timer {
    font-weight: bold;
    color: #444;
}

.ai-bot-timer.warning {
    color: #dc3545;
}

.ai-clear-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.ai-clear-btn:hover {
    background: #c82333;
}

/* --- CHAT BOX WINDOW --- */
.ai-chatbox {
    border: 1px solid #ccc;
    height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: #fff;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
    scroll-behavior: smooth;
}

/* --- MESSAGE BUBBLES --- */
.message {
    padding: 12px 16px;
    margin: 10px 0;
    border-radius: 12px;
    max-width: 80%;
    line-height: 1.6;
    font-size: 14.5px;
    white-space: pre-wrap; /* Preserves spacing/tabs */
    word-wrap: break-word;
    position: relative;
}

.user-message {
    background: #0078ff;
    color: #fff;
    align-self: flex-end;
    float: right;
    clear: both;
    border-bottom-right-radius: 2px;
}

.bot-message {
    background: #f1f0f0;
    color: #333;
    align-self: flex-start;
    float: left;
    clear: both;
    border-bottom-left-radius: 2px;
}

/* Inline Markdown Styling */
.bot-message strong {
    color: #000;
}

.bot-message code {
    background: #e1e1e1;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

/* --- CONTROLS AND INPUT --- */
.ai-controls-wrapper {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.ai-user-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-user-input:focus {
    border-color: #0078ff;
}

.ai-send-btn, 
.ai-upload-btn, 
.ai-export-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: opacity 0.2s, transform 0.1s;
}

.ai-send-btn { background: #0078ff; }
.ai-upload-btn { background: #6c757d; }
.ai-export-btn { background: #28a745; }

.ai-send-btn:hover, 
.ai-upload-btn:hover, 
.ai-export-btn:hover {
    opacity: 0.9;
}

.ai-send-btn:active {
    transform: scale(0.98);
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .ai-chatbot-container {
        margin: 10px auto;
        padding: 0 10px;
    }
    
    .ai-chatbox {
        height: 400px;
    }

    .message {
        max-width: 92%;
    }

    .ai-controls-wrapper {
        flex-wrap: wrap;
    }

    .ai-user-input {
        width: 100%;
        margin-bottom: 5px;
    }

    .ai-send-btn, 
    .ai-upload-btn, 
    .ai-export-btn {
        flex: 1;
        text-align: center;
        margin-bottom: 5px;
        min-width: 100px;
    }
}