.course-ai-assistant {
    max-width: 800px;
    margin: 20px auto;
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: #fff;
}

.ai-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
}

.ai-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.ai-conversation {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

.ai-message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message.ai-welcome {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.ai-message.user-message {
    background: #667eea;
    color: white;
    margin-left: 60px;
    text-align: right;
}

.ai-message.ai-response {
    background: white;
    border: 1px solid #e0e0e0;
    margin-right: 60px;
}

.ai-message p {
    margin: 0 0 10px 0;
    line-height: 1.6;
}

.ai-message p:last-child {
    margin-bottom: 0;
}

.ai-sources {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.ai-sources h4 {
    font-size: 0.9em;
    color: #666;
    margin: 0 0 10px 0;
}

.ai-sources ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ai-sources li {
    padding: 6px 0;
    font-size: 0.85em;
    color: #555;
}

.ai-sources .timestamp {
    color: #999;
    font-size: 0.9em;
}

.ai-input-container {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

#ai-question {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 44px;
}

#ai-question:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.ai-send-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 100px;
}

.ai-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-send-btn:active {
    transform: translateY(0);
}

.ai-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ai-loading {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-error {
    background: #ffebee;
    border-left: 4px solid #f44336;
    color: #c62828;
}

/* Scrollbar styling */
.ai-conversation::-webkit-scrollbar {
    width: 8px;
}

.ai-conversation::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ai-conversation::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.ai-conversation::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 768px) {
    .course-ai-assistant {
        margin: 10px;
    }
    
    .ai-message.user-message {
        margin-left: 20px;
    }
    
    .ai-message.ai-response {
        margin-right: 20px;
    }
    
    .ai-input-container {
        flex-direction: column;
    }
    
    .ai-send-btn {
        width: 100%;
    }
}