/* Scrollable chat area */
.chatbot-chat-area {
    max-height: calc(100vh - 150px);
    overflow-y: auto; 
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 15px;
    line-height: 1.5;
    font-family: 'Segoe UI', Arial, sans-serif;
    scroll-behavior: smooth;
}

/* Message styling */
.system-message {
    color: #666;
    font-style: italic;
    margin: 8px 0;
    padding: 8px 12px;
    background-color: #f0f0f0;
    border-radius: 6px;
}

.user-message {
    margin: 12px 0;
    padding: 10px 15px;
    background-color: #e3f2fd;
    border-radius: 8px 8px 0 8px;
    color: #0d90a1;
}

.bot-message {
    margin: 12px 0;
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-radius: 8px 8px 8px 0;
    color: #2e1866;
}

.bot-message strong {
    color: #0073aa;
    font-weight: 600;
}

.stream-cursor {
    display: inline-block;
    animation: blink 1s step-end infinite;
    color: #00a4aa;
    font-weight: bold;
}

@keyframes blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

/* Chatbox styling */
.chatbot-popup {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    padding: 20px;
    width: 420px;
    z-index: 1000;
    font-family: 'Segoe UI', Arial, sans-serif;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.chatbot-header {
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.chatbot-header h3 {
    margin: 0;
    color: #00aa9f;
    font-size: 18px;
}

/* Form elements */
.chatbot-popup label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #444;
}

.chatbot-popup input[type="text"],
.chatbot-popup textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, sans-serif;
    transition: border-color 0.3s;
}

.chatbot-popup input[type="text"]:focus,
.chatbot-popup textarea:focus {
    border-color: #00aa9c;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.chatbot-popup textarea {
    height: 80px;
    resize: none;
}

/* Buttons */
.chatbot-popup button {
    display: block;
    width: 100%;
    background-color: #00aa9f;
    color: white;
    font-weight: 600;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
}

.chatbot-popup button:hover {
    background-color: #008185;
    transform: translateY(-1px);
}

/* Chat icon */
.chatbot-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #00aaa4;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1001;
}

.chatbot-icon:hover {
    background-color: #005885;
    transform: scale(1.05);
}

/* Chat input container */
.chat-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.chat-input-container textarea {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    font-size: 15px;
    height: 60px;
    box-sizing: border-box;
    transition: all 0.3s;
}

.send-icon {
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 8px;
    border-radius: 50%;
}

.send-icon:hover {
    transform: scale(1.1);
    background-color: rgba(0, 115, 170, 0.1);
}

/* Close button */
.chatbot-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 20px;
    font-weight: bold;
    color: #777;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.chatbot-close:hover {
    color: #0073aa;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Feedback button */
.feedback-button {
    display: block;
    margin: 15px auto 5px;
    text-align: center;
    background-color: #0073aa;
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: fit-content;
    font-size: 14px;
}

.feedback-button:hover {
    background-color: #005885;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Markdown formatting */
.bot-message ul,
.bot-message ol {
    padding-left: 20px;
    margin: 8px 0;
}

.bot-message li {
    margin-bottom: 6px;
}

.bot-message strong {
    font-weight: 600;
}

.bot-message em {
    font-style: italic;
}

.bot-message code {
    font-family: monospace;
    background-color: #f0f0f0;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 90%;
}

/* Responsive design */
@media (max-width: 768px) {
    .chatbot-popup {
        width: 90%;
        right: 5%;
        bottom: 20px;
        padding: 15px;
        max-height: calc(100vh - 40px);
        border-radius: 10px;
    }
    
    .chatbot-chat-area {
        padding: 12px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .chatbot-popup {
        width: 94%;
        right: 3%;
        bottom: 15px;
        padding: 12px;
        max-height: calc(100vh - 30px);
    }
    
    .chatbot-chat-area {
        max-height: 55vh;
        padding: 10px;
    }
    
    .chatbot-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Scrollbar styling */
.chatbot-chat-area::-webkit-scrollbar {
    width: 8px;
}

.chatbot-chat-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chatbot-chat-area::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.chatbot-chat-area::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}