/* AI Sidebar Styles */
.ai-sidebar-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1040;
    border: none;
    font-size: 24px;
    transition: all 0.3s ease;
}

.ai-sidebar-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ai-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.ai-sidebar.open {
    right: 0;
}

.ai-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1049;
}

.ai-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.ai-sidebar-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
}

.ai-message {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
}

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.ai-message.user .ai-message-avatar {
    background: #007bff;
    color: white;
    margin-left: 8px;
}

.ai-message.assistant .ai-message-avatar {
    background: #e9ecef;
    color: #6c757d;
    margin-right: 8px;
}

.ai-message-content {
    max-width: calc(100% - 40px);
    display: flex;
    flex-direction: column;
}

.ai-message.user .ai-message-content {
    align-items: flex-end;
}

.ai-message-text {
    padding: 8px 12px;
    border-radius: 12px;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.4;
}

.ai-message.user .ai-message-text {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message.assistant .ai-message-text {
    background: #f8f9fa;
    color: #212529;
    border-bottom-left-radius: 4px;
}

.ai-message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
    padding: 0 4px;
}

.ai-quick-actions {
    padding: 16px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.ai-sidebar-footer {
    padding: 16px;
    border-top: 1px solid #e9ecef;
    background: white;
}

.ai-sidebar-footer .input-group-sm {
    font-size: 14px;
}

/* Responsive design */
@media (max-width: 768px) {
    .ai-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .ai-sidebar-toggle {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Typing indicator styles */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #6c757d;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Message content formatting */
.ai-message-text h1, 
.ai-message-text h2, 
.ai-message-text h3 {
    font-size: 1.1em;
    font-weight: bold;
    margin: 0.5em 0;
}

.ai-message-text strong {
    font-weight: 600;
}

.ai-message-text .btn {
    margin-top: 8px;
    font-size: 12px;
}

/* Smooth animations */
.ai-sidebar, .ai-sidebar-toggle {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Z-index management */
.ai-sidebar-toggle {
    z-index: 1040;
}

.ai-sidebar-overlay {
    z-index: 1049;
}

.ai-sidebar {
    z-index: 1050;
}