/* LLM Chat Sidebar Styles */

.llm-chat-sidebar {
    position: fixed;
    top: 56px;
    right: 0;
    width: 380px;
    height: calc(100vh - 56px);
    background: var(--bg-primary, #ffffff);
    border-left: 1px solid var(--border-color, #dee2e6);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.llm-chat-sidebar.open {
    transform: translateX(0);
}

body.llm-chat-open .container-fluid,
body.llm-chat-open .main-container {
    margin-right: 380px;
    transition: margin-right 0.25s ease;
}

/* Sidebar header */
.llm-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #dee2e6);
    background: var(--bg-secondary, #f8f9fa);
    flex-shrink: 0;
}

.llm-chat-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #212529);
}

.llm-chat-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary, #6c757d);
    padding: 0 4px;
    line-height: 1;
}

.llm-chat-close-btn:hover {
    color: var(--text-primary, #212529);
}

/* Messages area */
.llm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.llm-chat-empty {
    text-align: center;
    color: var(--text-secondary, #6c757d);
    padding: 40px 20px;
    font-size: 14px;
}

/* Message bubbles */
.llm-chat-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.llm-chat-message.user {
    align-self: flex-end;
    background: var(--primary-color, #4361ee);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.llm-chat-message.assistant {
    align-self: flex-start;
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-primary, #212529);
    border-bottom-left-radius: 4px;
}

.llm-chat-message.error {
    align-self: flex-start;
    background: #fff3f3;
    color: #dc3545;
    border-bottom-left-radius: 4px;
    font-style: italic;
}

/* Typing indicator */
.llm-chat-typing {
    align-self: flex-start;
    padding: 10px 14px;
    background: var(--bg-secondary, #f0f0f0);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: none;
}

.llm-chat-typing.visible {
    display: flex;
    gap: 4px;
    align-items: center;
}

.llm-chat-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-secondary, #6c757d);
    animation: llm-chat-bounce 1.2s infinite;
}

.llm-chat-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.llm-chat-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes llm-chat-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Input area */
.llm-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color, #dee2e6);
    background: var(--bg-primary, #ffffff);
    flex-shrink: 0;
}

.llm-chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 38px;
    font-family: inherit;
    line-height: 1.4;
}

.llm-chat-input:focus {
    outline: none;
    border-color: var(--primary-color, #4361ee);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.15);
}

.llm-chat-send-btn {
    background: var(--primary-color, #4361ee);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    align-self: flex-end;
    white-space: nowrap;
}

.llm-chat-send-btn:hover {
    opacity: 0.9;
}

.llm-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Navbar toggle button */
.llm-chat-toggle-btn {
    background: none;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary, #212529);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 8px;
    white-space: nowrap;
}

.llm-chat-toggle-btn:hover {
    background: var(--bg-secondary, #f8f9fa);
}

.llm-chat-toggle-btn.active {
    background: var(--primary-color, #4361ee);
    color: #ffffff;
    border-color: var(--primary-color, #4361ee);
}

/* Responsive: full-width on mobile */
@media (max-width: 768px) {
    .llm-chat-sidebar {
        width: 100%;
    }

    body.llm-chat-open .container-fluid,
    body.llm-chat-open .main-container {
        margin-right: 0;
    }
}
