/* Chat Container */
#chat-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 380px;
    max-width: 90vw;
    height: 500px;
    max-height: 70vh;
    background: white; 
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    overflow: hidden;
    display: none;
}

/* Language */
#chat-language div {
	margin-top: 15px;
	margin-bottom: -20px;
    padding: 12px 15px;
    background: #4a6bff;
    color: white;
    font-weight: 600;
    display: flex;
    align-items: left;
}
.language-tag {
    background: #e8e8e8;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    color: #555;
	margin-bottom: 5px;
}
/* Header */
#chat-header {
    padding: 14px 18px;
    background: #4a6bff;
    color: white;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}

/* Messages Area */
#chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.chat-message {
    color: black; /*  */
    margin: 0;
    padding: 0;
    max-width: 90%;
    animation: messageAppear 0.25s ease-out;
}

@keyframes messageAppear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
    margin-left: auto;
}

.chat-message.bot {
    margin-right: auto;
}

/* Message Bubbles */
.message-bubble {
    color: black; /*  */
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.user .message-bubble {
    background: #4a6bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.bot .message-bubble {
    color: black; /*  */
    background: #f1f1f1;
    border-bottom-left-radius: 4px;
}

/* Multiple Answers */
.answers-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.answer-item {
    border-left: 3px solid #4a6bff;
    padding-left: 12px;
    background: rgba(255,255,255,0.9);
    border-radius: 0 8px 8px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.answer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.85em;
}

.answer-type {
    font-weight: 600;
    color: #4a6bff;
}

.section-tag {
    background: #e8e8e8;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    color: #555;
}
/*
.answer-content {
    font-size: 0.95em;
    line-height: 1.5;
}
*/
.answer-content {
    max-height: 300px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.answer-content.expanded {
    max-height: 1000px !important;
}

/* Expand/Collapse */
.expand-btn {
    background: none;
    border: none;
    color: #4a6bff;
    cursor: pointer;
    font-size: 0.85em;
    padding: 4px 0;
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.expand-btn:hover {
    text-decoration: underline;
}

.expand-btn::after {
    content: "→";
    display: inline-block;
    transition: transform 0.2s;
}

.expand-btn.expanded::after {
    transform: rotate(90deg);
}

/* Answer Footer */
.answer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 0.8em;
}

.doc-link {
    color: #4a6bff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.doc-link:hover {
    text-decoration: underline;
}

.doc-link::before {
    content: "🔗";
}

/* Feedback Buttons */
.feedback-buttons {
    display: flex;
    gap: 6px;
}

.feedback-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
}

.feedback-btn:hover {
    background: #f5f5f5;
}

.feedback-btn.active {
    border-color: #4a6bff;
    background: rgba(74, 107, 255, 0.1);
}

.feedback-btn.like.active {
    color: #28a745;
}

.feedback-btn.dislike.active {
    color: #dc3545;
}

/* Input Area */
#chat-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #e1e1e1;
    background: white;
    position: relative;
}

#chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 0.95em;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #4a6bff;
}

#chat-send {
    margin-left: 10px;
    padding: 0 16px;
    background: #4a6bff;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background 0.2s;
}

#chat-send:hover {
    background: #3a5bef;
}

/* Toggle Button */
#chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #4a6bff;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    font-size: 1em;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

#chat-toggle:hover {
    background: #3a5bef;
    transform: translateY(-2px);
}

/* Typing dots */
.typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
    margin: 0 4px;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
}

/* Suggestions */
.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.suggestion-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 16px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.suggestion-btn:hover {
    background: #e0e0e0;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    #chat-container {
        width: 100%;
        max-width: 100%;
        right: 0;
        bottom: 0;
        border-radius: 0;
        height: 80vh;
        max-height: none;
    }
    
    #chat-toggle {
        right: 10px;
        bottom: 10px;
        padding: 10px 16px;
        font-size: 0.9em;
    }
}
