/*
MAINUL-X Chatbot Styles
Author: Md. Mainul Islam
GitHub: https://github.com/M41NUL
*/

/* Main Container */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: var(--card-bg);
    border-radius: 18px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    border: 1px solid var(--border);
}

.chatbot-container.open { display: flex; }

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

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

.header-left i { font-size: 16px; }
.header-left h3 { font-size: 13px; margin: 0; }

.bot-status {
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.bot-status i {
    font-size: 8px;
    color: #10b981;
}

.header-right button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: var(--darker);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Message Container - FIXED POSITIONING */
.message {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    max-width: 100%;
}

/* Bot Message - Icon বামে */
.message.bot {
    justify-content: flex-start;
}

/* User Message - Icon ডানে */
.message.user {
    justify-content: flex-end;
}

/* Avatar - Fixed Size */
.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

/* Bot Avatar - বামে */
.bot .message-avatar {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    margin-right: 6px;
    margin-left: 0;
}

/* User Avatar - ডানে */
.user .message-avatar {
    background: var(--card-bg);
    border: 1px solid var(--primary);
    color: var(--light);
    margin-left: 6px;
    margin-right: 0;
}

/* Message Wrapper */
.message-wrapper {
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.message.user .message-wrapper { 
    align-items: flex-end; 
}

.message.bot .message-wrapper { 
    align-items: flex-start; 
}

/* Message Bubble */
.message-content {
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 12px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Bot Bubble - বামে */
.bot .message-content {
    background: var(--card-bg);
    color: var(--light);
    border-bottom-left-radius: 4px;
}

/* User Bubble - ডানে */
.user .message-content {
    background: var(--gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Message Footer */
.message-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

/* Read Receipt */
.read-receipt {
    font-size: 8px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0.8;
}

.read-receipt i { font-size: 7px; }

/* Message Time */
.message-time {
    font-size: 8px;
    color: var(--gray);
    display: flex;
    align-items: center;
    gap: 3px;
}

.message-time i { font-size: 7px; }

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 3px;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 14px;
    width: fit-content;
}

.typing-indicator span {
    width: 5px;
    height: 5px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Quick Questions */
.quick-questions {
    padding: 10px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.quick-btn {
    background: var(--darker);
    border: 1px solid var(--border);
    color: var(--light);
    padding: 4px 8px;
    border-radius: 14px;
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
}

.quick-btn i {
    font-size: 10px;
    color: var(--primary);
}

.quick-btn:hover {
    background: var(--gradient);
    border-color: transparent;
}

.quick-btn:hover i { color: white; }

/* Input Area */
.chatbot-input {
    padding: 3px 6px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 3px;
    align-items: center;
    height: 35px !important;
    min-height: 35px;
}

/* All Buttons */
.chatbot-input button,
.upload-btn,
.voice-btn,
#sendMessage {
    width: 25px !important;
    height: 25px !important;
    min-width: 25px;
    min-height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    padding: 0;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

/* Input Field */
.chatbot-input input {
    flex: 1;
    height: 25px;
    padding: 0 6px;
    background: var(--darker);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--light);
    font-size: 10px;
    outline: none;
}

/* Hover Effects */
.chatbot-input button:hover,
.upload-btn:hover,
.voice-btn:hover {
    transform: scale(1.05);
}

/* Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(37,99,235,0.3);
    z-index: 9998;
}

/* Image Messages */
.message-content img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    border: 2px solid var(--primary);
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-container {
        width: 280px;
        height: 450px;
        right: 10px;
        bottom: 70px;
    }
    
    .message-avatar {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .message-content {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .bot .message-avatar {
        margin-right: 3px;
    }
    
    .user .message-avatar {
        margin-left: 3px;
    }
}
